import fcoe-utils-1.0.33-3.git848bcc6.el8
This commit is contained in:
parent
d9f6769b01
commit
4c9793e14a
@ -1 +1 @@
|
||||
af94ad7bd13d0828be6246f46f04b3b7d6a1ad0a SOURCES/fcoe-utils-1.0.32.tar.gz
|
||||
263e7e1c31e5c834126afb0a510a852268bd07af SOURCES/fcoe-utils-1.0.33-848bcc6.tar.gz
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/fcoe-utils-1.0.32.tar.gz
|
||||
SOURCES/fcoe-utils-1.0.33-848bcc6.tar.gz
|
||||
|
@ -0,0 +1,115 @@
|
||||
From 729135eea0ed39b3dfd57b7ea15f284e67af532f Mon Sep 17 00:00:00 2001
|
||||
From: Chris Leech <cleech@redhat.com>
|
||||
Date: Mon, 18 Jan 2021 13:37:39 -0800
|
||||
Subject: [PATCH 1/1] Revert "fcoemon: Correctly handle options in the service
|
||||
file"
|
||||
|
||||
This reverts commit b06c3df0f0b06c1ad37b3bbf8bd602b24318aae6.
|
||||
---
|
||||
doc/fcoemon.txt | 6 +++---
|
||||
etc/systemd/fcoe.service | 4 ++--
|
||||
fcoemon.c | 24 +++++++++---------------
|
||||
3 files changed, 14 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/doc/fcoemon.txt b/doc/fcoemon.txt
|
||||
index ba70478d141..3bfb3581a1b 100644
|
||||
--- a/doc/fcoemon.txt
|
||||
+++ b/doc/fcoemon.txt
|
||||
@@ -53,13 +53,13 @@ OPTIONS
|
||||
-------
|
||||
*-f*, *--foreground*::
|
||||
Run *fcoemon* in the foreground.
|
||||
-*-d*, *--debug=yes|no*::
|
||||
- Enable or disable debugging messages.
|
||||
+*-d*, *--debug*::
|
||||
+ Enable 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=yes|no*::
|
||||
+*-s*, *--syslog*::
|
||||
Use syslogd for logging. The default behavior is to log to stdout
|
||||
and stderr.
|
||||
*-h*, *--help*::
|
||||
diff --git a/etc/systemd/fcoe.service b/etc/systemd/fcoe.service
|
||||
index b1d95671573..5e5c8a2b67b 100644
|
||||
--- a/etc/systemd/fcoe.service
|
||||
+++ b/etc/systemd/fcoe.service
|
||||
@@ -4,9 +4,9 @@ After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
-EnvironmentFile=/etc/fcoe/config
|
||||
+EnvironmentFile=/etc/sysconfig/fcoe
|
||||
ExecStartPre=/sbin/modprobe -qa $SUPPORTED_DRIVERS
|
||||
-ExecStart=/usr/sbin/fcoemon --foreground --debug=$DEBUG --syslog=$SYSLOG
|
||||
+ExecStart=/usr/sbin/fcoemon $FCOEMON_OPTS
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
diff --git a/fcoemon.c b/fcoemon.c
|
||||
index 8c08bc5a032..0cc36fec304 100644
|
||||
--- a/fcoemon.c
|
||||
+++ b/fcoemon.c
|
||||
@@ -335,9 +335,9 @@ static int fcoe_vid_from_ifname(const char *ifname);
|
||||
* Table for getopt_long(3).
|
||||
*/
|
||||
static struct option fcm_options[] = {
|
||||
- {"debug", 1, NULL, 'd'},
|
||||
+ {"debug", 0, NULL, 'd'},
|
||||
{"legacy", 0, NULL, 'l'},
|
||||
- {"syslog", 1, NULL, 's'},
|
||||
+ {"syslog", 0, NULL, 's'},
|
||||
{"exec", 1, NULL, 'e'},
|
||||
{"foreground", 0, NULL, 'f'},
|
||||
{"version", 0, NULL, 'v'},
|
||||
@@ -3271,9 +3271,9 @@ static void fcm_usage(void)
|
||||
{
|
||||
printf("Usage: %s\n"
|
||||
"\t [-f|--foreground]\n"
|
||||
- "\t [-d|--debug=yes|no]\n"
|
||||
+ "\t [-d|--debug]\n"
|
||||
"\t [-l|--legacy]\n"
|
||||
- "\t [-s|--syslog=yes|no]\n"
|
||||
+ "\t [-s|--syslog]\n"
|
||||
"\t [-v|--version]\n"
|
||||
"\t [-h|--help]\n\n", progname);
|
||||
exit(1);
|
||||
@@ -3729,28 +3729,22 @@ int main(int argc, char **argv)
|
||||
sa_log_flags = 0;
|
||||
openlog(sa_log_prefix, LOG_CONS, LOG_DAEMON);
|
||||
|
||||
- while ((c = getopt_long(argc, argv, "fd:hls:v",
|
||||
+ while ((c = getopt_long(argc, argv, "fdhlsv",
|
||||
fcm_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
fcm_fg = 1;
|
||||
break;
|
||||
case 'd':
|
||||
- if (!strncmp(optarg, "yes", 3) ||
|
||||
- !strncmp(optarg, "YES", 3)) {
|
||||
- fcoe_config.debug = 1;
|
||||
- enable_debug_log(1);
|
||||
- }
|
||||
+ fcoe_config.debug = 1;
|
||||
+ enable_debug_log(1);
|
||||
break;
|
||||
case 'l':
|
||||
force_legacy = true;
|
||||
break;
|
||||
case 's':
|
||||
- if (!strncmp(optarg, "yes", 3) ||
|
||||
- !strncmp(optarg, "YES", 3)) {
|
||||
- fcoe_config.use_syslog = 1;
|
||||
- enable_syslog(1);
|
||||
- }
|
||||
+ fcoe_config.use_syslog = 1;
|
||||
+ enable_syslog(1);
|
||||
break;
|
||||
case 'v':
|
||||
printf("%s\n", FCOE_UTILS_VERSION);
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,125 +0,0 @@
|
||||
From 3b4ca6b87dae6b11da137b6afb4cf8275687d281 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Leech <cleech@redhat.com>
|
||||
Date: Thu, 24 Jan 2019 18:16:47 -0800
|
||||
Subject: [PATCH] fcoemon: netlink buffer resize fix
|
||||
|
||||
The recv buffer resizing for netlink messages looks to have always been
|
||||
busted, it discards some of the data in the process of increasing the
|
||||
buffer size.
|
||||
|
||||
I've recently seen issues where the size of the netlink attributes in a
|
||||
GETLINK request hit the fcm_link_buf_size window and some of the network
|
||||
interfaces were ignored by fcoemon (happened mostly with recent kernels,
|
||||
2 dual-port bnx2 NICs, bonding for LAN traffic on 2 ports and FCoE on
|
||||
the other 2). When the ignored interface happens to be the one you want
|
||||
to use for FCoE, it never gets fixed.
|
||||
|
||||
This fixes the buffer resize code to use MSG_PEEK|MSG_TRUNC to check for
|
||||
the needed buffer size first, and then resize with realloc when needed.
|
||||
This might not actually be needed, with an 8k buffer I don't think the
|
||||
kernel side will send more at once until after it sees the application
|
||||
post a larger buffer, but I did force a resize and see that it worked.
|
||||
|
||||
Signed-off-by: Chris Leech <cleech@redhat.com>
|
||||
---
|
||||
fcoemon.c | 54 ++++++++++++++++++------------------------------------
|
||||
1 file changed, 18 insertions(+), 36 deletions(-)
|
||||
|
||||
diff --git a/fcoemon.c b/fcoemon.c
|
||||
index 9a400c56b72..9af0f1284af 100644
|
||||
--- a/fcoemon.c
|
||||
+++ b/fcoemon.c
|
||||
@@ -328,7 +328,6 @@ static int fcm_link_socket;
|
||||
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);
|
||||
|
||||
@@ -354,8 +353,7 @@ char progname[20];
|
||||
* 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".
|
||||
@@ -1848,8 +1846,22 @@ static void fcm_link_recv(UNUSED void *arg)
|
||||
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 > 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 +1870,6 @@ static void fcm_link_recv(UNUSED void *arg)
|
||||
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);
|
||||
@@ -1927,34 +1934,9 @@ static void fcm_link_getlink(void)
|
||||
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)
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,78 @@
|
||||
From 1e6837c8ce063399eeb9580104da33f807e15443 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Leech <cleech@redhat.com>
|
||||
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 <cleech@redhat.com>
|
||||
---
|
||||
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
|
||||
|
38
SOURCES/0003-fix-VLAN-device-name-overflow-check.patch
Normal file
38
SOURCES/0003-fix-VLAN-device-name-overflow-check.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From b9885692cb283a674e04528486984fb61f92a190 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Leech <cleech@redhat.com>
|
||||
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 <cleech@redhat.com>
|
||||
---
|
||||
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
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 108387a2aa986a8107faa7548f3f9e9c084749d2 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Leech <cleech@redhat.com>
|
||||
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 <cleech@redhat.com>
|
||||
---
|
||||
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
|
||||
|
35
SOURCES/0005-minor-fcoeadm-output-issues.patch
Normal file
35
SOURCES/0005-minor-fcoeadm-output-issues.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From c4fe62dd3d26b30fdcf94c94f74bc0b9f7034c17 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Leech <cleech@redhat.com>
|
||||
Date: Wed, 24 Mar 2021 10:17:52 -0700
|
||||
Subject: [PATCH 5/5] minor fcoeadm output issues
|
||||
|
||||
Signed-off-by: Chris Leech <cleech@redhat.com>
|
||||
---
|
||||
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
|
||||
|
@ -1,53 +0,0 @@
|
||||
diff --git a/fipvlan.c b/fipvlan.c
|
||||
index 7c00c7c..065b742 100644
|
||||
--- a/fipvlan.c
|
||||
+++ b/fipvlan.c
|
||||
@@ -621,8 +621,10 @@ 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 >= IFNAMSIZ)
|
||||
+ return -E2BIG;
|
||||
rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name);
|
||||
if (rc < 0)
|
||||
printf("Failed to create VLAN device %s\n\t%s\n",
|
||||
diff --git a/libopenfcoe.c b/libopenfcoe.c
|
||||
index 07090d5..98fb975 100644
|
||||
--- a/libopenfcoe.c
|
||||
+++ b/libopenfcoe.c
|
||||
@@ -59,6 +59,7 @@ static int add_fcoe_fcf_device(struct dirent *dp, void *arg)
|
||||
{
|
||||
struct fcoe_ctlr_device *ctlr = (struct fcoe_ctlr_device *)arg;
|
||||
struct fcoe_fcf_device *fcf;
|
||||
+ int rc;
|
||||
|
||||
if (!strstr(dp->d_name, "fcf") ||
|
||||
(!strcmp(dp->d_name, "fcf_dev_loss_tmo")))
|
||||
@@ -71,8 +72,10 @@ static int add_fcoe_fcf_device(struct dirent *dp, void *arg)
|
||||
memset(fcf, 0, sizeof(struct fcoe_fcf_device));
|
||||
|
||||
/* Save the path */
|
||||
- snprintf(fcf->path, sizeof(fcf->path),
|
||||
- "%s/%s", ctlr->path, dp->d_name);
|
||||
+ rc = snprintf(fcf->path, sizeof(fcf->path),
|
||||
+ "%s/%s", ctlr->path, dp->d_name);
|
||||
+ if (rc >= sizeof(fcf->path))
|
||||
+ goto fail;
|
||||
|
||||
/* Use the index from the logical enumeration */
|
||||
fcf->index = atoi(dp->d_name + sizeof("fcf_") - 1);
|
||||
@@ -198,7 +201,9 @@ static int read_fcoe_ctlr_device(struct dirent *dp, void *arg)
|
||||
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);
|
||||
+ rc = snprintf(lesb_path, sizeof(lesb_path), "%s/lesb/", ctlr->path);
|
||||
+ if (rc >= sizeof(lesb_path))
|
||||
+ goto fail;
|
||||
|
||||
/* Get LESB statistics */
|
||||
sa_sys_read_u32(lesb_path, "link_fail",
|
@ -1,119 +0,0 @@
|
||||
From: Chris Leech <cleech@redhat.com>
|
||||
Subject: fix build warnings/errors with GCC format-truncation checks
|
||||
|
||||
diff --git a/fcoeadm_display.c b/fcoeadm_display.c
|
||||
index 120c6084b7ca..f10cfb53d454 100644
|
||||
--- a/fcoeadm_display.c
|
||||
+++ b/fcoeadm_display.c
|
||||
@@ -254,6 +254,7 @@ static void show_full_lun_info(unsigned int hba, unsigned int port,
|
||||
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",
|
||||
@@ -287,10 +288,18 @@ static void show_full_lun_info(unsigned int hba, unsigned int port,
|
||||
|
||||
osname = dp->d_name;
|
||||
|
||||
- snprintf(npath, sizeof(npath), "%s/%s/", path, osname);
|
||||
+ rc = snprintf(npath, sizeof(npath), "%s/%s/", path, osname);
|
||||
+ if (rc < 0 || rc >= sizeof(npath)) {
|
||||
+ /* error or truncation, bailing out */
|
||||
+ return;
|
||||
+ }
|
||||
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 || rc >= sizeof(npath)) {
|
||||
+ /* error or truncation, bailing out */
|
||||
+ return;
|
||||
+ }
|
||||
sa_sys_read_u32(npath, "hw_sector_size", &blksize);
|
||||
}
|
||||
|
||||
@@ -340,6 +349,7 @@ static void show_short_lun_info(unsigned int hba, unsigned int port,
|
||||
char *capstr = "Unknown";
|
||||
char *osname = "Unknown";
|
||||
uint64_t size;
|
||||
+ int rc;
|
||||
|
||||
snprintf(path, sizeof(path),
|
||||
"/sys/class/scsi_device/%u:%u:%u:%u/device/",
|
||||
@@ -363,10 +373,18 @@ static void show_short_lun_info(unsigned int hba, unsigned int port,
|
||||
|
||||
osname = dp->d_name;
|
||||
|
||||
- snprintf(npath, sizeof(npath), "%s/%s/", path, osname);
|
||||
+ rc = snprintf(npath, sizeof(npath), "%s/%s/", path, osname);
|
||||
+ if (rc < 0 || rc >= sizeof(npath)) {
|
||||
+ /* error or truncation, bailing out */
|
||||
+ return;
|
||||
+ }
|
||||
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 || rc >= sizeof(npath)) {
|
||||
+ /* error or truncation, bailing out */
|
||||
+ return;
|
||||
+ }
|
||||
sa_sys_read_u32(npath, "hw_sector_size", &blksize);
|
||||
}
|
||||
|
||||
diff --git a/fcoemon.c b/fcoemon.c
|
||||
index 9a400c56b72a..bf73a0d4c89e 100644
|
||||
--- a/fcoemon.c
|
||||
+++ b/fcoemon.c
|
||||
@@ -939,6 +939,7 @@ static struct fcoe_port *fcm_new_vlan(int ifindex, int vid, bool vn2vn)
|
||||
[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 +948,15 @@ static struct fcoe_port *fcm_new_vlan(int ifindex, int vid, bool vn2vn)
|
||||
|
||||
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 >= 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);
|
||||
@@ -3549,7 +3557,7 @@ static void fcm_srv_receive(void *arg)
|
||||
}
|
||||
|
||||
cmd = data->cmd;
|
||||
- strncpy(ifname, data->ifname, sizeof(data->ifname));
|
||||
+ strncpy(ifname, data->ifname, sizeof(ifname) - 1);
|
||||
ifname[sizeof(data->ifname)] = 0;
|
||||
|
||||
if (cmd != CLIF_PID_CMD) {
|
||||
diff --git a/libopenfcoe.c b/libopenfcoe.c
|
||||
index 07090d5a09aa..c1190adc2328 100644
|
||||
--- a/libopenfcoe.c
|
||||
+++ b/libopenfcoe.c
|
||||
@@ -179,7 +179,9 @@ static int read_fcoe_ctlr_device(struct dirent *dp, void *arg)
|
||||
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));
|
||||
|
@ -1,34 +0,0 @@
|
||||
From f369a89e914eb1f14b26d6e84fa32fdf8a591cfc Mon Sep 17 00:00:00 2001
|
||||
From: Andrey Grafin <Andrey.Grafin@acronis.com>
|
||||
Date: Mon, 18 Sep 2017 17:35:08 +0300
|
||||
Subject: [PATCH 1/1] fcoe-utils: Fix get_ctlr_num() for large ctlr_* indices
|
||||
|
||||
Each creation of a FCoE device increases counter which is used as a suffix
|
||||
in a FCoE device name in sysfs (i.e. /sys/bus/fcoe/devices/ctlr_1).
|
||||
Once this counter reaches the value of two digits (10 and larger),
|
||||
get_ctlr_num() stopped working properly and a command like `fcoeadm -i`
|
||||
which depends on get_ctlr_num() call doesn't show anything.
|
||||
This patch solves this problem.
|
||||
|
||||
Signed-off-by: Andrey Grafin <Andrey.Grafin@acronis.com>
|
||||
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
|
||||
---
|
||||
lib/sysfs_hba.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/sysfs_hba.c b/lib/sysfs_hba.c
|
||||
index 5cb7fd3fa5d5..786215440bac 100644
|
||||
--- a/lib/sysfs_hba.c
|
||||
+++ b/lib/sysfs_hba.c
|
||||
@@ -606,7 +606,7 @@ static int get_ctlr_num(const char *netdev)
|
||||
if (!ctlr)
|
||||
continue;
|
||||
|
||||
- ctlr_num = atoi(&ctlr[strlen(ctlr) - 1]);
|
||||
+ ctlr_num = atoi(&ctlr[sizeof("ctlr_") - 1]);
|
||||
break;
|
||||
}
|
||||
|
||||
--
|
||||
2.14.4
|
||||
|
@ -1,26 +1,29 @@
|
||||
# https://fedoraproject.org/wiki/Packaging:Guidelines#Compiler_flags
|
||||
%global _hardened_build 1
|
||||
|
||||
%global checkout f5cbb9a
|
||||
# v1.0.33-9-g848bcc6ba8c
|
||||
%global commit0 848bcc6ba8cda1f344663b4e73f1bc4857bcb4e3
|
||||
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
|
||||
|
||||
Name: fcoe-utils
|
||||
Version: 1.0.32
|
||||
Release: 7%{?dist}
|
||||
Version: 1.0.33
|
||||
Release: 3.git%{shortcommit0}%{?dist}
|
||||
Summary: Fibre Channel over Ethernet utilities
|
||||
Group: Applications/System
|
||||
License: GPLv2
|
||||
URL: http://www.open-fcoe.org
|
||||
# git://open-fcoe.org/fcoe/fcoe-utils.git
|
||||
Source0: https://github.com/morbidrsa/fcoe-utils/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
Source0: https://github.com/openSUSE/fcoe-utils/archive/%{commit0}.tar.gz#/%{name}-%{version}-%{shortcommit0}.tar.gz
|
||||
Source1: quickstart.txt
|
||||
Source2: fcoe.service
|
||||
Source3: fcoe.config
|
||||
ExcludeArch: ppc s390
|
||||
Patch0: fcoe-utils-gcc7-fmt-truc-err.patch
|
||||
Patch1: fcoe-utils-gcc8-fmt-truc-err.patch
|
||||
Patch2: fcoe-utils-v1.0.32-1-fcoe-utils-Fix-get_ctlr_num-for-large-ctlr_-indices.patch
|
||||
Patch3: fcoe-utils-set-default-DCB_REQUIRED-to-no.patch
|
||||
Patch4: 0001-fcoemon-netlink-buffer-resize-fix.patch
|
||||
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
|
||||
@ -40,7 +43,7 @@ fcoeadm - command line tool for configuring FCoE interfaces
|
||||
fcoemon - service to configure DCB Ethernet QOS filters, works with lldpad
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
%autosetup -p1 -n fcoe-utils-%{commit0}
|
||||
cp -v %{SOURCE1} quickstart.txt
|
||||
|
||||
%build
|
||||
@ -81,10 +84,22 @@ rm -f %{buildroot}/%{_sysconfdir}/fcoe/config
|
||||
%{_sysconfdir}/fcoe/
|
||||
%config(noreplace) %{_sysconfdir}/fcoe/cfg-ethx
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/fcoe
|
||||
%{_sysconfdir}/bash_completion.d/*
|
||||
%{_datadir}/bash-completion/completions/*
|
||||
%{_libexecdir}/fcoe/
|
||||
|
||||
%changelog
|
||||
* Tue Mar 23 2021 Chris Leech <cleech@redhat.com> - 1.0.33-3.git848bcc6
|
||||
- 1918561 regression in fipvlan VLAN name generation and fcoeadm commands
|
||||
|
||||
* Mon Jan 18 2021 Chris Leech <cleech@redhat.com> - 1.0.33-2.git848bcc6
|
||||
- 1897503 revert breaking upstream change to command line options
|
||||
|
||||
* Tue Nov 03 2020 Chris Leech <cleech@redhat.com> - 1.0.33-1.git848bcc6
|
||||
- 1889536 add back default change of DCB_REQUIRED="no" for RHEL 8
|
||||
|
||||
* Tue Nov 03 2020 Chris Leech <cleech@redhat.com> - 1.0.33-0.git848bcc6
|
||||
- 1889536 new version
|
||||
|
||||
* Fri Dec 06 2019 Chris Leech <cleech@redhat.com> - 1.0.32-7
|
||||
- 1776492 fcoemon: fix ignored devices from recv buffer resize bug
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user