Blame SOURCES/0002-Revert-Make-gcc-compiler-happy-about-ifname-string-t.patch

201fb0
From 1e6837c8ce063399eeb9580104da33f807e15443 Mon Sep 17 00:00:00 2001
201fb0
From: Chris Leech <cleech@redhat.com>
201fb0
Date: Tue, 23 Mar 2021 11:16:06 -0700
201fb0
Subject: [PATCH 2/5] Revert "Make gcc compiler happy about ifname string
201fb0
 truncation."
201fb0
201fb0
This change dropped the "." from between the physical interface name and
201fb0
the vlan number, making fipvlan created vlan names incompatible with
201fb0
fcoeadm commands that ended up calling get_pci_dev_from_netdev in
201fb0
lib/sysfs_hba.c (fcoeadm -i). That requirement should be fixed, but for
201fb0
now lets deal with the fipvlan naming regression.
201fb0
201fb0
safe_makevlan_name isn't doing anything that can't be handled by
201fb0
checking the return from snprintf
201fb0
201fb0
This reverts commit eee875e6526786031ec916274deec92148677c38.
201fb0
201fb0
Signed-off-by: Chris Leech <cleech@redhat.com>
201fb0
---
201fb0
 fipvlan.c | 34 +---------------------------------
201fb0
 1 file changed, 1 insertion(+), 33 deletions(-)
201fb0
201fb0
diff --git a/fipvlan.c b/fipvlan.c
201fb0
index c8a07339314..fe8d7955cc5 100644
201fb0
--- a/fipvlan.c
201fb0
+++ b/fipvlan.c
201fb0
@@ -595,36 +595,6 @@ static int rtnl_listener_handler(struct nlmsghdr *nh, UNUSED void *arg)
201fb0
 	return -1;
201fb0
 }
201fb0
 
201fb0
-static int
201fb0
-safe_makevlan_name(char *vlan_name, size_t vsz,
201fb0
-		char *ifname, int vlan_num, char *suffix)
201fb0
-{
201fb0
-	size_t ifsz = strlen(ifname);
201fb0
-	size_t susz = strlen(suffix);	/* should never be NULL */
201fb0
-	int nusz;
201fb0
-	char numbuf[16];
201fb0
-	char *cp = vlan_name;
201fb0
-
201fb0
-	nusz = snprintf(numbuf, sizeof(numbuf), "%d", vlan_num);
201fb0
-
201fb0
-	if ((ifsz + susz + nusz + 2) > vsz) {
201fb0
-		FIP_LOG_ERR(EINVAL,
201fb0
-			"Cannot make VLAN name from ifname=\"%s\", vlan %d, and suffix=\"%s\"\n",
201fb0
-			ifname, vlan_num, suffix);
201fb0
-		return -EINVAL;
201fb0
-	}
201fb0
-	memcpy(cp, ifname, ifsz);
201fb0
-	cp += ifsz;
201fb0
-	memcpy(cp, numbuf, nusz);
201fb0
-	cp += nusz;
201fb0
-	if (susz > 0) {
201fb0
-		memcpy(cp, suffix, susz);
201fb0
-		cp += susz;
201fb0
-	}
201fb0
-	*cp = '\0';
201fb0
-	return 0;
201fb0
-}
201fb0
-
201fb0
 static int
201fb0
 create_and_start_vlan(struct fcf *fcf, bool vn2vn)
201fb0
 {
201fb0
@@ -654,10 +624,8 @@ create_and_start_vlan(struct fcf *fcf, bool vn2vn)
201fb0
 				    real_dev->ifname, fcf->vlan, vlan->ifname);
201fb0
 			rc = 0;
201fb0
 		} else {
201fb0
-			rc = safe_makevlan_name(vlan_name, sizeof(vlan_name),
201fb0
+			snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
201fb0
 				 real_dev->ifname, fcf->vlan, config.suffix);
201fb0
-			if (rc < 0)
201fb0
-				return rc;
201fb0
 			rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name);
201fb0
 			if (rc < 0)
201fb0
 				printf("Failed to create VLAN device %s\n\t%s\n",
201fb0
-- 
201fb0
2.26.2
201fb0