From 14d6c54105f6b338c831fe5ca613bae46f70be69 Mon Sep 17 00:00:00 2001 From: fjoe Date: Tue, 13 Apr 2004 19:25:26 +0000 Subject: Use ifconfig(8) for setting common 802.11 parameters. Submitted by: Stanislav A. Svirid --- share/man/man4/man4.i386/arl.4 | 20 +++ sys/dev/arl/if_arl.c | 268 ++++++++++++++++++++++++++++++++++----- sys/dev/arl/if_arl_isa.c | 37 +----- sys/dev/arl/if_arlreg.h | 3 +- usr.sbin/arlconfig/arlconfig.8 | 102 +-------------- usr.sbin/arlconfig/arlconfig.c | 99 +-------------- usr.sbin/arlcontrol/arlcontrol.8 | 102 +-------------- usr.sbin/arlcontrol/arlcontrol.c | 99 +-------------- 8 files changed, 281 insertions(+), 449 deletions(-) diff --git a/share/man/man4/man4.i386/arl.4 b/share/man/man4/man4.i386/arl.4 index 0e97543..77df3a7 100644 --- a/share/man/man4/man4.i386/arl.4 +++ b/share/man/man4/man4.i386/arl.4 @@ -59,6 +59,26 @@ To set up Radio Network parameters, use .Xr netintro 4 , .Xr arlconfig 8 , .Xr ifconfig 8 +.Sh LIMITATIONS +When using +.Xr ifconfig 8 +for setting +.Ar SSID +you must use a 4-byte even hexadecimal digit value and it must start with +00 or 02. +.Pp +You can change +.Ar channel +for current +.Ar country +only through +.Xr ifconfig 8 . +You must use +.Xr arlconfig 8 +for changing +.Ar country . +.Pp +Can't change lladdr. .Sh HISTORY The .Nm diff --git a/sys/dev/arl/if_arl.c b/sys/dev/arl/if_arl.c index c9759b2..f3495fb 100644 --- a/sys/dev/arl/if_arl.c +++ b/sys/dev/arl/if_arl.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #ifdef INET #include @@ -106,10 +107,45 @@ static struct mbuf* arl_get (caddr_t, int, int, struct ifnet *); static void arl_cache_store (struct arl_softc *, struct ether_header *, u_int8_t, u_int8_t, int); #endif - + +static int arl_media_change (struct ifnet *); +static void arl_media_status (struct ifnet *, struct ifmediareq *); +static void arl_read_config (struct arl_softc *); + devclass_t arl_devclass; /* + * Copy config values to local cache + */ +static void +arl_read_config(sc) + struct arl_softc *sc; +{ + bzero(&arcfg, sizeof(arcfg)); + + bcopy(ar->lanCardNodeId, arcfg.lanCardNodeId, + sizeof(ar->lanCardNodeId)); + bcopy(ar->specifiedRouter, arcfg.specifiedRouter, + sizeof(ar->specifiedRouter)); + GET_ARL_PARAM(hardwareType); + GET_ARL_PARAM(majorHardwareVersion); + GET_ARL_PARAM(minorHardwareVersion); + GET_ARL_PARAM(radioModule); + GET_ARL_PARAM(channelSet); + if (!arcfg.channelSet) + arcfg.channelSet = ar->defaultChannelSet; + GET_ARL_PARAM(channelNumber); + GET_ARL_PARAM(spreadingCode); + GET_ARL_PARAM(priority); + GET_ARL_PARAM(receiveMode); + arcfg.registrationMode = 1; /* set default TMA mode */ + arcfg.txRetry = 0; + + bcopy(ar->name, arcfg.name, ARLAN_NAME_SIZE); + bcopy(ar->systemId, arcfg.sid, 4 * sizeof(arcfg.sid[0])); +} + +/* * Attach device */ int @@ -118,16 +154,24 @@ arl_attach(dev) { struct arl_softc* sc = device_get_softc(dev); struct ifnet *ifp = &sc->arpcom.ac_if; - int attached; + int attached, configured = 0; D(("attach\n")); - if (ar->configuredStatusFlag == 0 && bootverbose) - printf("arl%d: card is NOT configured\n", sc->arl_unit); - - arl_reset (sc); + configured = ar->configuredStatusFlag; attached = (ifp->if_softc != 0); + if (!configured && bootverbose) + device_printf(dev, "card is not configured\n"); + else + arl_read_config(sc); + + arl_reset(sc); + + /* Read config for default values if card was not configured */ + if (!configured) + arl_read_config(sc); + /* Initialize ifnet structure. */ ifp->if_softc = sc; #if __FreeBSD_version < 502000 @@ -147,6 +191,18 @@ arl_attach(dev) ifp->if_baudrate = 2000000; ifp->if_timer = 0; + ifmedia_init(&sc->arl_ifmedia, 0, arl_media_change, arl_media_status); +#define ADD(s, o) ifmedia_add(&sc->arl_ifmedia, \ + IFM_MAKEWORD(IFM_IEEE80211, (s), (o), 0), 0, NULL) + ADD(IFM_IEEE80211_DS1, 0); + ADD(IFM_IEEE80211_DS1, IFM_IEEE80211_ADHOC); + ADD(IFM_IEEE80211_DS2, 0); + ADD(IFM_IEEE80211_DS2, IFM_IEEE80211_ADHOC); + ifmedia_set(&sc->arl_ifmedia, IFM_MAKEWORD(IFM_IEEE80211, + arcfg.spreadingCode == 4 ? IFM_IEEE80211_DS2 : IFM_IEEE80211_DS1 + , 0, 0)); +#undef ADD + /* * Attach the interface */ @@ -163,7 +219,7 @@ arl_attach(dev) /* * Hardware reset - * reset all setting to default ( setted ARLANDGS ) + * reset all setting to default (setted ARLANDGS) */ static void arl_hwreset(sc) @@ -336,9 +392,13 @@ arl_ioctl(ifp, cmd, data) { struct arl_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; + struct ieee80211req *ireq = (struct ieee80211req *)data;; d_thread_t *td = _ARL_CURPROC; struct arl_req arlan_io; int count, s, error = 0; + u_int8_t tmpstr[IEEE80211_NWID_LEN*2]; + u_int8_t *tmpptr; + u_int32_t newsid; caddr_t user; D(("ioctl %lx\n", cmd)); @@ -360,15 +420,119 @@ arl_ioctl(ifp, cmd, data) arl_stop(sc); } break; + case SIOCSIFMEDIA: + case SIOCGIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &sc->arl_ifmedia, cmd); + break; + + case SIOCG80211: + switch (ireq->i_type) { + case IEEE80211_IOC_SSID: + if (ireq->i_val != -1) { + error = EINVAL; + break; + } + bzero(tmpstr, IEEE80211_NWID_LEN); + snprintf(tmpstr, IEEE80211_NWID_LEN - 1, "0x%08x", + *(int *)arcfg.sid); + ireq->i_len = IEEE80211_NWID_LEN; + error = copyout(tmpstr, ireq->i_data, + IEEE80211_NWID_LEN); + break; + case IEEE80211_IOC_STATIONNAME: + ireq->i_len = sizeof(arcfg.name); + tmpptr = arcfg.name; + bzero(tmpstr, IEEE80211_NWID_LEN); + bcopy(tmpptr, tmpstr, ireq->i_len); + error = copyout(tmpstr, ireq->i_data, + IEEE80211_NWID_LEN); + break; + case IEEE80211_IOC_CHANNEL: + ireq->i_val = arcfg.channelNumber; + break; + case IEEE80211_IOC_POWERSAVE: + ireq->i_val = (arcfg.registrationMode == 2 ? + IEEE80211_POWERSAVE_PSP : + IEEE80211_POWERSAVE_OFF); + break; + default: + error = EINVAL; + break; + } + break; + + case SIOCS80211: + if ((error = suser(td))) + break; + switch (ireq->i_type) { + case IEEE80211_IOC_SSID: + if (ireq->i_len > 4) { + error = EINVAL; + break; + } + bzero(&newsid, sizeof(newsid)); + error = copyin(ireq->i_data, + (u_char *)(&newsid) + 4 - ireq->i_len, + ireq->i_len); + + if (error) + break; + + newsid = htonl(newsid); + if (newsid < 0 || newsid % 2) { + error = EINVAL; + break; + } + + bcopy(&newsid, arcfg.sid, sizeof(arcfg.sid)); + break; + case IEEE80211_IOC_STATIONNAME: + if (ireq->i_len > ARLAN_NAME_SIZE) { + error = EINVAL; + break; + } + bzero(arcfg.name, ARLAN_NAME_SIZE); + error = copyin(ireq->i_data, arcfg.name, ireq->i_len); + break; + case IEEE80211_IOC_CHANNEL: + if (ireq->i_val < 0 || ireq->i_val > 5) { + error = EINVAL; + break; + } + arcfg.channelNumber = ireq->i_val; + break; + case IEEE80211_IOC_POWERSAVE: + switch (ireq->i_val) { + case IEEE80211_POWERSAVE_OFF: + if (arcfg.registrationMode == 2) + arcfg.registrationMode = 1; + break; + case IEEE80211_POWERSAVE_ON: + case IEEE80211_POWERSAVE_PSP: + arcfg.registrationMode = 2; + break; + default: + error = EINVAL; + break; + } + break; + default: + error = EINVAL; + break; + } + + if (!error) + arl_config(sc); + + break; -#define GET_PARAM(name) (arlan_io.cfg.name = ar->name) +#define GET_PARAM(name) (arlan_io.cfg.name = arcfg.name) #define GET_COPY_PARAM(name) \ { \ bzero(arlan_io.cfg.name, sizeof(arlan_io.cfg.name)); \ - bcopy(ar->name, arlan_io.cfg.name, sizeof(arlan_io.cfg.name)); \ + bcopy(arcfg.name, arlan_io.cfg.name, sizeof(arlan_io.cfg.name)); \ } - case SIOCGARLALL: bzero(&arlan_io, sizeof(arlan_io)); if (!suser(td)) { @@ -388,7 +552,7 @@ arl_ioctl(ifp, cmd, data) GET_PARAM(radioModule); GET_PARAM(priority); GET_PARAM(receiveMode); - arlan_io.cfg.txRetry = arcfg.txRetry; + GET_PARAM(txRetry); user = (void *)ifr->ifr_data; for (count = 0; count < sizeof(arlan_io); count++) @@ -434,9 +598,7 @@ arl_ioctl(ifp, cmd, data) SET_PARAM(registrationMode); SET_PARAM(priority); SET_PARAM(receiveMode); - - if (arlan_io.what_set & ARLAN_SET_txRetry) - arcfg.txRetry = arlan_io.cfg.txRetry; + SET_PARAM(txRetry); arl_config(sc); } @@ -455,7 +617,7 @@ arl_ioctl(ifp, cmd, data) while (ar->interruptInProgress) ; /* wait */ bcopy(&(sc->arl_sigcache), (void *)ifr->ifr_data, sizeof(sc->arl_sigcache)); break; -#endif +#endif case SIOCGARLSTB: user = (void *)ifr->ifr_data; for (count = 0; count < sizeof(struct arl_stats); count++) { @@ -680,7 +842,7 @@ arl_stop(sc) ifp->if_timer = 0; /* disable timer */ ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); - /* arl_hwreset( unit ); */ + /* arl_hwreset(unit); */ sc->rx_len = 0; sc->tx_len = 0; /* disable interrupt */ @@ -783,7 +945,7 @@ arl_read(sc, buf, len) * Note that the interface cannot be in promiscuous mode if * there are no bpf listeners. And if el are in promiscuous * mode, el have to check if this packet is really ours. - * + * * This test does not support multicasts. */ if ((ifp->if_flags & IFF_PROMISC) @@ -805,7 +967,7 @@ arl_read(sc, buf, len) return; #ifdef ARLCACHE - arl_cache_store(sc, eh, ar->rxQuality & 0x0f, + arl_cache_store(sc, eh, ar->rxQuality & 0x0f, (ar->rxQuality & 0xf0) >> 4, ARLCACHE_RX); #endif @@ -866,9 +1028,9 @@ arl_intr(arg) arl_start(ifp); ar->txStatusVector = 0; #ifdef ARLCACHE - arl_cache_store(sc, - (struct ether_header *)(sc->arl_tx), - ar->txAckQuality & 0x0f, + arl_cache_store(sc, + (struct ether_header *)(sc->arl_tx), + ar->txAckQuality & 0x0f, (ar->txAckQuality & 0xf0) >> 4, ARLCACHE_TX); #endif } @@ -928,8 +1090,8 @@ arl_alloc_irq(dev, rid, flags) struct arl_softc *sc = device_get_softc(dev); struct resource *res; - res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, - 0ul, ~0ul, 1, (RF_ACTIVE | flags)); + res = bus_alloc_resource_any( + dev, SYS_RES_IRQ, &rid, (RF_ACTIVE | flags)); if (res) { sc->irq_rid = rid; sc->irq_res = res; @@ -999,26 +1161,70 @@ arl_cache_store(sc, eh, level, quality, dir) } for (i = 0; i < MAXARLCACHE; i++) { - if (! bcmp(dir == ARLCACHE_RX ? eh->ether_shost : eh->ether_dhost, - sc->arl_sigcache[i].macsrc, 6) ) { + if (!bcmp(dir == ARLCACHE_RX ? eh->ether_shost : eh->ether_dhost, + sc->arl_sigcache[i].macsrc, 6)) { break; } } - if (i < MAXARLCACHE) { + if (i < MAXARLCACHE) cache_slot = i; - } else { - if (wrapindex == MAXARLCACHE) { + if (wrapindex == MAXARLCACHE) wrapindex = 0; - } cache_slot = wrapindex++; } - bcopy(dir == ARLCACHE_RX ? eh->ether_shost : eh->ether_dhost, - sc->arl_sigcache[cache_slot].macsrc, 6); + bcopy(dir == ARLCACHE_RX ? eh->ether_shost : eh->ether_dhost, + sc->arl_sigcache[cache_slot].macsrc, 6); sc->arl_sigcache[cache_slot].level[dir] = level; sc->arl_sigcache[cache_slot].quality[dir] = quality; } #endif + +static int +arl_media_change(ifp) + struct ifnet *ifp; +{ + struct arl_softc *sc = ifp->if_softc; + int otype = arcfg.registrationMode; + int orate = arcfg.spreadingCode; + + arcfg.spreadingCode = ieee80211_media2rate( + IFM_SUBTYPE(sc->arl_ifmedia.ifm_cur->ifm_media)); + + if (arcfg.spreadingCode == 2) + arcfg.spreadingCode = 3; + + /* XXX Need fix for PSP mode */ + if ((sc->arl_ifmedia.ifm_cur->ifm_media & IFM_IEEE80211_ADHOC) != 0) + arcfg.registrationMode = 0; + else + arcfg.registrationMode = 1; + + if (otype != arcfg.registrationMode || + orate != arcfg.spreadingCode) + arl_config(sc); + + return (0); +} + +static void +arl_media_status(ifp, imr) + struct ifnet *ifp; + struct ifmediareq *imr; +{ + struct arl_softc *sc = ifp->if_softc; + int rate = (arcfg.spreadingCode == 4 ? 4 : 2); + + imr->ifm_active = IFM_IEEE80211; + + if (arcfg.registrationMode == 0) + imr->ifm_active |= IFM_IEEE80211_ADHOC; + + imr->ifm_active |= ieee80211_rate2media(NULL, rate, IEEE80211_T_DS); + imr->ifm_status = IFM_AVALID; + if (!ARL_CHECKREG(sc)) + imr->ifm_status |= IFM_ACTIVE; +} diff --git a/sys/dev/arl/if_arl_isa.c b/sys/dev/arl/if_arl_isa.c index 3cb2a88..c09dbc1 100644 --- a/sys/dev/arl/if_arl_isa.c +++ b/sys/dev/arl/if_arl_isa.c @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -166,7 +167,7 @@ arl_isa_identify (driver_t *driver, device_t parent) } if (bootverbose) - device_printf(child, "%sfound at 0x%x\n", + device_printf(child, "%sfound at 0x%x\n", !found ? "not " : "", chunk); arl_release_resources(child); @@ -250,35 +251,9 @@ arl_isa_probe (device_t dev) if (ar->diagnosticInfo == 0xFF) { /* Copy arp to arpcom struct */ - bcopy(ar->lanCardNodeId, sc->arpcom.ac_enaddr, - ETHER_ADDR_LEN); - - /* copy values to local cache */ - bzero(&arcfg, sizeof(arcfg)); - - bcopy(ar->lanCardNodeId, arcfg.lanCardNodeId, - sizeof(ar->lanCardNodeId)); - bcopy(ar->specifiedRouter, arcfg.specifiedRouter, - sizeof(ar->specifiedRouter)); - - GET_ARL_PARAM(hardwareType); - GET_ARL_PARAM(majorHardwareVersion); - GET_ARL_PARAM(minorHardwareVersion); - GET_ARL_PARAM(radioModule); - GET_ARL_PARAM(channelSet); - if (!arcfg.channelSet) - arcfg.channelSet = ar->defaultChannelSet; - GET_ARL_PARAM(channelNumber); - GET_ARL_PARAM(spreadingCode); - GET_ARL_PARAM(priority); - GET_ARL_PARAM(receiveMode); - arcfg.registrationMode = 1; /* set default TMA mode */ - arcfg.txRetry = 0; /* use default */ - - strncpy(arcfg.name, ar->name, ARLAN_NAME_SIZE); - bcopy(ar->systemId, arcfg.sid, 4 * sizeof(ar->systemId[0])); - - device_set_desc_copy(dev, arl_make_desc(ar->hardwareType, ar->radioModule)); + bcopy(ar->lanCardNodeId, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); + device_set_desc_copy(dev, arl_make_desc(ar->hardwareType, + ar->radioModule)); error = 0; } else { if (bootverbose) @@ -325,7 +300,7 @@ arl_isa_detach(device_t dev) struct arl_softc *sc = device_get_softc(dev); arl_stop(sc); - /* ifmedia_removeall(&sc->an_ifmedia); */ + ifmedia_removeall(&sc->arl_ifmedia); #if __FreeBSD_version < 500100 ether_ifdetach(&sc->arpcom.ac_if, ETHER_BPF_SUPPORTED); #else diff --git a/sys/dev/arl/if_arlreg.h b/sys/dev/arl/if_arlreg.h index 368dc55..660f327 100644 --- a/sys/dev/arl/if_arlreg.h +++ b/sys/dev/arl/if_arlreg.h @@ -274,10 +274,11 @@ struct arl_softc { int tx_len; u_char arl_rx[2048]; int rx_len; - + #ifdef ARLCACHE struct arl_sigcache arl_sigcache[MAXARLCACHE]; #endif + struct ifmedia arl_ifmedia; }; #endif diff --git a/usr.sbin/arlconfig/arlconfig.8 b/usr.sbin/arlconfig/arlconfig.8 index c86f881..a961539 100644 --- a/usr.sbin/arlconfig/arlconfig.8 +++ b/usr.sbin/arlconfig/arlconfig.8 @@ -40,26 +40,12 @@ .Nm .Ar iface .Nm -.Ar iface Cm name Ar name -.Nm -.Ar iface Cm sid Ar SID -.Nm .Ar iface Cm country Ar country ( Cm 9-15 ) .Nm -.Ar iface Cm channel Ar channel -(depend on -.Ar country ) -.Nm -.Ar iface Cm freq Ar freq ( Cm 2412, 2427, 2442, 2457, 2465 ) -.Nm -.Ar iface Cm spread Ar spread Cm ( 354, 500, 1000, 2000 ) -.Nm -.Ar iface Cm bitrate Ar bitrate ( Cm 0-4) -.Nm -.Ar iface Cm mode Ar mode ( Cm 640 | 655 ) -.Nm .Ar iface Cm priority Ar priority ( Cm normal, high, highest ) .Nm +.Ar iface Cm txretry Ar txretry +.Nm .Ar iface Cm stat .Nm .Ar iface Cm quality @@ -72,11 +58,6 @@ devices via the driver. Most of the parameters that can be changed are related to the Aironet protocol which the Aironet Arlan 655 card implements. -The parameters include -the station name, the station operation mode -.Ar (point to point or infrastructure) , -and the network name of a service -set to join. The .Nm utility can also be used to view the current NIC status, configuration @@ -97,71 +78,9 @@ The options are as follows: Display current settings of specified wireless interface. This retrieves current card settings from the driver and prints them out. -.It Ar iface Cm name Ar name -Set -.Ar Device Name . -This -parameter is used to establish a 15-byte ASCII name -for the Arlan 655 Client Card. -The -.Ar Device Name -is optional and may be left blank. -.Pp -If you choose to assign a name, while operating in -.Ar TMA -mode, the name will appear in the Arlan Access Point's Registration Table. -Duplicate names are allowed. -.It Ar iface Cm sid Ar SID -Set -.Ar System Identifier. -The System Identifier -.Ar (SID) -is a 4-byte, hexadecimal digit value that -is attached to each packet sent out over the radio. -Establishing a -.Ar SID -allows you to group nodes into a microcellular network and exclude -those nodes that are whiting radio range on other networks. -.Pp -The -.Ar SID -value must be an even number, cannot exceed ts and must start with -00 or 02. -Examples of valid SID values are: 00000102, 0200AA14, 00013A18, -007F6380. -The -.Ar default -SID is -.Cm 00000002 . -.Pp -Since nodes will only receive packets from other nodes with a matching SID, -you must make sure that the Arlan 655 Client Card is set the same SID as -other nodes on your network. -.It Ar iface Cm mode Ar mode ( Cm 640 | 655 ) -Use -.Ar operating mode -parameter to specify whether you are operating in -.Ar TMA , Non-TMA -or -.Ar PSP -mode. -The -.Ar default -setting is -.Cm TMA -mode. -.Bl -column ".Em Mode" ".Em Regmode" -offset indent indent -.Em "Mode Registration mode" -.It 640 Ta TMA -.It 655 Ta Non-TMA -.It PSP Ta Power save mode -.El -.!!! .It Ar iface Cm country Ar country ( Cm 9-15 ) -.It Ar iface Cm channel Ar channel -.It Ar iface Cm freq Ar freq ( Cm 2412, 2427, 2442, 2457, 2465 ) Chose -.Ar country , channel , freq +.Ar country , channel parameters that depend on the .Ar country according to the following table: @@ -181,17 +100,6 @@ according to the following table: .It "U.K. " Ta 15 Ta "2460" .It "Spain " Ta 15 Ta "2460" .El -.It Ar iface Cm bitrate Ar bitrate ( Cm 0-4) -.It Ar iface Cm spread Ar spread Cm ( 354, 500, 1000, 2000 ) -Set device operating bitrate or spread. -.Bl -column ".Em Rate" ".Em Spread" ".Em kb/s" -offset indent indent -.Em "Rate Spread kb/s" -.It 0 Ta - Ta Auto -.It 1 Ta 354 Ta 354 -.It 2 Ta 512 Ta 512 -.It 3 Ta 1000 Ta 1000 -.It 4 Ta 2000 Ta 2000 -.El .It Ar iface Cm priority Ar priority ( Cm normal, high, highest ) Use the .Ar priority @@ -207,6 +115,8 @@ to transmit at the same time. The percentage of units on your network that you set to values other than .Dq normal should be kept small - 10 percent or less. +.It Ar iface Cm txretry Ar txretry +Set transmit retries. Default is 0. .It Ar iface Cm stat Print internal Arlan 655 statistics block. .It Ar iface Cm quality @@ -219,7 +129,7 @@ Also the driver extracts values from ACK packets. .El .Sh EXAMPLES .Bd -literal -offset indent -arlconfig arl0 name NODE1 sid 4 freq 2442 +arlconfig arl0 country 11 priority hight arlconfig arl0 quality arlconfig arl0 stat arlconfig arl0 diff --git a/usr.sbin/arlconfig/arlconfig.c b/usr.sbin/arlconfig/arlconfig.c index 9055ddaa..dd03581 100644 --- a/usr.sbin/arlconfig/arlconfig.c +++ b/usr.sbin/arlconfig/arlconfig.c @@ -190,19 +190,9 @@ usage() fprintf(stderr, "\t\t\tParameter name (see below).\n"); fprintf(stderr, "\t\t\tNew value for parameter.\n"); fprintf(stderr, "Parameter name:\t\tValue:\n"); - fprintf(stderr, "\tname\t\tset Name.\n"); - fprintf(stderr, "\tsid\t\tset System ID.\n"); - fprintf(stderr, "\tfreq\t\tset Frequency Channel (2412, 2427, 2442, 2457, 2465)\n"); - fprintf(stderr, "\tspread\t\tset Bitrate (354, 500, 1000, 2000)\n"); - fprintf(stderr, "\tmode\t\tset Mode (640, 655, PSP).\n"); fprintf(stderr, "\tcountry\t\tset Country (9-15)\n"); - fprintf(stderr, "\tchannel\t\tset Channel (depended on country)\n"); - fprintf(stderr, "\tbitrate\t\tset Bitrate (0-4)\n"); fprintf(stderr, "\tpriority\tset Priority (normal, high, highest)\n"); -#if 0 - fprintf(stderr, "\tparent\t\tset Arlan parent's MAC.\n"); - fprintf(stderr, "\taddr\t\tset Arlan MAC.\n"); -#endif + fprintf(stderr, "\ttxretry\t\tset Arlan Tx retry.\n"); fprintf(stderr, "or: %s stat\n", progname); fprintf(stderr, "\tprint internal arlan statistics block\n"); #ifdef ARLCACHE @@ -380,7 +370,7 @@ main(int argc, char *argv[]) strncpy(ifr.ifr_name, argv[1], sizeof(ifr.ifr_name)); ifr.ifr_addr.sa_family = AF_INET; ifr.ifr_data = (caddr_t)qlt; - if (ioctl(sd, SIOCGARLQLT, (caddr_t)&ifr)) + if (ioctl(sd, SIOCGARLQLT, (caddr_t)&ifr)) err(1,"Get QLT"); print_qlt(qlt); exit(0); @@ -395,53 +385,6 @@ main(int argc, char *argv[]) value = argv[argind+1]; val = -1; - if (!strcasecmp(param, "name")) { - bzero(arl_io.cfg.name, 16); - strncpy(arl_io.cfg.name, value, 16); - arl_io.what_set |= ARLAN_SET_name; - } - - if (!strcasecmp(param, "sid")) { - val2 = strtol(value, &value2, 0); - if (val2 < 0 || val2 > 0xffffff || val2 % 2 || - value == value2) - err(1, "Bad SID - %s", value); - bcopy(&val2, arl_io.cfg.sid, 4); - arl_io.what_set |= ARLAN_SET_sid; - } - - if (!strcasecmp (param, "freq")) { - if (!strcmp(value, "2412")) - val = 1; - else if (!strcmp(value, "2427")) - val = 2; - else if (!strcmp(value, "2442")) - val = 3; - else if (!strcmp(value, "2457")) - val = 4; - else if (!strcmp(value, "2465")) - val = 5; - if (val == -1) - err(1, "Bad Frequency - %s", value); - arl_io.cfg.channelNumber = val; - arl_io.what_set |= ARLAN_SET_channelNumber; - } - - if (!strcasecmp(param, "spread")) { - if (!strcmp(value, "354")) - val = 1; - else if (!strcmp(value, "500")) - val = 2; - else if (!strcmp(value, "1000")) - val = 3; - else if (!strcmp(value, "2000")) - val = 4; - if (val == -1) - err (1, "Bad Bitrate - %s", value); - arl_io.cfg.spreadingCode = val; - arl_io.what_set |= ARLAN_SET_spreadingCode; - } - if (!strcasecmp(param, "priority")) { if (!strcasecmp(value, "normal")) val = 0; @@ -455,19 +398,6 @@ main(int argc, char *argv[]) arl_io.what_set |= ARLAN_SET_priority; } - if (!strcasecmp(param, "mode")) { - if (!strcmp(value, "655")) - val = 0; - else if (!strcmp(value, "640")) - val = 1; - else if (!strcasecmp (value, "PSP")) - val = 2; - if (val == -1) - err (1, "Bad Mode - %s", value); - arl_io.cfg.registrationMode = val; - arl_io.what_set |= ARLAN_SET_registrationMode; - } - if (!strcasecmp(param, "parent")) { if ((ea = (struct ether_addr*) ether_aton(value)) == NULL) err (1, "Bad parent's MAC - %s", value); @@ -478,36 +408,11 @@ main(int argc, char *argv[]) arl_io.what_set |= ARLAN_SET_specifiedRouter; } - if (!strcasecmp(param, "addr")) { - if ((ea = (struct ether_addr*) ether_aton(value)) == NULL) - err (1, "Bad MAC - %s", value); - for (val = 0; val < 6; val++) { - arl_io.cfg.lanCardNodeId[val] = - (int) ea->octet[val]; - } - arl_io.what_set |= ARLAN_SET_lanCardNodeId; - } - if (!strcasecmp(param, "country")) { arl_io.cfg.channelSet = atoi(value); arl_io.what_set |= ARLAN_SET_channelSet; } - if (!strcasecmp(param, "channel")) { - arl_io.cfg.channelNumber = atoi(value); - arl_io.what_set |= ARLAN_SET_channelNumber; - } - - if (!strcasecmp(param, "bitrate")) { - arl_io.cfg.spreadingCode = atoi(value); - arl_io.what_set |= ARLAN_SET_spreadingCode; - } - - if (!strcasecmp(param, "receive")) { - arl_io.cfg.receiveMode = atoi(value); - arl_io.what_set |= ARLAN_SET_receiveMode; - } - if (!strcasecmp(param, "txretry")) { arl_io.cfg.txRetry = atoi(value); arl_io.what_set |= ARLAN_SET_txRetry; diff --git a/usr.sbin/arlcontrol/arlcontrol.8 b/usr.sbin/arlcontrol/arlcontrol.8 index c86f881..a961539 100644 --- a/usr.sbin/arlcontrol/arlcontrol.8 +++ b/usr.sbin/arlcontrol/arlcontrol.8 @@ -40,26 +40,12 @@ .Nm .Ar iface .Nm -.Ar iface Cm name Ar name -.Nm -.Ar iface Cm sid Ar SID -.Nm .Ar iface Cm country Ar country ( Cm 9-15 ) .Nm -.Ar iface Cm channel Ar channel -(depend on -.Ar country ) -.Nm -.Ar iface Cm freq Ar freq ( Cm 2412, 2427, 2442, 2457, 2465 ) -.Nm -.Ar iface Cm spread Ar spread Cm ( 354, 500, 1000, 2000 ) -.Nm -.Ar iface Cm bitrate Ar bitrate ( Cm 0-4) -.Nm -.Ar iface Cm mode Ar mode ( Cm 640 | 655 ) -.Nm .Ar iface Cm priority Ar priority ( Cm normal, high, highest ) .Nm +.Ar iface Cm txretry Ar txretry +.Nm .Ar iface Cm stat .Nm .Ar iface Cm quality @@ -72,11 +58,6 @@ devices via the driver. Most of the parameters that can be changed are related to the Aironet protocol which the Aironet Arlan 655 card implements. -The parameters include -the station name, the station operation mode -.Ar (point to point or infrastructure) , -and the network name of a service -set to join. The .Nm utility can also be used to view the current NIC status, configuration @@ -97,71 +78,9 @@ The options are as follows: Display current settings of specified wireless interface. This retrieves current card settings from the driver and prints them out. -.It Ar iface Cm name Ar name -Set -.Ar Device Name . -This -parameter is used to establish a 15-byte ASCII name -for the Arlan 655 Client Card. -The -.Ar Device Name -is optional and may be left blank. -.Pp -If you choose to assign a name, while operating in -.Ar TMA -mode, the name will appear in the Arlan Access Point's Registration Table. -Duplicate names are allowed. -.It Ar iface Cm sid Ar SID -Set -.Ar System Identifier. -The System Identifier -.Ar (SID) -is a 4-byte, hexadecimal digit value that -is attached to each packet sent out over the radio. -Establishing a -.Ar SID -allows you to group nodes into a microcellular network and exclude -those nodes that are whiting radio range on other networks. -.Pp -The -.Ar SID -value must be an even number, cannot exceed ts and must start with -00 or 02. -Examples of valid SID values are: 00000102, 0200AA14, 00013A18, -007F6380. -The -.Ar default -SID is -.Cm 00000002 . -.Pp -Since nodes will only receive packets from other nodes with a matching SID, -you must make sure that the Arlan 655 Client Card is set the same SID as -other nodes on your network. -.It Ar iface Cm mode Ar mode ( Cm 640 | 655 ) -Use -.Ar operating mode -parameter to specify whether you are operating in -.Ar TMA , Non-TMA -or -.Ar PSP -mode. -The -.Ar default -setting is -.Cm TMA -mode. -.Bl -column ".Em Mode" ".Em Regmode" -offset indent indent -.Em "Mode Registration mode" -.It 640 Ta TMA -.It 655 Ta Non-TMA -.It PSP Ta Power save mode -.El -.!!! .It Ar iface Cm country Ar country ( Cm 9-15 ) -.It Ar iface Cm channel Ar channel -.It Ar iface Cm freq Ar freq ( Cm 2412, 2427, 2442, 2457, 2465 ) Chose -.Ar country , channel , freq +.Ar country , channel parameters that depend on the .Ar country according to the following table: @@ -181,17 +100,6 @@ according to the following table: .It "U.K. " Ta 15 Ta "2460" .It "Spain " Ta 15 Ta "2460" .El -.It Ar iface Cm bitrate Ar bitrate ( Cm 0-4) -.It Ar iface Cm spread Ar spread Cm ( 354, 500, 1000, 2000 ) -Set device operating bitrate or spread. -.Bl -column ".Em Rate" ".Em Spread" ".Em kb/s" -offset indent indent -.Em "Rate Spread kb/s" -.It 0 Ta - Ta Auto -.It 1 Ta 354 Ta 354 -.It 2 Ta 512 Ta 512 -.It 3 Ta 1000 Ta 1000 -.It 4 Ta 2000 Ta 2000 -.El .It Ar iface Cm priority Ar priority ( Cm normal, high, highest ) Use the .Ar priority @@ -207,6 +115,8 @@ to transmit at the same time. The percentage of units on your network that you set to values other than .Dq normal should be kept small - 10 percent or less. +.It Ar iface Cm txretry Ar txretry +Set transmit retries. Default is 0. .It Ar iface Cm stat Print internal Arlan 655 statistics block. .It Ar iface Cm quality @@ -219,7 +129,7 @@ Also the driver extracts values from ACK packets. .El .Sh EXAMPLES .Bd -literal -offset indent -arlconfig arl0 name NODE1 sid 4 freq 2442 +arlconfig arl0 country 11 priority hight arlconfig arl0 quality arlconfig arl0 stat arlconfig arl0 diff --git a/usr.sbin/arlcontrol/arlcontrol.c b/usr.sbin/arlcontrol/arlcontrol.c index 9055ddaa..dd03581 100644 --- a/usr.sbin/arlcontrol/arlcontrol.c +++ b/usr.sbin/arlcontrol/arlcontrol.c @@ -190,19 +190,9 @@ usage() fprintf(stderr, "\t\t\tParameter name (see below).\n"); fprintf(stderr, "\t\t\tNew value for parameter.\n"); fprintf(stderr, "Parameter name:\t\tValue:\n"); - fprintf(stderr, "\tname\t\tset Name.\n"); - fprintf(stderr, "\tsid\t\tset System ID.\n"); - fprintf(stderr, "\tfreq\t\tset Frequency Channel (2412, 2427, 2442, 2457, 2465)\n"); - fprintf(stderr, "\tspread\t\tset Bitrate (354, 500, 1000, 2000)\n"); - fprintf(stderr, "\tmode\t\tset Mode (640, 655, PSP).\n"); fprintf(stderr, "\tcountry\t\tset Country (9-15)\n"); - fprintf(stderr, "\tchannel\t\tset Channel (depended on country)\n"); - fprintf(stderr, "\tbitrate\t\tset Bitrate (0-4)\n"); fprintf(stderr, "\tpriority\tset Priority (normal, high, highest)\n"); -#if 0 - fprintf(stderr, "\tparent\t\tset Arlan parent's MAC.\n"); - fprintf(stderr, "\taddr\t\tset Arlan MAC.\n"); -#endif + fprintf(stderr, "\ttxretry\t\tset Arlan Tx retry.\n"); fprintf(stderr, "or: %s stat\n", progname); fprintf(stderr, "\tprint internal arlan statistics block\n"); #ifdef ARLCACHE @@ -380,7 +370,7 @@ main(int argc, char *argv[]) strncpy(ifr.ifr_name, argv[1], sizeof(ifr.ifr_name)); ifr.ifr_addr.sa_family = AF_INET; ifr.ifr_data = (caddr_t)qlt; - if (ioctl(sd, SIOCGARLQLT, (caddr_t)&ifr)) + if (ioctl(sd, SIOCGARLQLT, (caddr_t)&ifr)) err(1,"Get QLT"); print_qlt(qlt); exit(0); @@ -395,53 +385,6 @@ main(int argc, char *argv[]) value = argv[argind+1]; val = -1; - if (!strcasecmp(param, "name")) { - bzero(arl_io.cfg.name, 16); - strncpy(arl_io.cfg.name, value, 16); - arl_io.what_set |= ARLAN_SET_name; - } - - if (!strcasecmp(param, "sid")) { - val2 = strtol(value, &value2, 0); - if (val2 < 0 || val2 > 0xffffff || val2 % 2 || - value == value2) - err(1, "Bad SID - %s", value); - bcopy(&val2, arl_io.cfg.sid, 4); - arl_io.what_set |= ARLAN_SET_sid; - } - - if (!strcasecmp (param, "freq")) { - if (!strcmp(value, "2412")) - val = 1; - else if (!strcmp(value, "2427")) - val = 2; - else if (!strcmp(value, "2442")) - val = 3; - else if (!strcmp(value, "2457")) - val = 4; - else if (!strcmp(value, "2465")) - val = 5; - if (val == -1) - err(1, "Bad Frequency - %s", value); - arl_io.cfg.channelNumber = val; - arl_io.what_set |= ARLAN_SET_channelNumber; - } - - if (!strcasecmp(param, "spread")) { - if (!strcmp(value, "354")) - val = 1; - else if (!strcmp(value, "500")) - val = 2; - else if (!strcmp(value, "1000")) - val = 3; - else if (!strcmp(value, "2000")) - val = 4; - if (val == -1) - err (1, "Bad Bitrate - %s", value); - arl_io.cfg.spreadingCode = val; - arl_io.what_set |= ARLAN_SET_spreadingCode; - } - if (!strcasecmp(param, "priority")) { if (!strcasecmp(value, "normal")) val = 0; @@ -455,19 +398,6 @@ main(int argc, char *argv[]) arl_io.what_set |= ARLAN_SET_priority; } - if (!strcasecmp(param, "mode")) { - if (!strcmp(value, "655")) - val = 0; - else if (!strcmp(value, "640")) - val = 1; - else if (!strcasecmp (value, "PSP")) - val = 2; - if (val == -1) - err (1, "Bad Mode - %s", value); - arl_io.cfg.registrationMode = val; - arl_io.what_set |= ARLAN_SET_registrationMode; - } - if (!strcasecmp(param, "parent")) { if ((ea = (struct ether_addr*) ether_aton(value)) == NULL) err (1, "Bad parent's MAC - %s", value); @@ -478,36 +408,11 @@ main(int argc, char *argv[]) arl_io.what_set |= ARLAN_SET_specifiedRouter; } - if (!strcasecmp(param, "addr")) { - if ((ea = (struct ether_addr*) ether_aton(value)) == NULL) - err (1, "Bad MAC - %s", value); - for (val = 0; val < 6; val++) { - arl_io.cfg.lanCardNodeId[val] = - (int) ea->octet[val]; - } - arl_io.what_set |= ARLAN_SET_lanCardNodeId; - } - if (!strcasecmp(param, "country")) { arl_io.cfg.channelSet = atoi(value); arl_io.what_set |= ARLAN_SET_channelSet; } - if (!strcasecmp(param, "channel")) { - arl_io.cfg.channelNumber = atoi(value); - arl_io.what_set |= ARLAN_SET_channelNumber; - } - - if (!strcasecmp(param, "bitrate")) { - arl_io.cfg.spreadingCode = atoi(value); - arl_io.what_set |= ARLAN_SET_spreadingCode; - } - - if (!strcasecmp(param, "receive")) { - arl_io.cfg.receiveMode = atoi(value); - arl_io.what_set |= ARLAN_SET_receiveMode; - } - if (!strcasecmp(param, "txretry")) { arl_io.cfg.txRetry = atoi(value); arl_io.what_set |= ARLAN_SET_txRetry; -- cgit v1.1