Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fcoe-utils for openSUSE:Factory checked in at 2021-04-01 14:15:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fcoe-utils (Old) and /work/SRC/openSUSE:Factory/.fcoe-utils.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fcoe-utils" Thu Apr 1 14:15:55 2021 rev:21 rq:881366 version:1.0.34 Changes: -------- --- /work/SRC/openSUSE:Factory/fcoe-utils/fcoe-utils.changes 2020-09-04 10:53:11.966433302 +0200 +++ /work/SRC/openSUSE:Factory/.fcoe-utils.new.2401/fcoe-utils.changes 2021-04-01 14:16:05.155876379 +0200 @@ -1,0 +2,36 @@ +Thu Mar 25 17:09:14 UTC 2021 - Lee Duncan <ldun...@suse.com> + +- Update to version 1.0.34 (fixing bsc#1182804), which replaces the + source tarball, and removes these two patches, which are fixed + upstream: + * Handle-NIC-names-longer-than-7-characters.patch + * fcoe-utils-fix-arm.patch + + Change summary: + Chris Leech (6): + 21 string-op truncation, format truncation, and format overflow errors + use of uninitialized values detected during LTO + Revert "Make gcc compiler happy about ifname string truncation." + fix VLAN device name overflow check + fix regressions caused by safe_makepath change in libopenfcoe.c + minor fcoeadm output issues + + Guillaume Gardet (1): + char can be unsigned on arm, so set signed explicitly as the check expects it can be negative + + Lee Duncan (6): + Handle NIC names longer than 7 characters. + Change debug->log message if daemon running + Remove references to open-fcoe.org + Fix two gcc-11 compiler warnings. + Remove comment that doesn't match code. + Preparing for version v1.0.34 + + Lily Nie (1): + fix one bug introduced by commit b06c3df + + Nitin U. Yewale (1): + Exit fcoemon command if fcoemon daemon is already running. + + +------------------------------------------------------------------- Old: ---- Handle-NIC-names-longer-than-7-characters.patch fcoe-utils-1.0.33.tar.xz fcoe-utils-fix-arm.patch New: ---- fcoe-utils-1.0.34.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fcoe-utils.spec ++++++ --- /var/tmp/diff_new_pack.bGOvD4/_old 2021-04-01 14:16:05.647877233 +0200 +++ /var/tmp/diff_new_pack.bGOvD4/_new 2021-04-01 14:16:05.647877233 +0200 @@ -1,7 +1,7 @@ # # spec file for package fcoe-utils # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -31,15 +31,12 @@ Requires: open-lldp Requires: pkgconfig(systemd) %systemd_ordering -Version: 1.0.33 +Version: 1.0.34 Release: 0 Summary: FCoE userspace management tools License: GPL-2.0-only Group: System/Daemons Source: %{name}-%{version}.tar.xz -Patch1: Handle-NIC-names-longer-than-7-characters.patch -# PATCH-FIX-UPSTREAM - https://github.com/openSUSE/fcoe-utils/pull/14 -Patch2: fcoe-utils-fix-arm.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %{?systemd_requires} @@ -50,8 +47,6 @@ %prep %setup -q -%patch1 -p1 -%patch2 -p1 %build autoreconf -vi ++++++ _service ++++++ --- /var/tmp/diff_new_pack.bGOvD4/_old 2021-04-01 14:16:05.671877275 +0200 +++ /var/tmp/diff_new_pack.bGOvD4/_new 2021-04-01 14:16:05.671877275 +0200 @@ -3,8 +3,8 @@ <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.33</param> - <param name="revision">v1.0.33</param> + <param name="versionformat">1.0.34</param> + <param name="revision">v1.0.34</param> <param name="exclude">.git</param> </service> <service name="recompress" mode="disabled"> ++++++ fcoe-utils-1.0.33.tar.xz -> fcoe-utils-1.0.34.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/QUICKSTART new/fcoe-utils-1.0.34/QUICKSTART --- old/fcoe-utils-1.0.33/QUICKSTART 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/QUICKSTART 2021-03-25 17:51:54.000000000 +0100 @@ -11,9 +11,9 @@ # Dependencies ############### -git://open-fcoe.org/libHBAAPI.git -git://open-fcoe.org/libhbalinux.git -git://open-fcoe.org/fcoe-utils.git +https://github.com/cleech/libHBAAPI.git +https://github.com/cleech/libhbalinux.git +https://github.com/openSUSE/fcoe-utils.git ## # Kernel Configuration and Compilation @@ -137,7 +137,7 @@ 1) Obtain the latest source - git clone git://open-fcoe.org/libHBAAPI.git + git clone https://github.com/cleech/libHBAAPI.git 2) Bootstrap, configure, make and make install # cd libHBAAPI @@ -166,7 +166,7 @@ 1) Obtain the latest source - git clone git://open-fcoe.org/libhbalinux.git + git clone https://github.com/cleech/libhbalinux.git 2) Bootstrap, configure, make and make install # cd libhbalinux @@ -196,7 +196,7 @@ 1) Obtain the latest source - git clone git://open-fcoe.org/fcoe-utils.git + git clone https://github.com/openSUSE/fcoe-utils.git 2) Bootstrap, configure, make and make install # cd fcoe-utils @@ -253,7 +253,8 @@ Please run '<fcoe-utils-src>/debug/fcoedump.sh eth3.<VID>-fcoe &>dump.out' and provide the dump.out file with the bug report. Defects can be filed against the distribution used, reported to the Ethernet vendor of the -card in use, or mailed to fcoe-de...@open-fcoe.org. +card in use, or reported to the "Issues" page for each of the packages +on github. ## diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/configure.ac new/fcoe-utils-1.0.34/configure.ac --- old/fcoe-utils-1.0.33/configure.ac 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/configure.ac 2021-03-25 17:51:54.000000000 +0100 @@ -1,4 +1,4 @@ -AC_INIT([fcoe-utils], [1.0.33], [fcoe-de...@open-fcoe.org]) +AC_INIT([fcoe-utils], [1.0.34], [https://github.com/openSUSE/fcoe-utils]) 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.33/doc/fcnsq.txt new/fcoe-utils-1.0.34/doc/fcnsq.txt --- old/fcoe-utils-1.0.33/doc/fcnsq.txt 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/doc/fcnsq.txt 2021-03-25 17:51:54.000000000 +0100 @@ -88,6 +88,5 @@ SUPPORT ------- -*fcnsq* is part of the _fcoe-utils_ package, maintained through the -_Open-FCoE_ project. Resources for both developers and users can be found -at the _Open-FCoE_ website <http://open-fcoe.org/>. +*fcnsq* is part of the _fcoe-utils_ package, which can be found +at the website <https://github.com/openSUSE/open-fcoe> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/doc/fcoeadm.txt new/fcoe-utils-1.0.34/doc/fcoeadm.txt --- old/fcoe-utils-1.0.33/doc/fcoeadm.txt 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/doc/fcoeadm.txt 2021-03-25 17:51:54.000000000 +0100 @@ -202,6 +202,5 @@ SUPPORT ------- -*fcoeadm* is part of the _fcoe-utils_ package, maintained through the -_Open-FCoE_ project. Resources for both developers and users can be found -at the _Open-FCoE_ website <http://open-fcoe.org/> +*fcoeadm* is part of the _fcoe-utils_ package, which can be found +at the website <https://github.com/openSUSE/open-fcoe> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/doc/fcoemon.txt new/fcoe-utils-1.0.34/doc/fcoemon.txt --- old/fcoe-utils-1.0.33/doc/fcoemon.txt 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/doc/fcoemon.txt 2021-03-25 17:51:54.000000000 +0100 @@ -239,6 +239,5 @@ SUPPORT ------- -*fcoemon* is part of the _fcoe-utils_ package, maintained through the -_Open-FCoE_ project. Resources for both developers and users can be found -at the _Open-FCoE_ website <http://open-fcoe.org/> +*fcoemon* is part of the _fcoe-utils_ package, which can be found +at the website <https://github.com/openSUSE/open-fcoe> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/doc/fcping.txt new/fcoe-utils-1.0.34/doc/fcping.txt --- old/fcoe-utils-1.0.33/doc/fcping.txt 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/doc/fcping.txt 2021-03-25 17:51:54.000000000 +0100 @@ -115,6 +115,5 @@ SUPPORT ------- -*fcping* is part of the _fcoe-utils_ package, maintained through the -_Open-FCoE_ project. Resources for both developers and users can be found -at the _Open-FCoE_ website <http://open-fcoe.org/>. +*fcping* is part of the _fcoe-utils_ package, which can be found +at the website <https://github.com/openSUSE/open-fcoe> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/doc/fcrls.txt new/fcoe-utils-1.0.34/doc/fcrls.txt --- old/fcoe-utils-1.0.33/doc/fcrls.txt 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/doc/fcrls.txt 2021-03-25 17:51:54.000000000 +0100 @@ -63,6 +63,5 @@ SUPPORT ------- -*fcrls* is part of the _fcoe-utils_ package, maintained through the -_Open-FCoE_ project. Resources for both developers and users can be found -at the _Open-FCoE_ website <http://open-fcoe.org/>. +*fcrls* is part of the _fcoe-utils_ package, which can be found +at the website <https://github.com/openSUSE/open-fcoe> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/doc/fipvlan.txt new/fcoe-utils-1.0.34/doc/fipvlan.txt --- old/fcoe-utils-1.0.33/doc/fipvlan.txt 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/doc/fipvlan.txt 2021-03-25 17:51:54.000000000 +0100 @@ -116,6 +116,5 @@ SUPPORT ------- -*fipvlan* is part of the _fcoe-utils_ package, maintained through the -_Open-FCoE_ project. Resources for both developers and users can be found -at the _Open-FCoE_ website <http://open-fcoe.org/> +*fipvlan* is part of the _fcoe-utils_ package, which can be found +at the website <https://github.com/openSUSE/open-fcoe> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/etc/initd/initd.fedora new/fcoe-utils-1.0.34/etc/initd/initd.fedora --- old/fcoe-utils-1.0.33/etc/initd/initd.fedora 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/etc/initd/initd.fedora 2021-03-25 17:51:54.000000000 +0100 @@ -40,7 +40,7 @@ . $CONFIG_DIR/config if [ "$USE_SYSLOG" = "yes" ] || [ "$USE_SYSLOG" = "YES" ]; then - FCOEMON_OPTS+=" --syslog" + FCOEMON_OPTS+=" --syslog=yes" fi if [ "$DEBUG" = "yes" ] || [ "$DEBUG" = "YES" ]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/fcnsq.c new/fcoe-utils-1.0.34/fcnsq.c --- old/fcoe-utils-1.0.33/fcnsq.c 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/fcnsq.c 2021-03-25 17:51:54.000000000 +0100 @@ -381,7 +381,7 @@ u64 wwnn = 0; int rc = 0; enum commands cmd = 0; - char c; + signed char c; uintmax_t wwnn_tmp = 0; while(1) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/fcoe-utils.spec.in new/fcoe-utils-1.0.34/fcoe-utils.spec.in --- old/fcoe-utils-1.0.33/fcoe-utils.spec.in 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/fcoe-utils.spec.in 2021-03-25 17:51:54.000000000 +0100 @@ -5,8 +5,8 @@ Group: Applications/System License: GPLv2 -URL: http://www.open-fcoe.org -Source0: http://www.open-fcoe.org/openfc/%{name}-%{version}.tar.gz +URL: https://github.com/openSUSE/fcoe-utils +Source0: https://github.com/openfc/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libHBAAPI-devel lldpad-devel libpciaccess0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/fcoeadm.c new/fcoe-utils-1.0.34/fcoeadm.c --- old/fcoe-utils-1.0.33/fcoeadm.c 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/fcoeadm.c 2021-03-25 17:51:54.000000000 +0100 @@ -185,9 +185,10 @@ struct clif_sock_info clif_info; int rc; - if (ifname) - strncpy(data.ifname, ifname, sizeof(data.ifname)); - else + if (ifname) { + strncpy(data.ifname, ifname, IFNAMSIZ); + data.ifname[IFNAMSIZ - 1] = '\0'; + } else data.ifname[0] = '\0'; data.cmd = cmd; data.flags = flags; @@ -232,6 +233,7 @@ * expects progname to be valid. */ strncpy(progname, basename(argv[0]), sizeof(progname)); + progname[sizeof(progname) - 1] = '\0'; /* check if we have sysfs */ if (fcoe_checkdir(SYSFS_MOUNT)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/fcoeadm_display.c new/fcoe-utils-1.0.34/fcoeadm_display.c --- old/fcoe-utils-1.0.33/fcoeadm_display.c 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/fcoeadm_display.c 2021-03-25 17:51:54.000000000 +0100 @@ -132,7 +132,7 @@ printf(" Port Name: %s\n", lp_info->port_name); - printf(" Fabric Name: %s\n", + printf(" Fabric Name: %s\n", lp_info->fabric_name); printf(" Speed: %s\n", @@ -188,6 +188,7 @@ struct dirent *dp; void (*f)(char *dirname, enum disp_style style); char path[1024]; + int rc; f = func; @@ -199,8 +200,9 @@ if (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) continue; - snprintf(path, sizeof(path), "%s/%s", dir_name, dp->d_name); - + rc = snprintf(path, sizeof(path), "%s/%s", dir_name, dp->d_name); + if (rc < 0 || (size_t) rc >= sizeof(path)) + continue; f(path, style); } closedir(dir); @@ -254,10 +256,13 @@ 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", - hba, port, tgt, lun); + rc = snprintf(path, sizeof(path), + "/sys/class/scsi_device/%u:%u:%u:%u", + hba, port, tgt, lun); + if (rc < 0 || (size_t) rc >= sizeof(path)) + return; rport_attrs = get_rport_attribs_by_device(path); if (!rport_attrs) @@ -287,10 +292,14 @@ osname = dp->d_name; - snprintf(npath, sizeof(npath), "%s/%s/", path, osname); + rc = snprintf(npath, sizeof(npath), "%s/%s/", path, osname); + if (rc < 0 || (size_t) rc >= sizeof(npath)) + continue; 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 || (size_t) rc >= sizeof(npath)) + continue; sa_sys_read_u32(npath, "hw_sector_size", &blksize); } @@ -339,11 +348,14 @@ uint32_t blksize = 0; char *capstr = "Unknown"; char *osname = "Unknown"; - uint64_t size; + uint64_t size = 0; + int rc; - snprintf(path, sizeof(path), - "/sys/class/scsi_device/%u:%u:%u:%u/device/", - hba, port, tgt, lun); + rc = snprintf(path, sizeof(path), + "/sys/class/scsi_device/%u:%u:%u:%u/device/", + hba, port, tgt, lun); + if (rc < 0 || (size_t) rc >= sizeof(path)) + return; sa_sys_read_line(path, "rev", rev, sizeof(rev)); sa_sys_read_line(path, "model", model, sizeof(model)); @@ -363,10 +375,14 @@ osname = dp->d_name; - snprintf(npath, sizeof(npath), "%s/%s/", path, osname); + rc = snprintf(npath, sizeof(npath), "%s/%s/", path, osname); + if (rc < 0 || (size_t) rc >= sizeof(npath)) + continue; 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 || (size_t) rc >= sizeof(npath)) + continue; sa_sys_read_u32(npath, "hw_sector_size", &blksize); } @@ -419,8 +435,11 @@ char *substr; int len; int ret; + int rc; - snprintf(path, sizeof(path), "/sys/class/fc_remote_ports/%s", rport); + rc = snprintf(path, sizeof(path), "/sys/class/fc_remote_ports/%s", rport); + if (rc < 0 || (size_t) rc >= sizeof(path)) + return; ret = readlink(path, link, sizeof(link)); if (ret == -1) @@ -430,7 +449,9 @@ link[ret] = '\0'; substr = strstr(link, "net"); - snprintf(path, sizeof(path), "/sys/class/%s", substr); + rc = snprintf(path, sizeof(path), "/sys/class/%s", substr); + if (rc < 0 || (size_t) rc >= sizeof(path)) + return; substr = strstr(path, "fc_remote_ports"); @@ -455,7 +476,7 @@ static void show_port_stats_header(const char *ifname, int interval) { printf("\n"); - printf("%-7s interval: %-2d Err Inv " + printf("%-15s interval: %-2d Err Inv " "IvTx Link Cntl Input Input Output Output\n", ifname, interval); printf("Seconds TxFrames TxBytes RxFrames RxBytes " @@ -560,11 +581,16 @@ static int crawl_vports(struct dirent *dp, void *arg) { char *oldpath = arg; + int rc; if (!strncmp(dp->d_name, "vport", strlen("vport"))) { char path[1024]; - snprintf(path, sizeof(path), "%s/%s", oldpath, dp->d_name); + rc = snprintf(path, sizeof(path), "%s/%s", oldpath, dp->d_name); + if (rc < 0 || (size_t) rc >= sizeof(path)) { + // ignore error and continue + return 0; + } sa_dir_read(path, get_host_from_vport, NULL); } return 0; @@ -573,10 +599,12 @@ static void show_host_vports(const char *host) { char path[1024]; + int rc; - snprintf(path, sizeof(path), "%s/%s/device/", SYSFS_HOST_DIR, host); + rc = snprintf(path, sizeof(path), "%s/%s/device/", SYSFS_HOST_DIR, host); + if (rc < 0 || (size_t) rc >= sizeof(path)) + return; sa_dir_read(path, crawl_vports, path); - } static enum fcoe_status display_one_adapter_info(char *ifname) @@ -825,7 +853,7 @@ buf = temp; printf(" Connection Mode: %s\n", buf); printf(" Fabric Name: 0x%016" PRIx64 "\n", fcf->fabric_name); - printf(" Switch Name 0x%016" PRIx64 "\n", fcf->switch_name); + printf(" Switch Name: 0x%016" PRIx64 "\n", fcf->switch_name); mac2str(fcf->mac, mac, MAX_STR_LEN); printf(" MAC Address: %s\n", mac); printf(" FCF Priority: %u\n", fcf->priority); @@ -893,7 +921,7 @@ print_interface_fcoe_lesb_stats_header(const char *ifname, int interval) { printf("\n"); - printf("%-7s interval: %-2d\n", ifname, interval); + printf("%-15s interval: %-2d\n", ifname, interval); printf("LinkFail VLinkFail MissFKA SymbErr ErrBlkCnt FCSErrCnt\n"); printf("-------- --------- ------- ------- --------- ---------\n"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/fcoemon.c new/fcoe-utils-1.0.34/fcoemon.c --- old/fcoe-utils-1.0.33/fcoemon.c 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/fcoemon.c 2021-03-25 17:51:54.000000000 +0100 @@ -518,6 +518,7 @@ } strncpy(file, CONFIG_DIR "/", sizeof(file)); strncat(file, dp->d_name, sizeof(file) - strlen(file)); + file[sizeof(file) - 1] = '\0'; fp = fopen(file, "r"); if (!fp) { FCM_LOG_ERR(errno, "Failed to read %s\n", file); @@ -939,6 +940,7 @@ [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 +949,15 @@ 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 < 0 || (size_t) 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); @@ -1077,6 +1086,7 @@ { int fd; struct vlan_ioctl_args ifv; + int rc; real_ifname[0] = '\0'; @@ -1093,9 +1103,18 @@ 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, IFNAMSIZ-1); + + rc = snprintf(ifv.device1, IFNAMSIZ, "%s", vlan_ifname); + if (rc < 0 || rc >= IFNAMSIZ) + goto close_fd; + + if (ioctl(fd, SIOCGIFVLAN, &ifv) == 0) { + rc = snprintf(real_ifname, IFNAMSIZ, "%s", ifv.u.device2); + if (rc < 0 || rc >= IFNAMSIZ) { + real_ifname[0] = '\0'; + goto close_fd; + } + } close_fd: close(fd); } @@ -1647,8 +1666,10 @@ /* try to find the real device name */ real_dev[0] = '\0'; fcm_vlan_dev_real_dev(ifname, real_dev); - if (strlen(real_dev)) - strncpy(p->real_ifname, real_dev, IFNAMSIZ-1); + if (strlen(real_dev)) { + strncpy(p->real_ifname, real_dev, IFNAMSIZ); + p->real_ifname[IFNAMSIZ - 1] = '\0'; + } if (p->ready) update_fcoe_port_state(p, type, operstate, FCP_CFG_IFNAME); @@ -1660,7 +1681,8 @@ if (p) { p->ifindex = ifindex; memcpy(p->mac, mac, ETHER_ADDR_LEN); - strncpy(p->real_ifname, ifname, IFNAMSIZ-1); + strncpy(p->real_ifname, ifname, IFNAMSIZ); + p->real_ifname[IFNAMSIZ - 1] = '\0'; update_fcoe_port_state(p, type, operstate, FCP_REAL_IFNAME); } @@ -1788,7 +1810,9 @@ if (rta_parent->rta_type != DCB_ATTR_IFNAME) return; - strncpy(ifname, NLA_DATA(rta_parent), sizeof(ifname)); + strncpy(ifname, NLA_DATA(rta_parent), IFNAMSIZ); + ifname[IFNAMSIZ - 1] = '\0'; + ff = fcm_netif_lookup_create(ifname); if (!ff) { FCM_LOG("Processing IEEE message: %s not found or created\n", @@ -3699,6 +3723,8 @@ memset(&fcoe_config, 0, sizeof(fcoe_config)); strncpy(progname, basename(argv[0]), sizeof(progname)); + progname[sizeof(progname) - 1] = '\0'; + sa_log_prefix = progname; sa_log_flags = 0; openlog(sa_log_prefix, LOG_CONS, LOG_DAEMON); @@ -3796,6 +3822,10 @@ fcm_dcbd_init(); rc = fcm_srv_create(&srv_info); + if (rc == EADDRINUSE) { + FCM_LOG("Daemon already running OR Failed to bind socket so exiting!\n"); + exit(1); + } if (rc != 0) goto err_cleanup; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/fcping.c new/fcoe-utils-1.0.34/fcping.c --- old/fcoe-utils-1.0.33/fcping.c 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/fcping.c 2021-03-25 17:51:54.000000000 +0100 @@ -570,6 +570,7 @@ struct sg_io_v4 sg_io; size_t actual_len; int cmd, rc = 0; + uint32_t *uct = (uint32_t *)&ct.hdr; memset((char *)&cdb, 0, sizeof(cdb)); memset(&ct, 0, sizeof(ct)); @@ -584,8 +585,11 @@ cdb.msgcode = FC_BSG_HST_CT; hton24(cdb.rqst_data.h_ct.port_id, 0xfffffc); - memcpy(&cdb.rqst_data.h_ct.preamble_word0, &ct.hdr, - 3 * sizeof(uint32_t)); + + /* copy preamble words one at a time, to make compiler happy */ + cdb.rqst_data.h_ct.preamble_word0 = uct[0]; + cdb.rqst_data.h_ct.preamble_word1 = uct[1]; + cdb.rqst_data.h_ct.preamble_word2 = uct[2]; sg_io.guard = 'Q'; sg_io.protocol = BSG_PROTOCOL_SCSI; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/fipvlan.c new/fcoe-utils-1.0.34/fipvlan.c --- old/fcoe-utils-1.0.33/fipvlan.c 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/fipvlan.c 2021-03-25 17:51:54.000000000 +0100 @@ -447,8 +447,12 @@ iff->iflink = *(int *)RTA_DATA(ifla[IFLA_LINK]); else iff->iflink = iff->ifindex; - memcpy(iff->mac_addr, RTA_DATA(ifla[IFLA_ADDRESS]), ETHER_ADDR_LEN); - strncpy(iff->ifname, RTA_DATA(ifla[IFLA_IFNAME]), IFNAMSIZ); + + if (ifla[IFLA_ADDRESS]) + memcpy(iff->mac_addr, RTA_DATA(ifla[IFLA_ADDRESS]), ETHER_ADDR_LEN); + if (ifla[IFLA_IFNAME]) + memcpy(iff->ifname, RTA_DATA(ifla[IFLA_IFNAME]), IFNAMSIZ); + iff->ifname[IFNAMSIZ - 1] = '\0'; if (ifla[IFLA_LINKINFO]) { parse_linkinfo(linkinfo, ifla[IFLA_LINKINFO]); @@ -541,8 +545,10 @@ config.start = true; break; case 'f': - if (optarg && strlen(optarg)) + if (optarg && strlen(optarg)) { strncpy(config.suffix, optarg, 256); + config.suffix[256 - 1] = '\0'; + } break; case 'l': config.link_retry = strtoul(optarg, NULL, 10); @@ -593,36 +599,6 @@ } 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; @@ -651,10 +627,16 @@ real_dev->ifname, fcf->vlan, vlan->ifname); rc = 0; } else { - rc = safe_makevlan_name(vlan_name, sizeof(vlan_name), - real_dev->ifname, fcf->vlan, config.suffix); - if (rc < 0) - return rc; + rc = snprintf(vlan_name, IFNAMSIZ, "%s.%d%s", + real_dev->ifname, fcf->vlan, + config.suffix); + if (rc < 0 || rc >= IFNAMSIZ) { + printf("Failed to create VLAN device " + "(name %s.%d%s is too long)\n", + real_dev->ifname, fcf->vlan, + config.suffix); + return -EINVAL; + } rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name); if (rc < 0) printf("Failed to create VLAN device %s\n\t%s\n", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/lib/fcoe_utils.c new/fcoe-utils-1.0.34/lib/fcoe_utils.c --- old/fcoe-utils-1.0.33/lib/fcoe_utils.c 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/lib/fcoe_utils.c 2021-03-25 17:51:54.000000000 +0100 @@ -68,9 +68,10 @@ enum fcoe_status fcoe_find_fchost(const char *ifname, char *fchost, int len) { - int n, dname_len, status; + int n, status; struct dirent **namelist; int rc = ENOFCOECONN; + int rrc; status = n = scandir(SYSFS_FCHOST, &namelist, 0, alphasort); @@ -78,19 +79,17 @@ if (rc) { /* check symbolic name */ if (!fcoe_check_fchost(ifname, namelist[n]->d_name)) { - dname_len = strnlen(namelist[n]->d_name, len); - - if (len > dname_len) { - strncpy(fchost, namelist[n]->d_name, - dname_len + 1); - /* rc = 0 indicates found */ - rc = SUCCESS; - } else { + rrc = snprintf(fchost, len, "%s", namelist[n]->d_name); + if (rrc < 0 || rrc >= len) { + fchost[0] = '\0'; /* * The fc_host is too large * for the buffer. */ rc = EINTERR; + } else { + /* rc = 0 indicates found */ + rc = SUCCESS; } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/lib/sysfs_hba.c new/fcoe-utils-1.0.34/lib/sysfs_hba.c --- old/fcoe-utils-1.0.33/lib/sysfs_hba.c 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/lib/sysfs_hba.c 2021-03-25 17:51:54.000000000 +0100 @@ -215,6 +215,7 @@ vname = unknown; strncpy(info->manufacturer, vname, sizeof(info->manufacturer)); + info->manufacturer[sizeof(info->manufacturer) - 1] = '\0'; dname = pci_device_get_device_name(dev); if (!dname) @@ -222,6 +223,7 @@ strncpy(info->model_description, dname, sizeof(info->model_description)); + info->model_description[sizeof(info->model_description) - 1] = '\0'; pci_device_cfg_read_u8(dev, &revision, PCI_REVISION_ID); snprintf(info->hardware_version, sizeof(info->hardware_version), @@ -259,6 +261,7 @@ strncpy(info->driver_name, strstr(buf, "module") + strlen("module") + 1, sizeof(info->driver_name)); + info->driver_name[sizeof(info->driver_name) - 1] = '\0'; } @@ -316,6 +319,8 @@ goto free_path; strncpy(pa->device_name, rport, sizeof(pa->device_name)); + pa->device_name[sizeof(pa->device_name) - 1] = '\0'; + sa_sys_read_line(path, "node_name", pa->node_name, sizeof(pa->node_name)); sa_sys_read_line(path, "port_name", pa->port_name, @@ -391,6 +396,7 @@ goto free_path; strncpy(pa->device_name, host, sizeof(pa->device_name)); + pa->device_name[sizeof(pa->device_name) - 1] = '\0'; sa_sys_read_line(path, "symbolic_name", pa->symbolic_name, sizeof(pa->symbolic_name)); @@ -522,7 +528,7 @@ DIR *dir; char *host = NULL; char path[1024]; - uint32_t port_id; + uint32_t port_id = 0; dir = opendir(SYSFS_HOST_DIR); if (!dir) @@ -556,7 +562,7 @@ DIR *dir; char *rport = NULL; char path[1024]; - uint32_t port_id; + uint32_t port_id = 0; dir = opendir(SYSFS_RPORT_DIR); if (!dir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcoe-utils-1.0.33/libopenfcoe.c new/fcoe-utils-1.0.34/libopenfcoe.c --- old/fcoe-utils-1.0.33/libopenfcoe.c 2020-06-09 19:26:02.000000000 +0200 +++ new/fcoe-utils-1.0.34/libopenfcoe.c 2021-03-25 17:51:54.000000000 +0100 @@ -58,7 +58,7 @@ static char *safe_makepath(char *path, size_t path_sz, char *dname, char *fname) { - size_t dsz = sizeof(dname); + size_t dsz = strlen(dname); size_t fsz = strlen(fname); char *cp = path; @@ -207,7 +207,9 @@ 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));