Author: hselasky Date: Thu Dec 10 09:37:06 2020 New Revision: 368504 URL: https://svnweb.freebsd.org/changeset/base/368504
Log: 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.mu...@custos.es Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: stable/11/sbin/ifconfig/ifclone.c Modified: stable/11/sbin/ifconfig/ifclone.c ============================================================================== --- stable/11/sbin/ifconfig/ifclone.c Thu Dec 10 09:31:05 2020 (r368503) +++ stable/11/sbin/ifconfig/ifclone.c Thu Dec 10 09:37:06 2020 (r368504) @@ -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; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"