Hello community,

here is the log from the commit of package fcoe-utils for openSUSE:Factory 
checked in at 2020-06-11 14:46:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/fcoe-utils (Old)
 and      /work/SRC/openSUSE:Factory/.fcoe-utils.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "fcoe-utils"

Thu Jun 11 14:46:53 2020 rev:18 rq:813010 version:1.0.33

Changes:
--------
--- /work/SRC/openSUSE:Factory/fcoe-utils/fcoe-utils.changes    2020-04-09 
23:14:03.866196277 +0200
+++ /work/SRC/openSUSE:Factory/.fcoe-utils.new.3606/fcoe-utils.changes  
2020-06-11 14:47:22.061848441 +0200
@@ -1,0 +2,28 @@
+Tue Jun  9 15:57:49 UTC 2020 - Lee Duncan <ldun...@suse.com>
+
+- Updated with latest upstream v1.0.33 from v1.0.32:
+  * Added "-Wextra" and enabled "-Werror" for compiling
+  * Ignore auto-generated files
+  * Update systemd service files (several updates)
+  * A bunch of gcc-10-related fixes, such as marking unused
+    arguments, fixing strncpy()s, string truncation/overflow
+  * better error handling/retry for link issues (like EBUSY)
+  * replace use of "ifconfig" with "ip" in debug scripts
+  * fix long-standing issue with netlink buffer resizing
+  * move bash completions to proper system directory
+  This replaces fcoe-utils-v1.0.32.tar.xz with
+  fcoe-utils-v1.0.33.tar.xz, and it does away with the
+  following patches, since they are all fixed upstream:
+  * 0003-systemctl-cannot-start-fcoemon.socket.patch
+  * 0004-fcoemon-Correctly-handle-options-in-the-service-file.patch
+  * 0005-fcoe.service-Add-foreground-to-prevent-fcoemon-to-be.patch
+  * 0006-fipvlan-fixup-return-value-on-error.patch
+  * 0008-Use-correct-socket-for-fcoemon.socket.patch
+  * 0012-fcoemon-Retry-fcm_link_getlink-on-EBUSY.patch
+  * fcoe-utils-1.0.29-make.patch
+  * fcoe-utils-stop-using-ifconfig.patch
+  And the following patch was removed because we can
+  successfully compile with "-Werror" now:
+  * 0009-disable-Werror-building.patch
+
+-------------------------------------------------------------------

Old:
----
  0003-systemctl-cannot-start-fcoemon.socket.patch
  0004-fcoemon-Correctly-handle-options-in-the-service-file.patch
  0005-fcoe.service-Add-foreground-to-prevent-fcoemon-to-be.patch
  0006-fipvlan-fixup-return-value-on-error.patch
  0008-Use-correct-socket-for-fcoemon.socket.patch
  0009-disable-Werror-building.patch
  0012-fcoemon-Retry-fcm_link_getlink-on-EBUSY.patch
  fcoe-utils-1.0.29-make.patch
  fcoe-utils-1.0.32.tar.xz
  fcoe-utils-stop-using-ifconfig.patch

New:
----
  fcoe-utils-1.0.33.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ fcoe-utils.spec ++++++
--- /var/tmp/diff_new_pack.xIj7y2/_old  2020-06-11 14:47:23.489852601 +0200
+++ /var/tmp/diff_new_pack.xIj7y2/_new  2020-06-11 14:47:23.493852612 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           fcoe-utils
-URL:            http://www.open-fcoe.org
+URL:            https://github.com/openSUSE/fcoe-utils
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  libpciaccess-devel
@@ -25,31 +25,20 @@
 BuildRequires:  open-lldp-devel
 BuildRequires:  pkg-config
 BuildRequires:  pkgconfig(libsystemd)
+PreReq:         %fillup_prereq
 Requires:       device-mapper
 Requires:       iproute
 Requires:       open-lldp
+Requires:       pkgconfig(systemd)
 %systemd_ordering
-Version:        1.0.32
+Version:        1.0.33
 Release:        0
 Summary:        FCoE userspace management tools
