svn commit: r301651 - head/sbin/ifconfig

Andriy Voskoboinyk avos at FreeBSD.org
Wed Jun 8 17:21:16 UTC 2016


Author: avos
Date: Wed Jun  8 17:21:15 2016
New Revision: 301651
URL: https://svnweb.freebsd.org/changeset/base/301651

Log:
  ifconfig: fix wlan creation when unit number is not provided
  (was broken after r300738).
  
  Reported by:	Yoshihiro Ota <ota at j.email.ne.jp>, adrian
  Tested by:	Yoshihiro Ota <ota at j.email.ne.jp>

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==============================================================================
--- head/sbin/ifconfig/ifieee80211.c	Wed Jun  8 17:17:03 2016	(r301650)
+++ head/sbin/ifconfig/ifieee80211.c	Wed Jun  8 17:21:15 2016	(r301651)
@@ -5190,6 +5190,7 @@ static void
 wlan_create(int s, struct ifreq *ifr)
 {
 	static const uint8_t zerobssid[IEEE80211_ADDR_LEN];
+	char orig_name[IFNAMSIZ];
 
 	if (params.icp_parent[0] == '\0')
 		errx(1, "must specify a parent device (wlandev) when creating "
@@ -5201,7 +5202,13 @@ wlan_create(int s, struct ifreq *ifr)
 	if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
 		err(1, "SIOCIFCREATE2");
 
+	/* XXX preserve original name for ifclonecreate(). */
+	strlcpy(orig_name, name, sizeof(orig_name));
+	strlcpy(name, ifr->ifr_name, sizeof(name));
+
 	setdefregdomain(s);
+
+	strlcpy(name, orig_name, sizeof(name));
 }
 
 static


More information about the svn-src-all mailing list