* These are taken from ieee80211_node.h
*/
#define IEEE80211_NODE_TURBOP 0x0001 /* Turbo prime enable */
-#define IEEE80211_NODE_COMP 0x0002 /* Compresssion enable */
+#define IEEE80211_NODE_COMP 0x0002 /* Compression enable */
#define IEEE80211_NODE_FF 0x0004 /* Fast Frame capable */
#define IEEE80211_NODE_XR 0x0008 /* Atheros WME enable */
#define IEEE80211_NODE_AR 0x0010 /* AR capable */
#define streq(a,b) (strncasecmp(a, b, sizeof(b) - 1) == 0)
+#undef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
static int if_split_name(const char *, char **, unsigned int *);
static void vap_create(struct ifreq *);
static void vap_destroy(const char *);
strncpy(ifr.ifr_name, argv[4], IFNAMSIZ);
argc--;
argv++;
- } else if (strcmp(argv[3], "nounit" ) == 0) {
+ } else if (strcmp(argv[3], "nounit") == 0) {
bnounit = 1;
} else {
int flag = getflag(argv[3]);
free(if_base);
if_base = NULL;
- ifr.ifr_data = (void *) &cp;
+ ifr.ifr_data = (void *)&cp;
vap_create(&ifr);
printf("%s\n", ifr.ifr_name);
} else if (streq(cmd, "destroy")) {
usage(void)
{
fprintf(stderr, "usage: wlanconfig athX create [nounit] wlandev wifiY\n");
- fprintf(stderr, " wlanmode [sta|adhoc|ap|monitor|wds|ahdemo] [bssid | -bssid] [nosbeacon]\n");
+ fprintf(stderr, " wlanmode [sta|adhoc|ap|monitor|wds|ahdemo] [uniquebssid]\n");
fprintf(stderr, "usage: wlanconfig athX destroy\n");
fprintf(stderr, "usage: wlanconfig athX list [active|ap|caps|chan|freq|keys|scan|sta|wme]\n");
exit(-1);
int flag = 0;
cp = (s[0] == '-' ? s + 1 : s);
- if (strcmp(cp, "bssid") == 0)
+ if (strcmp(cp, "bssid") == 0) {
+ printf("WARNING: the -bssid and bssid flags are deprecated.\n");
+ flag = IEEE80211_CLONE_BSSID;
+ }
+ if (strcmp(cp, "uniquebssid") == 0)
flag = IEEE80211_CLONE_BSSID;
- if (strcmp(cp, "nosbeacon") == 0)
- flag |= IEEE80211_NO_STABEACONS;
+ if (strcmp(cp, "nosbeacon") == 0) {
+ printf("WARNING: the nosbeacon flag has been deprecated.\n");
+ return 0; /* deprecated but skip */
+ }
if (flag == 0)
errx(1, "unknown create option %s", s);
return (s[0] == '-' ? -flag : flag);
}
static void
-printie(const char* tag, const uint8_t *ie, size_t ielen, int maxlen)
+printie(const char *tag, const uint8_t *ie, size_t ielen, int maxlen)
{
printf("%s", tag);
if (verbose) {
- maxlen -= strlen(tag)+2;
- if (2*ielen > maxlen)
+ maxlen -= strlen(tag) + 2;
+ if (2 * ielen > maxlen)
maxlen--;
printf("<");
for (; ielen > 0; ie++, ielen--) {
static void
list_stations(const char *ifname)
{
- uint8_t buf[24*1024];
+ uint8_t buf[24 * 1024];
struct iwreq iwr;
uint8_t *cp;
int s, len;
(void) memset(&iwr, 0, sizeof(iwr));
(void) strncpy(iwr.ifr_name, ifname, sizeof(iwr.ifr_name));
- iwr.u.data.pointer = (void *) buf;
+ iwr.u.data.pointer = (void *)buf;
iwr.u.data.length = sizeof(buf);
if (ioctl(s, IEEE80211_IOCTL_STA_INFO, &iwr) < 0)
errx(1, "unable to get station information");
struct ieee80211req_sta_info *si;
uint8_t *vp;
- si = (struct ieee80211req_sta_info *) cp;
+ si = (struct ieee80211req_sta_info *)cp;
vp = (u_int8_t *)(si+1);
printf("%s %4u %4d %3dM %4d %4d %5d %6d %7d %6d %7d %-4.4s %-5.5s %3x %8x %8s",
ieee80211_ntoa(si->isi_macaddr),
struct ieee80211req_scan_result *sr;
uint8_t *vp;
- sr = (struct ieee80211req_scan_result *) cp;
- vp = (u_int8_t *)(sr+1);
+ sr = (struct ieee80211req_scan_result *)cp;
+ vp = (u_int8_t *)(sr + 1);
printf("%-14.*s %s %3d %3dM %2d:%-2d %3d %-4.4s",
copy_essid(ssid, sizeof(ssid), vp, sr->isr_ssid_len),
ssid,
static void
print_chaninfo(const struct ieee80211_channel *c)
{
-#define IEEE80211_IS_CHAN_PASSIVE(_c) \
- (((_c)->ic_flags & IEEE80211_CHAN_PASSIVE))
char buf[14];
buf[0] = '\0';
strlcat(buf, " Static", sizeof(buf));
if (IEEE80211_IS_CHAN_DTURBO(c))
strlcat(buf, " Dynamic", sizeof(buf));
- printf("Channel %3u : %u%c Mhz%-14.14s",
+ if (IEEE80211_IS_CHAN_HALF(c))
+ strlcat(buf, " Half", sizeof(buf));
+ if (IEEE80211_IS_CHAN_QUARTER(c))
+ strlcat(buf, " Quarter", sizeof(buf));
+ printf("Channel %3u : %u%c%c Mhz%-14.14s",
c->ic_ieee, c->ic_freq,
- IEEE80211_IS_CHAN_PASSIVE(c) ? '*' : ' ', buf);
-#undef IEEE80211_IS_CHAN_PASSIVE
+ IEEE80211_IS_CHAN_PASSIVE(c) ? '*' : ' ',
+ IEEE80211_IS_CHAN_RADAR(c) ? '!' : ' ',
+ buf);
}
static void
static int
do80211priv(struct iwreq *iwr, const char *ifname, int op, void *data, size_t len)
{
-#define N(a) (sizeof(a)/sizeof(a[0]))
-
memset(iwr, 0, sizeof(struct iwreq));
strncpy(iwr->ifr_name, ifname, IFNAMSIZ);
if (len < IFNAMSIZ) {
IOCTL_ERR(IEEE80211_IOCTL_RADAR),
IOCTL_ERR(IEEE80211_IOCTL_SETKEY),
IOCTL_ERR(IEEE80211_IOCTL_DELKEY),
+ IOCTL_ERR(IEEE80211_IOCTL_HALMAP),
IOCTL_ERR(IEEE80211_IOCTL_ADDMAC),
IOCTL_ERR(IEEE80211_IOCTL_DELMAC),
IOCTL_ERR(IEEE80211_IOCTL_WDSADDMAC),
IOCTL_ERR(IEEE80211_IOCTL_WDSDELMAC),
- IOCTL_ERR(IEEE80211_IOCTL_READREG),
- IOCTL_ERR(IEEE80211_IOCTL_WRITEREG),
};
op -= SIOCIWFIRSTPRIV;
- if (0 <= op && op < N(opnames))
+ if (0 <= op && op < ARRAY_SIZE(opnames))
perror(opnames[op]);
else
perror("ioctl[unknown???]");
return -1;
}
return 0;
-#undef N
}
static int