Date: Fri, 11 Jun 2021 19:38:45 GMT From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d865da5edf7f - main - ancontrol: Remove an(4) utility Message-ID: <202106111938.15BJcjOY050967@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=d865da5edf7f77315ddecfd1b10a5b72ecf5af12 commit d865da5edf7f77315ddecfd1b10a5b72ecf5af12 Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2021-06-07 16:48:57 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2021-06-11 19:18:21 +0000 ancontrol: Remove an(4) utility Last an(4) devices have been End Of Life and End Of Sale in 2007. Time to remove this driver. Differential Revision: https://reviews.freebsd.org/D30680 Reviewed by: imp (earlier version), emaste (earlier version) Sponsored by: Diablotin Systems --- ObsoleteFiles.inc | 4 + usr.sbin/Makefile | 1 - usr.sbin/ancontrol/Makefile | 11 - usr.sbin/ancontrol/Makefile.depend | 19 - usr.sbin/ancontrol/ancontrol.8 | 553 ----------- usr.sbin/ancontrol/ancontrol.c | 1781 ------------------------------------ 6 files changed, 4 insertions(+), 2365 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 1b4c291a0c51..f61441307a06 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20210607: remove ancontrol(8) related programs +OLD_FILES+=usr/sbin/ancontrol +OLD_FILES+=usr/share/man/man8/ancontrol.8.gz + # 20210607: remove an(4) OLD_FILES+=usr/include/dev/an/if_aironet_ieee.h OLD_FILES+=usr/include/dev/an/if_anreg.h diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index ae568746119a..12285ad1d1fd 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -208,7 +208,6 @@ SUBDIR.${MK_USB}+= usbdump SUBDIR.${MK_UTMPX}+= ac SUBDIR.${MK_UTMPX}+= lastlogin SUBDIR.${MK_UTMPX}+= utx -SUBDIR.${MK_WIRELESS}+= ancontrol SUBDIR.${MK_WIRELESS}+= wlandebug SUBDIR.${MK_WIRELESS}+= wpa diff --git a/usr.sbin/ancontrol/Makefile b/usr.sbin/ancontrol/Makefile deleted file mode 100644 index 61dd02bf8481..000000000000 --- a/usr.sbin/ancontrol/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ - -PROG= ancontrol -MAN= ancontrol.8 - -WARNS?= 3 -CFLAGS+= -DANCACHE -I${SRCTOP}/sys - -LIBADD= md - -.include <bsd.prog.mk> diff --git a/usr.sbin/ancontrol/Makefile.depend b/usr.sbin/ancontrol/Makefile.depend deleted file mode 100644 index 9dfb51c0b371..000000000000 --- a/usr.sbin/ancontrol/Makefile.depend +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/arpa \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/libmd \ - - -.include <dirdeps.mk> - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.sbin/ancontrol/ancontrol.8 b/usr.sbin/ancontrol/ancontrol.8 deleted file mode 100644 index 25fa5aefa061..000000000000 --- a/usr.sbin/ancontrol/ancontrol.8 +++ /dev/null @@ -1,553 +0,0 @@ -.\" Copyright (c) 1997, 1998, 1999 -.\" Bill Paul <wpaul@ee.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. -.\" -.\" $FreeBSD$ -.\" -.Dd September 10, 1999 -.Dt ANCONTROL 8 -.Os -.Sh NAME -.Nm ancontrol -.Nd configure Aironet 4500/4800 devices -.Sh SYNOPSIS -.Nm -.Fl i Ar iface Fl A -.Nm -.Fl i Ar iface Fl N -.Nm -.Fl i Ar iface Fl S -.Nm -.Fl i Ar iface Fl I -.Nm -.Fl i Ar iface Fl T -.Nm -.Fl i Ar iface Fl C -.Nm -.Fl i Ar iface Fl Q -.Nm -.Fl i Ar iface Fl Z -.Nm -.Fl i Ar iface Fl R -.Nm -.Fl i Ar iface Fl t Cm 0 Ns - Ns Cm 4 -.Nm -.Fl i Ar iface Fl s Cm 0 Ns - Ns Cm 3 -.Nm -.Fl i Ar iface -.Op Fl v Cm 1 Ns - Ns Cm 4 -.Fl a Ar AP -.Nm -.Fl i Ar iface Fl b Ar beacon_period -.Nm -.Fl i Ar iface -.Op Fl v Cm 0 | 1 -.Fl d Cm 0 Ns - Ns Cm 3 -.Nm -.Fl i Ar iface Fl e Cm 0 Ns - Ns Cm 4 -.Nm -.Fl i Ar iface -.Op Fl v Cm 0 Ns - Ns Cm 8 -.Fl k Ar key -.Nm -.Fl i Ar iface -.Fl K Cm 0 Ns - Ns Cm 2 -.Nm -.Fl i Ar iface -.Fl W Cm 0 Ns - Ns Cm 2 -.Nm -.Fl i Ar iface -.Fl L Ar user_name -.Nm -.Fl i Ar iface Fl j Ar netjoin_timeout -.Nm -.Fl i Ar iface Fl l Ar station_name -.Nm -.Fl i Ar iface Fl m Ar mac_address -.Nm -.Fl i Ar iface -.Op Fl v Cm 1 Ns - Ns Cm 3 -.Fl n Ar SSID -.Nm -.Fl i Ar iface Fl o Cm 0 | 1 -.Nm -.Fl i Ar iface Fl p Ar tx_power -.Nm -.Fl i Ar iface Fl c Ar frequency -.Nm -.Fl i Ar iface Fl f Ar fragmentation_threshold -.Nm -.Fl i Ar iface Fl r Ar RTS_threshold -.Nm -.Fl i Ar iface Fl M Cm 0 Ns - Ns Cm 15 -.Nm -.Fl h -.Sh DESCRIPTION -The -.Nm -utility controls the operation of Aironet wireless networking -devices via the -.Xr an 4 -driver. -Most of the parameters that can be changed relate to the -IEEE 802.11 protocol which the Aironet cards implement. -This includes such things as -the station name, whether the station is operating in ad-hoc (point -to point) or infrastructure mode, and the network name of a service -set to join. -The -.Nm -utility can also be used to view the current NIC status, configuration -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 Aironet -device -.Li ( an0 , an1 , -etc.). -If one is not specified the device -.Dq Li an0 -will be assumed. -.Pp -The -.Nm -utility is not designed to support the combination of arguments from different -.Sx SYNOPSIS -lines in a single -.Nm -invocation, and such combinations are not recommended. -.Sh OPTIONS -The options are as follows: -.Bl -tag -width indent -.It Fl i Ar iface 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 -wishes to associate. -If no AP list is specified (the default) then -the station will associate with the first access point that it finds -which serves the SSID(s) specified in the SSID list. -The AP list can -be modified with the -.Fl a -option. -.It Fl i Ar iface 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 -Display NIC status information. -This includes the current operating -status, current BSSID, SSID, channel, beacon period and currently -associated access point. -The operating mode indicates the state of -the NIC, MAC status and receiver status. -When the -.Qq Li synced -keyword -appears, it means the NIC has successfully associated with an access -point, associated with an ad-hoc -.Dq master -station, or become a -.Dq master -itself. -The beacon period can be anything between 20 and 976 milliseconds. -The default is 100. -.It Fl i Ar iface Fl I -Display NIC capability information. -This shows the device type, -frequency, speed and power level capabilities and firmware revision levels. -.It Fl i Ar iface Fl T -Display the NIC's internal statistics counters. -.It Fl i Ar iface 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 Q -Display the cached signal strength information maintained by the -.Xr an 4 -driver. -The driver retains information about signal strength and -noise level for packets received from different hosts. -The signal strength and noise level values are displayed in units of dBms by -default. -The -.Va hw.an.an_cache_mode -.Xr sysctl 8 -variable can be set to -.Cm raw , dbm -or -.Cm per . -.It Fl i Ar iface Fl Z -Clear the signal strength cache maintained internally by the -.Xr an 4 -driver. -.It Fl i Ar iface Fl R -Display RSSI map that converts from the RSSI index to percent and dBm. -.It Fl i Ar iface Fl t Cm 0 Ns - Ns Cm 4 -Select transmit speed. -The available settings are as follows: -.Bl -column ".Em TX rate" -offset indent -.Em "TX rate NIC speed" -.It Cm 0 Ta "Auto -- NIC selects optimal speed" -.It Cm 1 Ta "1Mbps fixed" -.It Cm 2 Ta "2Mbps fixed" -.It Cm 3 Ta "5.5Mbps fixed" -.It Cm 4 Ta "11Mbps fixed" -.El -.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 Cm 0 Ns - Ns Cm 3 -Set power save mode. -Valid selections are as follows: -.Bl -column ".Em Selection" -offset indent -.Em "Selection Power save mode" -.It Cm 0 Ta "None - power save disabled" -.It Cm 1 Ta "Constantly awake mode (CAM)" -.It Cm 2 Ta "Power Save Polling (PSP)" -.It Cm 3 Ta "Fast Power Save Polling (PSP-CAM)" -.El -.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 Oo Fl v Cm 1 Ns - Ns Cm 4 Oc Fl a Ar AP -Set preferred access point. -The -.Ar AP -is specified as a MAC address consisting of 6 hexadecimal values -separated by colons. -By default, the -.Fl a -option only sets the first entry in the AP list. -The -.Fl v -modifier can be used to specify exactly which AP list entry is to be -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 -Set the ad-hoc mode beacon period. -The -.Ar beacon_period -is specified in milliseconds. -The default is 100ms. -.It Fl i Ar iface Oo Fl v Cm 0 | 1 Oc Fl d Cm 0 Ns - Ns Cm 3 -Select the antenna diversity. -Aironet devices can be configured with up -to two antennas, and transmit and receive diversity can be configured -accordingly. -Valid selections are as follows: -.Bl -column ".Em Selection" -offset indent -.Em "Selection Diversity" -.It Cm 0 Ta "Select factory default diversity" -.It Cm 1 Ta "Antenna 1 only" -.It Cm 2 Ta "Antenna 2 only" -.It Cm 3 Ta "Antenna 1 and 2" -.El -.Pp -The receive and transmit diversity can be set independently. -The user -must specify which diversity setting is to be modified by using the -.Fl v -option: selection -.Cm 0 -sets the receive diversity and -.Cm 1 -sets the transmit diversity. -.It Fl i Ar iface Fl e Cm 0 Ns - Ns Cm 4 -Set the transmit WEP key to use. -Note that until this command is issued, the device will use the -last key programmed. -The transmit key is stored in NVRAM. -Currently -set transmit key can be checked via -.Fl C -option. -Selection -.Cm 4 -sets the card in -.Dq "Home Network Mode" -and uses the home key. -.It Fl i Ar iface Oo Fl v Cm 0 Ns - Ns Cm 8 Oc Fl k Ar key -Set a WEP key. -For 40 bit prefix 10 hex character with 0x. -For 128 bit prefix 26 hex character with 0x. -Use -.Qq -as the key to erase the key. -Supports 4 keys; even numbers are for permanent keys -and odd number are for temporary keys. -For example, -.Fl v Cm 1 -sets the first temporary key. -(A -.Dq permanent -key is stored in NVRAM; a -.Dq temporary -key is not.) -Note that the device will use the most recently-programmed key by default. -Currently set keys can be checked via -.Fl C -option, only the sizes of the -keys are returned. -The value of -.Cm 8 -is for the home key. -Note that the value for the home key can be read back from firmware. -.It Fl i Ar iface Fl K Cm 0 Ns - Ns Cm 2 -Set authorization type. -Use -.Cm 0 -for none, -.Cm 1 -for -.Dq Open , -.Cm 2 -for -.Dq "Shared Key" . -.It Fl i Ar iface Fl W Cm 0 Ns - Ns Cm 2 -Enable WEP. -Use -.Cm 0 -for no WEP, -.Cm 1 -to enable full WEP, -.Cm 2 -for mixed cell. -.It Fl i Ar iface Fl L Ar user_name -Enable LEAP and query for password. -It will check to see if it has authenticated for up to 60s. -To disable LEAP, set WEP mode. -.It Fl i Ar iface 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 -.Dq master -station with the desired -SSID and associate with it. -If the station is unable to locate another -station with the same SSID after a suitable timeout, it sets itself up -as the -.Dq master -so that other stations may associate with it. -This -timeout defaults to 10000 milliseconds (10 seconds) but may be changed -with this option. -The timeout should be specified in milliseconds. -.It Fl i Ar iface Fl l Ar station_name -Set the station name used internally by the NIC. -The -.Ar station_name -can be any text string up to 16 characters in length. -The default name -is set by the driver to -.Dq Li FreeBSD . -.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.: -.Li 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 Oo Fl v Cm 1 Ns - Ns Cm 3 Oc Fl n Ar SSID -Set the desired SSID (network name). -There are three SSIDs which allows -the NIC to work with access points at several locations without needing -to be reconfigured. -The NIC checks each SSID in sequence when searching -for a match. -The SSID to be changed can be specified with the -.Fl v -modifier option. -If the -.Fl v -flag is not used, the first SSID in the list is set. -.It Fl i Ar iface Fl o Cm 0 | 1 -Set the operating mode of the Aironet interface. -Valid selections are -.Cm 0 -for ad-hoc mode and -.Cm 1 -for infrastructure mode. -The default driver setting is for infrastructure -mode. -.It Fl i Ar iface 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 -device capabilities with the -.Fl I -flag. -Typical values are 1, 5, 20, 50 and 100mW. -Selecting 0 sets -the factory default. -.It Fl i Ar iface Fl c Ar frequency -Set the radio frequency of a given interface. -The -.Ar frequency -should be specified as a channel ID as shown in the table below. -The -list of available frequencies is dependent on radio regulations specified -by regional authorities. -Recognized regulatory authorities include -the FCC (United States), ETSI (Europe), France and Japan. -Frequencies -in the table are specified in MHz. -.Bl -column ".Em Channel ID" ".Em FCC" ".Em ETSI" ".Em France" ".Em Japan" -offset indent -.Em "Channel ID FCC ETSI France Japan" -.It Cm 1 Ta 2412 Ta 2412 Ta - Ta - -.It Cm 2 Ta 2417 Ta 2417 Ta - Ta - -.It Cm 3 Ta 2422 Ta 2422 Ta - Ta - -.It Cm 4 Ta 2427 Ta 2427 Ta - Ta - -.It Cm 5 Ta 2432 Ta 2432 Ta - Ta - -.It Cm 6 Ta 2437 Ta 2437 Ta - Ta - -.It Cm 7 Ta 2442 Ta 2442 Ta - Ta - -.It Cm 8 Ta 2447 Ta 2447 Ta - Ta - -.It Cm 9 Ta 2452 Ta 2452 Ta - Ta - -.It Cm 10 Ta 2457 Ta 2457 Ta 2457 Ta - -.It Cm 11 Ta 2462 Ta 2462 Ta 2462 Ta - -.It Cm 12 Ta - Ta 2467 Ta 2467 Ta - -.It Cm 13 Ta - Ta 2472 Ta 2472 Ta - -.It Cm 14 Ta - Ta - Ta - Ta 2484 -.El -.Pp -If an illegal channel is specified, the -NIC will revert to its default channel. -For NICs sold in the United States -and Europe, the default channel is 3. -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 -Set the fragmentation threshold in bytes. -This threshold controls the -point at which outgoing packets will be split into multiple fragments. -If a single fragment is not sent successfully, only that fragment will -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 -Set the RTS/CTS threshold for a given interface. -This controls the -number of bytes used for the RTS/CTS handshake boundary. -The -.Ar RTS_threshold -can be any value between 0 and 2312. -The default is 2312. -.It Fl i Ar iface Fl M Cm 0 Ns - Ns Cm 15 -Set monitor mode via bit mask, meaning: -.Pp -.Bl -tag -width indent -offset indent -compact -.It Em Bit -.Em Meaning -.It 0 -to not dump 802.11 packet. -.It 1 -to enable 802.11 monitor. -.It 2 -to monitor any SSID. -.It 4 -to not skip beacons, monitor beacons produces a high system load. -.It 8 -to enable full Aironet header returned via BPF. -Note it appears that a SSID must be set. -.El -.It Fl h -Print a list of available options and sample usage. -.El -.Sh SECURITY NOTES -WEP -.Pq Dq "wired equivalent privacy" -is based on the RC4 algorithm, -using a 24 bit initialization vector. -.Pp -RC4 is supposedly vulnerable to certain known plaintext attacks, -especially with 40 bit keys. -So the security of WEP in part depends on how much known plaintext -is transmitted. -.Pp -Because of this, although counter-intuitive, using -.Dq "shared key" -authentication (which involves sending known plaintext) is less -secure than using -.Dq open -authentication when WEP is enabled. -.Pp -Devices may alternate among all of the configured WEP keys when -transmitting packets. -Therefore, all configured keys (up to four) must agree. -.Sh EXAMPLES -.Bd -literal -offset indent -ancontrol -i an0 -v 0 -k 0x12345678901234567890123456 -ancontrol -i an0 -K 2 -ancontrol -i an0 -W 1 -ancontrol -i an0 -e 0 -.Ed -.Pp -Sets a WEP key 0, enables -.Dq "Shared Key" -authentication, enables full WEP -and uses transmit key 0. -.Sh SEE ALSO -.Xr an 4 , -.Xr ifconfig 8 -.Sh HISTORY -The -.Nm -utility first appeared in -.Fx 4.0 . -.Sh AUTHORS -The -.Nm -utility was written by -.An Bill Paul Aq Mt wpaul@ee.columbia.edu . -.Sh BUGS -The statistics counters do not seem to show the amount of transmit -and received frames as increasing. -This is likely due to the fact that -the -.Xr an 4 -driver uses unmodified packet mode instead of letting the NIC perform -802.11/ethernet encapsulation itself. -.Pp -Setting the channel does not seem to have any effect. diff --git a/usr.sbin/ancontrol/ancontrol.c b/usr.sbin/ancontrol/ancontrol.c deleted file mode 100644 index 6d76f0770f4a..000000000000 --- a/usr.sbin/ancontrol/ancontrol.c +++ /dev/null @@ -1,1781 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright 1997, 1998, 1999 - * Bill Paul <wpaul@ee.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. - */ - -#if 0 -#ifndef lint -static const char copyright[] = "@(#) Copyright (c) 1997, 1998, 1999\ - Bill Paul. All rights reserved."; -#endif -#endif -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/ioctl.h> - -#include <arpa/inet.h> - -#include <net/if.h> -#include <net/ethernet.h> - -#include <dev/an/if_aironet_ieee.h> - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <errno.h> -#include <err.h> -#include <md4.h> -#include <ctype.h> - -static int an_getval(const char *, struct an_req *); -static void an_setval(const char *, struct an_req *); -static void an_printwords(const u_int16_t *, int); -static void an_printspeeds(const u_int8_t *, int); -static void an_printbool(int); -static void an_printhex(const char *, int); -static void an_printstr(char *, int); -static void an_dumpstatus(const char *); -static void an_dumpstats(const char *); -static void an_dumpconfig(const char *); -static void an_dumpcaps(const char *); -static void an_dumpssid(const char *); -static void an_dumpap(const char *); -static void an_setconfig(const char *, int, void *); -static void an_setssid(const char *, int, void *); -static void an_setap(const char *, int, void *); -static void an_setspeed(const char *, int, void *); -static void an_readkeyinfo(const char *); -#ifdef ANCACHE -static void an_zerocache(const char *); -static void an_readcache(const char *); -#endif -static int an_hex2int(char); -static void an_str2key(const char *, struct an_ltv_key *); -static void an_setkeys(const char *, const char *, int); -static void an_enable_tx_key(const char *, const char *); -static void an_enable_leap_mode(const char *, const char *); -static void an_dumprssimap(const char *); -static void usage(const char *); - -#define ACT_DUMPSTATS 1 -#define ACT_DUMPCONFIG 2 -#define ACT_DUMPSTATUS 3 -#define ACT_DUMPCAPS 4 -#define ACT_DUMPSSID 5 -#define ACT_DUMPAP 6 - -#define ACT_SET_OPMODE 7 -#define ACT_SET_SSID 8 -#define ACT_SET_FREQ 11 -#define ACT_SET_AP1 12 -#define ACT_SET_AP2 13 -#define ACT_SET_AP3 14 -#define ACT_SET_AP4 15 -#define ACT_SET_DRIVERNAME 16 -#define ACT_SET_SCANMODE 17 -#define ACT_SET_TXRATE 18 -#define ACT_SET_RTS_THRESH 19 -#define ACT_SET_PWRSAVE 20 -#define ACT_SET_DIVERSITY_RX 21 -#define ACT_SET_DIVERSITY_TX 22 -#define ACT_SET_RTS_RETRYLIM 23 -#define ACT_SET_WAKE_DURATION 24 -#define ACT_SET_BEACON_PERIOD 25 -#define ACT_SET_TXPWR 26 -#define ACT_SET_FRAG_THRESH 27 -#define ACT_SET_NETJOIN 28 -#define ACT_SET_MYNAME 29 -#define ACT_SET_MAC 30 - -#define ACT_DUMPCACHE 31 -#define ACT_ZEROCACHE 32 - -#define ACT_ENABLE_WEP 33 -#define ACT_SET_KEY_TYPE 34 -#define ACT_SET_KEYS 35 -#define ACT_ENABLE_TX_KEY 36 -#define ACT_SET_MONITOR_MODE 37 -#define ACT_SET_LEAP_MODE 38 - -#define ACT_DUMPRSSIMAP 39 - -static int -an_getval(const char *iface, struct an_req *areq) -{ - struct ifreq ifr; - int s, okay = 1; - - bzero(&ifr, sizeof(ifr)); - - strlcpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)); - ifr.ifr_data = (caddr_t)areq; - - s = socket(AF_INET, SOCK_DGRAM, 0); - - if (s == -1) - err(1, "socket"); - - if (ioctl(s, SIOCGAIRONET, &ifr) == -1) { - okay = 0; - err(1, "SIOCGAIRONET"); - } - - close(s); - - return (okay); -} - -static void -an_setval(const char *iface, struct an_req *areq) -{ - struct ifreq ifr; - int s; - - bzero(&ifr, sizeof(ifr)); - - strlcpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)); - ifr.ifr_data = (caddr_t)areq; - - s = socket(AF_INET, SOCK_DGRAM, 0); - - if (s == -1) - err(1, "socket"); - - if (ioctl(s, SIOCSAIRONET, &ifr) == -1) - err(1, "SIOCSAIRONET"); - - close(s); - - return; -} - -static void -an_printstr(char *str, int len) -{ - int i; - - for (i = 0; i < len - 1; i++) { - if (str[i] == '\0') - str[i] = ' '; - } - - printf("[ %.*s ]", len, str); -} - -static void -an_printwords(const u_int16_t *w, int len) -{ - int i; - - printf("[ "); - for (i = 0; i < len; i++) - printf("%u ", w[i]); - printf("]"); -} - -static void -an_printspeeds(const u_int8_t *w, int len) -{ - int i; - - printf("[ "); - for (i = 0; i < len && w[i]; i++) - printf("%2.1fMbps ", w[i] * 0.500); - printf("]"); -} - -static void -an_printbool(int val) -{ - if (val) - printf("[ On ]"); - else - printf("[ Off ]"); -} - -static void -an_printhex(const char *ptr, int len) -{ - int i; - - printf("[ "); - for (i = 0; i < len; i++) { - printf("%02x", ptr[i] & 0xFF); - if (i < (len - 1)) - printf(":"); - } - - printf(" ]"); -} - - - -static void -an_dumpstatus(const char *iface) -{ - struct an_ltv_status *sts; - struct an_req areq; - struct an_ltv_rssi_map an_rssimap; - int rssimap_valid = 0; - - /* - * Try to get RSSI to percent and dBM table - */ - - an_rssimap.an_len = sizeof(an_rssimap); - an_rssimap.an_type = AN_RID_RSSI_MAP; - rssimap_valid = an_getval(iface, (struct an_req*)&an_rssimap); - - if (rssimap_valid) - printf("RSSI table:\t\t[ present ]\n"); - else - printf("RSSI table:\t\t[ not available ]\n"); - - areq.an_len = sizeof(areq); - areq.an_type = AN_RID_STATUS; - - an_getval(iface, &areq); - - sts = (struct an_ltv_status *)&areq; - - printf("MAC address:\t\t"); - an_printhex((char *)&sts->an_macaddr, ETHER_ADDR_LEN); - printf("\nOperating mode:\t\t[ "); - if (sts->an_opmode & AN_STATUS_OPMODE_CONFIGURED) - printf("configured "); - if (sts->an_opmode & AN_STATUS_OPMODE_MAC_ENABLED) - printf("MAC ON "); - if (sts->an_opmode & AN_STATUS_OPMODE_RX_ENABLED) - printf("RX ON "); - if (sts->an_opmode & AN_STATUS_OPMODE_IN_SYNC) - printf("synced "); - if (sts->an_opmode & AN_STATUS_OPMODE_ASSOCIATED) - printf("associated "); - if (sts->an_opmode & AN_STATUS_OPMODE_LEAP) - printf("LEAP "); - if (sts->an_opmode & AN_STATUS_OPMODE_ERROR) - printf("error "); - printf("]\n"); - printf("Error code:\t\t"); - an_printhex((char *)&sts->an_errcode, 1); - if (rssimap_valid) - printf("\nSignal strength:\t[ %u%% ]", - an_rssimap.an_entries[ - sts->an_normalized_strength].an_rss_pct); - else - printf("\nSignal strength:\t[ %u%% ]", - sts->an_normalized_strength); - printf("\nAverage Noise:\t\t[ %u%% ]", sts->an_avg_noise_prev_min_pc); - if (rssimap_valid) - printf("\nSignal quality:\t\t[ %u%% ]", - an_rssimap.an_entries[ - sts->an_cur_signal_quality].an_rss_pct); - else - printf("\nSignal quality:\t\t[ %u ]", - sts->an_cur_signal_quality); - printf("\nMax Noise:\t\t[ %u%% ]", sts->an_max_noise_prev_min_pc); - /* - * XXX: This uses the old definition of the rate field (units of - * 500kbps). Technically the new definition is that this field - * contains arbitrary values, but no devices which need this - * support exist and the IEEE seems to intend to use the old - * definition until they get something big so we'll keep using - * it as well because this will work with new cards with - * rate <= 63.5Mbps. - */ - printf("\nCurrent TX rate:\t[ %u%s ]", sts->an_current_tx_rate / 2, - (sts->an_current_tx_rate % 2) ? ".5" : ""); - printf("\nCurrent SSID:\t\t"); - an_printstr((char *)&sts->an_ssid, sts->an_ssidlen); - printf("\nCurrent AP name:\t"); - an_printstr((char *)&sts->an_ap_name, 16); - printf("\nCurrent BSSID:\t\t"); *** 1455 LINES SKIPPED ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106111938.15BJcjOY050967>