diff options
author | wpaul <wpaul@FreeBSD.org> | 1999-05-05 07:37:11 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1999-05-05 07:37:11 +0000 |
commit | fd47563fe449bc68eedf485677029899cbb99171 (patch) | |
tree | 6fda3b95841c793f0ebfb4afe67a6ec13e313f0b /usr.sbin/wicontrol | |
parent | 44741b5aa7dec45f5a55515334a0dc37426ac861 (diff) | |
download | FreeBSD-src-fd47563fe449bc68eedf485677029899cbb99171.zip FreeBSD-src-fd47563fe449bc68eedf485677029899cbb99171.tar.gz |
Add device driver support for the Lucent WaveLAN/IEEE 802.11 PCMCIA
adapter (and some workalikes). Also add man pages and a wicontrol
utility to manipulate some of the card parameters.
This driver was written using information gleaned from the Lucent HCF Light
library, though it does not use any of the HCF Light code itself, mainly
because it's contaminated by the GPL (but also because it's pretty gross).
The HCF Light lacks certain featurs from the full (but proprietary) HCF
library, including 802.11 frame encapsulation support, however it has
just enough register information about the Hermes chip to allow someone
with enough spare time and energy to implement a proper driver. (I would
have prefered getting my hands on the Hermes manual, but that's proprietary
too. For those who are wondering, the Linux driver uses the proprietary
HCF library, but it's provided in object code form only.)
Note that I do not have access to a WavePOINT access point, so I have
only been able to test ad-hoc mode. The wicontrol utility can turn on
BSS mode, but I don't know for certain that the NIC will associate with
an access point correctly. Testers are encouraged to send their results
to me so that I can find out if I screwed up or not.
Diffstat (limited to 'usr.sbin/wicontrol')
-rw-r--r-- | usr.sbin/wicontrol/Makefile | 9 | ||||
-rw-r--r-- | usr.sbin/wicontrol/wicontrol.8 | 187 | ||||
-rw-r--r-- | usr.sbin/wicontrol/wicontrol.c | 499 |
3 files changed, 695 insertions, 0 deletions
diff --git a/usr.sbin/wicontrol/Makefile b/usr.sbin/wicontrol/Makefile new file mode 100644 index 0000000..971f12c --- /dev/null +++ b/usr.sbin/wicontrol/Makefile @@ -0,0 +1,9 @@ +# $Id: Makefile,v 1.2 1997/05/23 04:04:15 msmith Exp $ +PROG= wicontrol +SRCS= wicontrol.c + +CFLAGS+= -Wall + +MAN8= wicontrol.8 + +.include <bsd.prog.mk> diff --git a/usr.sbin/wicontrol/wicontrol.8 b/usr.sbin/wicontrol/wicontrol.8 new file mode 100644 index 0000000..629a9c7 --- /dev/null +++ b/usr.sbin/wicontrol/wicontrol.8 @@ -0,0 +1,187 @@ +.\" Copyright (c) 1997, 1998, 1999 +.\" Bill Paul <wpaul@ctr.columbia.edu> All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Bill Paul. +.\" 4. Neither the name of the author nor the names of any co-contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +.\" THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $Id$ +.\" +.Dd April 21, 1999 +.Dt WICONTROL 8 +.Os FreeBSD 3.0 +.Sh NAME +.Nm wicontrol +.Nd configure WaveLAN/IEEE devices +.Sh SYNOPSIS +.Nm wicontrol +.Fl i Ar iface Op Fl o +.Nm wicontrol +.Fl i Ar iface Fl t Ar tx rate +.Nm wicontrol +.Fl i Ar iface Fl n Ar network name +.Nm wicontrol +.Fl i Ar iface Fl s Ar station name +.Nm wicontrol +.Fl i Ar iface Fl c Ar 0|1 +.Nm wicontrol +.Fl i Ar iface Fl q Ar SSID +.Nm wicontrol +.Fl i Ar iface Fl p Ar port type +.Nm wicontrol +.Fl i Ar iface Fl a Ar access point density +.Nm wicontrol +.Fl i Ar iface Fl m Ar mac address +.Nm wicontrol +.Fl i Ar iface Fl d Ar max data length +.Nm wicontrol +.Fl i Ar iface Fl r Ar RTS threshold +.Sh DESCRIPTION +The +.Nm +command controls the operation of WaveLAN/IEEE wireless networking +devices via the +.Xr wi 4 +driver. Most of the parameters that can be changed relate to the +IEEE 802.11 protocol which the WaveLAN implements. This includes +the station name, whether the station is operating in ad-hoc (point +to point) or BSS (service set) mode, and the network name of a service +set to join (IBSS) if BSS mode is enabled. The +.Nm +command can also be used to view the current settings of these paremeters +and to dump out the values of the card's statistics counters. +.Pp +The +.Ar iface +argument given to +.Nm +should be the logical interface name associated with the WaveLAN/IEEE +device (wi0, wi1, etc...). Interface parameters should only be changed +when the interface is down. If the interface is already up, you should +use the +.Xr ifconfig 8 +command to bring the interface down, then set the interface parameters +with +.Nm , +and then bring the interface up again. +.Sh OPTIONS +The options are as follows: +.Bl -tag -width Fl +.It Fl i Ar iface Op Fl o +Display the current settings of the specified WaveLAN/IEEE interface. +This retrives the current card settings from the driver and prints them +out. Using the additional +.Fl o +flag will cause +.Nm +to print out the statistics counters instead of the card settings. +.It Fl i Ar iface Fl t Ar tx rate +Set the transmit rate of the specified interface. The permitted values +for the transmit rate are 1, 2 and 3, where 1 is fixed 1Mbps, 2 is +fixed 2Mbps and 3 is 2Mbps with automatic fallback to 1Mbps. The default +driver setting is 3. +.It Fl i Ar iface Fl n Ar network name +Set the name of the service set (IBSS) that this station wishes to +join. The +.Ar network name +can be any text string up to 30 characters in length. The default name +is the string "ANY" which should allow the station to connect to the first +available access point. The interface should be set for BSS mode using +the +.Fl p +flag in order for this to work. +.Pp +Note: the WaveLAN manual indicates that an empty string will allow the +host to connect to any access point, however I have also seen a reference +in another driver which indicates that the "ANY" string works as well. +.It Fl i Ar iface Fl s Ar station name +Sets the +.Ar station name +for the specified interface. The +.Ar station name +is used for diagnostic purposes. The Lucent WaveMANAGER sofware can +poll the names of remove hosts. +.It Fl i Ar iface Fl c Ar 0|1 +Allow the station to create a service set (IBSS). Permitted values +are 0 (don't create IBSS) and 1 (enable creation of IBSS). The default +is 0. +.Pp +Note: this option is provided for experimental purposes only: enabling +the creation of an IBSS on a host system doesn't appear to actually work. +.It Fl i Ar iface Fl q Ar SSID +Specify the name of an IBSS (SSID) to create on a given interface. +The +.Ar SSID +can be any text string up to 30 characters long. +.Pp +Note: this option is provided for experimental purposes only: enabling +the creation of an IBSS on a host system doesn't appear to actually work. +.It Fl i Ar iface Fl p Ar port type +Set the +.Ar port type +for a specified interface. The legal values for +.Ar port type +are 1 (BSS mode) and 3 (ad-hoc) mode. In ad-hoc mode, the station can +comminicate directly with any other stations within direct radio range +(provided that they are also operating in ad-hoc mode). In BSS mode, +hosts must associate with a service set controlled by an access point, +which relays traffic between end stations. The default setting is 3 +(ad-hoc mode). +.It Fl i Ar iface Fl a Ar access_point_density +Specify the +.Ar access point density +for a given interface. Legal values are 1 (low), 2 (medium) and 3 (high). +This setting influences some of the radio modem threshold settings. +.It Fl i Ar iface Fl m Ar mac address +Set the station address for the specified interface. The +.Ar mac address +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 d Ar max_data_length +Set the maximum receive and transmit frame size for a specified interface. +The +.Ar max data length +can be any number from 350 to 2304. The default is 2304. +.It Fl i Ar iface 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. The +.Ar RTS threshold +can be any value between 0 and 2047. The default is 2347. +.El +.Sh SEE ALSO +.Xr wi 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +command first appeared in +.Fx 3.0 . +.Sh AUTHOR +The +.Nm +command was written by +.An Bill Paul Aq wpaul@ctr.columbia.edu . diff --git a/usr.sbin/wicontrol/wicontrol.c b/usr.sbin/wicontrol/wicontrol.c new file mode 100644 index 0000000..3c0f490 --- /dev/null +++ b/usr.sbin/wicontrol/wicontrol.c @@ -0,0 +1,499 @@ +/* + * Copyright (c) 1997, 1998, 1999 + * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Bill Paul. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id: wicontrol.c,v 1.14 1999/05/05 01:33:16 wpaul Exp $ + */ + +#include <sys/types.h> +#include <sys/cdefs.h> +#include <sys/param.h> +#include <sys/socket.h> +#include <sys/ioctl.h> +#include <sys/socket.h> + +#include <net/if.h> +#include <net/if_var.h> +#include <net/ethernet.h> + +#include <machine/if_wavelan_ieee.h> + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <err.h> + +#if !defined(lint) +static const char copyright[] = "@(#) Copyright (c) 1997, 1998, 1999\ + Bill Paul. All rights reserved."; +static const char rcsid[] = + "@(#) $Id: wicontrol.c,v 1.14 1999/05/05 01:33:16 wpaul Exp $"; +#endif + +static void wi_getval __P((char *, struct wi_req *)); +static void wi_setval __P((char *, struct wi_req *)); +static void wi_printstr __P((struct wi_req *)); +static void wi_setstr __P((char *, int, char *)); +static void wi_setbytes __P((char *, int, char *, int)); +static void wi_setword __P((char *, int, int)); +static void wi_sethex __P((char *, int, char *)); +static void wi_printwords __P((struct wi_req *)); +static void wi_printbool __P((struct wi_req *)); +static void wi_printhex __P((struct wi_req *)); +static void wi_dumpinfo __P((char *)); +static void usage __P((char *)); + +static void wi_getval(iface, wreq) + char *iface; + struct wi_req *wreq; +{ + struct ifreq ifr; + int s; + + bzero((char *)&ifr, sizeof(ifr)); + + strcpy(ifr.ifr_name, iface); + ifr.ifr_data = (caddr_t)wreq; + + s = socket(AF_INET, SOCK_DGRAM, 0); + + if (s == -1) + err(1, "socket"); + + if (ioctl(s, SIOCGWAVELAN, &ifr) == -1) + err(1, "SIOCGWAVELAN"); + + close(s); + + return; +} + +static void wi_setval(iface, wreq) + char *iface; + struct wi_req *wreq; +{ + struct ifreq ifr; + int s; + + bzero((char *)&ifr, sizeof(ifr)); + + strcpy(ifr.ifr_name, iface); + ifr.ifr_data = (caddr_t)wreq; + + s = socket(AF_INET, SOCK_DGRAM, 0); + + if (s == -1) + err(1, "socket"); + + if (ioctl(s, SIOCSWAVELAN, &ifr) == -1) + err(1, "SIOCSWAVELAN"); + + close(s); + + return; +} + +void wi_printstr(wreq) + struct wi_req *wreq; +{ + char *ptr; + int i; + + if (wreq->wi_type == WI_RID_SERIALNO) { + ptr = (char *)&wreq->wi_val; + for (i = 0; i < (wreq->wi_len - 1) * 2; i++) { + if (ptr[i] == '\0') + ptr[i] = ' '; + } + } else { + ptr = (char *)&wreq->wi_val[1]; + for (i = 0; i < ntohs(wreq->wi_val[0]); i++) { + if (ptr[i] == '\0') + ptr[i] = ' '; + } + } + + ptr[i] = '\0'; + printf("[ %s ]", ptr); + + return; +} + +void wi_setstr(iface, code, str) + char *iface; + int code; + char *str; +{ + struct wi_req wreq; + + if (iface == NULL) + errx(1, "must specify interface name"); + + if (str == NULL) + errx(1, "must specify string"); + + bzero((char *)&wreq, sizeof(wreq)); + + if (strlen(str) > 30) + errx(1, "string too long"); + + wreq.wi_type = code; + wreq.wi_len = 18; + wreq.wi_val[0] = htons(strlen(str)); + bcopy(str, (char *)&wreq.wi_val[1], strlen(str)); + + wi_setval(iface, &wreq); + + return; +} + +void wi_setbytes(iface, code, bytes, len) + char *iface; + int code; + char *bytes; + int len; +{ + struct wi_req wreq; + + if (iface == NULL) + errx(1, "must specify interface name"); + + bzero((char *)&wreq, sizeof(wreq)); + + wreq.wi_type = code; + wreq.wi_len = (len / 2) + 1; + bcopy(bytes, (char *)&wreq.wi_val[0], len); + + wi_setval(iface, &wreq); + + return; +} + +void wi_setword(iface, code, word) + char *iface; + int code; + int word; +{ + struct wi_req wreq; + + bzero((char *)&wreq, sizeof(wreq)); + + wreq.wi_type = code; + wreq.wi_len = 2; + wreq.wi_val[0] = word; + + wi_setval(iface, &wreq); + + return; +} + +void wi_sethex(iface, code, str) + char *iface; + int code; + char *str; +{ + struct ether_addr *addr; + + if (str == NULL) + errx(1, "must specify address"); + + addr = ether_aton(str); + + if (addr == NULL) + errx(1, "badly formatted address"); + + wi_setbytes(iface, code, (char *)addr, ETHER_ADDR_LEN); + + return; +} + +void wi_printwords(wreq) + struct wi_req *wreq; +{ + int i; + + printf("[ "); + for (i = 0; i < wreq->wi_len - 1; i++) + printf("%d ", wreq->wi_val[i]); + printf("]"); + + return; +} + +void wi_printbool(wreq) + struct wi_req *wreq; +{ + if (wreq->wi_val[0]) + printf("[ On ]"); + else + printf("[ Off ]"); + + return; +} + +void wi_printhex(wreq) + struct wi_req *wreq; +{ + int i; + unsigned char *c; + + c = (unsigned char *)&wreq->wi_val; + + printf("[ "); + for (i = 0; i < (wreq->wi_len - 1) * 2; i++) { + printf("%02x", c[i]); + if (i < ((wreq->wi_len - 1) * 2) - 1) + printf(":"); + } + + printf(" ]"); + return; +} + +#define WI_STRING 0x01 +#define WI_BOOL 0x02 +#define WI_WORDS 0x03 +#define WI_HEXBYTES 0x04 + +struct wi_table { + int wi_code; + int wi_type; + char *wi_str; +}; + +static struct wi_table wi_table[] = { + { WI_RID_SERIALNO, WI_STRING, "NIC serial number:\t\t\t" }, + { WI_RID_NODENAME, WI_STRING, "Station name:\t\t\t\t" }, + { WI_RID_OWN_SSID, WI_STRING, "SSID for IBSS creation:\t\t\t" }, + { WI_RID_CURRENT_SSID, WI_STRING, "Current netname (SSID):\t\t\t" }, + { WI_RID_DESIRED_SSID, WI_STRING, "Desired netname (SSID):\t\t\t" }, + { WI_RID_CURRENT_BSSID, WI_HEXBYTES, "Current BSSID:\t\t\t\t" }, + { WI_RID_CHANNEL_LIST, WI_WORDS, "Channel list:\t\t\t\t" }, + { WI_RID_OWN_CHNL, WI_WORDS, "IBSS channel:\t\t\t\t" }, + { WI_RID_CURRENT_CHAN, WI_WORDS, "Current channel:\t\t\t" }, + { WI_RID_COMMS_QUALITY, WI_WORDS, "Comms quality/signal/noise:\t\t" }, + { WI_RID_PROMISC, WI_BOOL, "Promiscuous mode:\t\t\t" }, + { WI_RID_PORTTYPE, WI_WORDS, "Port type (1=BSS, 3=ad-hoc):\t\t"}, + { WI_RID_MAC_NODE, WI_HEXBYTES, "MAC address:\t\t\t\t"}, + { WI_RID_TX_RATE, WI_WORDS, "TX rate (1=1Mbps, 2=2Mbps, 3=auto):\t"}, + { WI_RID_RTS_THRESH, WI_WORDS, "RTS/CTS handshake threshold:\t\t"}, + { WI_RID_CREATE_IBSS, WI_BOOL, "Create IBSS:\t\t\t\t" }, + { WI_RID_SYSTEM_SCALE, WI_WORDS, "Access point density:\t\t\t" }, + { 0, NULL } +}; + +static void wi_dumpinfo(iface) + char *iface; +{ + struct wi_req wreq; + int i; + struct wi_table *w; + + w = wi_table; + + for (i = 0; w[i].wi_type; i++) { + bzero((char *)&wreq, sizeof(wreq)); + + wreq.wi_len = WI_MAX_DATALEN; + wreq.wi_type = w[i].wi_code; + + wi_getval(iface, &wreq); + printf("%s", w[i].wi_str); + switch(w[i].wi_type) { + case WI_STRING: + wi_printstr(&wreq); + break; + case WI_WORDS: + wi_printwords(&wreq); + break; + case WI_BOOL: + wi_printbool(&wreq); + break; + case WI_HEXBYTES: + wi_printhex(&wreq); + break; + default: + break; + } + printf("\n"); + } + + return; +} + +static void wi_dumpstats(iface) + char *iface; +{ + struct wi_req wreq; + struct wi_counters *c; + + if (iface == NULL) + errx(1, "must specify interface name"); + + bzero((char *)&wreq, sizeof(wreq)); + wreq.wi_len = WI_MAX_DATALEN; + wreq.wi_type = WI_RID_IFACE_STATS; + + wi_getval(iface, &wreq); + + c = (struct wi_counters *)&wreq.wi_val; + + printf("Transmitted unicast frames:\t\t%d\n", + c->wi_tx_unicast_frames); + printf("Transmitted multicast frames:\t\t%d\n", + c->wi_tx_multicast_frames); + printf("Transmitted fragments:\t\t\t%d\n", + c->wi_tx_fragments); + printf("Transmitted unicast octets:\t\t%d\n", + c->wi_tx_unicast_octets); + printf("Transmitted multicast octets:\t\t%d\n", + c->wi_tx_multicast_octets); + printf("Single transmit retries:\t\t%d\n", + c->wi_tx_single_retries); + printf("Multiple transmit retries:\t\t%d\n", + c->wi_tx_multi_retries); + printf("Transmit retry limit exceeded:\t\t%d\n", + c->wi_tx_retry_limit); + printf("Transmit discards:\t\t\t%d\n", + c->wi_tx_discards); + printf("Transmit discards due to wrong SA:\t%d\n", + c->wi_tx_discards_wrong_sa); + printf("Received unicast frames:\t\t%d\n", + c->wi_rx_unicast_frames); + printf("Received multicast frames:\t\t%d\n", + c->wi_rx_multicast_frames); + printf("Received fragments:\t\t\t%d\n", + c->wi_rx_fragments); + printf("Received unicast octets:\t\t%d\n", + c->wi_rx_unicast_octets); + printf("Received multicast octets:\t\t%d\n", + c->wi_rx_multicast_octets); + printf("Receive FCS errors:\t\t\t%d\n", + c->wi_rx_fcs_errors); + printf("Receive discards due to no buffer:\t%d\n", + c->wi_rx_discards_nobuf); + printf("Can't decrypt WEP frame:\t\t%d\n", + c->wi_rx_WEP_cant_decrypt); + printf("Received message fragments:\t\t%d\n", + c->wi_rx_msg_in_msg_frags); + printf("Received message bad fragments:\t\t%d\n", + c->wi_rx_msg_in_bad_msg_frags); + + return; +} + +static void usage(p) + char *p; +{ + fprintf(stderr, "usage: %s -i iface\n", p); + fprintf(stderr, "\t%s -i iface -o\n", p); + fprintf(stderr, "\t%s -i iface -t tx rate\n", p); + fprintf(stderr, "\t%s -i iface -n network name\n", p); + fprintf(stderr, "\t%s -i iface -s station name\n", p); + fprintf(stderr, "\t%s -i iface -c create IBSS\n", p); + fprintf(stderr, "\t%s -i iface -q SSID of IBSS to create\n", p); + fprintf(stderr, "\t%s -i iface -p port type\n", p); + fprintf(stderr, "\t%s -i iface -a access point density\n", p); + fprintf(stderr, "\t%s -i iface -m mac address\n", p); + fprintf(stderr, "\t%s -i iface -d max data length\n", p); + fprintf(stderr, "\t%s -i iface -r RTS threshold\n", p); + + exit(1); +} + +int main(argc, argv) + int argc; + char *argv[]; +{ + int ch; + char *iface = NULL; + char *p = argv[0]; + + while((ch = getopt(argc, argv, "hoc:d:i:p:r:q:t:n:s:m:")) != -1) { + switch(ch) { + case 'o': + wi_dumpstats(iface); + exit(0); + break; + case 'i': + iface = optarg; + break; + case 'c': + wi_setword(iface, WI_RID_CREATE_IBSS, atoi(optarg)); + exit(0); + break; + case 'd': + wi_setword(iface, WI_RID_MAX_DATALEN, atoi(optarg)); + exit(0); + break; + case 'p': + wi_setword(iface, WI_RID_PORTTYPE, atoi(optarg)); + exit(0); + break; + case 'r': + wi_setword(iface, WI_RID_RTS_THRESH, atoi(optarg)); + exit(0); + break; + case 't': + wi_setword(iface, WI_RID_TX_RATE, atoi(optarg)); + exit(0); + break; + case 'n': + wi_setstr(iface, WI_RID_DESIRED_SSID, optarg); + exit(0); + break; + case 's': + wi_setstr(iface, WI_RID_NODENAME, optarg); + exit(0); + break; + case 'm': + wi_sethex(iface, WI_RID_MAC_NODE, optarg); + exit(0); + break; + case 'q': + wi_setstr(iface, WI_RID_OWN_SSID, optarg); + exit(0); + break; + case 'h': + default: + usage(p); + break; + } + } + + if (iface == NULL) + usage(p); + + wi_dumpinfo(iface); + + exit(0); +} |