ifconfig: fix wlan creation when unit number is not provided

(was broken after r300738).

Reported by:	Yoshihiro Ota <ota@j.email.ne.jp>, adrian
Tested by:	Yoshihiro Ota <ota@j.email.ne.jp>
This commit is contained in:
Andriy Voskoboinyk 2016-06-08 17:21:15 +00:00
parent 3648197a1b
commit 7951c6aa9b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301651

View File

@ -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