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

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