update code
This commit is contained in:
commit
70becaddfe
BIN
fcoe-utils-1.0.32.tar.gz
Normal file
BIN
fcoe-utils-1.0.32.tar.gz
Normal file
Binary file not shown.
53
fcoe-utils-gcc7-fmt-truc-err.patch
Normal file
53
fcoe-utils-gcc7-fmt-truc-err.patch
Normal file
@ -0,0 +1,53 @@
|
||||
diff --git a/fipvlan.c b/fipvlan.c
|
||||
index 7c00c7c..065b742 100644
|
||||
--- a/fipvlan.c
|
||||
+++ b/fipvlan.c
|
||||
@@ -621,8 +621,10 @@ create_and_start_vlan(struct fcf *fcf, bool vn2vn)
|
||||
real_dev->ifname, fcf->vlan, vlan->ifname);
|
||||
rc = 0;
|
||||
} else {
|
||||
- snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
|
||||
- real_dev->ifname, fcf->vlan, config.suffix);
|
||||
+ rc = snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
|
||||
+ real_dev->ifname, fcf->vlan, config.suffix);
|
||||
+ if (rc >= IFNAMSIZ)
|
||||
+ return -E2BIG;
|
||||
rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name);
|
||||
if (rc < 0)
|
||||
printf("Failed to create VLAN device %s\n\t%s\n",
|
||||
diff --git a/libopenfcoe.c b/libopenfcoe.c
|
||||
index 07090d5..98fb975 100644
|
||||
--- a/libopenfcoe.c
|
||||
+++ b/libopenfcoe.c
|
||||
@@ -59,6 +59,7 @@ static int add_fcoe_fcf_device(struct dirent *dp, void *arg)
|
||||
{
|
||||
struct fcoe_ctlr_device *ctlr = (struct fcoe_ctlr_device *)arg;
|
||||
struct fcoe_fcf_device *fcf;
|
||||
+ int rc;
|
||||
|
||||
if (!strstr(dp->d_name, "fcf") ||
|
||||
(!strcmp(dp->d_name, "fcf_dev_loss_tmo")))
|
||||
@@ -71,8 +72,10 @@ static int add_fcoe_fcf_device(struct dirent *dp, void *arg)
|
||||
memset(fcf, 0, sizeof(struct fcoe_fcf_device));
|
||||
|
||||
/* Save the path */
|
||||
- snprintf(fcf->path, sizeof(fcf->path),
|
||||
- "%s/%s", ctlr->path, dp->d_name);
|
||||
+ rc = snprintf(fcf->path, sizeof(fcf->path),
|
||||
+ "%s/%s", ctlr->path, dp->d_name);
|
||||
+ if (rc >= sizeof(fcf->path))
|
||||
+ goto fail;
|
||||
|
||||
/* Use the index from the logical enumeration */
|
||||
fcf->index = atoi(dp->d_name + sizeof("fcf_") - 1);
|
||||
@@ -198,7 +201,9 @@ static int read_fcoe_ctlr_device(struct dirent *dp, void *arg)
|
||||
sa_sys_read_line(ctlr->path, "mode", buf, sizeof(buf));
|
||||
sa_enum_encode(fip_conn_type_table, buf, &ctlr->mode);
|
||||
|
||||
- snprintf(lesb_path, sizeof(lesb_path), "%s/lesb/", ctlr->path);
|
||||
+ rc = snprintf(lesb_path, sizeof(lesb_path), "%s/lesb/", ctlr->path);
|
||||
+ if (rc >= sizeof(lesb_path))
|
||||
+ goto fail;
|
||||
|
||||
/* Get LESB statistics */
|
||||
sa_sys_read_u32(lesb_path, "link_fail",
|
||||
119
fcoe-utils-gcc8-fmt-truc-err.patch
Normal file
119
fcoe-utils-gcc8-fmt-truc-err.patch
Normal file
@ -0,0 +1,119 @@
|
||||
From: Chris Leech <cleech@redhat.com>
|
||||
Subject: fix build warnings/errors with GCC format-truncation checks
|
||||
|
||||
diff --git a/fcoeadm_display.c b/fcoeadm_display.c
|
||||
index 120c6084b7ca..f10cfb53d454 100644
|
||||
--- a/fcoeadm_display.c
|
||||
+++ b/fcoeadm_display.c
|
||||
@@ -254,6 +254,7 @@ static void show_full_lun_info(unsigned int hba, unsigned int port,
|
||||
struct dirent *dp;
|
||||
struct port_attributes *rport_attrs;
|
||||
struct port_attributes *port_attrs;
|
||||
+ int rc;
|
||||
|
||||
snprintf(path, sizeof(path),
|
||||
"/sys/class/scsi_device/%u:%u:%u:%u",
|
||||
@@ -287,10 +288,18 @@ static void show_full_lun_info(unsigned int hba, unsigned int port,
|
||||
|
||||
osname = dp->d_name;
|
||||
|
||||
- snprintf(npath, sizeof(npath), "%s/%s/", path, osname);
|
||||
+ rc = snprintf(npath, sizeof(npath), "%s/%s/", path, osname);
|
||||
+ if (rc < 0 || rc >= sizeof(npath)) {
|
||||
+ /* error or truncation, bailing out */
|
||||
+ return;
|
||||
+ }
|
||||
sa_sys_read_u64(npath, "size", &lba);
|
||||
|
||||
- snprintf(npath, sizeof(npath), "%s/%s/queue/", path, osname);
|
||||
+ rc = snprintf(npath, sizeof(npath), "%s/%s/queue/", path, osname);
|
||||
+ if (rc < 0 || rc >= sizeof(npath)) {
|
||||
+ /* error or truncation, bailing out */
|
||||
+ return;
|
||||
+ }
|
||||
sa_sys_read_u32(npath, "hw_sector_size", &blksize);
|
||||
}
|
||||
|
||||
@@ -340,6 +349,7 @@ static void show_short_lun_info(unsigned int hba, unsigned int port,
|
||||
char *capstr = "Unknown";
|
||||
char *osname = "Unknown";
|
||||
uint64_t size;
|
||||
+ int rc;
|
||||
|
||||
snprintf(path, sizeof(path),
|
||||
"/sys/class/scsi_device/%u:%u:%u:%u/device/",
|
||||
@@ -363,10 +373,18 @@ static void show_short_lun_info(unsigned int hba, unsigned int port,
|
||||
|
||||
osname = dp->d_name;
|
||||
|
||||
- snprintf(npath, sizeof(npath), "%s/%s/", path, osname);
|
||||
+ rc = snprintf(npath, sizeof(npath), "%s/%s/", path, osname);
|
||||
+ if (rc < 0 || rc >= sizeof(npath)) {
|
||||
+ /* error or truncation, bailing out */
|
||||
+ return;
|
||||
+ }
|
||||
sa_sys_read_u64(npath, "size", &size);
|
||||
|
||||
- snprintf(npath, sizeof(npath), "%s/%s/queue/", path, osname);
|
||||
+ rc = snprintf(npath, sizeof(npath), "%s/%s/queue/", path, osname);
|
||||
+ if (rc < 0 || rc >= sizeof(npath)) {
|
||||
+ /* error or truncation, bailing out */
|
||||
+ return;
|
||||
+ }
|
||||
sa_sys_read_u32(npath, "hw_sector_size", &blksize);
|
||||
}
|
||||
|
||||
diff --git a/fcoemon.c b/fcoemon.c
|
||||
index 9a400c56b72a..bf73a0d4c89e 100644
|
||||
--- a/fcoemon.c
|
||||
+++ b/fcoemon.c
|
||||
@@ -939,6 +939,7 @@ static struct fcoe_port *fcm_new_vlan(int ifindex, int vid, bool vn2vn)
|
||||
[false] = CLIF_FLAGS_FABRIC,
|
||||
[true] = CLIF_FLAGS_VN2VN,
|
||||
};
|
||||
+ int rc;
|
||||
|
||||
if (vn2vn)
|
||||
FCM_LOG_DBG("Auto VLAN found vn2vn on VID %d\n", vid);
|
||||
@@ -947,8 +948,15 @@ static struct fcoe_port *fcm_new_vlan(int ifindex, int vid, bool vn2vn)
|
||||
|
||||
if (rtnl_find_vlan(ifindex, vid, vlan_name)) {
|
||||
rtnl_get_linkname(ifindex, real_name);
|
||||
- snprintf(vlan_name, sizeof(vlan_name), FCOE_VLAN_FORMAT,
|
||||
- real_name, vid);
|
||||
+ rc = snprintf(vlan_name, sizeof(vlan_name), FCOE_VLAN_FORMAT,
|
||||
+ real_name, vid);
|
||||
+ if (rc >= sizeof(vlan_name)) {
|
||||
+ FCM_LOG("Warning: Generating FCoE VLAN device name for"
|
||||
+ "interface %s VLAN %d: format resulted in a"
|
||||
+ "name larger than IFNAMSIZ\n", real_name, vid);
|
||||
+ vlan_name[sizeof(vlan_name) - 1] = 0;
|
||||
+ FCM_LOG("\tTruncating VLAN name to %s\n", vlan_name);
|
||||
+ }
|
||||
vlan_create(ifindex, vid, vlan_name);
|
||||
}
|
||||
rtnl_set_iff_up(0, vlan_name);
|
||||
@@ -3549,7 +3557,7 @@ static void fcm_srv_receive(void *arg)
|
||||
}
|
||||
|
||||
cmd = data->cmd;
|
||||
- strncpy(ifname, data->ifname, sizeof(data->ifname));
|
||||
+ strncpy(ifname, data->ifname, sizeof(ifname) - 1);
|
||||
ifname[sizeof(data->ifname)] = 0;
|
||||
|
||||
if (cmd != CLIF_PID_CMD) {
|
||||
diff --git a/libopenfcoe.c b/libopenfcoe.c
|
||||
index 07090d5a09aa..c1190adc2328 100644
|
||||
--- a/libopenfcoe.c
|
||||
+++ b/libopenfcoe.c
|
||||
@@ -179,7 +179,9 @@ static int read_fcoe_ctlr_device(struct dirent *dp, void *arg)
|
||||
if (!rc)
|
||||
goto fail;
|
||||
|
||||
- sprintf(hpath, "%s/%s/", SYSFS_FCHOST, fchost);
|
||||
+ rc = snprintf(hpath, MAX_STR_LEN, "%s/%s/", SYSFS_FCHOST, fchost);
|
||||
+ if (rc < 0 || rc >= MAX_STR_LEN)
|
||||
+ goto fail;
|
||||
|
||||
rc = sa_sys_read_line(hpath, "symbolic_name", buf, sizeof(buf));
|
||||
|
||||
74
fcoe-utils.spec
Normal file
74
fcoe-utils.spec
Normal file
@ -0,0 +1,74 @@
|
||||
Name: fcoe-utils
|
||||
Version: 1.0.32
|
||||
Release: 7
|
||||
Summary: Fibre Channel over Ethernet utilities
|
||||
License: GPLv2
|
||||
URL: https://www.open-fcoe.org
|
||||
Source0: https://github.com/morbidrsa/fcoe-utils/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
Source1: quickstart.txt
|
||||
Source2: fcoe.service
|
||||
Source3: fcoe.config
|
||||
Patch0: fcoe-utils-gcc7-fmt-truc-err.patch
|
||||
Patch1: fcoe-utils-gcc8-fmt-truc-err.patch
|
||||
|
||||
BuildRequires: autoconf automake libpciaccess-devel libtool lldpad-devel systemd
|
||||
Requires: lldpad iproute device-mapper-multipath
|
||||
%{?systemd_requires}
|
||||
|
||||
%description
|
||||
Fibre Channel over Ethernet utilities
|
||||
fcoeadm - command line tool for configuring FCoE interfaces
|
||||
fcoemon - service to configure DCB Ethernet QOS filters, works with lldpad
|
||||
|
||||
%package_help
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version} -p1
|
||||
cp -v %{SOURCE1} quickstart.txt
|
||||
|
||||
%build
|
||||
./bootstrap.sh
|
||||
%configure
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%make_install
|
||||
rm -rf %{buildroot}/etc/init.d
|
||||
install -d %{buildroot}%{_sysconfdir}/sysconfig %{buildroot}%{_unitdir}
|
||||
rm -f %{buildroot}%{_unitdir}/*
|
||||
install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}
|
||||
install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/fcoe
|
||||
install -d %{buildroot}%{_libexecdir}/fcoe
|
||||
for file in contrib/*.sh debug/*sh
|
||||
do install -m 755 ${file} %{buildroot}%{_libexecdir}/fcoe/
|
||||
done
|
||||
rm -f %{buildroot}/%{_sysconfdir}/fcoe/config
|
||||
|
||||
%post
|
||||
%systemd_post fcoe.service
|
||||
|
||||
%preun
|
||||
%systemd_preun fcoe.service
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart fcoe.service
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc COPYING
|
||||
%config(noreplace) %{_sysconfdir}/fcoe/cfg-ethx
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/fcoe
|
||||
%{_unitdir}/fcoe.service
|
||||
%{_sbindir}/*
|
||||
%{_sysconfdir}/bash_completion.d/*
|
||||
%{_libexecdir}/fcoe/
|
||||
|
||||
%files help
|
||||
%defattr(-,root,root)
|
||||
%doc README quickstart.txt QUICKSTART
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Fri Oct 11 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.0.32-7
|
||||
- Package init
|
||||
|
||||
5
fcoe.config
Normal file
5
fcoe.config
Normal file
@ -0,0 +1,5 @@
|
||||
# All supported drivers listed here are loaded when service starts
|
||||
SUPPORTED_DRIVERS="libfc fcoe bnx2fc"
|
||||
|
||||
# Add --debug to enable debug messages
|
||||
FCOEMON_OPTS="--syslog"
|
||||
12
fcoe.service
Normal file
12
fcoe.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Open-FCoE Inititator.
|
||||
After=syslog.target network.target lldpad.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
EnvironmentFile=/etc/sysconfig/fcoe
|
||||
ExecStartPre=/sbin/modprobe -qa $SUPPORTED_DRIVERS
|
||||
ExecStart=/usr/sbin/fcoemon $FCOEMON_OPTS
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
25
quickstart.txt
Normal file
25
quickstart.txt
Normal file
@ -0,0 +1,25 @@
|
||||
Quick Start guide for Open-FCoE
|
||||
===============================
|
||||
|
||||
1. Install fcoe-utils package. This should also install dcbd, libhbaapi and
|
||||
libhbalinux as dependencies.
|
||||
|
||||
2. Rename /etc/fcoe/cfg-ethx so it corresponds with name of your network
|
||||
interface (e.g. /etc/fcoe/cfg-eth0). Copy and rename this file accordingly
|
||||
if you have more interfaces, which should be fcoe-enabled
|
||||
|
||||
3. Modify configuration files to enable FCoE. Set FCOE_ENABLE="yes" and
|
||||
DCB_REQUIRED="yes".
|
||||
|
||||
3. Run 'systemctl enable fcoe.service' to start FCoE per run level. This
|
||||
will setup FCoE to start on reboot.
|
||||
|
||||
4. Run 'systemctl enable lldpad.service' to start LLDP agent per run
|
||||
level. This will setup DCB to start on reboot.
|
||||
|
||||
5. Run 'systemctl start lldpad.service' to start LLDP agent.
|
||||
|
||||
6. Run 'dcbtool sc ethX dcb on; dcbtool sc ethX app:0 e:1;' for each fcoe-enabled
|
||||
interface to setup DCB for FCoE.
|
||||
|
||||
7. Run 'systemctl start fcoe.sertvice' to start FCoE.
|
||||
Loading…
x
Reference in New Issue
Block a user