Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Dec 2020 09:39:27 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r368505 - stable/10/sbin/ifconfig
Message-ID:  <202012100939.0BA9dRGH089198@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Dec 10 09:39:27 2020
New Revision: 368505
URL: https://svnweb.freebsd.org/changeset/base/368505

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
  
  This is a direct commit.
  
  Differential Revision:	https://reviews.freebsd.org/D27521
  Tested by:		raul.munoz@custos.es
  Sponsored by:		Mellanox Technologies // NVIDIA Networking

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

Modified: stable/10/sbin/ifconfig/ifclone.c
==============================================================================
--- stable/10/sbin/ifconfig/ifclone.c	Thu Dec 10 09:37:06 2020	(r368504)
+++ stable/10/sbin/ifconfig/ifclone.c	Thu Dec 10 09:39:27 2020	(r368505)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012100939.0BA9dRGH089198>