svn commit: r368502 - stable/12/sbin/ifconfig

Hans Petter Selasky hselasky at FreeBSD.org
Thu Dec 10 09:30:10 UTC 2020


Author: hselasky
Date: Thu Dec 10 09:30:09 2020
New Revision: 368502
URL: https://svnweb.freebsd.org/changeset/base/368502

Log:
  Fix bug in ifconfig preventing proper 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 worked previously, because the data pointed to by the
  ifr_data pointer was not parsed by the VLAN create ioctl(2). This is a
  regression after r368229, because the VLAN creation now parses the
  ifr_data field.
  
  How to reproduce:
  # ifconfig lagg0 create
  # ifconfig lagg0.256 create
  
  This is a direct commit, until r366917, stacked VLANs has been MFC'ed.
  
  Differential Revision:	https://reviews.freebsd.org/D27521
  Tested by:		raul.munoz at custos.es
  Sponsored by:		Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sbin/ifconfig/ifclone.c

Modified: stable/12/sbin/ifconfig/ifclone.c
==============================================================================
--- stable/12/sbin/ifconfig/ifclone.c	Thu Dec 10 08:48:03 2020	(r368501)
+++ stable/12/sbin/ifconfig/ifclone.c	Thu Dec 10 09:30:09 2020	(r368502)
@@ -124,6 +124,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));
@@ -131,7 +132,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;


More information about the svn-src-all mailing list