diff --git a/.gitignore b/.gitignore index 69b2beb..424588c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,33 @@ -fcoe-utils-1.0.14.tar.gz -/fcoe-utils-1.0.17.tar.gz +# standard autotools stuff +.deps/ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache/ +compile +config.log +config.status +configure +depcomp +install-sh +missing + +# other autoconf generated files +fcoe-utils.spec +fcoeplumb +fcoe_utils_version.h + +# compile generated files +*.o +fcoeadm +fcoemon +fipvlan +fcping +fcnsq +fcrls +etc/initd/fcoe + +# build.sh generated files +fcoe-utils-*.tar.gz +fcoe-utils-*.rpm +/fcoe-utils-1.0.18.tar.bz2 diff --git a/fcoe-utils-1.0.12-makefile-data-hook.patch b/fcoe-utils-1.0.12-makefile-data-hook.patch deleted file mode 100644 index a7cfab7..0000000 --- a/fcoe-utils-1.0.12-makefile-data-hook.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- fcoe-utils-1.0.12/Makefile.am.orig 2010-03-15 17:02:19.000000000 +0100 -+++ fcoe-utils-1.0.12/Makefile.am 2010-03-15 17:02:34.000000000 +0100 -@@ -62,8 +62,3 @@ - init_d_SCRIPTS = etc/initd/fcoe - - dist_noinst_DATA = README COPYING INSTALL fcoe-utils.spec etc/config -- --install-data-hook: -- if [ ! -f ${DESTDIR}${fcoe_configdir}/config ] ; then \ -- cp ${srcdir}/etc/config ${DESTDIR}${fcoe_configdir}/config; \ -- fi diff --git a/fcoe-utils-1.0.14-no-vconfig.patch b/fcoe-utils-1.0.14-no-vconfig.patch deleted file mode 100644 index 7767ae4..0000000 --- a/fcoe-utils-1.0.14-no-vconfig.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- fcoe-utils-1.0.14/contrib/fcoe-setup.sh 2010-05-18 23:50:48.000000000 +0200 -+++ fcoe-utils-1.0.14/contrib/fcoe-setup.sh.new 2010-11-30 17:24:07.839269545 +0100 -@@ -24,9 +24,8 @@ - vif=$(scan_vlan $ifname $vlan) - - if [ -z "$vif" ] ; then -- vconfig set_name_type DEV_PLUS_VID_NO_PAD -- vconfig add $ifname $vlan > /dev/null - vif="$ifname.$vlan" -+ ip link add dev $vif link $ifname type vlan id $vlan - fi - ip link set $vif up - echo "$vif" diff --git a/fcoe-utils-1.0.17-init.patch b/fcoe-utils-1.0.17-init.patch new file mode 100644 index 0000000..8ef89b0 --- /dev/null +++ b/fcoe-utils-1.0.17-init.patch @@ -0,0 +1,118 @@ +--- fcoe-utils-1.0.17/etc/initd/initd.fedora 2011-01-15 01:28:10.000000000 +0100 ++++ fcoe-utils-1.0.17/etc/initd/initd.fedora.new 2011-02-04 10:54:50.152483041 +0100 +@@ -15,7 +15,7 @@ + # this program; if not, write to the Free Software Foundation, Inc., + # 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + # +-# chkconfig: - 21 80 ++# chkconfig: 2345 21 80 + # + # Maintained at www.Open-FCoE.org + +@@ -23,7 +23,7 @@ + # Provides: fcoe + # Required-Start: network + # Required-Stop: +-# Default-Start: ++# Default-Start: 2 3 4 5 + # Default-Stop: + # Short-Description: Open-FCoE Initiator + # Description: Open-FCoE Initiator +--- fcoe-utils-1.0.17/etc/initd/initd.fedora 2011-02-04 11:06:42.251483139 +0100 ++++ fcoe-utils-1.0.17/etc/initd/initd.fedora.new 2011-02-04 11:35:26.779482986 +0100 +@@ -63,6 +63,16 @@ + fi + } + ++have_fcoe_root() { ++ # This simply checks if root is on a net device ++ local rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab) ++ if [[ "$rootopts" =~ "_netdev" ]]; then ++ return 0 ++ else ++ return 1 ++ fi ++} ++ + start() + { + echo -n $"Starting FCoE initiator service: " +@@ -80,22 +90,27 @@ + + stop() + { +- local force=$1 +- +- pid=$(pidof "$FCOEMON") +- if [ "$force" == "force" ] +- then +- action "Destroying any active fcoe interface/s" +- [ "$pid" ] && kill -HUP $pid ++ if have_fcoe_root; then ++ echo $"Possible FCoE root detected, not stopping FCoE." ++ exit 1 + else +- [ "$pid" ] && kill -TERM $pid +- fi ++ local force=$1 + +- action $"Stopping FCoE initiator service: " +- +- rm -f /var/run/fcoemon.* +- rm -f /tmp/fcoemon.dcbd.* +- rm -f /var/lock/subsys/fcoe ++ pid=$(pidof "$FCOEMON") ++ if [ "$force" == "force" ] ++ then ++ action "Destroying any active fcoe interface/s" ++ [ "$pid" ] && kill -HUP $pid ++ else ++ [ "$pid" ] && kill -TERM $pid ++ fi ++ ++ action $"Stopping FCoE initiator service: " ++ ++ rm -f /var/run/fcoemon.* ++ rm -f /tmp/fcoemon.dcbd.* ++ rm -f /var/lock/subsys/fcoe ++ fi + } + + status() +--- fcoe-utils-1.0.17/etc/initd/initd.fedora 2011-02-04 11:52:53.990483140 +0100 ++++ fcoe-utils-1.0.17/etc/initd/initd.fedora.new 2011-02-04 12:46:03.401482934 +0100 +@@ -85,6 +85,34 @@ + echo + touch /var/lock/subsys/fcoe + ++ # Wait for the _netdev devices ++ if [ "$WAIT_TIMEOUT" = "" ]; then ++ WAIT_TIMEOUT=65 ++ fi ++ local donewait=1 ++ local devs=($(egrep 'by-path\/fc-.*_netdev' /etc/fstab | cut -d ' ' -f1)) ++ if [ "$devs" != "" ]; then ++ echo -n "Waiting for FCoE devices . " ++ while [ $WAIT_TIMEOUT -gt 0 ]; do ++ for disk in ${devs[*]}; do ++ if ! test -b $disk; then ++ donewait=0 ++ break ++ fi ++ done ++ test $donewait -eq 1 && break; ++ sleep 1 ++ echo -n ". " ++ donewait=1 ++ WAIT_TIMEOUT=$(($WAIT_TIMEOUT-1)) ++ done ++ if [ "$WAIT_TIMEOUT" -eq 0 ]; then ++ echo "timed out!" ++ else ++ echo "done!" ++ fi ++ fi ++ + echo + } + diff --git a/fcoe-utils-1.0.17-make.patch b/fcoe-utils-1.0.17-make.patch new file mode 100644 index 0000000..9c82334 --- /dev/null +++ b/fcoe-utils-1.0.17-make.patch @@ -0,0 +1,22 @@ +--- fcoe-utils-1.0.17/Makefile.am 2011-01-15 01:28:10.000000000 +0100 ++++ fcoe-utils-1.0.17/Makefile.am.new 2011-02-04 10:59:25.579483545 +0100 +@@ -2,7 +2,7 @@ + sbin_PROGRAMS = fcoeadm fcoemon fcping fipvlan fcnsq fcrls + + ## all targets should look for headers in the include directory +-AM_CPPFLAGS = -I${srcdir}/include -I${builddir}/include ++AM_CPPFLAGS = -I${srcdir}/include -I${builddir}/include -I/lib/modules/`rpm -q --list kernel | grep "^/lib/modules/.*/build$$" | cut -f4 -d"/" | sort -r | head -1`/build/include + ## pass the sysconfdir into the C proprocessor + AM_CPPFLAGS += -DSYSCONFDIR="\"${sysconfdir}\"" + AM_CFLAGS = -Wall +--- fcoe-utils-1.0.17/Makefile.am 2011-02-04 11:06:42.253483139 +0100 ++++ fcoe-utils-1.0.17/Makefile.am.new 2011-02-04 11:06:59.956483271 +0100 +@@ -65,8 +65,3 @@ + init_d_SCRIPTS = etc/initd/fcoe + + dist_noinst_DATA = README COPYING INSTALL fcoe-utils.spec etc/config +- +-install-data-hook: +- if [ ! -f ${DESTDIR}${fcoe_configdir}/config ] ; then \ +- cp ${srcdir}/etc/config ${DESTDIR}${fcoe_configdir}/config; \ +- fi diff --git a/fcoe-utils-1.0.17-manpages.patch b/fcoe-utils-1.0.17-manpages.patch new file mode 100644 index 0000000..9c60b19 --- /dev/null +++ b/fcoe-utils-1.0.17-manpages.patch @@ -0,0 +1,59 @@ +--- fcoe-utils-1.0.17/doc/fcoeadm.txt 2011-01-15 01:28:10.000000000 +0100 ++++ fcoe-utils-1.0.17/doc/fcoeadm.txt.new 2011-02-04 11:46:24.217483236 +0100 +@@ -25,6 +25,8 @@ + + *fcoeadm* -r|--reset _ethX_ + ++*fcoeadm* -S|--Scan _ethX_ ++ + *fcoeadm* -i|--interface [_ethX_] + + *fcoeadm* -t|--target [_ethX_] +@@ -64,6 +66,9 @@ + *-r*, *--reset* _ethX_:: + Resets the FCoE instance on the specified network interface. + ++*-S*, *--Scan* _ethX_:: ++ Validates that the interface name has an active FCoE session. ++ + *-i*, *--interface* [_ethX_]:: + Show information about the FCoE instance on the specified network + interface, or all FCoE instances if no network interface is specified. +--- fcoe-utils-1.0.17/doc/fcoeadm.8 2011-01-15 01:28:10.000000000 +0100 ++++ fcoe-utils-1.0.17/doc/fcoeadm.8.new 2011-02-04 11:50:48.400482913 +0100 +@@ -2,12 +2,12 @@ + .\" Title: fcoeadm + .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] + .\" Generator: DocBook XSL Stylesheets v1.75.2 +-.\" Date: 04/29/2010 ++.\" Date: 02/04/2011 + .\" Manual: Open-FCoE Tools + .\" Source: Open-FCoE + .\" Language: English + .\" +-.TH "FCOEADM" "8" "04/29/2010" "Open\-FCoE" "Open\-FCoE Tools" ++.TH "FCOEADM" "8" "02/04/2011" "Open\-FCoE" "Open\-FCoE Tools" + .\" ----------------------------------------------------------------- + .\" * set default formatting + .\" ----------------------------------------------------------------- +@@ -26,6 +26,8 @@ + .sp + \fBfcoeadm\fR \-r|\-\-reset \fIethX\fR + .sp ++\fBfcoeadm\fR \-S|\-\-Scan \fIethX\fR ++.sp + \fBfcoeadm\fR \-i|\-\-interface [\fIethX\fR] + .sp + \fBfcoeadm\fR \-t|\-\-target [\fIethX\fR] +@@ -60,6 +62,11 @@ + Resets the FCoE instance on the specified network interface\&. + .RE + .PP ++\fB\-S\fR, \fB\-\-Scan\fR \fIethX\fR ++.RS 4 ++Validates that the interface name has an active FCoE session\&. ++.RE ++.PP + \fB\-i\fR, \fB\-\-interface\fR [\fIethX\fR] + .RS 4 + Show information about the FCoE instance on the specified network interface, or all FCoE instances if no network interface is specified\&. diff --git a/fcoe-utils-1.0.17-no-vconfig.patch b/fcoe-utils-1.0.17-no-vconfig.patch new file mode 100644 index 0000000..6973da5 --- /dev/null +++ b/fcoe-utils-1.0.17-no-vconfig.patch @@ -0,0 +1,14 @@ +--- fcoe-utils-1.0.17/contrib/fcoe-setup.sh 2011-01-15 01:28:10.000000000 +0100 ++++ fcoe-utils-1.0.17/contrib/fcoe-setup.sh.new 2011-02-04 12:52:13.873482656 +0100 +@@ -24,9 +24,8 @@ + vif=$(scan_vlan $ifname $vlan) + + if [ -z "$vif" ] ; then +- vconfig set_name_type DEV_PLUS_VID_NO_PAD +- vconfig add $ifname $vlan > /dev/null +- vif="$ifname.$vlan" ++ vif="$ifname.$vlan" ++ ip link add dev $vif link $ifname type vlan id $vlan + fi + ip link set $vif up + echo "$vif" diff --git a/fcoe-utils-1.0.18-config.patch b/fcoe-utils-1.0.18-config.patch new file mode 100644 index 0000000..4c5ec66 --- /dev/null +++ b/fcoe-utils-1.0.18-config.patch @@ -0,0 +1,13 @@ +diff --git a/etc/config b/etc/config +index c993f35..bfccf8c 100644 +--- a/etc/config ++++ b/etc/config +@@ -12,3 +12,8 @@ USE_SYSLOG="yes" + ## Default: list of default drivers + # All supported drivers listed here are loaded when service starts + SUPPORTED_DRIVERS="fcoe bnx2fc" ++ ++## Type: integer ++## Default: 65 ++# Wait at most for this amount of seconds to discover all _netdev fstab devices ++WAIT_TIMEOUT="65" diff --git a/fcoe-utils-1.0.18-fcoe-utils-Add-SUPPORTED_DRIVERS-field-to-config.patch b/fcoe-utils-1.0.18-fcoe-utils-Add-SUPPORTED_DRIVERS-field-to-config.patch new file mode 100644 index 0000000..799ed0e --- /dev/null +++ b/fcoe-utils-1.0.18-fcoe-utils-Add-SUPPORTED_DRIVERS-field-to-config.patch @@ -0,0 +1,76 @@ +From fabcf9389e79c3535a58b5dc30632d444cb513f6 Mon Sep 17 00:00:00 2001 +From: Nithin Sujir +Date: Thu, 27 Jan 2011 04:12:08 +0000 +Subject: [PATCH 02/16] fcoe-utils: Add SUPPORTED_DRIVERS field to config + +SUPPORTED_DRIVERS is a space separated string field added to the config +file. The fcoe service will use this field instead of the previous +hardcoded "fcoe" to modprobe during startup. + +Signed-off-by: Nithin Nayak Sujir +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + doc/fcoemon.txt | 5 +++-- + etc/config | 4 ++++ + etc/initd/initd.fedora | 2 +- + etc/initd/initd.suse | 2 +- + 4 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/doc/fcoemon.txt b/doc/fcoemon.txt +index f42c8c0..117b2d0 100644 +--- a/doc/fcoemon.txt ++++ b/doc/fcoemon.txt +@@ -159,8 +159,9 @@ default options in this file are: *DEBUG="no"* and *USE_SYSLOG="yes"*. The + former is used to enable debugging messages from the fcoe service script + and *fcoemon* (via the *--debug* option). The latter is to indicate if the + log messages are to be output to the system log (via the *--syslog* +-option). Any changes to this file will require a restart of the *fcoe* +-service. ++option). *SUPPORTED_DRIVERS* is the list of drivers to automatically load ++during fcoe service start. Any changes to this file will require a restart ++of the *fcoe* service. + + /etc/fcoe/cfg- + ~~~~~~~~~~~~~~~~~~~~~~ +diff --git a/etc/config b/etc/config +index 2d08c9e..c993f35 100644 +--- a/etc/config ++++ b/etc/config +@@ -8,3 +8,7 @@ DEBUG="no" + # All the messages go to syslog and stderr (script & C code) + USE_SYSLOG="yes" + ++## Type: string. Driver names separated by space ++## Default: list of default drivers ++# All supported drivers listed here are loaded when service starts ++SUPPORTED_DRIVERS="fcoe bnx2fc" +diff --git a/etc/initd/initd.fedora b/etc/initd/initd.fedora +index 3888dda..6a791cd 100755 +--- a/etc/initd/initd.fedora ++++ b/etc/initd/initd.fedora +@@ -68,7 +68,7 @@ start() + echo -n $"Starting FCoE initiator service: " + + modprobe -q libfc +- modprobe -q fcoe ++ modprobe -q -a $SUPPORTED_DRIVERS + + daemon --pidfile ${PID_FILE} ${FCOEMON} ${FCOEMON_OPTS} + +diff --git a/etc/initd/initd.suse b/etc/initd/initd.suse +index 139de2d..638eae5 100755 +--- a/etc/initd/initd.suse ++++ b/etc/initd/initd.suse +@@ -82,7 +82,7 @@ test -x $FCOEMON || { + + startup_fcoe_modules() + { +- modprobe fcoe > /dev/null 2>&1 ++ modprobe -a $SUPPORTED_DRIVERS > /dev/null 2>&1 + } + + start() +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoe-utils-Add-libnl-build-dependency-for-fcoe-utils.patch b/fcoe-utils-1.0.18-fcoe-utils-Add-libnl-build-dependency-for-fcoe-utils.patch new file mode 100644 index 0000000..8768d7f --- /dev/null +++ b/fcoe-utils-1.0.18-fcoe-utils-Add-libnl-build-dependency-for-fcoe-utils.patch @@ -0,0 +1,30 @@ +From 12acb3a16b13e96b0ac604540aaf0148dffceb74 Mon Sep 17 00:00:00 2001 +From: Ross Brattain +Date: Wed, 13 Apr 2011 03:51:59 +0000 +Subject: [PATCH 07/16] fcoe-utils: Add libnl build dependency for fcoe-utils + to QUICKSTART document. + +fcoemon uses the header from libnl. + +Signed-off-by: Ross Brattain +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + QUICKSTART | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/QUICKSTART b/QUICKSTART +index 5183803..abe6cf2 100644 +--- a/QUICKSTART ++++ b/QUICKSTART +@@ -176,6 +176,7 @@ PROCESS + + DEPENDENCIES + ++* libnl (see DCB section) + * libhbalinux + * lldpad v0.9.26 or greater (optional configure flag to build without) + +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoe-utils-Avoid-freeing-uninitialized-pointer-in-fc.patch b/fcoe-utils-1.0.18-fcoe-utils-Avoid-freeing-uninitialized-pointer-in-fc.patch new file mode 100644 index 0000000..b1fea6a --- /dev/null +++ b/fcoe-utils-1.0.18-fcoe-utils-Avoid-freeing-uninitialized-pointer-in-fc.patch @@ -0,0 +1,49 @@ +From 8f4092733b9b3ba815597e67fc20c9e1897803e5 Mon Sep 17 00:00:00 2001 +From: Petr Sabata +Date: Fri, 1 Apr 2011 00:21:34 +0000 +Subject: [PATCH 16/16] fcoe-utils: Avoid freeing uninitialized pointer in + fcoe_find_fchost() + +Currently, running fcoeadm -i when SYSFS_FCHOST path isn't available results +in fcoeadm crash. This patch checks for this and frees namelist only if it's +been initialized. + +Signed-off-by: Petr Sabata +Signed-off-by: Robert Love +--- + lib/fcoe_utils.c | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/lib/fcoe_utils.c b/lib/fcoe_utils.c +index 142b045..d54cd4d 100644 +--- a/lib/fcoe_utils.c ++++ b/lib/fcoe_utils.c +@@ -67,11 +67,11 @@ static int fcoe_check_fchost(const char *ifname, const char *dname) + + enum fcoe_status fcoe_find_fchost(char *ifname, char *fchost, int len) + { +- int n, dname_len; ++ int n, dname_len, status; + struct dirent **namelist; + int rc = ENOFCOECONN; + +- n = scandir(SYSFS_FCHOST, &namelist, 0, alphasort); ++ status = n = scandir(SYSFS_FCHOST, &namelist, 0, alphasort); + + for (n-- ; n >= 0 ; n--) { + if (rc) { +@@ -94,9 +94,9 @@ enum fcoe_status fcoe_find_fchost(char *ifname, char *fchost, int len) + } + } + free(namelist[n]); +- + } +- free(namelist); ++ if (status >= 0) ++ free(namelist); + + return rc; + } +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoe-utils-Documentation-for-the-fcoeadm-Scan-option.patch b/fcoe-utils-1.0.18-fcoe-utils-Documentation-for-the-fcoeadm-Scan-option.patch new file mode 100644 index 0000000..9056204 --- /dev/null +++ b/fcoe-utils-1.0.18-fcoe-utils-Documentation-for-the-fcoeadm-Scan-option.patch @@ -0,0 +1,54 @@ +From 04943a7ed51fe27fb064990c6d1496c3267eedd3 Mon Sep 17 00:00:00 2001 +From: Petr Sabata +Date: Fri, 1 Apr 2011 00:06:11 +0000 +Subject: [PATCH 13/16] fcoe-utils: Documentation for the fcoeadm -Scan option + and correct long option parsing + +This patch adds a simple description for the fcoeadm -Scan along with the +long option fix. + +Signed-off-by: Petr Sabata +Signed-off-by: Robert Love +--- + doc/fcoeadm.txt | 5 +++++ + fcoeadm.c | 1 + + 2 files changed, 6 insertions(+), 0 deletions(-) + +diff --git a/doc/fcoeadm.txt b/doc/fcoeadm.txt +index 2b1cf0a..2552d4d 100644 +--- a/doc/fcoeadm.txt ++++ b/doc/fcoeadm.txt +@@ -27,6 +27,8 @@ SYNOPSIS + + *fcoeadm* -i|--interface [_ethX_] + ++*fcoeadm* -S|--Scan [_ethX_] ++ + *fcoeadm* -t|--target [_ethX_] + + *fcoeadm* -l|--lun [_ethX_] +@@ -68,6 +70,9 @@ OPTIONS + Show information about the FCoE instance on the specified network + interface, or all FCoE instances if no network interface is specified. + ++*-S*, *--Scan* _ethX_:: ++ Validates that the interface name has an active FCoE session. ++ + *-t*, *--target* [_ethX_]:: + Show information about the discovered targets associated with the + FCoE instance on the specified network interface. +diff --git a/fcoeadm.c b/fcoeadm.c +index 0573d91..3cbff71 100644 +--- a/fcoeadm.c ++++ b/fcoeadm.c +@@ -39,6 +39,7 @@ static struct option fcoeadm_opts[] = { + {"destroy", required_argument, 0, 'd'}, + {"reset", required_argument, 0, 'r'}, + {"interface", no_argument, 0, 'i'}, ++ {"Scan", required_argument, 0, 'S'}, + {"target", no_argument, 0, 't'}, + {"lun", no_argument, 0, 'l'}, + {"stats", no_argument, 0, 's'}, +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoe-utils-Drain-fip-socket-during-creation-to-disca.patch b/fcoe-utils-1.0.18-fcoe-utils-Drain-fip-socket-during-creation-to-disca.patch new file mode 100644 index 0000000..ee5e586 --- /dev/null +++ b/fcoe-utils-1.0.18-fcoe-utils-Drain-fip-socket-during-creation-to-disca.patch @@ -0,0 +1,71 @@ +From d880216b9882eb601e60d2111a97ac1405f3529f Mon Sep 17 00:00:00 2001 +From: Nithin Sujir +Date: Tue, 12 Apr 2011 05:33:05 +0000 +Subject: [PATCH 09/16] fcoe-utils: Drain fip socket during creation to + discard unintended rx packets. + +During fcoe start, fcoemon creates a PF_PACKET,ETH_P_FIP raw socket for +vlan discovery. After the socket() call and before binding to the +desired device interface, the socket receives FIP packets from all +interfaces. This can interfere with VLAN discovery if a discovery packet +on one interface is received on the wrong socket. This patch drains the +socket after binding it to an interface and before adding the fd to +select monitoring. + +Signed-off-by: Nithin Nayak Sujir +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + lib/fip.c | 29 +++++++++++++++++++++++++++++ + 1 files changed, 29 insertions(+), 0 deletions(-) + +diff --git a/lib/fip.c b/lib/fip.c +index f8c8014..20c1082 100644 +--- a/lib/fip.c ++++ b/lib/fip.c +@@ -136,6 +136,28 @@ static void fip_ethhdr(int ifindex, unsigned char *mac, struct ethhdr *eh) + } + + /** ++ * drain_socket - Discard receive packets on a socket ++ */ ++static void drain_socket(int s) ++{ ++ char buf[4096]; ++ struct sockaddr_ll sa; ++ struct iovec iov[] = { ++ { .iov_base = buf, .iov_len = sizeof(buf), }, ++ }; ++ struct msghdr msg = { ++ .msg_name = &sa, ++ .msg_namelen = sizeof(sa), ++ .msg_iov = iov, ++ .msg_iovlen = ARRAY_SIZE(iov), ++ }; ++ ++ while (recvmsg(s, &msg, MSG_DONTWAIT) > 0) { ++ /* Drop the packet */ ++ } ++} ++ ++/** + * fip_socket - create and bind a packet socket for FIP + */ + int fip_socket(int ifindex) +@@ -160,6 +182,13 @@ int fip_socket(int ifindex) + return rc; + } + ++ /* ++ * Drain the packets that were received between socket and bind. We ++ * could've received packets not meant for our interface. This can ++ * interfere with vlan discovery ++ */ ++ drain_socket(s); ++ + return s; + } + +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoe-utils-Handle-more-than-128-adapters-in-fcoeadm-.patch b/fcoe-utils-1.0.18-fcoe-utils-Handle-more-than-128-adapters-in-fcoeadm-.patch new file mode 100644 index 0000000..a202e94 --- /dev/null +++ b/fcoe-utils-1.0.18-fcoe-utils-Handle-more-than-128-adapters-in-fcoeadm-.patch @@ -0,0 +1,463 @@ +From 48677372717fcbfcff17dbcd13441d9049f027e8 Mon Sep 17 00:00:00 2001 +From: Parikh, Neerav +Date: Wed, 9 Mar 2011 08:16:46 +0000 +Subject: [PATCH 03/16] fcoe-utils: Handle more than 128 adapters in fcoeadm + display commands + +Currently fcoeadm only supports 128 adapters for display routines. +It does not handle scenario if there are more than 128 adapters +available on the system. + +This patch removes that limitation and would allow display of more +than 128 adapters using fcoeadm display commands. + +Signed-off-by: Neerav Parikh +Tested-by: Ross Brattain +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + fcoeadm_display.c | 211 ++++++++++++++++++++++++++++++++++------------------- + 1 files changed, 136 insertions(+), 75 deletions(-) + +diff --git a/fcoeadm_display.c b/fcoeadm_display.c +index 6b69148..8f95530 100644 +--- a/fcoeadm_display.c ++++ b/fcoeadm_display.c +@@ -53,9 +53,6 @@ + /* #define TEST_READ_CAP_V1 */ + /* #define TEST_DEV_SERIAL_NO */ + +-/* Maximum number of HBA the display routines support */ +-#define MAX_HBA_COUNT 128 +- + /* Define FC4 Type */ + #define FC_TYPE_FCP 0x08 /* SCSI FCP */ + +@@ -84,6 +81,14 @@ struct hba_name_table { + int displayed; + }; + ++/* ++ * List of HBA objects. ++ */ ++struct hba_name_table_list { ++ int hba_count; ++ struct hba_name_table hba_table[1]; ++}; ++ + struct sa_nameval port_states[] = { + { "Not Present", HBA_PORTSTATE_UNKNOWN }, + { "Online", HBA_PORTSTATE_ONLINE }, +@@ -1040,17 +1045,18 @@ show_port_stats_in_row(HBA_INT64 start_time, + printf("\n"); + } + +-static void hba_table_destroy(struct hba_name_table *hba_table) ++static void hba_table_list_destroy(struct hba_name_table_list *hba_table_list) + { + int i; + +- /* +- * This is inefficiant as is closes adapter handles +- * (presumedly 0) that weren't open. However, it allows +- * us to avoid maintaining a count. +- */ +- for (i = 0 ; i < MAX_HBA_COUNT ; i++) +- HBA_CloseAdapter(hba_table[i].hba_handle); ++ if (!hba_table_list) ++ return; ++ ++ for (i = 0 ; i < hba_table_list->hba_count ; i++) ++ HBA_CloseAdapter(hba_table_list->hba_table[i].hba_handle); ++ ++ free(hba_table_list); ++ hba_table_list = NULL; + } + + static enum fcoe_status fcoeadm_loadhba() +@@ -1064,19 +1070,14 @@ static enum fcoe_status fcoeadm_loadhba() + /* + * This routine leaves all adapters fd's open. + */ +-static int hba_table_init(struct hba_name_table *hba_table) ++static int hba_table_list_init(struct hba_name_table_list **hba_table_list) + { + HBA_STATUS retval; + char namebuf[1024]; + int i, num_hbas = 0; +- +- /* +- * Initialize the table. +- */ +- for (i = 0 ; i < MAX_HBA_COUNT ; i++) { +- memset(&hba_table[i], 0, +- sizeof(struct hba_name_table)); +- } ++ struct hba_name_table_list *hba_table_list_temp = NULL; ++ struct hba_name_table *hba_table = NULL; ++ int size = 0; + + num_hbas = HBA_GetNumberOfAdapters(); + if (!num_hbas) { +@@ -1084,6 +1085,18 @@ static int hba_table_init(struct hba_name_table *hba_table) + return num_hbas; + } + ++ size = sizeof(struct hba_name_table_list) + \ ++ (num_hbas - 1)*sizeof(struct hba_name_table); ++ ++ hba_table_list_temp = (struct hba_name_table_list *)calloc(1, size); ++ if (!hba_table_list_temp) { ++ fprintf(stderr, ++ "Failure allocating memory.\n"); ++ return -1; ++ } ++ ++ hba_table_list_temp->hba_count = num_hbas; ++ + /* + * Fill out the HBA table. + */ +@@ -1095,19 +1108,20 @@ static int hba_table_init(struct hba_name_table *hba_table) + continue; + } + +- hba_table[i].hba_handle = HBA_OpenAdapter(namebuf); +- if (!hba_table[i].hba_handle) { +- hba_table[i].failed = 1; ++ hba_table = &hba_table_list_temp->hba_table[i]; ++ hba_table->hba_handle = HBA_OpenAdapter(namebuf); ++ if (!hba_table->hba_handle) { ++ hba_table->failed = 1; + fprintf(stderr, "HBA_OpenAdapter failed\n"); + perror("HBA_OpenAdapter"); + continue; + } + +- retval = HBA_GetAdapterAttributes(hba_table[i].hba_handle, +- &hba_table[i].hba_attrs); ++ retval = HBA_GetAdapterAttributes(hba_table->hba_handle, ++ &hba_table->hba_attrs); + if (retval != HBA_STATUS_OK) { +- HBA_CloseAdapter(hba_table[i].hba_handle); +- hba_table[i].failed = 1; ++ HBA_CloseAdapter(hba_table->hba_handle); ++ hba_table->failed = 1; + fprintf(stderr, + "HBA_GetAdapterAttributes failed, retval=%d\n", + retval); +@@ -1115,12 +1129,12 @@ static int hba_table_init(struct hba_name_table *hba_table) + continue; + } + +- retval = HBA_GetAdapterPortAttributes(hba_table[i].hba_handle, ++ retval = HBA_GetAdapterPortAttributes(hba_table->hba_handle, + 0, +- &hba_table[i].port_attrs); ++ &hba_table->port_attrs); + if (retval != HBA_STATUS_OK) { +- HBA_CloseAdapter(hba_table[i].hba_handle); +- hba_table[i].failed = 1; ++ HBA_CloseAdapter(hba_table->hba_handle); ++ hba_table->failed = 1; + fprintf(stderr, + "HBA_GetAdapterPortAttributes failed, " + "retval=%d\n", retval); +@@ -1128,20 +1142,26 @@ static int hba_table_init(struct hba_name_table *hba_table) + } + } + ++ *hba_table_list = hba_table_list_temp; ++ + return num_hbas; + } + + /* + * This routine expects a valid interface name. + */ +-static int get_index_for_ifname(struct hba_name_table *hba_table, +- int num_hbas, const char *ifname) ++static int get_index_for_ifname(struct hba_name_table_list *hba_table_list, ++ const char *ifname) + { ++ HBA_PORTATTRIBUTES *port_attrs; + int i; + +- for (i = 0 ; i < num_hbas ; i++) { ++ for (i = 0 ; i < hba_table_list->hba_count ; i++) { ++ ++ port_attrs = &hba_table_list->hba_table[i].port_attrs; ++ + if (!check_symbolic_name_for_interface( +- hba_table[i].port_attrs.PortSymbolicName, ++ port_attrs->PortSymbolicName, + ifname)) + return i; + } +@@ -1157,28 +1177,35 @@ enum fcoe_status display_port_stats(const char *ifname, int interval) + HBA_PORTSTATISTICS port_stats; + HBA_FC4STATISTICS port_fc4stats; + HBA_INT64 start_time = 0; +- struct hba_name_table hba_table[MAX_HBA_COUNT]; ++ struct hba_name_table_list *hba_table_list = NULL; + enum fcoe_status rc = SUCCESS; + int i, num_hbas; + + if (fcoeadm_loadhba()) + return EHBAAPIERR; + +- num_hbas = hba_table_init(hba_table); ++ num_hbas = hba_table_list_init(&hba_table_list); ++ if (!num_hbas) ++ goto out; ++ ++ if (num_hbas < 0) { ++ rc = EINTERR; ++ goto out; ++ } + +- i = get_index_for_ifname(hba_table, num_hbas, ifname); ++ i = get_index_for_ifname(hba_table_list, ifname); + + /* + * Return error code if a valid index wasn't returned. + */ + if (i < 0) { +- hba_table_destroy(hba_table); ++ hba_table_list_destroy(hba_table_list); + HBA_FreeLibrary(); + return EHBAAPIERR; + } + +- hba_handle = hba_table[i].hba_handle; +- port_attrs = &hba_table[i].port_attrs; ++ hba_handle = hba_table_list->hba_table[i].hba_handle; ++ port_attrs = &hba_table_list->hba_table[i].port_attrs; + + i = 0; + while (1) { +@@ -1231,21 +1258,34 @@ enum fcoe_status display_port_stats(const char *ifname, int interval) + } while (secs_left); + } + +- hba_table_destroy(hba_table); ++ hba_table_list_destroy(hba_table_list); ++out: + HBA_FreeLibrary(); + return rc; + } + + enum fcoe_status display_adapter_info(const char *ifname) + { +- struct hba_name_table hba_table[MAX_HBA_COUNT]; ++ struct hba_name_table_list *hba_table_list = NULL; + enum fcoe_status rc = SUCCESS; + int i, j, num_hbas = 0; ++ HBA_HANDLE hba_handle; ++ HBA_PORTATTRIBUTES *port_attrs; ++ HBA_PORTATTRIBUTES *sport_attrs; ++ HBA_ADAPTERATTRIBUTES *hba_attrs; ++ HBA_ADAPTERATTRIBUTES *shba_attrs; + + if (fcoeadm_loadhba()) + return EHBAAPIERR; + +- num_hbas = hba_table_init(hba_table); ++ num_hbas = hba_table_list_init(&hba_table_list); ++ if (!num_hbas) ++ goto out; ++ ++ if (num_hbas < 0) { ++ rc = EINTERR; ++ goto out; ++ } + + /* + * Loop through each HBA entry and for each serial number +@@ -1253,52 +1293,59 @@ enum fcoe_status display_adapter_info(const char *ifname) + * on that adapter. + */ + for (i = 0 ; i < num_hbas ; i++) { +- if (hba_table[i].failed || +- hba_table[i].displayed) ++ if (hba_table_list->hba_table[i].failed || ++ hba_table_list->hba_table[i].displayed) + continue; + ++ hba_handle = hba_table_list->hba_table[i].hba_handle; ++ port_attrs = &hba_table_list->hba_table[i].port_attrs; ++ hba_attrs = &hba_table_list->hba_table[i].hba_attrs; ++ + if (ifname && check_symbolic_name_for_interface( +- hba_table[i].port_attrs.PortSymbolicName, ++ port_attrs->PortSymbolicName, + ifname)) { + /* + * Overloading 'displayed' to indicate + * that the HBA/Port should be skipped. + */ +- hba_table[i].displayed = 1; ++ hba_table_list->hba_table[i].displayed = 1; + continue; + } + + /* + * Display the adapter header. + */ +- show_hba_info(&hba_table[i].hba_attrs); ++ show_hba_info(hba_attrs); + + /* + * Loop through HBAs again to print sub-ports. + */ + for (j = 0; j < num_hbas ; j++) { ++ sport_attrs = &hba_table_list->hba_table[j].port_attrs; ++ shba_attrs = &hba_table_list->hba_table[j].hba_attrs; + if (ifname && check_symbolic_name_for_interface( +- hba_table[j].port_attrs.PortSymbolicName, ++ sport_attrs->PortSymbolicName, + ifname)) { + /* + * Overloading 'displayed' to indicate + * that the HBA/Port should be skipped. + */ +- hba_table[i].displayed = 1; ++ hba_table_list->hba_table[i].displayed = 1; + continue; + } + +- if (!strncmp(hba_table[i].hba_attrs.SerialNumber, +- hba_table[j].hba_attrs.SerialNumber, +- strlen(hba_table[i].hba_attrs.SerialNumber))) { +- show_port_info(&hba_table[j].hba_attrs, +- &hba_table[j].port_attrs); +- hba_table[j].displayed = 1; ++ if (!strncmp(hba_attrs->SerialNumber, ++ shba_attrs->SerialNumber, ++ strlen(hba_attrs->SerialNumber))) { ++ show_port_info(shba_attrs, ++ sport_attrs); ++ hba_table_list->hba_table[j].displayed = 1; + } + } + } + +- hba_table_destroy(hba_table); ++ hba_table_list_destroy(hba_table_list); ++out: + HBA_FreeLibrary(); + + return rc; +@@ -1309,14 +1356,24 @@ enum fcoe_status display_target_info(const char *ifname, + { + HBA_STATUS retval; + HBA_PORTATTRIBUTES rport_attrs; +- struct hba_name_table hba_table[MAX_HBA_COUNT]; ++ struct hba_name_table_list *hba_table_list = NULL; + int i, target_index, num_hbas = 0; + enum fcoe_status rc = SUCCESS; ++ HBA_HANDLE hba_handle; ++ HBA_PORTATTRIBUTES *port_attrs; ++ HBA_ADAPTERATTRIBUTES *hba_attrs; + + if (fcoeadm_loadhba()) + return EHBAAPIERR; + +- num_hbas = hba_table_init(hba_table); ++ num_hbas = hba_table_list_init(&hba_table_list); ++ if (!num_hbas) ++ goto out; ++ ++ if (num_hbas < 0) { ++ rc = EINTERR; ++ goto out; ++ } + + /* + * Loop through each HBA entry and for each serial number +@@ -1324,28 +1381,32 @@ enum fcoe_status display_target_info(const char *ifname, + * on that adapter. + */ + for (i = 0 ; i < num_hbas ; i++) { +- if (hba_table[i].failed || +- hba_table[i].displayed) ++ if (hba_table_list->hba_table[i].failed || ++ hba_table_list->hba_table[i].displayed) + continue; + ++ hba_handle = hba_table_list->hba_table[i].hba_handle; ++ port_attrs = &hba_table_list->hba_table[i].port_attrs; ++ hba_attrs = &hba_table_list->hba_table[i].hba_attrs; ++ + if (ifname && check_symbolic_name_for_interface( +- hba_table[i].port_attrs.PortSymbolicName, ++ port_attrs->PortSymbolicName, + ifname)) { + /* + * Overloading 'displayed' to indicate + * that the HBA/Port should be skipped. + */ +- hba_table[i].displayed = 1; ++ hba_table_list->hba_table[i].displayed = 1; + continue; + } + + for (target_index = 0; +- target_index < hba_table[i].port_attrs.NumberofDiscoveredPorts; ++ target_index < port_attrs->NumberofDiscoveredPorts; + target_index++) { + + /* TODO: Second arg might be incorrect */ + retval = HBA_GetDiscoveredPortAttributes( +- hba_table[i].hba_handle, ++ hba_handle, + 0, target_index, + &rport_attrs); + +@@ -1354,7 +1415,7 @@ enum fcoe_status display_target_info(const char *ifname, + "HBA_GetDiscoveredPortAttributes " + "failed for target_index=%d, " + "status=%d\n", target_index, retval); +- hba_table[i].failed = 1; ++ hba_table_list->hba_table[i].failed = 1; + continue; + } + +@@ -1365,26 +1426,26 @@ enum fcoe_status display_target_info(const char *ifname, + continue; + + show_target_info( +- hba_table[i].port_attrs.PortSymbolicName, +- &hba_table[i].hba_attrs, ++ port_attrs->PortSymbolicName, ++ hba_attrs, + &rport_attrs); + +- if (hba_table[i].port_attrs.PortState != +- HBA_PORTSTATE_ONLINE) ++ if (port_attrs->PortState != HBA_PORTSTATE_ONLINE) + continue; + + /* + * This will print the LUN table + * under the target. + */ +- scan_device_map(hba_table[i].hba_handle, +- &hba_table[i].hba_attrs, +- &hba_table[i].port_attrs, ++ scan_device_map(hba_handle, ++ hba_attrs, ++ port_attrs, + &rport_attrs, ifname, style); + } + } + +- hba_table_destroy(hba_table); ++ hba_table_list_destroy(hba_table_list); ++out: + HBA_FreeLibrary(); + + return rc; +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoe-utils-Include-current-lldpad-headers.patch b/fcoe-utils-1.0.18-fcoe-utils-Include-current-lldpad-headers.patch new file mode 100644 index 0000000..d4fb5f2 --- /dev/null +++ b/fcoe-utils-1.0.18-fcoe-utils-Include-current-lldpad-headers.patch @@ -0,0 +1,29 @@ +From 6394a804ef09b83b78348c189dc4b99b440e0f6b Mon Sep 17 00:00:00 2001 +From: Petr Sabata +Date: Thu, 24 Mar 2011 00:39:30 +0000 +Subject: [PATCH 06/16] fcoe-utils: Include current lldpad headers + +Include current header files provided by open-lldp. + +Signed-off-by: Petr Sabata +Signed-off-by: Robert Love +--- + fcoemon.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/fcoemon.c b/fcoemon.c +index 9df473a..74795e4 100644 +--- a/fcoemon.c ++++ b/fcoemon.c +@@ -46,7 +46,7 @@ + + #include + #include +-#include ++#include + + #include "fcoe_utils_version.h" + #include "fcoemon_utils.h" +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoe-utils-Include-fcoe_utils.h-before-scsi-scsi.h.patch b/fcoe-utils-1.0.18-fcoe-utils-Include-fcoe_utils.h-before-scsi-scsi.h.patch new file mode 100644 index 0000000..1ba706d --- /dev/null +++ b/fcoe-utils-1.0.18-fcoe-utils-Include-fcoe_utils.h-before-scsi-scsi.h.patch @@ -0,0 +1,39 @@ +From 5aaaef140bf87138bca14a088a83a70b19fe4f23 Mon Sep 17 00:00:00 2001 +From: Petr Sabata +Date: Tue, 12 Apr 2011 15:38:04 +0000 +Subject: [PATCH 10/16] fcoe-utils: Include fcoe_utils.h before scsi/scsi.h + +The scsi/scsi.h header file defines 'SUCCESS' as 0x2002 which couses the +'SUCCESS' identifier in fcoe_status to get expanded, resulting in fcping +build failure. This patch prevents it by including fcoe_utils.h first. + +Signed-off-by: Petr Sabata +Signed-off-by: Robert Love +--- + fcping.c | 3 +-- + 1 files changed, 1 insertions(+), 2 deletions(-) + +diff --git a/fcping.c b/fcping.c +index 76ce7e2..a68883d 100644 +--- a/fcping.c ++++ b/fcping.c +@@ -47,6 +47,7 @@ + #include + #include "net_types.h" + #include "fc_types.h" ++#include "fcoe_utils.h" + typedef uint8_t u8; + #include + #include +@@ -54,8 +55,6 @@ typedef uint8_t u8; + #include + #include + +-#include "fcoe_utils.h" +- + static const char *cmdname; + + #define FC_MAX_PAYLOAD (2112UL - sizeof(net32_t)) +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoe-utils-Remove-unused-variable-symbolic_name_len.patch b/fcoe-utils-1.0.18-fcoe-utils-Remove-unused-variable-symbolic_name_len.patch new file mode 100644 index 0000000..ef0b6a0 --- /dev/null +++ b/fcoe-utils-1.0.18-fcoe-utils-Remove-unused-variable-symbolic_name_len.patch @@ -0,0 +1,27 @@ +From b8d63420e5c33391ff4ba300df862f599cd2a76b Mon Sep 17 00:00:00 2001 +From: Nithin Sujir +Date: Tue, 12 Apr 2011 05:33:06 +0000 +Subject: [PATCH 11/16] fcoe-utils: Remove unused variable symbolic_name_len + +Signed-off-by: Nithin Nayak Sujir +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + lib/fcoe_utils.c | 1 - + 1 files changed, 0 insertions(+), 1 deletions(-) + +diff --git a/lib/fcoe_utils.c b/lib/fcoe_utils.c +index 0ebdf9b..142b045 100644 +--- a/lib/fcoe_utils.c ++++ b/lib/fcoe_utils.c +@@ -161,7 +161,6 @@ int fcoe_checkdir(char *dir) + */ + char *get_ifname_from_symbolic_name(const char *symbolic_name) + { +- int symbolic_name_len = strlen(symbolic_name); + char *last_space = strrchr(symbolic_name, ' '); + + if (!last_space || strlen(last_space) == 1) +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoe-utils-Use-iproute2-instead-of-deprecated-vconfi.patch b/fcoe-utils-1.0.18-fcoe-utils-Use-iproute2-instead-of-deprecated-vconfi.patch new file mode 100644 index 0000000..033845c --- /dev/null +++ b/fcoe-utils-1.0.18-fcoe-utils-Use-iproute2-instead-of-deprecated-vconfi.patch @@ -0,0 +1,33 @@ +From 5300772f83c8f3eeb1dbb972d36b4112ec01a51f Mon Sep 17 00:00:00 2001 +From: Petr Sabata +Date: Fri, 1 Apr 2011 00:00:28 +0000 +Subject: [PATCH 12/16] fcoe-utils: Use iproute2 instead of deprecated vconfig + +vconfig has been considered generally deprecated in favor of iproute2 for +some time now. This patch utilizes `ip link' and removes vconfig dependency. + +Signed-off-by: Petr Sabata +Signed-off-by: Robert Love +--- + contrib/fcoe-setup.sh | 5 ++--- + 1 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/contrib/fcoe-setup.sh b/contrib/fcoe-setup.sh +index ab23400..2142c42 100755 +--- a/contrib/fcoe-setup.sh ++++ b/contrib/fcoe-setup.sh +@@ -24,9 +24,8 @@ create_vlan () { + vif=$(scan_vlan $ifname $vlan) + + if [ -z "$vif" ] ; then +- vconfig set_name_type DEV_PLUS_VID_NO_PAD +- vconfig add $ifname $vlan > /dev/null +- vif="$ifname.$vlan" ++ vif="$ifname.$vlan" ++ ip link add dev $vif link $ifname type vlan id $vlan + fi + ip link set $vif up + echo "$vif" +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoemon-Correct-wrong-error-check.patch b/fcoe-utils-1.0.18-fcoemon-Correct-wrong-error-check.patch new file mode 100644 index 0000000..d8e69b4 --- /dev/null +++ b/fcoe-utils-1.0.18-fcoemon-Correct-wrong-error-check.patch @@ -0,0 +1,32 @@ +From 1511aba0a6586ccd285c0c326f6f9c1a266c6a10 Mon Sep 17 00:00:00 2001 +From: Mark Rustad +Date: Fri, 8 Apr 2011 00:30:04 +0000 +Subject: [PATCH 14/16] fcoemon: Correct wrong error check. + +Correct wrong error check on return value from a socket() call. 0 is a +valid return, and treating it as an error could result in trouble. + +Signed-off-by: Mark Rustad +Tested-by: Ross Brattain +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + fcoemon.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/fcoemon.c b/fcoemon.c +index 77b3fd5..5449ae6 100644 +--- a/fcoemon.c ++++ b/fcoemon.c +@@ -607,7 +607,7 @@ static void fcm_vlan_dev_real_dev(char *vlan_ifname, char *real_ifname) + + fd = socket(PF_INET, SOCK_DGRAM, 0); + +- if (fd <= 0) { ++ if (fd < 0) { + FCM_LOG_ERR(errno, "open vlan query socket error"); + return; + } +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoemon-Fix-2-file-descriptor-leaks.patch b/fcoe-utils-1.0.18-fcoemon-Fix-2-file-descriptor-leaks.patch new file mode 100644 index 0000000..0d2d33b --- /dev/null +++ b/fcoe-utils-1.0.18-fcoemon-Fix-2-file-descriptor-leaks.patch @@ -0,0 +1,42 @@ +From adbae9962146896a90546ef2cd61abc938c7c2f7 Mon Sep 17 00:00:00 2001 +From: Mark Rustad +Date: Fri, 8 Apr 2011 00:24:04 +0000 +Subject: [PATCH 15/16] fcoemon: Fix 2 file descriptor leaks + +Fix 2 file descriptor leaks, one of which can occur repeatedly. + +Signed-off-by: Mark Rustad +Tested-by: Ross Brattain +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + fcoemon.c | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/fcoemon.c b/fcoemon.c +index 5449ae6..f2f3b86 100644 +--- a/fcoemon.c ++++ b/fcoemon.c +@@ -472,6 +472,7 @@ static int fcm_link_init(void) + rc = bind(fd, (struct sockaddr *)&l_local, sizeof(l_local)); + if (rc == -1) { + FCM_LOG_ERR(errno, "bind error"); ++ close(fd); + return rc; + } + fcm_link_socket = fd; +@@ -1255,8 +1256,10 @@ static void fcm_dcbd_retry_timeout(void *arg) + static void fcm_dcbd_disconnect(void) + { + if (fcm_clif != NULL && fcm_clif->cl_local.sun_path[0] != '\0') { +- if (fcm_clif->cl_fd >= 0) ++ if (fcm_clif->cl_fd >= 0) { + sa_select_rem_fd(fcm_clif->cl_fd); ++ close(fcm_clif->cl_fd); ++ } + unlink(fcm_clif->cl_local.sun_path); + fcm_clif->cl_local.sun_path[0] = '\0'; + fcm_clif->cl_fd = -1; /* mark as disconnected */ +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoemon-Unexpected-FLOGI-after-fcoe-port-is-destroye.patch b/fcoe-utils-1.0.18-fcoemon-Unexpected-FLOGI-after-fcoe-port-is-destroye.patch new file mode 100644 index 0000000..f3f6918 --- /dev/null +++ b/fcoe-utils-1.0.18-fcoemon-Unexpected-FLOGI-after-fcoe-port-is-destroye.patch @@ -0,0 +1,39 @@ +From 16b009e33b6fecab11a856428ada98288724fcbb Mon Sep 17 00:00:00 2001 +From: Nithin Sujir +Date: Wed, 30 Mar 2011 08:56:59 +0000 +Subject: [PATCH 08/16] fcoemon: Unexpected FLOGI after fcoe port is destroyed + +When fcoeadm -d is performed, fcoemon sets fcoe_enable=0 on the +physical port being destroyed but not on the vlan port. If a link toggle +occurs at this time, two link events are received, one each for physical +and vlan interfaces. The physical interface event is ignored due to +fcoe_enable=0 but the vlan event is processed and CREATE is called +resulting in unexpected FLOGI. This also puts the physical and vlan +ports out of sync and a subsequent fcoeadm -d is not processed. + +Signed-off-by: Nithin Nayak Sujir +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + fcoemon.c | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/fcoemon.c b/fcoemon.c +index 74795e4..77b3fd5 100644 +--- a/fcoemon.c ++++ b/fcoemon.c +@@ -2049,8 +2049,10 @@ static void fcm_fcoe_action(struct fcm_netif *ff, struct fcoe_port *p) + /* destroy all the VLANs */ + vp = fcm_find_fcoe_port(p->ifname, FCP_REAL_IFNAME); + while (vp) { +- if (vp->auto_created) ++ if (vp->auto_created) { ++ vp->fcoe_enable = 0; + fcp_set_next_action(vp, FCP_DESTROY_IF); ++ } + vp = fcm_find_next_fcoe_port(vp, p->ifname); + } + rc = SUCCESS; +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoemon-Use-new-libfcoe.ko-interfaces-create-destroy.patch b/fcoe-utils-1.0.18-fcoemon-Use-new-libfcoe.ko-interfaces-create-destroy.patch new file mode 100644 index 0000000..d86c49d --- /dev/null +++ b/fcoe-utils-1.0.18-fcoemon-Use-new-libfcoe.ko-interfaces-create-destroy.patch @@ -0,0 +1,33 @@ +From dbe527951f6f0836ba8d31ad77d09e8870dfb987 Mon Sep 17 00:00:00 2001 +From: Robert Love +Date: Tue, 25 Jan 2011 04:43:48 +0000 +Subject: [PATCH 01/16] fcoemon: Use new libfcoe.ko interfaces (create, + destroy, ...) + +The create, destroy, enable and disable interfaces have +all moved from fcoe.ko to libfcoe.ko with the kernel +fcoe transport changes. fcoemon needs to use the new kernel +interfaces since the old ones do not exist anymore. + +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + include/fcoe_utils.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/include/fcoe_utils.h b/include/fcoe_utils.h +index 48019b5..46085be 100644 +--- a/include/fcoe_utils.h ++++ b/include/fcoe_utils.h +@@ -38,7 +38,7 @@ + #define SYSFS_MOUNT "/sys" + #define SYSFS_NET SYSFS_MOUNT "/class/net" + #define SYSFS_FCHOST SYSFS_MOUNT "/class/fc_host" +-#define SYSFS_FCOE SYSFS_MOUNT "/module/fcoe/parameters" ++#define SYSFS_FCOE SYSFS_MOUNT "/module/libfcoe/parameters" + + #define FCHOSTBUFLEN 64 + +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoeutils-Cancel-vlan-discovery-timer-only-when-vali.patch b/fcoe-utils-1.0.18-fcoeutils-Cancel-vlan-discovery-timer-only-when-vali.patch new file mode 100644 index 0000000..247a22a --- /dev/null +++ b/fcoe-utils-1.0.18-fcoeutils-Cancel-vlan-discovery-timer-only-when-vali.patch @@ -0,0 +1,78 @@ +From c76c44392b52e58cab9212eb94c19f59835240c7 Mon Sep 17 00:00:00 2001 +From: Nithin Sujir +Date: Wed, 23 Mar 2011 01:38:25 +0000 +Subject: [PATCH 04/16] fcoeutils: Cancel vlan discovery timer only when valid + response is received + +Currently fcoemon cancels the timer as soon as a response is received +whether all the critical descriptors are present or not. This patch +verifies the critical descriptors are present in the vlan response +before cancelling the timer. + +Signed-off-by: Nithin Nayak Sujir +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + fcoemon.c | 20 ++++++++++++++++---- + 1 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/fcoemon.c b/fcoemon.c +index cd0916b..042d1c8 100644 +--- a/fcoemon.c ++++ b/fcoemon.c +@@ -517,6 +517,12 @@ int fcm_vlan_disc_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg) + struct fip_tlv_hdr *tlv = (struct fip_tlv_hdr *)(fh + 1); + struct fcoe_port *p = arg; + struct fcoe_port *vp; ++ int desc_mask = 0; ++ ++ enum { ++ VALID_MAC = 1, ++ VALID_VLAN = 2, ++ }; + + if (ntohs(fh->fip_proto) != FIP_PROTO_VLAN) + return -1; +@@ -524,14 +530,12 @@ int fcm_vlan_disc_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg) + if (fh->fip_subcode != FIP_VLAN_NOTE) + return -1; + +- /* cancel the retry timer, response received */ +- sa_timer_cancel(&p->vlan_disc_timer); +- + while (len > 0) { + switch (tlv->tlv_type) { + case FIP_TLV_MAC_ADDR: + memcpy(mac, ((struct fip_tlv_mac_addr *)tlv)->mac_addr, + ETHER_ADDR_LEN); ++ desc_mask |= VALID_MAC; + break; + /* + * this expects to see the MAC_ADDR TLV first, +@@ -545,6 +549,7 @@ int fcm_vlan_disc_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg) + vid = ntohs(((struct fip_tlv_vlan *)tlv)->vlan); + vp = fcm_new_vlan(sa->sll_ifindex, vid); + vp->dcb_required = p->dcb_required; ++ desc_mask |= VALID_VLAN; + break; + default: + /* unexpected or unrecognized descriptor */ +@@ -554,7 +559,14 @@ int fcm_vlan_disc_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg) + len -= tlv->tlv_len; + tlv = ((void *) tlv) + (tlv->tlv_len << 2); + }; +- return 0; ++ ++ if (desc_mask == (VALID_MAC | VALID_VLAN)) { ++ /* cancel the retry timer, valid response received */ ++ sa_timer_cancel(&p->vlan_disc_timer); ++ return 0; ++ } else { ++ return -1; ++ } + } + + static void fcm_fip_recv(void *arg) +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-fcoeutils-Retry-vlan-discovery-forever-if-AUTO_VLAN-.patch b/fcoe-utils-1.0.18-fcoeutils-Retry-vlan-discovery-forever-if-AUTO_VLAN-.patch new file mode 100644 index 0000000..06baddd --- /dev/null +++ b/fcoe-utils-1.0.18-fcoeutils-Retry-vlan-discovery-forever-if-AUTO_VLAN-.patch @@ -0,0 +1,40 @@ +From b4e06e408639fa29e3fac5a2235b46a4e1b4a3a0 Mon Sep 17 00:00:00 2001 +From: Nithin Sujir +Date: Wed, 23 Mar 2011 09:36:08 +0000 +Subject: [PATCH 05/16] fcoeutils: Retry vlan discovery forever if AUTO_VLAN + and FCOE_ENABLE are set + +This is a modified patch as per Robert Love's comments - +https://lists.open-fcoe.org/pipermail/devel/2011-March/011272.html + +After trying vlan discovery 10 times fcoemon disables auto_vlan on the +port and falls back to the physical interface. bnx2fc does not support +this. This patch checks for FCOE_ENABLE and AUTO_VLAN and if both are +set for the interface, the vlan discovery will continue until a vlan is +discovered. + +Signed-off-by: Nithin Nayak Sujir +Signed-off-by: Robert Love +Signed-off-by: Petr Sabata +--- + fcoemon.c | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/fcoemon.c b/fcoemon.c +index 042d1c8..9df473a 100644 +--- a/fcoemon.c ++++ b/fcoemon.c +@@ -1994,7 +1994,9 @@ void fcm_vlan_disc_timeout(void *arg) + struct fcoe_port *p = arg; + FCM_LOG_DBG("%s: VLAN discovery TIMEOUT [%d]", + p->ifname, p->vlan_disc_count); +- if (++(p->vlan_disc_count) > FCM_VLAN_DISC_MAX) { ++ p->vlan_disc_count++; ++ if (!(p->fcoe_enable && p->auto_vlan) && ++ (p->vlan_disc_count > FCM_VLAN_DISC_MAX)) { + FCM_LOG("%s: VLAN discovery failed after %d attempts", + p->ifname, FCM_VLAN_DISC_MAX); + FCM_LOG("%s: disabling VLAN discovery, trying FCoE on %s", +-- +1.7.4.4 + diff --git a/fcoe-utils-1.0.18-help.patch b/fcoe-utils-1.0.18-help.patch new file mode 100644 index 0000000..c9ea696 --- /dev/null +++ b/fcoe-utils-1.0.18-help.patch @@ -0,0 +1,13 @@ +diff --git a/fcnsq.c b/fcnsq.c +index 8722b21..466a85e 100644 +--- a/fcnsq.c ++++ b/fcnsq.c +@@ -360,7 +360,7 @@ static void help(int status) + " --gspn \n" + " --gsnn \n" + "Options:\n" +- " --quiet print minimal results on success, and no error messages\n" ++ " --quiet|-q print minimal results on success, and no error messages\n" + "\n" + "Port IDs and World Wide Names must be specified in hexadecimal.\n" + ); diff --git a/fcoe-include-headers.patch b/fcoe-utils-1.0.18-kernel-headers.patch similarity index 100% rename from fcoe-include-headers.patch rename to fcoe-utils-1.0.18-kernel-headers.patch diff --git a/fcoe-utils.spec b/fcoe-utils.spec index 255e17f..a2e0a10 100644 --- a/fcoe-utils.spec +++ b/fcoe-utils.spec @@ -1,25 +1,40 @@ Name: fcoe-utils -Version: 1.0.17 -Release: 1.1%{?dist} +Version: 1.0.18 +Release: 1%{?dist} Summary: Fibre Channel over Ethernet utilities Group: Applications/System License: GPLv2 URL: http://www.open-fcoe.org -# This source was pulled from upstream git repository -# To make a tarball, just run: -# git clone git://open-fcoe.org/fcoe/fcoe-utils.git && cd fcoe-utils -# git archive --prefix=fcoe-utils-%{version}/ v%{version} > ../fcoe-utils-%{version}.tar -# cd .. && gzip fcoe-utils-%{version} -Source0: %{name}-%{version}.tar.gz +# git://open-fcoe.org/fcoe/fcoe-utils.git +Source0: %{name}-%{version}.tar.bz2 Source1: quickstart.txt -Patch0: fcoe-utils-1.0.12-makefile-data-hook.patch -Patch1: fcoe-utils-1.0.14-no-vconfig.patch -Patch2: fcoe-include-headers.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -ExcludeArch: s390 +# Generic Fedora patches +Patch0: fcoe-utils-1.0.17-init.patch +Patch1: fcoe-utils-1.0.17-make.patch +Patch2: fcoe-utils-1.0.18-help.patch +#Patch3: fcoe-utils-1.0.17-manpages.patch +Patch4: fcoe-utils-1.0.18-config.patch +Patch5: fcoe-utils-1.0.18-kernel-headers.patch +# Upstream patches +Patch10: fcoe-utils-1.0.18-fcoemon-Use-new-libfcoe.ko-interfaces-create-destroy.patch +Patch11: fcoe-utils-1.0.18-fcoe-utils-Add-SUPPORTED_DRIVERS-field-to-config.patch +Patch12: fcoe-utils-1.0.18-fcoe-utils-Handle-more-than-128-adapters-in-fcoeadm-.patch +Patch13: fcoe-utils-1.0.18-fcoeutils-Cancel-vlan-discovery-timer-only-when-vali.patch +Patch14: fcoe-utils-1.0.18-fcoeutils-Retry-vlan-discovery-forever-if-AUTO_VLAN-.patch +Patch15: fcoe-utils-1.0.18-fcoe-utils-Include-current-lldpad-headers.patch +Patch16: fcoe-utils-1.0.18-fcoe-utils-Add-libnl-build-dependency-for-fcoe-utils.patch +Patch17: fcoe-utils-1.0.18-fcoemon-Unexpected-FLOGI-after-fcoe-port-is-destroye.patch +Patch18: fcoe-utils-1.0.18-fcoe-utils-Drain-fip-socket-during-creation-to-disca.patch +Patch19: fcoe-utils-1.0.18-fcoe-utils-Include-fcoe_utils.h-before-scsi-scsi.h.patch +Patch20: fcoe-utils-1.0.18-fcoe-utils-Remove-unused-variable-symbolic_name_len.patch +Patch21: fcoe-utils-1.0.18-fcoe-utils-Use-iproute2-instead-of-deprecated-vconfi.patch +Patch22: fcoe-utils-1.0.18-fcoe-utils-Documentation-for-the-fcoeadm-Scan-option.patch +Patch23: fcoe-utils-1.0.18-fcoemon-Correct-wrong-error-check.patch +Patch24: fcoe-utils-1.0.18-fcoemon-Fix-2-file-descriptor-leaks.patch +Patch25: fcoe-utils-1.0.18-fcoe-utils-Avoid-freeing-uninitialized-pointer-in-fc.patch -BuildRequires: libhbaapi-devel lldpad-devel +BuildRequires: libhbaapi-devel lldpad-devel libnl-devel BuildRequires: libtool automake autoconf Requires: lldpad libhbalinux >= 1.0.9 iproute device-mapper-multipath Requires(post): chkconfig @@ -32,38 +47,51 @@ fcoeadm - command line tool for configuring FCoE interfaces fcoemon - service to configure DCB Ethernet QOS filters, works with dcbd or lldpad %prep -%setup -q -%patch0 -p1 -b .data-hook -%patch1 -p1 -b .no-vconfig -%patch2 -p1 -b .headers +%setup -q -c -n %{name}-%{version} +# Upstream first +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +# Fedora patches on top of that... +%patch0 -p1 -b .init +%patch1 -p1 -b .make +%patch2 -p1 -b .help +#%patch3 -p1 -b .manpages +%patch4 -p1 -b .config +%patch5 -p1 -F 2 -b .kernel-headers %build ./bootstrap.sh %configure make %{?_smp_mflags} - %install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_initrddir} -mv $RPM_BUILD_ROOT/etc/init.d/fcoe $RPM_BUILD_ROOT%{_initrddir}/fcoe -rm -rf $RPM_BUILD_ROOT/etc/init.d +make install DESTDIR=%{buildroot} +mkdir -p %{buildroot}%{_initrddir} +mv %{buildroot}/etc/init.d/fcoe %{buildroot}%{_initrddir}/fcoe +rm -rf %{buildroot}/etc/init.d install -m 644 %SOURCE1 quickstart.txt -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/fcoe/ -cp etc/config $RPM_BUILD_ROOT%{_sysconfdir}/fcoe/config -mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/fcoe - -install -m 755 contrib/fcc.sh $RPM_BUILD_ROOT%{_libexecdir}/fcoe/fcc.sh -install -m 755 contrib/fcoe_edd.sh $RPM_BUILD_ROOT%{_libexecdir}/fcoe/fcoe_edd.sh -install -m 755 contrib/fcoe-setup.sh $RPM_BUILD_ROOT%{_libexecdir}/fcoe/fcoe-setup.sh -install -m 755 debug/fcoedump.sh $RPM_BUILD_ROOT%{_libexecdir}/fcoe/fcoedump.sh -install -m 755 debug/dcbcheck.sh $RPM_BUILD_ROOT%{_libexecdir}/fcoe/dcbcheck.sh - - -%clean -rm -rf $RPM_BUILD_ROOT - +mkdir -p %{buildroot}%{_sysconfdir}/fcoe/ +cp etc/config %{buildroot}%{_sysconfdir}/fcoe/config +mkdir -p %{buildroot}%{_libexecdir}/fcoe +install -m 755 contrib/fcc.sh %{buildroot}%{_libexecdir}/fcoe/fcc.sh +install -m 755 contrib/fcoe_edd.sh %{buildroot}%{_libexecdir}/fcoe/fcoe_edd.sh +install -m 755 contrib/fcoe-setup.sh %{buildroot}%{_libexecdir}/fcoe/fcoe-setup.sh +install -m 755 debug/fcoedump.sh %{buildroot}%{_libexecdir}/fcoe/fcoedump.sh +install -m 755 debug/dcbcheck.sh %{buildroot}%{_libexecdir}/fcoe/dcbcheck.sh %post /sbin/chkconfig --add fcoe @@ -110,6 +138,11 @@ fi %changelog +* Wed Apr 20 2011 Petr Sabata - 1.0.18-1 +- 1.0.18 bump with latest bugfixes +- Removing ExcludeArch completely; not related for Fedora +- Buildroot cleanup + * Tue Apr 19 2011 Karsten Hopp 1.0.17-1.1 - remove excludearch ppc, required by anaconda.ppc diff --git a/sources b/sources index 7a7d749..25a46cf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -18fc04e7bda993f8297f1106a44edb2b fcoe-utils-1.0.17.tar.gz +a6b3bb359aa59e0ec7eac2764aec5ba7 fcoe-utils-1.0.18.tar.bz2