aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-12-10 09:37:06 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-12-10 09:37:06 +0000
commitb655424adc7e77fd8dcad2f81cfeeddf1f2b6f9f (patch)
treeca3557b10914890c8ee48852172729278fec7ee3
parenta8835225c38421ab1002f15fbffc648a468d230b (diff)
downloadsrc-b655424adc7e77fd8dcad2f81cfeeddf1f2b6f9f.tar.gz
src-b655424adc7e77fd8dcad2f81cfeeddf1f2b6f9f.zip
Fix bug in ifconfig regarding VLAN creation.
Detection of VLAN interface type must happen before detection of interface type by prefix. Else the following sequence of commands will try to create a LAGG interface instead of a VLAN interface, which accidentially works, because the data pointed to by the ifr_data pointer is not parsed by the VLAN create ioctl(2). How to reproduce: # ifconfig lagg0 create # ifconfig lagg0.256 create Differential Revision: https://reviews.freebsd.org/D27521 Tested by: raul.munoz@custos.es Sponsored by: Mellanox Technologies // NVIDIA Networking
Notes
Notes: svn path=/stable/11/; revision=368504
-rw-r--r--sbin/ifconfig/ifclone.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifclone.c b/sbin/ifconfig/ifclone.c
index 30ce5b246125..1961c9293380 100644
--- a/sbin/ifconfig/ifclone.c
+++ b/sbin/ifconfig/ifclone.c
@@ -122,6 +122,7 @@ ifclonecreate(int s, void *arg)
struct ifreq ifr;
struct clone_defcb *dcp;
clone_callback_func *clone_cb = NULL;
+ const char *ifr_name = strchr(name, '.') ? "vlan" : name;
memset(&ifr, 0, sizeof(ifr));
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
@@ -129,7 +130,7 @@ ifclonecreate(int s, void *arg)
if (clone_cb == NULL) {
/* Try to find a default callback */
SLIST_FOREACH(dcp, &clone_defcbh, next) {
- if (strncmp(dcp->ifprefix, ifr.ifr_name,
+ if (strncmp(dcp->ifprefix, ifr_name,
strlen(dcp->ifprefix)) == 0) {
clone_cb = dcp->clone_cb;
break;