diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index 82c7515ee01b..caffe79811cc 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -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