-# git://open-fcoe.org/fcoe/fcoe-utils.git
 License:        GPL-2.0-only
 Group:          System/Daemons
-Source0:        %{name}-%{version}.tar.xz
-
-# Patches to be upstreamed
-Patch3:         0003-systemctl-cannot-start-fcoemon.socket.patch
-Patch4:         0004-fcoemon-Correctly-handle-options-in-the-service-file.patch
-Patch5:         0005-fcoe.service-Add-foreground-to-prevent-fcoemon-to-be.patch
-Patch6:         0006-fipvlan-fixup-return-value-on-error.patch
-Patch8:         0008-Use-correct-socket-for-fcoemon.socket.patch
-Patch9:         0009-disable-Werror-building.patch
-Patch12:        0012-fcoemon-Retry-fcm_link_getlink-on-EBUSY.patch
-Patch15:        %{name}-stop-using-ifconfig.patch
-
-# Patches from Fedora
-Patch101:       fcoe-utils-1.0.29-make.patch
+Source:         %{name}-%{version}.tar.xz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+%{?systemd_requires}
 
 %description
 Userspace tools to manage FibreChannel over Ethernet (FCoE)
@@ -58,15 +47,6 @@
 
 %prep
 %setup -q
-%patch3 -p1
-%patch4 -p1
-%patch5 -p1
-%patch6 -p1
-%patch8 -p1
-%patch9 -p1
-%patch12 -p1
-%patch15 -p1
-%patch101 -p1
 
 %build
 autoreconf -vi
@@ -90,21 +70,17 @@
 done
 
 %pre
-%service_add_pre fcoe.service
-exit 0
+%service_add_pre fcoe.service fcoemon.socket
 
 %post
-%service_add_post fcoe.service
+%service_add_post fcoe.service fcoemon.socket
 %fillup_only -n fcoe
-exit 0
 
 %preun
-%service_del_preun fcoe.service
-exit 0
+%service_del_preun fcoe.service fcoemon.socket
 
 %postun
-%service_del_postun fcoe.service
-exit 0
+%service_del_postun fcoe.service fcoemon.socket
 
 %files
 %defattr(-,root,root,-)
@@ -117,7 +93,7 @@
 %{_sysconfdir}/fcoe/
 %config(noreplace) %{_sysconfdir}/fcoe/config
 %config(noreplace) %{_sysconfdir}/fcoe/cfg-ethx
-%config %{_sysconfdir}/bash_completion.d/
+%{_datadir}/bash-completion/completions/
 %{_libexecdir}/fcoe/
 
 %changelog

++++++ _service ++++++
--- /var/tmp/diff_new_pack.xIj7y2/_old  2020-06-11 14:47:23.549852776 +0200
+++ /var/tmp/diff_new_pack.xIj7y2/_new  2020-06-11 14:47:23.553852787 +0200
@@ -1,10 +1,10 @@
 <services>
        <service name="tar_scm" mode="disabled">
-               <param 
name="url">https://github.com/morbidrsa/fcoe-utils.git</param>
+               <param 
name="url">https://github.com/openSUSE/fcoe-utils.git</param>
                <param name="scm">git</param>
                <param name="filename">fcoe-utils</param>
-               <param name="versionformat">1.0.32</param>
-               <param name="revision">v1.0.32</param>
+               <param name="versionformat">1.0.33</param>
+               <param name="revision">v1.0.33</param>
                <param name="exclude">.git</param>
        </service>
        <service name="recompress" mode="disabled">

++++++ fcoe-utils-1.0.32.tar.xz -> fcoe-utils-1.0.33.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/Makefile.am 
new/fcoe-utils-1.0.33/Makefile.am
--- old/fcoe-utils-1.0.32/Makefile.am   2017-01-17 13:19:20.000000000 +0100
+++ new/fcoe-utils-1.0.33/Makefile.am   2020-06-09 19:26:02.000000000 +0200
@@ -5,7 +5,7 @@
 AM_CPPFLAGS = -I${srcdir}/include -I${builddir}/include
 ## pass the sysconfdir into the C proprocessor
 AM_CPPFLAGS += -DSYSCONFDIR="\"${sysconfdir}\"" -D_FORTIFY_SOURCE=2
