diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-05-20 17:28:42 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-05-20 17:28:42 +0000 |
commit | c066735fd34020c06fde7c3e53d428eebfe3d28b (patch) | |
tree | e1e0b7a6db52d1e58bb029a8c7103a3bf6cedc70 | |
parent | 4f4e089be4540fe3f157c0c5c0301b82fb62eea4 (diff) |
make this more like our wicontrol(8)
-rw-r--r-- | sbin/ancontrol/ancontrol.8 | 111 | ||||
-rw-r--r-- | sbin/ancontrol/ancontrol.c | 48 |
2 files changed, 65 insertions, 94 deletions
diff --git a/sbin/ancontrol/ancontrol.8 b/sbin/ancontrol/ancontrol.8 index 79b52277bac..fad3b8858ca 100644 --- a/sbin/ancontrol/ancontrol.8 +++ b/sbin/ancontrol/ancontrol.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ancontrol.8,v 1.3 2000/04/16 16:09:21 aaron Exp $ +.\" $OpenBSD: ancontrol.8,v 1.4 2000/05/20 17:28:41 deraadt Exp $ .\" .\" Copyright (c) 1997, 1998, 1999 .\" Bill Paul <wpaul@ee.columbia.edu> All rights reserved. @@ -40,50 +40,30 @@ .Nd configure Aironet 4500/4800 devices .Sh SYNOPSIS .Nm ancontrol -.Fl i Ar iface Fl A -.Nm ancontrol -.Fl i Ar iface Fl N -.Nm ancontrol -.Fl i Ar iface Fl S -.Nm ancontrol -.Fl i Ar iface Fl I -.Nm ancontrol -.Fl i Ar iface Fl T -.Nm ancontrol -.Fl i Ar iface Fl C -.Nm ancontrol -.Fl i Ar iface Fl t Ar 0|1|2|3|4 -.Nm ancontrol -.Fl i Ar iface Fl s Ar 0|1|2|3 -.Nm ancontrol -.Fl i Ar iface Fl a Ar AP +.Ar interface +.Op Fl A +.Op Fl N +.Op Fl S +.Op Fl I +.Op Fl T +.Op Fl C +.Op Fl t Ar 0|1|2|3|4 +.Op Fl s Ar 0|1|2|3 +.Op Fl a Ar AP .Op Fl v Ar 1|2|3|4 -.Nm ancontrol -.Fl i Ar iface Fl b Ar beacon period -.Nm ancontrol -.Fl i Ar iface Fl d Ar 0|1|2|3 -.Op v Ar 0|1 -.Nm ancontrol -.Fl i Ar iface Fl j Ar netjoin timeout -.Nm ancontrol -.Fl i Ar iface Fl l Ar station name -.Nm ancontrol -.Fl i Ar iface Fl m Ar mac address -.Nm ancontrol -.Fl i Ar iface Fl n Ar SSID +.Op Fl b Ar beacon period +.Op Fl d Ar 0|1|2|3 +.Op Fl v Ar 0|1 +.Op Fl j Ar netjoin timeout +.Op Fl l Ar station name +.Op Fl m Ar macaddress +.Op Fl n Ar SSID .Op Fl v Ar 1|2|3 -.Nm ancontrol -.Fl i Ar iface Fl o Ar 0|1 -.Nm ancontrol -.Fl i Ar iface Fl p Ar tx power -.Nm ancontrol -.Fl i Ar iface Fl c Ar channel number -.Nm ancontrol -.Fl i Ar iface Fl f Ar fragmentation threshold -.Nm ancontrol -.Fl i Ar iface Fl r Ar RTS threshold -.Nm ancontrol -.Fl h +.Op Fl o Ar 0|1 +.Op Fl p Ar tx power +.Op Fl c Ar channel number +.Op Fl f Ar fragmentation threshold +.Op Fl r Ar RTS threshold .Sh DESCRIPTION The .Nm @@ -110,7 +90,7 @@ device (e.g., an0, an1, etc...). .Pp The options are as follows: .Bl -tag -width Fl -.It Fl i Ar iface Fl A +.It Fl A Display the preferred access point list. The AP list can be used by stations to specify the MAC address of access points with which it @@ -122,14 +102,14 @@ The AP list can be modified with the .Fl a option. -.It Fl i Ar iface Fl N +.It Fl N Display the SSID list. This is a list of service set IDs (i.e., network names) with which the station wishes to associate. There may be up to three SSIDs in the list: the station will go through the list in ascending order and associate with the first matching SSID that it finds. -.It Fl i Ar iface Fl S +.It Fl S Display NIC status information. This includes the current operating status, current BSSID, SSID, channel, beacon period, and currently @@ -146,18 +126,18 @@ station, or become a itself. The beacon period can be anything between 20 and 976 milliseconds. The default is 100. -.It Fl i Ar iface Fl I +.It Fl I Display NIC capability information. This shows the device type, frequency, speed, and power level capablities and firmware revision levels. -.It Fl i Ar iface Fl T +.It Fl T Display the NIC's internal statistics counters. -.It Fl i Ar iface Fl C +.It Fl C Display current NIC configuration. This shows the current operation mode, receive mode, MAC address, power save settings, various timing settings, channel selection, diversity, transmit power, and transmit speed. -.It Fl i Ar iface Fl t Ar 0|1|2|3|4 +.It Fl t Ar 0|1|2|3|4 Select transmit speed. The available settings are as follows: .Bd -filled -offset indent @@ -173,7 +153,7 @@ The available settings are as follows: .Pp Note that the 5.5 and 11Mbps settings are only supported on the 4800 series adapters: the 4500 series adapters have a maximum speed of 2Mbps. -.It Fl i Ar iface Fl s Ar 0|1|2|3 +.It Fl s Ar 0|1|2|3 Set power save mode. Valid selections are as follows: .Bd -filled -offset indent @@ -188,7 +168,7 @@ Valid selections are as follows: .Pp Note that for IBSS (ad-hoc) mode, only PSP mode is supported, and only if the ATIM window is non-zero. -.It Fl i Ar iface Fl a Ar AP "[-v 1|2|3|4]" +.It Fl a Ar AP Fl v Ar "1|2|3|4 Set preferred access point. The .Ar AP @@ -204,12 +184,12 @@ modified. If the .Fl v flag is not used, the first AP list entry will be changed. -.It Fl i Ar iface Fl b Ar beacon period +.It Fl b Ar beacon period Set the ad-hoc mode beacon period. The becon period is specified in milliseconds. The default is 100ms. -.It Fl i Ar iface Fl d Ar 0|1|2|3 "-v 0|1" +.It Fl d Ar 0|1|2|3 Fl v Ar "0|1" Select the antenna diversity. Aironet devices can be configured with up to two antennas, and transmit and receive diversity can be configured @@ -234,7 +214,7 @@ option: selection sets the receive diversity and .Ar 1 sets the transmit diversity. -.It Fl i Ar iface Fl j Ar netjoin timeout +.It Fl j Ar netjoin timeout Set the ad-hoc network join timeout. When a station is first activated in ad-hoc mode, it will search out a 'master' station with the desired @@ -246,7 +226,7 @@ This timeout defaults to 10000 milliseconds (10 seconds) but may be changed with this option. The timeout should be specified in milliseconds. -.It i Ar iface Fl l Ar station name +.Fl l Ar station name Set the station name used internally by the NIC. The .Ar station name @@ -254,15 +234,15 @@ can be any text string up to 16 characters in length. The default name is set by the driver to .Qq OpenBSD . -.It Fl i Ar iface Fl m Ar mac address +.It Fl m Ar macaddress Set the station address for the specified interface. The -.Ar mac address +.Ar macaddress is specified as a series of six hexadecimal values separated by colons, e.g.: 00:60:1d:12:34:56. This programs the new address into the card and updates the interface as well. -.It Fl i Ar iface Fl n Ar SSID "[-v 1|2|3]" +.It Fl n Ar SSID "[-v 1|2|3]" Set the desired SSID (network name). There are three SSIDs which allows the NIC to work with access points at several locations without needing @@ -275,7 +255,7 @@ modifier option. If the .Fl v flag isn't used, the first SSID in the list is set. -.It Fl i Ar iface Fl o Ar 0|1 +.It Fl o Ar 0|1 Set the operating mode of the Aironet interface. Valid selections are .Ar 0 @@ -284,7 +264,7 @@ for ad-hoc mode and for infrastructure mode. The default driver setting is for ad-hoc mode. -.It Fl i Ar iface Fl p Ar tx power +.It Fl p Ar tx power Set the transmit power level in milliwatts. Valid power settings vary depending on the actual NIC and can be viewed by dumping the @@ -294,7 +274,7 @@ flag. Typical values are 1, 5, 20, 50, and 100mW. Selecting 0 sets the factory default. -.It Fl i Ar iface Fl c Ar channel +.It Fl c Ar channel Set the radio frequency of a given interface. The .Ar frequency @@ -334,7 +314,7 @@ For NICs sold in France, the default channel is 11. For NICs sold in Japan, the only available channel is 14. Note that two stations must be set to the same channel in order to communicate. -.It Fl i Ar iface Fl f Ar fragmentation threshold +.It Fl f Ar fragmentation threshold Set the fragmentation threshold in bytes. This threshold controls the point at which outgoing packets will be split into multiple fragments. @@ -343,7 +323,7 @@ need to be retransmitted instead of the whole packet. The fragmentation threshold can be anything from 64 to 2312 bytes. The default is 2312. -.It Fl i Ar iface Fl r Ar RTS threshold +.It Fl r Ar RTS threshold Set the RTS/CTS threshold for a given interface. This controls the number of bytes used for the RTS/CTS handhake boundary. @@ -356,6 +336,9 @@ Prints a list of available options and sample usage. .El .Sh SEE ALSO .Xr an 4 , +.Xr wi 4 , +.Xr wicontrol 4 , +.Xr hostname.if 8 , .Xr ifconfig 8 .Sh AUTHORS The diff --git a/sbin/ancontrol/ancontrol.c b/sbin/ancontrol/ancontrol.c index 31d83a0c35b..986fc863c96 100644 --- a/sbin/ancontrol/ancontrol.c +++ b/sbin/ancontrol/ancontrol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ancontrol.c,v 1.1 2000/04/03 01:08:09 mickey Exp $ */ +/* $OpenBSD: ancontrol.c,v 1.2 2000/05/20 17:28:41 deraadt Exp $ */ /* * Copyright 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -786,34 +786,16 @@ void usage(p) char *p; { - fprintf(stderr, "usage: %s -i iface -A (show specified APs)\n", p); - fprintf(stderr, "\t%s -i iface -N (show specified SSIDss)\n", p); - fprintf(stderr, "\t%s -i iface -S (show NIC status)\n", p); - fprintf(stderr, "\t%s -i iface -I (show NIC capabilities)\n", p); - fprintf(stderr, "\t%s -i iface -T (show stats counters)\n", p); - fprintf(stderr, "\t%s -i iface -C (show current config)\n", p); - fprintf(stderr, "\t%s -i iface -t 0|1|2|3|4 (set TX speed)\n", p); - fprintf(stderr, "\t%s -i iface -s 0|1|2|3 (set power same mode)\n", p); - fprintf(stderr, "\t%s -i iface [-v 1|2|3|4] -a AP (specify AP)\n", p); - fprintf(stderr, "\t%s -i iface -b val (set beacon period)\n", p); - fprintf(stderr, "\t%s -i iface [-v 0|1] -d val (set diversity)\n", p); - fprintf(stderr, "\t%s -i iface -j val (set netjoin timeout)\n", p); - fprintf(stderr, "\t%s -i iface -l val (set station name)\n", p); - fprintf(stderr, "\t%s -i iface -m val (set MAC address)\n", p); - fprintf(stderr, "\t%s -i iface [-v 1|2|3] -n SSID " - "(specify SSID)\n", p); - fprintf(stderr, "\t%s -i iface -o 0|1 (set operating mode)\n", p); - fprintf(stderr, "\t%s -i iface -c val (set ad-hoc channel)\n", p); - fprintf(stderr, "\t%s -i iface -f val (set frag threshold)\n", p); - fprintf(stderr, "\t%s -i iface -r val (set RTS threshold)\n", p); + fprintf(stderr, + "usage: ancontrol interface [-A] [-N] [-S] [-I] [-T] [-C] [-t 0|1|2|3|4]\n" + " [-s 0|1|2|3] [-a AP] [-v 1|2|3|4] [-b beacon period] [-d 0|1|2|3]\n" + " [-v 0|1] [-j netjoin timeout] [-l station name] [-m macaddress]\n" + " [-n SSID] [-v 1|2|3] [-o 0|1] [-p tx power] [-c channel number]\n" + " [-f fragmentation threshold] [-r RTS threshold]\n"); #ifdef ANCACHE - fprintf(stderr, "\t%s -i iface -Q print signal quality cache\n", p); - fprintf(stderr, "\t%s -i iface -Z zero out signal cache\n", p); + fprintf(stderr, + " [-Q] [-Z]\n"); #endif - - fprintf(stderr, "\t%s -h (display this message)\n", p); - - exit(1); } @@ -1147,8 +1129,14 @@ main(argc, argv) void *arg = NULL; char *p = argv[0]; + if (argc > 1 && argv[1][0] != '-') { + iface = argv[1]; + memcpy(&argv[1], &argv[2], argc * sizeof(char *)); + argc--; + } + while ((ch = getopt(argc, argv, - "i:ANISCTht:a:o:s:n:v:d:j:b:c:r:p:w:m:l:QZ")) != -1) { + "i:ANISCTt:a:o:s:n:v:d:j:b:c:r:p:w:m:l:QZ")) != -1) { switch(ch) { case 'Z': #ifdef ANCACHE @@ -1165,7 +1153,8 @@ main(argc, argv) #endif break; case 'i': - iface = optarg; + if (iface == NULL) + iface = optarg; break; case 'A': act = ACT_DUMPAP; @@ -1298,7 +1287,6 @@ main(argc, argv) act = ACT_SET_WAKE_DURATION; arg = optarg; break; - case 'h': default: usage(p); } |