Date: Tue, 25 Mar 2008 19:00:14 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 138534 for review Message-ID: <200803251900.m2PJ0EMQ088232@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=138534 Change 138534 by sam@sam_ebb on 2008/03/25 19:00:13 checkpoint work to move regdomain tables out of ifconfig; works but the final plan is to create a lib80211 that contains the parser plus other useful bits from ifconfig Affected files ... .. //depot/projects/vap/etc/Makefile#4 edit .. //depot/projects/vap/etc/regdomain.xml#1 add .. //depot/projects/vap/sbin/ifconfig/Makefile#7 edit .. //depot/projects/vap/sbin/ifconfig/ifieee80211.c#15 edit .. //depot/projects/vap/sbin/ifconfig/regdomain.c#1 add .. //depot/projects/vap/sbin/ifconfig/regdomain.h#1 add Differences ... ==== //depot/projects/vap/etc/Makefile#4 (text+ko) ==== @@ -17,7 +17,7 @@ portsnap.conf pf.os phones profile protocols \ rc rc.bsdextended rc.firewall rc.firewall6 rc.initdiskless \ rc.sendmail rc.shutdown \ - rc.subr remote rpc services shells \ + rc.subr regdomain.xml remote rpc services shells \ snmpd.config sysctl.conf syslog.conf \ etc.${MACHINE_ARCH}/ttys \ ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config \ ==== //depot/projects/vap/sbin/ifconfig/Makefile#7 (text+ko) ==== @@ -23,7 +23,10 @@ SRCS+= ifmac.c # MAC support SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support SRCS+= ifvlan.c # SIOC[GS]ETVLAN support -SRCS+= ifieee80211.c # SIOC[GS]IEEE80211 support + +SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support +DPADD+= ${LIBBSDXML} ${LIBSBUF} +LDADD+= -lbsdxml -lsbuf SRCS+= ifcarp.c # SIOC[GS]VH support SRCS+= ifgroup.c # ... @@ -34,8 +37,8 @@ .if ${MK_IPX_SUPPORT} != "no" && !defined(RELEASE_CRUNCH) SRCS+= af_ipx.c # IPX support -DPADD= ${LIBIPX} -LDADD= -lipx +DPADD+= ${LIBIPX} +LDADD+= -lipx .endif MAN= ifconfig.8 ==== //depot/projects/vap/sbin/ifconfig/ifieee80211.c#15 (text+ko) ==== @@ -78,7 +78,6 @@ #include <net/route.h> #include <net80211/ieee80211_ioctl.h> -#include <net80211/ieee80211_regdomain.h> #include <ctype.h> #include <err.h> @@ -93,10 +92,16 @@ #include <stddef.h> /* NB: for offsetof */ #include "ifconfig.h" +#include "regdomain.h" #ifndef IEEE80211_FIXED_RATE_NONE #define IEEE80211_FIXED_RATE_NONE 0xff #endif + +#define REQ_ECM 0x01000000 /* enable if ECM set */ +#define REQ_OUTDOOR 0x02000000 /* enable for outdoor operation */ +#define REQ_FLAGS 0xff000000 /* private flags, don't pass to os */ + /* XXX need these publicly defined or similar */ #ifndef IEEE80211_NODE_AUTH #define IEEE80211_NODE_AUTH 0x0001 /* authorized for data */ @@ -117,45 +122,6 @@ static void LINE_BREAK(void); static void LINE_CHECK(const char *fmt, ...); -#define REQ_ECM 0x01000000 /* enable if ECM set */ -#define REQ_OUTDOOR 0x02000000 /* enable for outdoor operation */ -#define REQ_FLAGS 0xff000000 /* private flags, don't pass to os */ - -struct freqband { - uint16_t freqStart; /* starting frequency (MHz) */ - uint16_t freqEnd; /* ending frequency (MHz) */ - uint8_t chanWidth; /* channel width (MHz) */ - uint8_t chanSep; /* channel sepaaration (MHz) */ - uint32_t flags; /* common operational constraints */ -}; -struct netband { - const struct freqband *b; /* channel list description */ - uint8_t maxPower; /* regulatory cap on tx power (dBm) */ - uint8_t maxPowerDFS; /* regulatory cap w/ DFS (dBm) */ - uint32_t flags; /* net80211 channel flags */ -}; - -#define MAXFBANDS 10 /* XXX could define per netband */ - -struct regdomain { - enum RegdomainCode sku; /* regdomain code/SKU */ - const char *name; /* printable name */ - enum ISOCountryCode cc; /* country code for 1-1/default map */ - - struct netband bands_11b[MAXFBANDS]; /* 11b operation */ - struct netband bands_11g[MAXFBANDS]; /* 11g operation */ - struct netband bands_11a[MAXFBANDS]; /* 11a operation */ - struct netband bands_11ng[MAXFBANDS]; /* 11ng operation */ - struct netband bands_11na[MAXFBANDS]; /* 11na operation */ -}; - -struct countrycode { - enum ISOCountryCode code; - const struct regdomain *rd; - const char* isoname; - const char* name; -}; - static const char *modename[] = { "auto", "11a", "11b", "11g", "fh", "turboA", "turboG", "sturbo", "11na", "11ng" @@ -173,10 +139,6 @@ int allchans, int verbose); static void regdomain_makechannels(struct ieee80211_regdomain_req *, const struct ieee80211_devcaps_req *); -static const struct regdomain *regdomain_lookupbyrd(enum RegdomainCode sku); -static const struct regdomain *regdomain_lookupbyname(const char *name); -static const struct countrycode *countrycode_lookupbycc(enum ISOCountryCode); -static const struct countrycode *countrycode_lookupbyname(const char *); static struct ieee80211req_chaninfo chaninfo; static struct ieee80211_regdomain regdomain; @@ -216,6 +178,18 @@ gethtconf(s); } +static struct regdata * +getregdata(void) +{ + static struct regdata *rdp = NULL; + if (rdp == NULL) { + rdp = lib80211_alloc_regdata(); + if (rdp == NULL) + exit(-1); + } + return rdp; +} + /* * Given the channel at index i with attributes from, * check if there is a channel with attributes to in @@ -444,16 +418,17 @@ struct ieee80211_regdomain_req req; struct ieee80211_regdomain *rd = arg; struct ieee80211_devcaps_req dc; + struct regdata *rdp = getregdata(); if (rd->country != 0) { - const struct countrycode *cc; + const struct country *cc; /* * Check current country seting to make sure it's * compatible with the new regdomain. If not, then * override it with any default country for this * SKU. If we cannot arrange a match, then abort. */ - cc = countrycode_lookupbycc(rd->country); + cc = lib80211_country_findbycc(rdp, rd->country); if (cc == NULL) errx(1, "unknown ISO country code %d", rd->country); if (cc->rd->sku != rd->regdomain) { @@ -471,12 +446,12 @@ * constructing the channel list by deferring to the * regdomain to construct the channel list. */ - rp = regdomain_lookupbyrd(rd->regdomain); + rp = lib80211_regdomain_findbysku(rdp, rd->regdomain); if (rp == NULL) errx(1, "country %s (%s) is not usable with " "regdomain %d", cc->isoname, cc->name, rd->regdomain); - else if (rp->cc != 0 && rp->cc != cc->code) + else if (rp->cc != 0 && rp->cc != cc) errx(1, "country %s (%s) is not usable with " "regdomain %s", cc->isoname, cc->name, rp->name); @@ -1715,385 +1690,6 @@ set80211(s, IEEE80211_IOC_DOTD, d, 0, NULL); } -/* NB: keep sorted by starting frequency, legacy before HT */ -const struct freqband F1_5120_5240 = { 5120, 5240, 20, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5120_5240 = { 5120, 5240, 40, 20, IEEE80211_CHAN_A }; -const struct freqband F1_5180_5240 = { 5180, 5240, 20, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5180_5240 = { 5180, 5240, 40, 20, IEEE80211_CHAN_A }; -const struct freqband F1_5200_5240 = { 5200, 5240, 20, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5200_5240 = { 5200, 5240, 40, 20, IEEE80211_CHAN_A }; -const struct freqband F1_5260_5320 = { 5260, 5320, 20, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5260_5320 = { 5260, 5320, 40, 20, IEEE80211_CHAN_A }; -const struct freqband F1_5260_5700 = { 5260, 5700, 20, 20, IEEE80211_CHAN_A }; -const struct freqband F1_5280_5320 = { 5280, 5320, 20, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5280_5320 = { 5280, 5320, 40, 20, IEEE80211_CHAN_A }; -const struct freqband F1_5500_5620 = { 5500, 5620, 20, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5500_5620 = { 5500, 5620, 40, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5500_5680 = { 5500, 5680, 40, 20, IEEE80211_CHAN_A }; -const struct freqband F1_5500_5700 = { 5500, 5700, 20, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5725_5825 = { 5725, 5825, 40, 20, IEEE80211_CHAN_A }; -const struct freqband F1_5745_5805 = { 5745, 5805, 20, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5745_5805 = { 5745, 5805, 40, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5745_5825 = { 5745, 5825, 40, 20, IEEE80211_CHAN_A }; -const struct freqband F1_5825_5825 = { 5825, 5825, 20, 20, IEEE80211_CHAN_A }; -const struct freqband H4_5825_5825 = { 5825, 5825, 40, 20, IEEE80211_CHAN_A }; - -const struct freqband F1_2312_2372 = { 2312, 2372, 20, 5 }; -const struct freqband F1_2412_2462 = { 2412, 2462, 20, 5 }; -const struct freqband H4_2412_2462 = { 2412, 2462, 40, 5 }; -const struct freqband F1_2412_2472 = { 2412, 2472, 20, 5 }; -const struct freqband H4_2412_2472 = { 2412, 2472, 40, 5 }; -const struct freqband F1_2467_2472 = { 2467, 2472, 20, 5 }; -const struct freqband H4_2467_2472 = { 2467, 2472, 40, 5 }; -const struct freqband F1_2484_2484 = { 2484, 2484, 20, 5 }; -const struct freqband F1_2512_2732 = { 2512, 2732, 20, 5 }; - -const static struct regdomain rd_debug = { - .sku = SKU_DEBUG, .name = "DEBUG", -}; - -const static struct regdomain rd_fcc = { - .sku = SKU_FCC, .name = "FCC", .cc = CTRY_UNITED_STATES, - .bands_11b = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_B }, - }, - .bands_11g = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G }, - }, - .bands_11a = { - { &F1_5180_5240, 17, 17 }, - { &F1_5745_5805, 23, 23 }, - { &F1_5825_5825, 23, 23, IEEE80211_CHAN_PASSIVE }, - }, - .bands_11ng = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 }, - }, - .bands_11na = { - { &F1_5180_5240, 17, 17, IEEE80211_CHAN_HT20 }, - { &H4_5180_5240, 17, 17, IEEE80211_CHAN_HT40 }, - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_HT20 }, - { &H4_5745_5805, 23, 23, IEEE80211_CHAN_HT40 }, - }, -}; - -const static struct regdomain rd_fcc3 = { - .sku = SKU_FCC3, .name = "FCC3", - .bands_11b = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_B }, - }, - .bands_11g = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G }, - }, - .bands_11a = { - { &F1_5180_5240, 17, 17 }, - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &F1_5825_5825, 23, 23, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - }, - .bands_11ng = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 }, - }, - .bands_11na = { - { &F1_5180_5240, 17, 17, IEEE80211_CHAN_HT20 }, - { &H4_5180_5240, 17, 17, IEEE80211_CHAN_HT40 }, - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_HT20 }, - { &H4_5745_5805, 23, 23, IEEE80211_CHAN_HT40 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - }, -}; - -const static struct regdomain rd_japan = { - .sku = SKU_JAPAN, .name = "JAPAN", .cc = CTRY_JAPAN, - .bands_11b = { - { &F1_2412_2472, 23, 23, IEEE80211_CHAN_B }, - { &F1_2484_2484, 23, 23, IEEE80211_CHAN_B }, - }, - .bands_11g = { - { &F1_2412_2472, 23, 23, IEEE80211_CHAN_G }, - }, - .bands_11a = { - { &F1_5180_5240, 23, 23 }, - { &F1_5260_5320, 23, 23, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - }, - .bands_11ng = { - { &F1_2412_2472, 23, 23, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &H4_2412_2472, 23, 23, IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 }, - }, - .bands_11na = { - { &F1_5180_5240, 23, 23, IEEE80211_CHAN_HT20 }, - { &H4_5180_5240, 23, 23, IEEE80211_CHAN_HT40 }, - { &F1_5260_5320, 23, 23, IEEE80211_CHAN_HT20 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &H4_5260_5320, 23, 23, IEEE80211_CHAN_HT40 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - }, -}; - -const static struct regdomain rd_etsi = { - .sku = SKU_ETSI, .name = "ETSI", - .bands_11b = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_B }, - }, - .bands_11g = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_G }, - }, - .bands_11a = { - { &F1_5180_5240, 17, 17 }, - { &F1_5260_5320, 24, 24, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &F1_5500_5700, 23, 23, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - }, - .bands_11ng = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &H4_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 }, - }, - .bands_11na = { - { &F1_5180_5240, 17, 17, IEEE80211_CHAN_HT20 }, - { &H4_5180_5240, 17, 17, IEEE80211_CHAN_HT40 }, - { &F1_5260_5320, 24, 24, IEEE80211_CHAN_HT20 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &H4_5260_5320, 24, 24, IEEE80211_CHAN_HT40 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &F1_5500_5700, 23, 23, IEEE80211_CHAN_HT20 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &H4_5500_5680, 23, 23, IEEE80211_CHAN_HT40 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - }, -}; - -const static struct regdomain rd_etsi2 = { /* ETSI w/o HT40 in 5GHz */ - .sku = SKU_ETSI2, .name = "ETSI2", - .bands_11b = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_B }, - }, - .bands_11g = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_G }, - }, - .bands_11a = { - { &F1_5120_5240, 17, 17 }, - { &F1_5260_5320, 24, 24, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &F1_5500_5700, 23, 23, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - }, - .bands_11ng = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - }, - .bands_11na = { - { &F1_5120_5240, 17, 17, IEEE80211_CHAN_HT20 }, - { &F1_5260_5320, 24, 24, IEEE80211_CHAN_HT20 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &F1_5500_5700, 23, 23, IEEE80211_CHAN_HT20 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - }, -}; - -const static struct regdomain rd_etsi3 = { /* ETSI - channel 36 */ - .sku = SKU_ETSI3, .name = "ETSI3", .cc = CTRY_ROMANIA, - .bands_11b = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_B }, - }, - .bands_11g = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_G }, - }, - .bands_11a = { - { &F1_5200_5240, 17, 17 }, - { &F1_5280_5320, 24, 24, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &F1_5500_5700, 23, 23, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - }, - .bands_11ng = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &H4_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 }, - }, - .bands_11na = { - { &F1_5200_5240, 17, 17, IEEE80211_CHAN_HT20 }, - { &H4_5200_5240, 17, 17, IEEE80211_CHAN_HT40 }, - { &F1_5280_5320, 24, 24, IEEE80211_CHAN_HT20 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &H4_5280_5320, 24, 24, IEEE80211_CHAN_HT40 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &F1_5500_5700, 23, 23, IEEE80211_CHAN_HT20 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &H4_5500_5680, 23, 23, IEEE80211_CHAN_HT40 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - }, -}; - -const static struct regdomain rd_apac = { - .sku = SKU_APAC, .name = "APAC", - .bands_11b = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_B }, - }, - .bands_11g = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_G }, - }, - .bands_11a = { - { &F1_5180_5240, 17, 17 }, - { &F1_5260_5320, 23, 23, IEEE80211_CHAN_PASSIVE }, - { &F1_5745_5805, 23, 23 }, - { &F1_5825_5825, 23, 23 }, - }, - .bands_11ng = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &H4_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 }, - }, - .bands_11na = { - { &F1_5180_5240, 17, 17, IEEE80211_CHAN_HT20 }, - { &H4_5180_5240, 17, 17, IEEE80211_CHAN_HT40 }, - { &F1_5260_5320, 23, 23, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &H4_5260_5320, 23, 23, IEEE80211_CHAN_HT40 | IEEE80211_CHAN_PASSIVE }, - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_HT20 }, - { &H4_5745_5805, 23, 23, IEEE80211_CHAN_HT40 }, - }, -}; - -const static struct regdomain rd_apac2 = { /* APAC w/ DFS on Mid-band */ - .sku = SKU_APAC2, .name = "APAC2", - .bands_11b = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_B }, - }, - .bands_11g = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G }, - }, - .bands_11a = { - { &F1_5120_5240, 17, 17 }, - { &F1_5260_5320, 23, 23, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &F1_5745_5805, 23, 23 }, - { &F1_5825_5825, 23, 23 }, - }, - .bands_11ng = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &H4_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 }, - }, - .bands_11na = { - { &F1_5120_5240, 17, 17, IEEE80211_CHAN_HT20 }, - { &H4_5120_5240, 17, 17, IEEE80211_CHAN_HT40 }, - { &F1_5260_5320, 23, 23, IEEE80211_CHAN_HT20 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &H4_5260_5320, 23, 23, IEEE80211_CHAN_HT40 | - IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_HT20 }, - { &H4_5745_5805, 23, 23, IEEE80211_CHAN_HT40 }, - }, -}; - -const static struct regdomain rd_apac3 = { /* APAC w/o ISM band */ - .sku = SKU_APAC3, .name = "APAC3", - .bands_11b = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_B }, - }, - .bands_11g = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G }, - }, - .bands_11a = { - { &F1_5180_5240, 17, 17 }, - { &F1_5260_5320, 23, 23, IEEE80211_CHAN_PASSIVE | IEEE80211_CHAN_DFS }, - { &F1_5745_5805, 23, 23 }, - }, - .bands_11ng = { - { &F1_2412_2472, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &H4_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 }, - }, - .bands_11na = { - { &F1_5180_5240, 17, 17, IEEE80211_CHAN_HT20 }, - { &H4_5180_5240, 17, 17, IEEE80211_CHAN_HT40 }, - { &F1_5260_5320, 23, 23, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &H4_5260_5320, 23, 23, IEEE80211_CHAN_HT40 | IEEE80211_CHAN_PASSIVE }, - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_HT20 }, - { &H4_5745_5805, 23, 23, IEEE80211_CHAN_HT40 }, - }, -}; - -const static struct regdomain rd_korea = { - .sku = SKU_KOREA, .name = "KOREA", .cc = CTRY_KOREA_ROC, - .bands_11b = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_B }, - { &F1_2467_2472, 30, 30, IEEE80211_CHAN_B | IEEE80211_CHAN_PASSIVE }, - }, - .bands_11g = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G }, - { &F1_2467_2472, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_PASSIVE }, - }, - .bands_11a = { - { &F1_5180_5240, 17, 17, IEEE80211_CHAN_PASSIVE }, - { &F1_5260_5320, 23, 23, IEEE80211_CHAN_PASSIVE }, - { &F1_5500_5620, 23, 23, IEEE80211_CHAN_PASSIVE }, - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_PASSIVE }, - }, - .bands_11ng = { - { &F1_2412_2462, 30, 30, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &F1_2467_2472, 30, 30, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - }, - .bands_11na = { - { &F1_5180_5240, 17, 17, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &F1_5260_5320, 23, 23, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &F1_5500_5620, 23, 23, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - }, -}; - -const static struct regdomain rd_row = { - .sku = SKU_ROW, .name = "ROW", - .bands_11b = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_B }, - }, - .bands_11g = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G }, - }, - .bands_11a = { - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_PASSIVE }, - }, - .bands_11ng = { - { &F1_2412_2462, 30, 30, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &H4_2412_2462, 30, 30, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 }, - }, - .bands_11na = { - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &H4_5745_5805, 23, 23, IEEE80211_CHAN_HT40 | IEEE80211_CHAN_PASSIVE }, - }, -}; - -const static struct regdomain rd_none = { - .sku = SKU_NONE, .name = "NONE", - .bands_11b = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_B }, - { &F1_2467_2472, 30, 30, IEEE80211_CHAN_B | IEEE80211_CHAN_PASSIVE }, - }, - .bands_11g = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G }, - { &F1_2467_2472, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_PASSIVE }, - }, - .bands_11a = { - { &F1_5120_5240, 17, 17, IEEE80211_CHAN_PASSIVE }, - { &F1_5260_5320, 24, 24, IEEE80211_CHAN_PASSIVE }, - { &F1_5500_5700, 24, 24, IEEE80211_CHAN_PASSIVE }, - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_PASSIVE }, - { &F1_5825_5825, 23, 23, IEEE80211_CHAN_PASSIVE }, - }, - .bands_11ng = { - { &F1_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 }, - { &H4_2412_2462, 30, 30, IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 }, - { &F1_2467_2472, 30, 30, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &H4_2467_2472, 30, 30, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT40 | IEEE80211_CHAN_PASSIVE }, - }, - .bands_11na = { - { &F1_5120_5240, 17, 17, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &H4_5120_5240, 17, 17, IEEE80211_CHAN_HT40 | IEEE80211_CHAN_PASSIVE }, - { &F1_5260_5320, 24, 24, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &H4_5260_5320, 24, 24, IEEE80211_CHAN_HT40 | IEEE80211_CHAN_PASSIVE }, - { &F1_5500_5700, 24, 24, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &H4_5500_5680, 24, 24, IEEE80211_CHAN_HT40 | IEEE80211_CHAN_PASSIVE }, - { &F1_5745_5805, 23, 23, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &H4_5745_5805, 23, 23, IEEE80211_CHAN_HT40 | IEEE80211_CHAN_PASSIVE }, - { &F1_5825_5825, 23, 23, IEEE80211_CHAN_HT20 | IEEE80211_CHAN_PASSIVE }, - { &H4_5825_5825, 23, 23, IEEE80211_CHAN_HT40 | IEEE80211_CHAN_PASSIVE }, - }, -}; - static int regdomain_sort(const void *a, const void *b) { @@ -2126,23 +1722,22 @@ static void regdomain_addchans(struct ieee80211req_chaninfo *ci, - const struct netband *nb, + const netband_head *bands, const struct ieee80211_regdomain *reg, uint32_t chanFlags, const struct ieee80211req_chaninfo *avail) { + const struct netband *nb; const struct freqband *b; struct ieee80211_channel *c, *prev; - int i, freq, channelSep; + int freq, channelSep; channelSep = (chanFlags & IEEE80211_CHAN_2GHZ) ? 0 : 40; - for (i = 0; i < MAXFBANDS; nb++, i++) { + LIST_FOREACH(nb, bands, next) { + b = nb->band; if (verbose) - printf("%s: [%d] chanFlags 0x%x b %p\n", - __func__, i, chanFlags, nb->b); - if (nb->b == NULL) - break; - b = nb->b; + printf("%s: chanFlags 0x%x b %p\n", + __func__, chanFlags, b); prev = NULL; for (freq = b->freqStart; freq <= b->freqEnd; freq += b->chanSep) { uint32_t flags = nb->flags | b->flags; @@ -2219,10 +1814,12 @@ } static void -regdomain_makechannels(struct ieee80211_regdomain_req *req, +regdomain_makechannels( + struct ieee80211_regdomain_req *req, const struct ieee80211_devcaps_req *dc) { - const struct countrycode *cc; + struct regdata *rdp = getregdata(); + const struct country *cc; const struct ieee80211_regdomain *reg = &req->rd; struct ieee80211req_chaninfo *ci = &req->chaninfo; const struct regdomain *rd; @@ -2236,255 +1833,89 @@ * belong to at least one regdomain. */ if (reg->regdomain == 0) { - cc = countrycode_lookupbycc(reg->country); + cc = lib80211_country_findbycc(rdp, reg->country); if (cc == NULL) errx(1, "internal error, country %d not found", reg->country); rd = cc->rd; } else - rd = regdomain_lookupbyrd(reg->regdomain); + rd = lib80211_regdomain_findbysku(rdp, reg->regdomain); if (rd == NULL) errx(1, "internal error, regdomain %d not found", reg->regdomain); if (rd->sku != SKU_DEBUG) { memset(ci, 0, sizeof(*ci)); - regdomain_addchans(ci, rd->bands_11b, reg, - IEEE80211_CHAN_B, &dc->dc_chaninfo); - regdomain_addchans(ci, rd->bands_11g, reg, - IEEE80211_CHAN_G, &dc->dc_chaninfo); - regdomain_addchans(ci, rd->bands_11a, reg, - IEEE80211_CHAN_A, &dc->dc_chaninfo); - regdomain_addchans(ci, rd->bands_11na, reg, - IEEE80211_CHAN_A | IEEE80211_CHAN_HT20, &dc->dc_chaninfo); - regdomain_addchans(ci, rd->bands_11na, reg, - IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U, &dc->dc_chaninfo); - regdomain_addchans(ci, rd->bands_11na, reg, - IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D, &dc->dc_chaninfo); - regdomain_addchans(ci, rd->bands_11ng, reg, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT20, &dc->dc_chaninfo); - regdomain_addchans(ci, rd->bands_11ng, reg, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U, &dc->dc_chaninfo); - regdomain_addchans(ci, rd->bands_11ng, reg, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D, &dc->dc_chaninfo); + if (!LIST_EMPTY(&rd->bands_11b)) + regdomain_addchans(ci, &rd->bands_11b, reg, + IEEE80211_CHAN_B, &dc->dc_chaninfo); + if (!LIST_EMPTY(&rd->bands_11g)) + regdomain_addchans(ci, &rd->bands_11g, reg, + IEEE80211_CHAN_G, &dc->dc_chaninfo); + if (!LIST_EMPTY(&rd->bands_11a)) + regdomain_addchans(ci, &rd->bands_11a, reg, + IEEE80211_CHAN_A, &dc->dc_chaninfo); + if (!LIST_EMPTY(&rd->bands_11na)) { + regdomain_addchans(ci, &rd->bands_11na, reg, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT20, + &dc->dc_chaninfo); + regdomain_addchans(ci, &rd->bands_11na, reg, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U, + &dc->dc_chaninfo); + regdomain_addchans(ci, &rd->bands_11na, reg, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D, + &dc->dc_chaninfo); + } + if (!LIST_EMPTY(&rd->bands_11ng)) { + regdomain_addchans(ci, &rd->bands_11ng, reg, + IEEE80211_CHAN_G | IEEE80211_CHAN_HT20, + &dc->dc_chaninfo); + regdomain_addchans(ci, &rd->bands_11ng, reg, + IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U, + &dc->dc_chaninfo); + regdomain_addchans(ci, &rd->bands_11ng, reg, + IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D, + &dc->dc_chaninfo); + } qsort(ci->ic_chans, ci->ic_nchans, sizeof(ci->ic_chans[0]), regdomain_sort); } else *ci = dc->dc_chaninfo; } -static const struct regdomain *regdomain_info[] = { - &rd_fcc, - &rd_fcc3, - &rd_japan, - &rd_etsi, - &rd_etsi2, - &rd_etsi3, - &rd_apac, - &rd_apac2, - &rd_apac3, - &rd_korea, - &rd_row, - &rd_none, - &rd_debug, -}; - -#define N(a) (sizeof(a) / sizeof(a[0])) - -static const struct regdomain * -regdomain_lookupbyrd(enum RegdomainCode sku) -{ - int i; - - for (i = 0; i < N(regdomain_info); i++) { - if (regdomain_info[i]->sku == sku) - return regdomain_info[i]; - } - return NULL; -} - -static const struct regdomain * -regdomain_lookupbyname(const char *name) -{ - int i; - - for (i = 0; i < N(regdomain_info); i++) { - if (strcasecmp(regdomain_info[i]->name, name) == 0) - return regdomain_info[i]; - } - return NULL; -} - -/* - * Country Code Table. - */ -static const struct countrycode country_info[] = { - { CTRY_ALBANIA, &rd_none, "AL", "Albania" }, - { CTRY_ALGERIA, &rd_none, "DZ", "Algeria" }, - { CTRY_ARGENTINA, &rd_none, "AR", "Argentina" }, - { CTRY_ARMENIA, &rd_etsi, "AM", "Armenia" }, - { CTRY_AUSTRALIA, &rd_row, "AU", "Australia" }, - { CTRY_AUSTRIA, &rd_etsi2, "AT", "Austria", }, - { CTRY_AZERBAIJAN, &rd_etsi, "AZ", "Azerbaijan" }, - { CTRY_BAHRAIN, &rd_none, "BH", "Bahrain" }, - { CTRY_BANGLADESH, &rd_row, "BD", "Bangladesh" }, - { CTRY_BELARUS, &rd_none, "BY", "Belarus" }, - { CTRY_BELGIUM, &rd_etsi, "BE", "Belgium" }, - { CTRY_BELIZE, &rd_none, "BZ", "Belize" }, - { CTRY_BOLIVIA, &rd_none, "BO", "Bolivia" }, - { CTRY_BRAZIL, &rd_fcc, "BR", "Brazil" }, - { CTRY_BRUNEI_DARUSSALAM, &rd_apac, "BN", "Brunei" }, - { CTRY_BULGARIA, &rd_etsi, "BG", "Bulgaria" }, - { CTRY_CANADA, &rd_fcc, "CA", "Canada" }, - { CTRY_CHILE, &rd_row, "CL", "Chile" }, - { CTRY_CHINA, &rd_row, "CN", "China" }, - { CTRY_COLOMBIA, &rd_fcc, "CO", "Colombia" }, - { CTRY_COSTA_RICA, &rd_none, "CR", "Costa Rica" }, - { CTRY_CROATIA, &rd_etsi, "HR", "Croatia" }, - { CTRY_CYPRUS, &rd_etsi, "CY", "Cyprus" }, - { CTRY_CZECH, &rd_etsi, "CZ", "Czech Republic" }, - { CTRY_DENMARK, &rd_etsi, "DK", "Denmark" }, - { CTRY_DOMINICAN_REPUBLIC, &rd_none, "DO", "Dominican Republic" }, - { CTRY_ECUADOR, &rd_none, "EC", "Ecuador" }, - { CTRY_EGYPT, &rd_none, "EG", "Egypt" }, - { CTRY_EL_SALVADOR, &rd_none, "SV", "El Salvador" }, - { CTRY_ESTONIA, &rd_etsi, "EE", "Estonia" }, - { CTRY_FINLAND, &rd_etsi, "FI", "Finland" }, - { CTRY_FRANCE, &rd_etsi, "FR", "France" }, - { CTRY_FRANCE2, &rd_etsi, "F2", "France2" }, - { CTRY_GEORGIA, &rd_etsi, "GE", "Georgia" }, - { CTRY_GERMANY, &rd_etsi, "DE", "Germany" }, - { CTRY_GREECE, &rd_etsi, "GR", "Greece" }, - { CTRY_GUATEMALA, &rd_none, "GT", "Guatemala" }, - { CTRY_HONDURAS, &rd_none, "HN", "Honduras" }, - { CTRY_HONG_KONG, &rd_apac, "HK", "Hong Kong" }, - { CTRY_HUNGARY, &rd_etsi, "HU", "Hungary" }, - { CTRY_ICELAND, &rd_etsi, "IS", "Iceland" }, - { CTRY_INDIA, &rd_apac, "IN", "India" }, - { CTRY_INDONESIA, &rd_none, "ID", "Indonesia" }, - { CTRY_IRAN, &rd_none, "IR", "Iran" }, - { CTRY_IRELAND, &rd_etsi, "IE", "Ireland" }, - { CTRY_ISRAEL, &rd_none, "IL", "Israel" }, - { CTRY_ITALY, &rd_etsi, "IT", "Italy" }, - { CTRY_JAMAICA, &rd_none, "JM", "Jamaica" }, - { CTRY_JAPAN, &rd_japan, "JP", "Japan" }, - { CTRY_JAPAN1, &rd_japan, "J1", "Japan1" }, - { CTRY_JAPAN2, &rd_japan, "J2", "Japan2" }, - { CTRY_JAPAN3, &rd_japan, "J3", "Japan3" }, - { CTRY_JAPAN4, &rd_japan, "J4", "Japan4" }, - { CTRY_JAPAN5, &rd_japan, "J5", "Japan5" }, - { CTRY_JORDAN, &rd_none, "JO", "Jordan" }, - { CTRY_KAZAKHSTAN, &rd_none, "KZ", "Kazakhstan" }, - { CTRY_KOREA_NORTH, &rd_korea, "KP", "North Korea" }, - { CTRY_KOREA_ROC, &rd_korea, "KR", "Korea Republic" }, - { CTRY_KOREA_ROC2, &rd_none, "K2", "Korea Republic2" }, - { CTRY_KUWAIT, &rd_none, "KW", "Kuwait" }, - { CTRY_LATVIA, &rd_etsi2, "LV", "Latvia" }, - { CTRY_LEBANON, &rd_none, "LB", "Lebanon" }, - { CTRY_LIECHTENSTEIN, &rd_etsi, "LI", "Liechtenstein" }, - { CTRY_LITHUANIA, &rd_etsi, "LT", "Lithuania" }, - { CTRY_LUXEMBOURG, &rd_etsi, "LU", "Luxemborg" }, - { CTRY_MACAU, &rd_none, "MO", "Macau" }, - { CTRY_MACEDONIA, &rd_none, "MK", "Macedonia" }, - { CTRY_MALAYSIA, &rd_apac3, "MY", "Malaysia" }, - { CTRY_MALTA, &rd_etsi, "MT", "Malta" }, - { CTRY_MEXICO, &rd_fcc, "MX", "Mexico" }, - { CTRY_MONACO, &rd_none, "MC", "Monaco" }, - { CTRY_MOROCCO, &rd_etsi, "MA", "Morocco" }, - { CTRY_NEPAL, &rd_row, "NP", "Nepal" }, - { CTRY_NETHERLANDS, &rd_etsi, "NL", "Netherlands" }, - { CTRY_NEW_ZEALAND, &rd_apac, "NZ", "New Zealand" }, - { CTRY_NORWAY, &rd_etsi, "NO", "Norway" }, - { CTRY_OMAN, &rd_none, "OM", "Oman" }, - { CTRY_PAKISTAN, &rd_row, "PK", "Pakistan" }, - { CTRY_PANAMA, &rd_none, "PA", "Panama" }, - { CTRY_PERU, &rd_none, "PE", "Peru" }, - { CTRY_PHILIPPINES, &rd_apac2, "PH", "Phillipines" }, - { CTRY_POLAND, &rd_etsi, "PL", "Poland" }, - { CTRY_PORTUGAL, &rd_etsi, "PT", "Portugal" }, - { CTRY_PUERTO_RICO, &rd_fcc, "PR", "Puerto Rico" }, - { CTRY_QATAR, &rd_none, "QA", "Quatar" }, - { CTRY_ROMANIA, &rd_etsi, "RO", "Romania" }, - { CTRY_RUSSIA, &rd_none, "RU", "Rusia" }, - { CTRY_SAUDI_ARABIA, &rd_none, "SA", "Saudi Arabia" }, - { CTRY_SINGAPORE, &rd_apac2, "SG", "Singapore" }, - { CTRY_SLOVAKIA, &rd_etsi2, "SK", "Slovak Republic" }, - { CTRY_SLOVENIA, &rd_etsi, "SI", "Slovenia" }, - { CTRY_SOUTH_AFRICA, &rd_none, "ZA", "South Africa" }, - { CTRY_SPAIN, &rd_etsi2, "ES", "Spain" }, - { CTRY_SRILANKA, &rd_apac2, "LK", "Sri Lanka" }, - { CTRY_SWEDEN, &rd_etsi, "SE", "Sweden" }, - { CTRY_SWITZERLAND, &rd_etsi, "CH", "Switzerland" }, - { CTRY_SYRIA, &rd_none, "SY", "Syria" }, - { CTRY_TAIWAN, &rd_row, "TW", "Taiwan" }, - { CTRY_THAILAND, &rd_none, "TH", "Thailand" }, - { CTRY_TRINIDAD_Y_TOBAGO, &rd_none, "TT", "Trinidiad & Tobago" }, - { CTRY_TUNISIA, &rd_none, "TN", "Tunisia" }, - { CTRY_TURKEY, &rd_etsi, "TR", "Turkey" }, - { CTRY_UKRAINE, &rd_none, "UA", "Ukraine" }, - { CTRY_UAE, &rd_none, "AE", "United Arab Emirates" }, - { CTRY_UNITED_KINGDOM, &rd_etsi, "GB", "United Kingdom" }, - { CTRY_UNITED_STATES, &rd_fcc, "US", "United States" }, - { CTRY_URUGUAY, &rd_none, "UY", "Uruguay" }, - { CTRY_UZBEKISTAN, &rd_none, "UZ", "Uzbekistan" }, - { CTRY_VENEZUELA, &rd_fcc, "VE", "Venezuela" }, - { CTRY_VIET_NAM, &rd_apac2, "VN", "Viet Nam" }, - { CTRY_YEMEN, &rd_none, "YE", "Yemen" }, - { CTRY_ZIMBABWE, &rd_none, "ZW", "Zimbabwe" } -}; - -static const struct countrycode * -countrycode_lookupbycc(enum ISOCountryCode cc) -{ - int i; - - for (i = 0; i < N(country_info); i++) { - if (country_info[i].code == cc) - return &country_info[i]; - } - return NULL; -} - -static const struct countrycode * -countrycode_lookupbyname(const char *name) -{ - int i, len; - - len = strlen(name); - for (i = 0; i < N(country_info); i++) { - if (strcasecmp(country_info[i].isoname, name) == 0 || - strncasecmp(country_info[i].name, name, len) == 0) - return &country_info[i]; - } - return NULL; -} - static void list_countries(void) { + struct regdata *rdp = getregdata(); + const struct country *cp; + const struct regdomain *dp; int i; + i = 0; printf("\nCountry codes:\n"); - for (i = 0; i < N(country_info); i++) - printf("%2s %-15.15s%s", country_info[i].isoname, - country_info[i].name, ((i+1)%4) == 0 ? "\n" : " "); + LIST_FOREACH(cp, &rdp->countries, next) { + printf("%2s %-15.15s%s", cp->isoname, + cp->name, ((i+1)%4) == 0 ? "\n" : " "); + i++; + } + i = 0; printf("\nRegulatory domains:\n"); - for (i = 0; i < N(regdomain_info); i++) { - printf("%-15s%s", regdomain_info[i]->name, - ((i+1)%5) == 0 ? "\n" : ""); + LIST_FOREACH(dp, &rdp->domains, next) { + printf("%-15.15s%s", dp->name, ((i+1)%4) == 0 ? "\n" : " "); + i++; } printf("\n"); } -#undef N static void defaultcountry(const struct regdomain *rd) { - const struct countrycode *cc; + struct regdata *rdp = getregdata(); + const struct country *cc; - cc = countrycode_lookupbycc(rd->cc); + cc = lib80211_country_findbycc(rdp, rd->cc->code); if (cc == NULL) errx(1, "internal error, ISO country code %d not " - "defined for regdomain %s", rd->cc, rd->name); + "defined for regdomain %s", rd->cc->code, rd->name); regdomain.country = cc->code; regdomain.isocc[0] = cc->isoname[0]; regdomain.isocc[1] = cc->isoname[1]; @@ -2493,17 +1924,18 @@ static DECL_CMD_FUNC(set80211regdomain, val, d) { + struct regdata *rdp = getregdata(); const struct regdomain *rd; - rd = regdomain_lookupbyname(val); + rd = lib80211_regdomain_findbyname(rdp, val); if (rd == NULL) { - rd = regdomain_lookupbyrd(atoi(val)); + rd = lib80211_regdomain_findbysku(rdp, atoi(val)); if (rd == NULL) errx(1, "unknown regdomain %s", val); } getregdomain(s); regdomain.regdomain = rd->sku; - if (regdomain.country == 0 && rd->cc != 0) { + if (regdomain.country == 0 && rd->cc != NULL) { /* * No country code setup and there's a default * one for this regdomain fill it in. @@ -2516,11 +1948,12 @@ static DECL_CMD_FUNC(set80211country, val, d) { - const struct countrycode *cc; + struct regdata *rdp = getregdata(); + const struct country *cc; - cc = countrycode_lookupbyname(val); + cc = lib80211_country_findbyname(rdp, val); if (cc == NULL) { - cc = countrycode_lookupbycc(atoi(val)); + cc = lib80211_country_findbycc(rdp, atoi(val)); if (cc == NULL) errx(1, "unknown ISO country code %s", val); } @@ -3874,15 +3307,15 @@ if ((reg->regdomain != 0 && reg->regdomain != reg->country) || verb) { const struct regdomain *rd = - regdomain_lookupbyrd(reg->regdomain); + lib80211_regdomain_findbysku(getregdata(), reg->regdomain); if (rd == NULL) LINE_CHECK("regdomain %d", reg->regdomain); else LINE_CHECK("regdomain %s", rd->name); } if (reg->country != 0 || verb) { - const struct countrycode *cc = - countrycode_lookupbycc(reg->country); + const struct country *cc = + lib80211_country_findbycc(getregdata(), reg->country); if (cc == NULL) LINE_CHECK("country %d", reg->country); else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803251900.m2PJ0EMQ088232>