-AM_CFLAGS = -Wall -Wformat=2 -Werror -Wmissing-prototypes -Wstrict-prototypes
+AM_CFLAGS = -Wall -Wformat=2 -Werror -Wextra -Wmissing-prototypes 
-Wstrict-prototypes
 
 ## rules for building fcoeadm
 fcoeadm_SOURCES = fcoeadm.c fcoeadm_display.c
@@ -73,7 +73,7 @@
 
 dist_noinst_DATA = README COPYING INSTALL CONFIGURE QUICKSTART fcoe-utils.spec 
etc/config
 
-bashcompletiondir = $(sysconfdir)/bash_completion.d
+bashcompletiondir = $(datadir)/bash-completion/completions
 dist_bashcompletion_DATA = contrib/bash_completion/fcoeadm 
contrib/bash_completion/fcoemon
 
 install-data-hook:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/configure.ac 
new/fcoe-utils-1.0.33/configure.ac
--- old/fcoe-utils-1.0.32/configure.ac  2017-01-17 13:19:20.000000000 +0100
+++ new/fcoe-utils-1.0.33/configure.ac  2020-06-09 19:26:02.000000000 +0200
@@ -1,4 +1,4 @@
-AC_INIT([fcoe-utils], [1.0.32], [fcoe-de...@open-fcoe.org])
+AC_INIT([fcoe-utils], [1.0.33], [fcoe-de...@open-fcoe.org])
 
 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 AM_INIT_AUTOMAKE([foreign])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/debug/dcbcheck.sh 
new/fcoe-utils-1.0.33/debug/dcbcheck.sh
--- old/fcoe-utils-1.0.32/debug/dcbcheck.sh     2017-01-17 13:19:20.000000000 
+0100
+++ new/fcoe-utils-1.0.33/debug/dcbcheck.sh     2020-06-09 19:26:02.000000000 
+0200
@@ -27,7 +27,7 @@
 fi
 
 # Ensure that the interface name provided is valid
-if ifconfig ${IFNAME} 2>&1 | grep -q "Device not found" ; then
+if ip link show dev ${IFNAME} 2>&1 | grep -q "does not exist" ; then
     echo "Please provide a valid interface name." >&2
     exit 1
 fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/debug/fcoedump.sh 
new/fcoe-utils-1.0.33/debug/fcoedump.sh
--- old/fcoe-utils-1.0.32/debug/fcoedump.sh     2017-01-17 13:19:20.000000000 
+0100
+++ new/fcoe-utils-1.0.33/debug/fcoedump.sh     2020-06-09 19:26:02.000000000 
+0200
@@ -78,8 +78,10 @@
                ethtool -i $DEVICE
                echo -e "#ethtool offloads:"
                ethtool -k $DEVICE
-               echo -e "#ifconfig:"
-               ifconfig $DEVICE
+               echo -e "#ip link:"
+               ip link show dev $DEVICE
+               echo -e "#ip addr:"
+               ip addr show dev $DEVICE
        fi
 
        echo -e "\n###Adapter INFO $PHYSDEV"
@@ -93,8 +95,10 @@
        ethtool -k $PHYSDEV
        echo -e "#ethtool stats:"
        ethtool -S $PHYSDEV
-       echo -e "#ifconfig:"
-       ifconfig $PHYSDEV
+       echo -e "#ip link:"
+       ip link show dev $PHYSDEV
+       echo -e "#ip addr:"
+       ip addr show dev $PHYSDEV
 }
 
 dcbtool_info()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/doc/fcoemon.txt 
new/fcoe-utils-1.0.33/doc/fcoemon.txt
--- old/fcoe-utils-1.0.32/doc/fcoemon.txt       2017-01-17 13:19:20.000000000 
+0100
+++ new/fcoe-utils-1.0.33/doc/fcoemon.txt       2020-06-09 19:26:02.000000000 
+0200
@@ -53,13 +53,13 @@
 -------
 *-f*, *--foreground*::
        Run *fcoemon* in the foreground.
