aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorAndriy Voskoboinyk <avos@FreeBSD.org>2016-05-26 13:14:08 +0000
committerAndriy Voskoboinyk <avos@FreeBSD.org>2016-05-26 13:14:08 +0000
commitb628bdccce4f937fa194d7211cd78e59df6786f7 (patch)
tree879deddad8c09ceffb09d77ec86536b945c8a651 /sbin
parentbcec64bc615def6fae4f20ca1ba2bef5a10c6a69 (diff)
Notes
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifieee80211.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index 1e1e49878b78..82c7515ee01b 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -5141,6 +5141,44 @@ print_string(const u_int8_t *buf, int len)
}
}
+static void
+setdefregdomain(int s)
+{
+ struct regdata *rdp = getregdata();
+ const struct regdomain *rd;
+
+ /* Check if regdomain/country was already set by a previous call. */
+ /* XXX is it possible? */
+ if (regdomain.regdomain != 0 ||
+ regdomain.country != CTRY_DEFAULT)
+ return;
+
+ getregdomain(s);
+
+ /* Check if it was already set by the driver. */
+ if (regdomain.regdomain != 0 ||
+ regdomain.country != CTRY_DEFAULT)
+ return;
+
+ /* Set FCC/US as default. */
+ rd = lib80211_regdomain_findbysku(rdp, SKU_FCC);
+ if (rd == NULL)
+ errx(1, "FCC regdomain was not found");
+
+ regdomain.regdomain = rd->sku;
+ if (rd->cc != NULL)
+ defaultcountry(rd);
+
+ /* Send changes to net80211. */
+ setregdomain_cb(s, &regdomain);
+
+ /* Cleanup (so it can be overriden by subsequent parameters). */
+ regdomain.regdomain = 0;
+ regdomain.country = CTRY_DEFAULT;
+ regdomain.isocc[0] = 0;
+ regdomain.isocc[1] = 0;
+}
+
/*
* Virtual AP cloning support.
*/
@@ -5162,6 +5200,8 @@ wlan_create(int s, struct ifreq *ifr)
ifr->ifr_data = (caddr_t) &params;
if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
err(1, "SIOCIFCREATE2");
+
+ setdefregdomain(s);
}
static