Index: sbin/ifconfig/ifieee80211.c =================================================================== --- sbin/ifconfig/ifieee80211.c +++ sbin/ifconfig/ifieee80211.c @@ -5144,6 +5144,44 @@ } } +static void +setdefregdomain(int s) +{ + struct regdata *rdp = getregdata(); + const struct regdomain *rd; + + /* Check if it 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 it to the driver. */ + setregdomain_cb(s, ®domain); + + /* 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. */ @@ -5165,6 +5203,8 @@ ifr->ifr_data = (caddr_t) ¶ms; if (ioctl(s, SIOCIFCREATE2, ifr) < 0) err(1, "SIOCIFCREATE2"); + + setdefregdomain(s); } static Index: sys/net80211/ieee80211_regdomain.c =================================================================== --- sys/net80211/ieee80211_regdomain.c +++ sys/net80211/ieee80211_regdomain.c @@ -69,10 +69,7 @@ { if (ic->ic_regdomain.regdomain == 0 && ic->ic_regdomain.country == CTRY_DEFAULT) { - ic->ic_regdomain.country = CTRY_UNITED_STATES; /* XXX */ ic->ic_regdomain.location = ' '; /* both */ - ic->ic_regdomain.isocc[0] = 'U'; /* XXX */ - ic->ic_regdomain.isocc[1] = 'S'; /* XXX */ /* NB: driver calls ieee80211_init_channels or similar */ } ic->ic_getradiocaps = null_getradiocaps;