-*-d*, *--debug*::
-       Enable debugging messages.
+*-d*, *--debug=yes|no*::
+       Enable or disable debugging messages.
 *-l*, *--legacy*::
        Force fcoemon to use the legacy /sys/module/libfcoe/parameters/
        interface. The default is to use the newer /sys/bus/fcoe/ interfaces
        if they are available.
-*-s*, *--syslog*::
+*-s*, *--syslog=yes|no*::
        Use syslogd for logging. The default behavior is to log to stdout
        and stderr.
 *-h*, *--help*::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/etc/systemd/fcoe.service 
new/fcoe-utils-1.0.33/etc/systemd/fcoe.service
--- old/fcoe-utils-1.0.32/etc/systemd/fcoe.service      2017-01-17 
13:19:20.000000000 +0100
+++ new/fcoe-utils-1.0.33/etc/systemd/fcoe.service      2020-06-09 
19:26:02.000000000 +0200
@@ -4,9 +4,9 @@
 
 [Service]
 Type=simple
-EnvironmentFile=/etc/sysconfig/fcoe
+EnvironmentFile=/etc/fcoe/config
 ExecStartPre=/sbin/modprobe -qa $SUPPORTED_DRIVERS
-ExecStart=/usr/sbin/fcoemon $FCOEMON_OPTS
+ExecStart=/usr/sbin/fcoemon --foreground --debug=$DEBUG --syslog=$SYSLOG
 
 [Install]
 WantedBy=multi-user.target
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/etc/systemd/fcoemon.socket 
new/fcoe-utils-1.0.33/etc/systemd/fcoemon.socket
--- old/fcoe-utils-1.0.32/etc/systemd/fcoemon.socket    2017-01-17 
13:19:20.000000000 +0100
+++ new/fcoe-utils-1.0.33/etc/systemd/fcoemon.socket    2020-06-09 
19:26:02.000000000 +0200
@@ -1,5 +1,9 @@
+[Unit]
+Description=Open-FCoE daemon control socket
+
 [Socket]
-ListenDatagram=@/com/intel/fcoemon
+Service=fcoe.service
+ListenDatagram=@fcm_clif
 PassCredentials=true
 
 [Install]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/fcoeadm_display.c 
new/fcoe-utils-1.0.33/fcoeadm_display.c
--- old/fcoe-utils-1.0.32/fcoeadm_display.c     2017-01-17 13:19:20.000000000 
+0100
+++ new/fcoe-utils-1.0.33/fcoeadm_display.c     2020-06-09 19:26:02.000000000 
+0200
@@ -440,7 +440,7 @@
        sa_dir_crawl(path, search_rport_targets, style);
 }
 
-static void scan_device_map(char *port, char *rport, enum disp_style style)
+static void scan_device_map(char *rport, enum disp_style style)
 {
        if (style == DISP_TARG)
                show_short_lun_info_header();
@@ -540,7 +540,8 @@
        return rc;
 }
 
