aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-12-10 09:39:27 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-12-10 09:39:27 +0000
commite61d354b85d80126c4833746c22f320c31b68a2b (patch)
treed75a72b5518a6f17dc5deb184e9ac86c19ff290c
parent691ac35b6ef98dd5d74dc615e90f449164011cb7 (diff)
downloadsrc-e61d354b85d80126c4833746c22f320c31b68a2b.tar.gz
src-e61d354b85d80126c4833746c22f320c31b68a2b.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 This is a direct commit. Differential Revision: https://reviews.freebsd.org/D27521 Tested by: raul.munoz@custos.es Sponsored by: Mellanox Technologies // NVIDIA Networking
Notes
Notes: svn path=/stable/10/; revision=368505
-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 21dcdc3dec8e..8acb9029c73f 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;