diff --git a/SOURCES/0002-Revert-Make-gcc-compiler-happy-about-ifname-string-t.patch b/SOURCES/0002-Revert-Make-gcc-compiler-happy-about-ifname-string-t.patch new file mode 100644 index 0000000..2f03e5c --- /dev/null +++ b/SOURCES/0002-Revert-Make-gcc-compiler-happy-about-ifname-string-t.patch @@ -0,0 +1,78 @@ +From 1e6837c8ce063399eeb9580104da33f807e15443 Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Tue, 23 Mar 2021 11:16:06 -0700 +Subject: [PATCH 2/5] Revert "Make gcc compiler happy about ifname string + truncation." + +This change dropped the "." from between the physical interface name and +the vlan number, making fipvlan created vlan names incompatible with +fcoeadm commands that ended up calling get_pci_dev_from_netdev in +lib/sysfs_hba.c (fcoeadm -i). That requirement should be fixed, but for +now lets deal with the fipvlan naming regression. + +safe_makevlan_name isn't doing anything that can't be handled by +checking the return from snprintf + +This reverts commit eee875e6526786031ec916274deec92148677c38. + +Signed-off-by: Chris Leech +--- + fipvlan.c | 34 +--------------------------------- + 1 file changed, 1 insertion(+), 33 deletions(-) + +diff --git a/fipvlan.c b/fipvlan.c +index c8a07339314..fe8d7955cc5 100644 +--- a/fipvlan.c ++++ b/fipvlan.c +@@ -595,36 +595,6 @@ static int rtnl_listener_handler(struct nlmsghdr *nh, UNUSED void *arg) + return -1; + } + +-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) + { +@@ -654,10 +624,8 @@ create_and_start_vlan(struct fcf *fcf, bool vn2vn) + real_dev->ifname, fcf->vlan, vlan->ifname); + rc = 0; + } else { +- rc = safe_makevlan_name(vlan_name, sizeof(vlan_name), ++ snprintf(vlan_name, IFNAMSIZ, "%s.%d%s", + 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", +-- +2.26.2 + diff --git a/SOURCES/0003-fix-VLAN-device-name-overflow-check.patch b/SOURCES/0003-fix-VLAN-device-name-overflow-check.patch new file mode 100644 index 0000000..7dff86f --- /dev/null +++ b/SOURCES/0003-fix-VLAN-device-name-overflow-check.patch @@ -0,0 +1,38 @@ +From b9885692cb283a674e04528486984fb61f92a190 Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Tue, 23 Mar 2021 11:21:17 -0700 +Subject: [PATCH 3/5] fix VLAN device name overflow check + +check snprintf return for truncation + +Signed-off-by: Chris Leech +--- + fipvlan.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/fipvlan.c b/fipvlan.c +index fe8d7955cc5..3ce913d5eaf 100644 +--- a/fipvlan.c ++++ b/fipvlan.c +@@ -624,8 +624,16 @@ create_and_start_vlan(struct fcf *fcf, bool vn2vn) + real_dev->ifname, fcf->vlan, vlan->ifname); + rc = 0; + } else { +- snprintf(vlan_name, IFNAMSIZ, "%s.%d%s", +- real_dev->ifname, fcf->vlan, config.suffix); ++ rc = snprintf(vlan_name, IFNAMSIZ, "%s.%d%s", ++ real_dev->ifname, fcf->vlan, ++ config.suffix); ++ if (rc < 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", +-- +2.26.2 + diff --git a/SOURCES/0004-fix-regressions-caused-by-safe_makepath-change-in-li.patch b/SOURCES/0004-fix-regressions-caused-by-safe_makepath-change-in-li.patch new file mode 100644 index 0000000..bdcca30 --- /dev/null +++ b/SOURCES/0004-fix-regressions-caused-by-safe_makepath-change-in-li.patch @@ -0,0 +1,35 @@ +From 108387a2aa986a8107faa7548f3f9e9c084749d2 Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Wed, 24 Mar 2021 09:50:51 -0700 +Subject: [PATCH 4/5] fix regressions caused by safe_makepath change in + libopenfcoe.c + +This needs to use strlen(dname) not sizeof(dname) or the directory path +is truncated. On a 64-bit arch an 8 byte truncation kind of looks like +a valid path '/sys/bus' which is sort of funny unless you're debugging +it. + +This caused fcoeadm --fcf to fail to read in FCF info, and fcoeadm +--lesb to fail to find the link error status block counters. + +Signed-off-by: Chris Leech +--- + libopenfcoe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libopenfcoe.c b/libopenfcoe.c +index 452ee803e63..cd35c868eee 100644 +--- a/libopenfcoe.c ++++ b/libopenfcoe.c +@@ -58,7 +58,7 @@ out_err: + 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; + +-- +2.26.2 + diff --git a/SOURCES/0005-minor-fcoeadm-output-issues.patch b/SOURCES/0005-minor-fcoeadm-output-issues.patch new file mode 100644 index 0000000..3e4553c --- /dev/null +++ b/SOURCES/0005-minor-fcoeadm-output-issues.patch @@ -0,0 +1,35 @@ +From c4fe62dd3d26b30fdcf94c94f74bc0b9f7034c17 Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Wed, 24 Mar 2021 10:17:52 -0700 +Subject: [PATCH 5/5] minor fcoeadm output issues + +Signed-off-by: Chris Leech +--- + fcoeadm_display.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fcoeadm_display.c b/fcoeadm_display.c +index 585ecfae54e..c2ef33b82cf 100644 +--- a/fcoeadm_display.c ++++ b/fcoeadm_display.c +@@ -132,7 +132,7 @@ static void show_port_info(struct port_attributes *lp_info) + 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", +@@ -853,7 +853,7 @@ static void print_fcoe_fcf_device(void *ep, UNUSED void *arg) + 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); +-- +2.26.2 + diff --git a/SPECS/fcoe-utils.spec b/SPECS/fcoe-utils.spec index d787109..90f5f0c 100644 --- a/SPECS/fcoe-utils.spec +++ b/SPECS/fcoe-utils.spec @@ -7,7 +7,7 @@ Name: fcoe-utils Version: 1.0.33 -Release: 2.git%{shortcommit0}%{?dist} +Release: 4.git%{shortcommit0}%{?dist} Summary: Fibre Channel over Ethernet utilities Group: Applications/System License: GPLv2 @@ -19,6 +19,11 @@ Source3: fcoe.config ExcludeArch: ppc s390 Patch0: fcoe-utils-set-default-DCB_REQUIRED-to-no.patch Patch1: 0001-Revert-fcoemon-Correctly-handle-options-in-the-servi.patch +Patch2: 0002-Revert-Make-gcc-compiler-happy-about-ifname-string-t.patch +Patch3: 0003-fix-VLAN-device-name-overflow-check.patch +Patch4: 0004-fix-regressions-caused-by-safe_makepath-change-in-li.patch +Patch5: 0005-minor-fcoeadm-output-issues.patch + BuildRequires: autoconf BuildRequires: automake BuildRequires: libpciaccess-devel @@ -83,6 +88,12 @@ rm -f %{buildroot}/%{_sysconfdir}/fcoe/config %{_libexecdir}/fcoe/ %changelog +* Thu Jun 10 2021 Chris Leech - 1.0.33-4.git848bcc6 +- rebuilt for 8.5 + +* Tue Mar 23 2021 Chris Leech - 1.0.33-3.git848bcc6 +- 1918561 regression in fipvlan VLAN name generation and fcoeadm commands + * Mon Jan 18 2021 Chris Leech - 1.0.33-2.git848bcc6 - 1897503 revert breaking upstream change to command line options