-static int get_host_from_vport(struct dirent *dp, void *arg)
+static int get_host_from_vport(struct dirent *dp,
+                       void *arg __attribute__ ((unused)))
 {
        if (!strncmp(dp->d_name, "host", strlen("host"))) {
                struct port_attributes *port_attrs;
@@ -621,7 +622,8 @@
        return rc;
 }
 
-static int search_fc_adapter(struct dirent *dp, void *arg)
+static int search_fc_adapter(struct dirent *dp,
+                       void *arg __attribute__ ((unused)))
 {
        display_one_adapter_info(dp->d_name);
        return 0;
@@ -724,7 +726,7 @@
         * This will print the LUN table
         * under the target.
         */
-       scan_device_map(ifname, rport, style);
+       scan_device_map(rport, style);
 
 free_port_attribs:
        free(port_attrs);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/fcoemon.c 
new/fcoe-utils-1.0.33/fcoemon.c
--- old/fcoe-utils-1.0.32/fcoemon.c     2017-01-17 13:19:20.000000000 +0100
+++ new/fcoe-utils-1.0.33/fcoemon.c     2020-06-09 19:26:02.000000000 +0200
@@ -328,7 +328,6 @@
 static int fcm_link_seq;
 static void fcm_link_recv(void *);
 static void fcm_link_getlink(void);
-static int fcm_link_buf_check(size_t);
 static void clear_dcbd_info(struct fcm_netif *ff);
 static int fcoe_vid_from_ifname(const char *ifname);
 
@@ -336,9 +335,9 @@
  * Table for getopt_long(3).
  */
 static struct option fcm_options[] = {
-       {"debug", 0, NULL, 'd'},
+       {"debug", 1, NULL, 'd'},
        {"legacy", 0, NULL, 'l'},
-       {"syslog", 0, NULL, 's'},
+       {"syslog", 1, NULL, 's'},
        {"exec", 1, NULL, 'e'},
        {"foreground", 0, NULL, 'f'},
        {"version", 0, NULL, 'v'},
@@ -354,8 +353,7 @@
  * large enough to fit and expand it if we ever do a read that almost fills it.
  */
 static char *fcm_link_buf;
-static size_t fcm_link_buf_size = 4096;        /* initial size */
-static const size_t fcm_link_buf_fuzz = 300;   /* "almost full" remainder */
+static size_t fcm_link_buf_size = 8192;        /* initial size */
 
 /*
  * A value must be surrounded by quates, e.g. "x".
@@ -750,7 +748,7 @@
        }
 }
 
-static void log_nlmsg_error(struct nlmsghdr *hp, size_t rlen, const char *str)
+static int log_nlmsg_error(struct nlmsghdr *hp, size_t rlen, const char *str)
 {
        struct nlmsgerr *ep;
 
@@ -758,8 +756,10 @@
                ep = (struct nlmsgerr *)NLMSG_DATA(hp);
                FCM_LOG_DBG("%s, err=%d, type=%d\n",
                            str, ep->error, ep->msg.nlmsg_type);
+               return ep->error;
        } else {
                FCM_LOG("%s", str);
+               return 0;
        }
 }
 
@@ -1089,9 +1089,14 @@
 
        memset(&ifv, 0, sizeof(ifv));
        ifv.cmd = GET_VLAN_REALDEV_NAME_CMD;
-       strncpy(ifv.device1, vlan_ifname, strlen(vlan_ifname)+1);
+       if (strlen(vlan_ifname) > (sizeof(ifv.device1) - 1)) {
+               FCM_LOG_ERR(ENOSPC, "no room for vlan ifname");
+               goto close_fd;
+       }
+       strncpy(ifv.device1, vlan_ifname, sizeof(ifv.device1));
        if (ioctl(fd, SIOCGIFVLAN, &ifv) == 0)
-               strncpy(real_ifname, ifv.u.device2, strlen(ifv.u.device2)+1);
+               strncpy(real_ifname, ifv.u.device2, IFNAMSIZ-1);
+close_fd:
        close(fd);
 }
 
@@ -1643,7 +1648,7 @@
                real_dev[0] = '\0';
                fcm_vlan_dev_real_dev(ifname, real_dev);
                if (strlen(real_dev))
-                       strncpy(p->real_ifname, real_dev, strlen(real_dev)+1);
+                       strncpy(p->real_ifname, real_dev, IFNAMSIZ-1);
                if (p->ready)
                        update_fcoe_port_state(p, type, operstate,
                                               FCP_CFG_IFNAME);
@@ -1655,7 +1660,7 @@
                if (p) {
                        p->ifindex = ifindex;
                        memcpy(p->mac, mac, ETHER_ADDR_LEN);
-                       strncpy(p->real_ifname, ifname, strlen(ifname)+1);
+                       strncpy(p->real_ifname, ifname, IFNAMSIZ-1);
                        update_fcoe_port_state(p, type, operstate,
                                               FCP_REAL_IFNAME);
                }
@@ -1848,8 +1853,22 @@
        size_t plen;
        size_t rlen;
 
+       /* check to make sure our receive buffer is large enough,
+        * or scale it up as needed */
+       rc = recv(fcm_link_socket, NULL, 0, MSG_PEEK | MSG_TRUNC);
+       if (rc > (int)fcm_link_buf_size) {
+               FCM_LOG_DBG("resizing link buf to %d bytes\n", rc);
+               void *resize = realloc(fcm_link_buf, rc);
+               if (resize) {
+                       fcm_link_buf = resize;
+                       fcm_link_buf_size = rc;
+               } else {
+                       FCM_LOG_ERR(errno, "Failed to allocate link buffer");
+               }
+       }
+
        buf = fcm_link_buf;
-       rc = read(fcm_link_socket, buf, fcm_link_buf_size);
+       rc = recv(fcm_link_socket, buf, fcm_link_buf_size, 0);
        if (rc <= 0) {
                if (rc < 0)
                        FCM_LOG_ERR(errno, "Error reading from "
@@ -1858,11 +1877,6 @@
                return;
        }
 
-       if (fcm_link_buf_check(rc)) {
-               fcm_link_getlink();
-               return;
-       }
-
        hp = (struct nlmsghdr *)buf;
        rlen = rc;
        for (hp = (struct nlmsghdr *)buf; NLMSG_OK(hp, rlen);
@@ -1873,7 +1887,7 @@
                        break;
 
                if (hp->nlmsg_type == NLMSG_ERROR) {
-                       log_nlmsg_error(hp, rlen, "nlmsg error");
+                       rc = log_nlmsg_error(hp, rlen, "nlmsg error");
                        break;
                }
 
@@ -1904,6 +1918,11 @@
                        break;
                }
        }
+       if (rc == -EBUSY) {
+               FCM_LOG_DBG("%s: netlink returned -EBUSY, retry\n",
+                             __func__);
+               fcm_link_getlink();
+       }
 }
 
 /*
@@ -1927,34 +1946,9 @@
        msg.nl.nlmsg_pid = getpid();
        msg.ifi.ifi_family = AF_UNSPEC;
        msg.ifi.ifi_type = ARPHRD_ETHER;
-       rc = write(fcm_link_socket, &msg, sizeof(msg));
+       rc = send(fcm_link_socket, &msg, sizeof(msg), 0);
        if (rc < 0)
-               FCM_LOG_ERR(errno, "write error");
-}
-
-/*
- * Check for whether buffer needs to grow based on amount read.
- * Free's the old buffer so don't use that after this returns non-zero.
- */
-static int fcm_link_buf_check(size_t read_len)
-{
-       char *buf;
-       size_t len = read_len;
-
-       if (len > fcm_link_buf_size - fcm_link_buf_fuzz) {
-               len = fcm_link_buf_size;
-               len = len + len / 2;    /* grow by 50% */
-               buf = malloc(len);
-               if (buf != NULL) {
-                       free(fcm_link_buf);
-                       fcm_link_buf = buf;
-                       fcm_link_buf_size = len;
-                       return 1;
-               } else {
-                       FCM_LOG_ERR(errno, "failed to allocate link buffer");
-               }
-       }
-       return 0;
+               FCM_LOG_ERR(errno, "send error");
 }
 
 static void fcm_fcoe_init(void)
@@ -3253,9 +3247,9 @@
 {
        printf("Usage: %s\n"
               "\t [-f|--foreground]\n"
-              "\t [-d|--debug]\n"
+              "\t [-d|--debug=yes|no]\n"
               "\t [-l|--legacy]\n"
-              "\t [-s|--syslog]\n"
+              "\t [-s|--syslog=yes|no]\n"
               "\t [-v|--version]\n"
               "\t [-h|--help]\n\n", progname);
        exit(1);
@@ -3518,7 +3512,7 @@
        socklen_t fromlen = sizeof(struct sockaddr_un);
        struct sock_info *reply = NULL;
        char buf[MAX_MSGBUF], rbuf[MAX_MSGBUF];
-       char ifname[sizeof(data->ifname) + 1];
+       char ifname[IFNAMSIZ + 1];
        enum fcoe_status rc = EFAIL;
        int res, cmd, snum;
        size_t size;
@@ -3549,7 +3543,7 @@
        }
 
        cmd = data->cmd;
-       strncpy(ifname, data->ifname, sizeof(data->ifname));
+       strncpy(ifname, data->ifname, IFNAMSIZ);
        ifname[sizeof(data->ifname)] = 0;
 
        if (cmd != CLIF_PID_CMD) {
@@ -3709,22 +3703,28 @@
        sa_log_flags = 0;
        openlog(sa_log_prefix, LOG_CONS, LOG_DAEMON);
 
-       while ((c = getopt_long(argc, argv, "fdhlsv",
+       while ((c = getopt_long(argc, argv, "fd:hls:v",
                                fcm_options, NULL)) != -1) {
                switch (c) {
                case 'f':
                        fcm_fg = 1;
                        break;
                case 'd':
-                       fcoe_config.debug = 1;
-                       enable_debug_log(1);
+                       if (!strncmp(optarg, "yes", 3) ||
+                           !strncmp(optarg, "YES", 3)) {
+                               fcoe_config.debug = 1;
+                               enable_debug_log(1);
+                       }
                        break;
                case 'l':
                        force_legacy = true;
                        break;
                case 's':
-                       fcoe_config.use_syslog = 1;
-                       enable_syslog(1);
+                       if (!strncmp(optarg, "yes", 3) ||
+                           !strncmp(optarg, "YES", 3)) {
+                               fcoe_config.use_syslog = 1;
+                               enable_syslog(1);
+                       }
                        break;
                case 'v':
                        printf("%s\n", FCOE_UTILS_VERSION);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/fipvlan.c 
new/fcoe-utils-1.0.33/fipvlan.c
--- old/fcoe-utils-1.0.32/fipvlan.c     2017-01-17 13:19:20.000000000 +0100
+++ new/fcoe-utils-1.0.33/fipvlan.c     2020-06-09 19:26:02.000000000 +0200
@@ -593,6 +593,36 @@
 }
 
 static int
+safe_makevlan_name(char *vlan_name, size_t vsz,
+               char *ifname, int vlan_num, char *suffix)
+{
+       size_t ifsz = strlen(ifname);
+       size_t susz = strlen(suffix);   /* should never be NULL */
+       int nusz;
+       char numbuf[16];
+       char *cp = vlan_name;
+
+       nusz = snprintf(numbuf, sizeof(numbuf), "%d", vlan_num);
+
+       if ((ifsz + susz + nusz + 2) > vsz) {
+               FIP_LOG_ERR(EINVAL,
+                       "Cannot make VLAN name from ifname=\"%s\", vlan %d, and 
suffix=\"%s\"\n",
+                       ifname, vlan_num, suffix);
+               return -EINVAL;
+       }
+       memcpy(cp, ifname, ifsz);
+       cp += ifsz;
+       memcpy(cp, numbuf, nusz);
+       cp += nusz;
+       if (susz > 0) {
+               memcpy(cp, suffix, susz);
+               cp += susz;
+       }
+       *cp = '\0';
+       return 0;
+}
+
+static int
 create_and_start_vlan(struct fcf *fcf, bool vn2vn)
 {
        struct iff *real_dev, *vlan;
@@ -621,8 +651,10 @@
                                    real_dev->ifname, fcf->vlan, vlan->ifname);
                        rc = 0;
                } else {
-                       snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
+                       rc = safe_makevlan_name(vlan_name, sizeof(vlan_name),
                                 real_dev->ifname, fcf->vlan, config.suffix);
+                       if (rc < 0)
+                               return rc;
                        rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name);
                        if (rc < 0)
                                printf("Failed to create VLAN device 
%s\n\t%s\n",
@@ -983,7 +1015,7 @@
 
        ns = rtnl_socket(RTMGRP_LINK);
        if (ns < 0) {
-               rc = ns;
+               rc = 1;
                goto ns_err;
        }
        pfd_add(ns);
@@ -1003,7 +1035,7 @@
                                    "no interfaces to perform discovery on");
                else
                        FIP_LOG("no interfaces to perform discovery on");
-               exit(1);
+               exit(ENODEV);
        }
 
        do_vlan_discovery();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/lib/sysfs_hba.c 
new/fcoe-utils-1.0.33/lib/sysfs_hba.c
--- old/fcoe-utils-1.0.32/lib/sysfs_hba.c       2017-01-17 13:19:20.000000000 
+0100
+++ new/fcoe-utils-1.0.33/lib/sysfs_hba.c       2020-06-09 19:26:02.000000000 
+0200
@@ -443,7 +443,9 @@
                        return NULL;
 
                len = strlen(netdev) - strlen(subif);
-               strncpy(realdev, netdev, len);
+               if (len > (sizeof(realdev) - 1))
+                       return NULL;
+               strncpy(realdev, netdev, sizeof(realdev)-1);
                if (realdev[len] != '\0')
                        realdev[len] = '\0';
 
@@ -484,7 +486,7 @@
        DIR *dir;
        char *host = NULL;
        char path[1024];
-       uint64_t port_name;
+       uint64_t port_name = 0;
        struct hba_wwn port_wwn;
 
        dir = opendir(SYSFS_HOST_DIR);
@@ -606,7 +608,7 @@
                if (!ctlr)
                        continue;
 
-               ctlr_num = atoi(&ctlr[strlen(ctlr) - 1]);
+               ctlr_num = atoi(&ctlr[sizeof("ctlr_") - 1]);
                break;
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fcoe-utils-1.0.32/libopenfcoe.c 
new/fcoe-utils-1.0.33/libopenfcoe.c
--- old/fcoe-utils-1.0.32/libopenfcoe.c 2017-01-17 13:19:20.000000000 +0100
+++ new/fcoe-utils-1.0.33/libopenfcoe.c 2020-06-09 19:26:02.000000000 +0200
@@ -55,6 +55,33 @@
        return rc;
 }
 
+static char *safe_makepath(char *path, size_t path_sz,
+               char *dname, char *fname)
+{
+       size_t dsz = sizeof(dname);
+       size_t fsz = strlen(fname);
+       char *cp = path;
+
+       if ((dsz + fsz + 2) > path_sz) {
+               fprintf(stderr,
+                       "error: no room to expand pathname (%d+%d > %d)\n",
+                       (int)dsz, (int)fsz, (int)path_sz);
+               return NULL;
+       }
+
+       memcpy(cp, dname, dsz);
+       cp += dsz;
+
+       *cp++ = '/';
+
+       memcpy(cp, fname, fsz);
+       cp += fsz;
+
+       *cp = '\0';
+
+       return path;
+}
+
 static int add_fcoe_fcf_device(struct dirent *dp, void *arg)
 {
        struct fcoe_ctlr_device *ctlr = (struct fcoe_ctlr_device *)arg;
@@ -71,8 +98,9 @@
        memset(fcf, 0, sizeof(struct fcoe_fcf_device));
 
        /* Save the path */
-       snprintf(fcf->path, sizeof(fcf->path),
-                "%s/%s", ctlr->path, dp->d_name);
+       if (safe_makepath(fcf->path, sizeof(fcf->path),
+                               ctlr->path, dp->d_name) == NULL)
+               goto fail;
 
        /* Use the index from the logical enumeration */
        fcf->index = atoi(dp->d_name + sizeof("fcf_") - 1);
@@ -198,7 +226,9 @@
        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);
+       if (safe_makepath(lesb_path, sizeof(lesb_path),
+                               ctlr->path, "lesb") == NULL)
+               goto fail;
 
        /* Get LESB statistics */
        sa_sys_read_u32(lesb_path, "link_fail",


Reply via email to