summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig/regdomain.c
diff options
context:
space:
mode:
authorgavin <gavin@FreeBSD.org>2009-12-15 20:44:12 +0000
committergavin <gavin@FreeBSD.org>2009-12-15 20:44:12 +0000
commit9e26e7888c3d0a13576e842cba34c3d67bf26646 (patch)
treeb0c6932f96b0609c11129ae8298a650f475dbd48 /sbin/ifconfig/regdomain.c
parent59d89f70e970921e538ee7c0061e56d31e26a121 (diff)
downloadFreeBSD-src-9e26e7888c3d0a13576e842cba34c3d67bf26646.zip
FreeBSD-src-9e26e7888c3d0a13576e842cba34c3d67bf26646.tar.gz
ifconfig(8) is documented to take a ISO 3166-1 country code to set the
regulatory domain with the "country" parameter, but will also take a full country name. The man page warns that only the ISO code is unambiguous. In reality, however, the first match on either would be accepted, leading to "DE" being interpreted as the "DEBUG" country rather than Germany, and "MO" selecting Morocco rather than the correct country, Macau. Fix this by always checking for an ISO CC match first, and only search on the full country name if that fails. PR: bin/140571 Tested by: Dirk Meyer dirk.meyer dinoex.sub.org Reviewed by: sam Approved by: ed (mentor) MFC after: 1 month
Diffstat (limited to 'sbin/ifconfig/regdomain.c')
-rw-r--r--sbin/ifconfig/regdomain.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/ifconfig/regdomain.c b/sbin/ifconfig/regdomain.c
index a06ba55..4140289 100644
--- a/sbin/ifconfig/regdomain.c
+++ b/sbin/ifconfig/regdomain.c
@@ -694,8 +694,11 @@ lib80211_country_findbyname(const struct regdata *rdp, const char *name)
len = strlen(name);
LIST_FOREACH(cp, &rdp->countries, next) {
- if (strcasecmp(cp->isoname, name) == 0 ||
- strncasecmp(cp->name, name, len) == 0)
+ if (strcasecmp(cp->isoname, name) == 0)
+ return cp;
+ }
+ LIST_FOREACH(cp, &rdp->countries, next) {
+ if (strncasecmp(cp->name, name, len) == 0)
return cp;
}
return NULL;
OpenPOWER on IntegriCloud