2 * Copyright (c) 1997, 1998, 1999
3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by Bill Paul.
16 * 4. Neither the name of the author nor the names of any co-contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
34 static const char copyright[] = "@(#) Copyright (c) 1997, 1998, 1999\
35 Bill Paul. All rights reserved.";
36 static const char rcsid[] =
37 "$FreeBSD: src/usr.sbin/wicontrol/wicontrol.c,v 1.9.2.7 2002/08/03 07:24:17 imp Exp $";
40 #include <sys/types.h>
41 #include <sys/cdefs.h>
42 #include <sys/param.h>
43 #include <sys/socket.h>
44 #include <sys/ioctl.h>
45 #include <sys/socket.h>
48 #include <net/if_var.h>
49 #include <net/ethernet.h>
51 #include <net/if_ieee80211.h>
52 #include <dev/wi/if_wavelan_ieee.h>
53 #include <dev/wi/wi_hostap.h>
54 #include <dev/wi/if_wireg.h>
64 static void wi_getval(const char *, struct wi_req *);
65 static void wi_setval(const char *, struct wi_req *);
66 static void wi_printstr(struct wi_req *);
67 static void wi_setstr(const char *, int, char *);
68 static void wi_setbytes(const char *, int, char *, int);
69 static void wi_setword(const char *, int, int);
70 static void wi_sethex(const char *, int, char *);
71 static void wi_printwords(struct wi_req *);
72 static void wi_printbool(struct wi_req *);
73 static void wi_printhex(struct wi_req *);
74 static void wi_dumpinfo(const char *);
75 static void wi_dumpstats(const char *);
76 static void wi_setkeys(const char *, char *, int);
77 static void wi_printkeys(struct wi_req *);
78 static void wi_printaplist(const char *);
79 static int wi_hex2int(char);
80 static void wi_str2key(char *, struct wi_key *);
82 static void wi_zerocache(const char *);
83 static void wi_readcache(const char *);
85 static void usage(const char *);
90 * Print a value a la the %b format of the kernel's printf
91 * (ripped screaming from ifconfig/ifconfig.c)
102 if (bits && *bits == 8)
103 printf("%s=%o", s, v);
105 printf("%s=%x", s, v);
109 while ((i = *bits++)) {
110 if (v & (1 << (i-1))) {
114 for (; (c = *bits) > 32; bits++)
117 for (; *bits > 32; bits++)
125 wi_getval(const char *iface, struct wi_req *wreq)
130 bzero((char *)&ifr, sizeof(ifr));
132 strlcpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
133 ifr.ifr_data = (caddr_t)wreq;
135 s = socket(AF_INET, SOCK_DGRAM, 0);
140 if (ioctl(s, SIOCGWAVELAN, &ifr) == -1)
141 err(1, "SIOCGWAVELAN");
149 wi_setval(const char *iface, struct wi_req *wreq)
154 bzero((char *)&ifr, sizeof(ifr));
156 strlcpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
157 ifr.ifr_data = (caddr_t)wreq;
159 s = socket(AF_INET, SOCK_DGRAM, 0);
164 if (ioctl(s, SIOCSWAVELAN, &ifr) == -1)
165 err(1, "SIOCSWAVELAN");
173 wi_printstr(struct wi_req *wreq)
178 if (wreq->wi_type == WI_RID_SERIALNO) {
179 ptr = (char *)&wreq->wi_val;
180 for (i = 0; i < (wreq->wi_len - 1) * 2; i++) {
185 ptr = (char *)&wreq->wi_val[1];
186 for (i = 0; i < wreq->wi_val[0]; i++) {
193 printf("[ %s ]", ptr);
199 wi_setstr(const char *iface, int code, char *str)
204 errx(1, "must specify interface name");
207 errx(1, "must specify string");
209 bzero((char *)&wreq, sizeof(wreq));
211 if (strlen(str) > 30)
212 errx(1, "string too long");
216 wreq.wi_val[0] = strlen(str);
217 bcopy(str, (char *)&wreq.wi_val[1], strlen(str));
219 wi_setval(iface, &wreq);
225 wi_setbytes(const char *iface, int code, char *bytes, int len)
230 errx(1, "must specify interface name");
232 bzero((char *)&wreq, sizeof(wreq));
235 wreq.wi_len = (len / 2) + 1;
236 bcopy(bytes, (char *)&wreq.wi_val[0], len);
238 wi_setval(iface, &wreq);
244 wi_setword(const char *iface, int code, int word)
248 bzero((char *)&wreq, sizeof(wreq));
252 wreq.wi_val[0] = word;
254 wi_setval(iface, &wreq);
260 wi_sethex(const char *iface, int code, char *str)
262 struct ether_addr *addr;
265 errx(1, "must specify address");
267 addr = ether_aton(str);
270 errx(1, "badly formatted address");
272 wi_setbytes(iface, code, (char *)addr, ETHER_ADDR_LEN);
280 if (c >= '0' && c <= '9')
282 if (c >= 'A' && c <= 'F')
283 return (c - 'A' + 10);
284 if (c >= 'a' && c <= 'f')
285 return (c - 'a' + 10);
291 wi_str2key(char *s, struct wi_key *k)
296 /* Is this a hex string? */
297 if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) {
298 /* Yes, convert to int. */
300 p = (char *)&k->wi_keydat[0];
301 for (i = 2; s[i] != '\0' && s[i + 1] != '\0'; i+= 2) {
302 *p++ = (wi_hex2int(s[i]) << 4) + wi_hex2int(s[i + 1]);
306 errx(1, "hex strings must be of even length");
309 /* No, just copy it in. */
310 bcopy(s, k->wi_keydat, strlen(s));
311 k->wi_keylen = strlen(s);
318 wi_setkeys(const char *iface, char *key, int idx)
322 struct wi_ltv_keys *keys;
325 bzero((char *)&wreq, sizeof(wreq));
326 wreq.wi_len = WI_MAX_DATALEN;
327 wreq.wi_type = WI_RID_WEP_AVAIL;
329 wi_getval(iface, &wreq);
330 if (wreq.wi_val[0] == 0)
331 errx(1, "no WEP option available on this card");
333 bzero((char *)&wreq, sizeof(wreq));
334 wreq.wi_len = WI_MAX_DATALEN;
335 wreq.wi_type = WI_RID_DEFLT_CRYPT_KEYS;
337 wi_getval(iface, &wreq);
338 keys = (struct wi_ltv_keys *)&wreq;
340 keylen = strlen(key);
341 if (key[0] == '0' && (key[1] == 'x' || key[1] == 'X')) {
342 if (keylen != 2 && keylen != 12 && keylen != 28) {
343 errx(1, "encryption key must be 0, 10, or 26 "
347 if (keylen != 0 && keylen != 5 && keylen != 13) {
348 errx(1, "encryption key must be 0, 5, or 13 "
354 errx(1, "only 4 encryption keys available");
356 k = &keys->wi_keys[idx];
359 wreq.wi_len = (sizeof(struct wi_ltv_keys) / 2) + 1;
360 wreq.wi_type = WI_RID_DEFLT_CRYPT_KEYS;
361 wi_setval(iface, &wreq);
367 wi_printkeys(struct wi_req *wreq)
372 struct wi_ltv_keys *keys;
375 keys = (struct wi_ltv_keys *)wreq;
377 for (i = 0; i < 4; i++) {
378 k = &keys->wi_keys[i];
379 ptr = (char *)k->wi_keydat;
381 for (j = 0; j < k->wi_keylen; j++) {
382 if (!isprint(ptr[j])) {
389 printf("[ %s ]", ptr);
392 for (j = 0; j < k->wi_keylen; j++) {
393 printf("%02x", ptr[j] & 0xFF);
404 wi_printwords(struct wi_req *wreq)
409 for (i = 0; i < wreq->wi_len - 1; i++)
410 printf("%d ", wreq->wi_val[i]);
417 wi_printbool(struct wi_req *wreq)
428 wi_printhex(struct wi_req *wreq)
433 c = (unsigned char *)&wreq->wi_val;
436 for (i = 0; i < (wreq->wi_len - 1) * 2; i++) {
437 printf("%02x", c[i]);
438 if (i < ((wreq->wi_len - 1) * 2) - 1)
447 wi_printaplist(const char *iface)
449 int prism2, len, i = 0, j;
451 struct wi_scan_p2_hdr *wi_p2_h;
452 struct wi_scan_res *res;
454 printf("Available APs:\n");
456 /* first determine if this is a prism2 card or not */
457 wreq.wi_len = WI_MAX_DATALEN;
458 wreq.wi_type = WI_RID_PRISM2;
460 wi_getval(iface, &wreq);
461 prism2 = wreq.wi_val[0];
463 /* send out a scan request */
464 wreq.wi_len = prism2 ? 3 : 1;
465 wreq.wi_type = WI_RID_SCAN_REQ;
468 wreq.wi_val[0] = 0x3FFF;
469 wreq.wi_val[1] = 0x000F;
472 wi_setval(iface, &wreq);
475 * sleep for 100 milliseconds so there's enough time for the card to
476 * respond... prism2's take a little longer.
478 usleep(prism2 ? 500000 : 100000);
480 /* get the scan results */
481 wreq.wi_len = WI_MAX_DATALEN;
482 wreq.wi_type = WI_RID_SCAN_RES;
484 wi_getval(iface, &wreq);
487 wi_p2_h = (struct wi_scan_p2_hdr *)wreq.wi_val;
489 /* if the reason is 0, this info is invalid */
490 if (wi_p2_h->wi_reason == 0)
496 len = prism2 ? WI_PRISM2_RES_SIZE : WI_WAVELAN_RES_SIZE;
498 for (; i < (wreq.wi_len * 2) - len; i += len) {
499 res = (struct wi_scan_res *)((char *)wreq.wi_val + i);
501 res->wi_ssid[res->wi_ssid_len] = '\0';
503 printf(" %-8s [ %02x:%02x:%02x:%02x:%02x:%02x ] [ %-2d ] "
504 "[ %d %d %d ] %-3d ", res->wi_ssid,
505 res->wi_bssid[0], res->wi_bssid[1], res->wi_bssid[2],
506 res->wi_bssid[3], res->wi_bssid[4], res->wi_bssid[5],
507 res->wi_chan, res->wi_signal - res->wi_noise,
508 res->wi_signal, res->wi_noise, res->wi_interval);
510 if (res->wi_capinfo) {
512 if (res->wi_capinfo & WI_CAPINFO_ESS)
514 if (res->wi_capinfo & WI_CAPINFO_IBSS)
516 if (res->wi_capinfo & WI_CAPINFO_PRIV)
523 for (j = 0; res->wi_srates[j] != 0; j++) {
524 res->wi_srates[j] = res->wi_srates[j] &
526 printf("%d.%d ", res->wi_srates[j] / 2,
527 (res->wi_srates[j] % 2) * 5);
531 printf("* %2.1f *", res->wi_rate == 0xa ? 1 :
532 (res->wi_rate == 0x14 ? 2 :
533 (res->wi_rate == 0x37 ? 5.5 :
534 (res->wi_rate == 0x6e ? 11 : 0))));
543 #define WI_STRING 0x01
545 #define WI_WORDS 0x03
546 #define WI_HEXBYTES 0x04
547 #define WI_KEYSTRUCT 0x05
555 static struct wi_table wi_table[] = {
556 { WI_RID_SERIALNO, WI_STRING, "NIC serial number:\t\t\t" },
557 { WI_RID_NODENAME, WI_STRING, "Station name:\t\t\t\t" },
558 { WI_RID_OWN_SSID, WI_STRING, "SSID for IBSS creation:\t\t\t" },
559 { WI_RID_CURRENT_SSID, WI_STRING, "Current netname (SSID):\t\t\t" },
560 { WI_RID_DESIRED_SSID, WI_STRING, "Desired netname (SSID):\t\t\t" },
561 { WI_RID_CURRENT_BSSID, WI_HEXBYTES, "Current BSSID:\t\t\t\t" },
562 { WI_RID_CHANNEL_LIST, WI_WORDS, "Channel list:\t\t\t\t" },
563 { WI_RID_OWN_CHNL, WI_WORDS, "IBSS channel:\t\t\t\t" },
564 { WI_RID_CURRENT_CHAN, WI_WORDS, "Current channel:\t\t\t" },
565 { WI_RID_COMMS_QUALITY, WI_WORDS, "Comms quality/signal/noise:\t\t" },
566 { WI_RID_PROMISC, WI_BOOL, "Promiscuous mode:\t\t\t" },
567 { WI_RID_PROCFRAME, WI_BOOL, "Process 802.11b Frame:\t\t\t" },
568 { WI_RID_PRISM2, WI_WORDS, "Intersil-Prism2 based card:\t\t" },
569 { WI_RID_PORTTYPE, WI_WORDS, "Port type (1=BSS, 3=ad-hoc):\t\t"},
570 { WI_RID_MAC_NODE, WI_HEXBYTES, "MAC address:\t\t\t\t"},
571 { WI_RID_TX_RATE, WI_WORDS, "TX rate (selection):\t\t\t"},
572 { WI_RID_CUR_TX_RATE, WI_WORDS, "TX rate (actual speed):\t\t\t"},
573 { WI_RID_RTS_THRESH, WI_WORDS, "RTS/CTS handshake threshold:\t\t"},
574 { WI_RID_CREATE_IBSS, WI_BOOL, "Create IBSS:\t\t\t\t" },
575 { WI_RID_SYSTEM_SCALE, WI_WORDS, "Access point density:\t\t\t" },
576 { WI_RID_PM_ENABLED, WI_WORDS, "Power Mgmt (1=on, 0=off):\t\t" },
577 { WI_RID_MAX_SLEEP, WI_WORDS, "Max sleep time:\t\t\t\t" },
581 static struct wi_table wi_crypt_table[] = {
582 { WI_RID_ENCRYPTION, WI_BOOL, "WEP encryption:\t\t\t\t" },
583 { WI_RID_TX_CRYPT_KEY, WI_WORDS, "TX encryption key:\t\t\t" },
584 { WI_RID_DEFLT_CRYPT_KEYS, WI_KEYSTRUCT, "Encryption keys:\t\t\t" },
589 wi_dumpinfo(const char *iface)
595 bzero((char *)&wreq, sizeof(wreq));
597 wreq.wi_len = WI_MAX_DATALEN;
598 wreq.wi_type = WI_RID_WEP_AVAIL;
600 wi_getval(iface, &wreq);
601 has_wep = wreq.wi_val[0];
605 for (i = 0; w[i].wi_type; i++) {
606 bzero((char *)&wreq, sizeof(wreq));
608 wreq.wi_len = WI_MAX_DATALEN;
609 wreq.wi_type = w[i].wi_code;
611 wi_getval(iface, &wreq);
612 printf("%s", w[i].wi_str);
613 switch(w[i].wi_type) {
618 wi_printwords(&wreq);
634 for (i = 0; w[i].wi_type; i++) {
635 bzero((char *)&wreq, sizeof(wreq));
637 wreq.wi_len = WI_MAX_DATALEN;
638 wreq.wi_type = w[i].wi_code;
640 wi_getval(iface, &wreq);
641 printf("%s", w[i].wi_str);
642 switch(w[i].wi_type) {
647 if (wreq.wi_type == WI_RID_TX_CRYPT_KEY)
649 wi_printwords(&wreq);
668 wi_printaplist(iface);
674 wi_dumpstats(const char *iface)
677 struct wi_counters *c;
680 errx(1, "must specify interface name");
682 bzero((char *)&wreq, sizeof(wreq));
683 wreq.wi_len = WI_MAX_DATALEN;
684 wreq.wi_type = WI_RID_IFACE_STATS;
686 wi_getval(iface, &wreq);
688 c = (struct wi_counters *)&wreq.wi_val;
690 printf("Transmitted unicast frames:\t\t%d\n",
691 c->wi_tx_unicast_frames);
692 printf("Transmitted multicast frames:\t\t%d\n",
693 c->wi_tx_multicast_frames);
694 printf("Transmitted fragments:\t\t\t%d\n",
696 printf("Transmitted unicast octets:\t\t%d\n",
697 c->wi_tx_unicast_octets);
698 printf("Transmitted multicast octets:\t\t%d\n",
699 c->wi_tx_multicast_octets);
700 printf("Single transmit retries:\t\t%d\n",
701 c->wi_tx_single_retries);
702 printf("Multiple transmit retries:\t\t%d\n",
703 c->wi_tx_multi_retries);
704 printf("Transmit retry limit exceeded:\t\t%d\n",
705 c->wi_tx_retry_limit);
706 printf("Transmit discards:\t\t\t%d\n",
708 printf("Transmit discards due to wrong SA:\t%d\n",
709 c->wi_tx_discards_wrong_sa);
710 printf("Received unicast frames:\t\t%d\n",
711 c->wi_rx_unicast_frames);
712 printf("Received multicast frames:\t\t%d\n",
713 c->wi_rx_multicast_frames);
714 printf("Received fragments:\t\t\t%d\n",
716 printf("Received unicast octets:\t\t%d\n",
717 c->wi_rx_unicast_octets);
718 printf("Received multicast octets:\t\t%d\n",
719 c->wi_rx_multicast_octets);
720 printf("Receive FCS errors:\t\t\t%d\n",
721 c->wi_rx_fcs_errors);
722 printf("Receive discards due to no buffer:\t%d\n",
723 c->wi_rx_discards_nobuf);
724 printf("Can't decrypt WEP frame:\t\t%d\n",
725 c->wi_rx_WEP_cant_decrypt);
726 printf("Received message fragments:\t\t%d\n",
727 c->wi_rx_msg_in_msg_frags);
728 printf("Received message bad fragments:\t\t%d\n",
729 c->wi_rx_msg_in_bad_msg_frags);
737 fprintf(stderr, "usage: %s -i iface\n", p);
738 fprintf(stderr, "\t%s -i iface -o\n", p);
739 fprintf(stderr, "\t%s -i iface -l\n", p);
740 fprintf(stderr, "\t%s -i iface -t tx rate\n", p);
741 fprintf(stderr, "\t%s -i iface -n network name\n", p);
742 fprintf(stderr, "\t%s -i iface -s station name\n", p);
743 fprintf(stderr, "\t%s -i iface -c 0|1\n", p);
744 fprintf(stderr, "\t%s -i iface -q SSID\n", p);
745 fprintf(stderr, "\t%s -i iface -p port type\n", p);
746 fprintf(stderr, "\t%s -i iface -a access point density\n", p);
747 fprintf(stderr, "\t%s -i iface -m mac address\n", p);
748 fprintf(stderr, "\t%s -i iface -d max data length\n", p);
749 fprintf(stderr, "\t%s -i iface -e 0|1\n", p);
750 fprintf(stderr, "\t%s -i iface -k encryption key [-v 1|2|3|4]\n", p);
751 fprintf(stderr, "\t%s -i iface -r RTS threshold\n", p);
752 fprintf(stderr, "\t%s -i iface -f frequency\n", p);
753 fprintf(stderr, "\t%s -i iface -F 0|1\n", p);
754 fprintf(stderr, "\t%s -i iface -P 0|1\n", p);
755 fprintf(stderr, "\t%s -i iface -S max sleep duration\n", p);
756 fprintf(stderr, "\t%s -i iface -T 1|2|3|4\n", p);
758 fprintf(stderr, "\t%s -i iface -Z zero out signal cache\n", p);
759 fprintf(stderr, "\t%s -i iface -C print signal cache\n", p);
766 wi_dumpstations(const char *iface)
768 struct hostap_getall reqall;
769 struct hostap_sta stas[WIHAP_MAX_STATIONS];
773 bzero(&ifr, sizeof(ifr));
774 strlcpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
775 ifr.ifr_data = (caddr_t) & reqall;
776 bzero(&reqall, sizeof(reqall));
777 reqall.size = sizeof(stas);
779 bzero(&stas, sizeof(stas));
781 s = socket(AF_INET, SOCK_DGRAM, 0);
785 if (ioctl(s, SIOCHOSTAP_GETALL, &ifr) < 0)
786 err(1, "SIOCHOSTAP_GETALL");
788 printf("%d station%s:\n", reqall.nstations, reqall.nstations>1?"s":"");
789 for (i = 0; i < reqall.nstations; i++) {
790 struct hostap_sta *info = &stas[i];
792 printf("%02x:%02x:%02x:%02x:%02x:%02x asid=%04x",
793 info->addr[0], info->addr[1], info->addr[2],
794 info->addr[3], info->addr[4], info->addr[5],
795 info->asid - 0xc001);
796 printb(", flags", info->flags, HOSTAP_FLAGS_BITS);
797 printb(", caps", info->capinfo, IEEE80211_CAPINFO_BITS);
798 printb(", rates", info->rates, WI_RATES_BITS);
800 printf(", sig=%d/%d",
801 info->sig_info >> 8, info->sig_info & 0xff);
808 wi_zerocache(const char *iface)
813 errx(1, "must specify interface name");
815 bzero((char *)&wreq, sizeof(wreq));
817 wreq.wi_type = WI_RID_ZERO_CACHE;
819 wi_getval(iface, &wreq);
823 wi_readcache(const char *iface)
827 struct wi_sigcache *sc;
832 errx(1, "must specify interface name");
834 bzero((char *)&wreq, sizeof(wreq));
835 wreq.wi_len = WI_MAX_DATALEN;
836 wreq.wi_type = WI_RID_READ_CACHE;
838 wi_getval(iface, &wreq);
840 wi_sigitems = (int *) &wreq.wi_val;
841 pt = ((char *) &wreq.wi_val);
843 sc = (struct wi_sigcache *) pt;
845 for (i = 0; i < *wi_sigitems; i++) {
846 printf("[%d/%d]:", i+1, *wi_sigitems);
847 printf(" %02x:%02x:%02x:%02x:%02x:%02x,",
854 printf(" %d.%d.%d.%d,",((sc->ipsrc >> 0) & 0xff),
855 ((sc->ipsrc >> 8) & 0xff),
856 ((sc->ipsrc >> 16) & 0xff),
857 ((sc->ipsrc >> 24) & 0xff));
858 printf(" sig: %d, noise: %d, qual: %d\n",
870 main(int argc, char *argv[])
873 const char *iface = NULL;
878 /* Get the interface name */
880 ch = getopt(argc, argv, "i:");
884 if (argc > 1 && *argv[1] != '-') {
895 while((ch = getopt(argc, argv,
896 "a:hoc:d:e:f:i:k:lp:r:q:t:n:s:m:v:F:LP:S:T:ZC")) != -1) {
902 printf("WICACHE not available\n");
910 printf("WICACHE not available\n");
919 wi_setword(iface, WI_RID_CREATE_IBSS, atoi(optarg));
923 wi_setword(iface, WI_RID_MAX_DATALEN, atoi(optarg));
927 wi_setword(iface, WI_RID_ENCRYPTION, atoi(optarg));
931 wi_setword(iface, WI_RID_OWN_CHNL, atoi(optarg));
935 wi_setword(iface, WI_RID_PROCFRAME, atoi(optarg));
945 wi_dumpstations(iface);
949 wi_setword(iface, WI_RID_PORTTYPE, atoi(optarg));
953 wi_setword(iface, WI_RID_RTS_THRESH, atoi(optarg));
957 wi_setword(iface, WI_RID_TX_RATE, atoi(optarg));
961 wi_setstr(iface, WI_RID_DESIRED_SSID, optarg);
965 wi_setstr(iface, WI_RID_NODENAME, optarg);
969 wi_sethex(iface, WI_RID_MAC_NODE, optarg);
973 wi_setstr(iface, WI_RID_OWN_SSID, optarg);
977 wi_setword(iface, WI_RID_MAX_SLEEP, atoi(optarg));
982 WI_RID_TX_CRYPT_KEY, atoi(optarg) - 1);
986 wi_setword(iface, WI_RID_PM_ENABLED, atoi(optarg));
990 wi_setword(iface, WI_RID_SYSTEM_SCALE, atoi(optarg));
994 modifier = atoi(optarg);
1008 wi_setkeys(iface, key, modifier);