wlandebug has been moved to the base system.
Approved by: re (rwatson)
This commit is contained in:
parent
20cbc3f89b
commit
dff1b6c68a
@ -1,5 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= stumbler w00t wlandebug wesside wlaninject wlanstats wlanwatch
|
||||
SUBDIR= stumbler w00t wesside wlaninject wlanstats wlanwatch
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -7,7 +7,6 @@ wireless driver. Everything should work with ath.
|
||||
stumbler view nearby networks using raw packet interface
|
||||
w00t variety of programs that use the raw packet interface
|
||||
wesside WEP frag attack tool using raw packet interface
|
||||
wlandebug manipulate net80211 debug flags symbolically
|
||||
wlaninject inject 802.11 packets using the raw packet interface
|
||||
wlanstats dump net80211 statistics
|
||||
wlanwatch monitor net80211 events via the routing socket
|
||||
|
@ -1,7 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= wlandebug
|
||||
BINDIR= /usr/local/bin
|
||||
MAN= wlandebug.8
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,181 +0,0 @@
|
||||
.\" Copyright (c) 2007 Sam Leffler, Errno Consulting
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 THE AUTHOR OR CONTRIBUTORS 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 January 8, 2007
|
||||
.Dt WLANDEBUG 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm wlandebug
|
||||
.Nd "set/query 802.11 wireless debugging messages"
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl i Ar ifnet
|
||||
.Op Fl flag|+flag Ar ...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
command is a tool for enabling and disabling
|
||||
debugging messages in the
|
||||
.Xr wlan 4
|
||||
module.
|
||||
Running
|
||||
.Nm
|
||||
without any options will display the current messages
|
||||
enabled for the specified network interface
|
||||
(by default, ``ath0').
|
||||
When run as the super-user
|
||||
.Nm
|
||||
can be used to enable and/or disable debugging messages.
|
||||
.Pp
|
||||
To enable debugging messages of a certain
|
||||
.Ar type
|
||||
use
|
||||
.Ar +type ;
|
||||
to disable such messages use
|
||||
.Ar -type .
|
||||
Multiple messages can be enabled and disabled with a single command.
|
||||
.Pp
|
||||
Messages are organized in the following groups:
|
||||
.Bl -tag -width ".Ar dumppkts"
|
||||
.It Ar debug
|
||||
general debugging facilities; equivalent to setting the debug
|
||||
parameter with
|
||||
.Xr ifconfig 8 .
|
||||
.It Ar dumppkts
|
||||
dump packet contents on transmit and receive.
|
||||
.It Ar crypto
|
||||
crypto-related work.
|
||||
.It Ar input
|
||||
errors encountered during input handling.
|
||||
.It Ar xrate
|
||||
extended rate set handling (for 802.11g).
|
||||
.It Ar elemid
|
||||
information element processing in 802.11 management frames.
|
||||
.It Ar node
|
||||
management of per-station state.
|
||||
.It Ar assoc
|
||||
802.11 station association processing; particularly useful to
|
||||
see when stations join and leave a BSS.
|
||||
.It Ar auth
|
||||
802.11 station authentication processing.
|
||||
.It Ar scan
|
||||
scanning operation; especially useful for debugging problems
|
||||
with not locating an access point.
|
||||
.It Ar output
|
||||
errors encountered during output handling.
|
||||
.It Ar state
|
||||
.Xr wlan 4
|
||||
state machine operation.
|
||||
.It Ar power
|
||||
802.11 power save operation; in hostap mode this enables
|
||||
copious information about buffered frames for stations operating
|
||||
in power save mode.
|
||||
.It Ar dot1x
|
||||
802.1x operation; not presently meaningful as 802.1x protocol
|
||||
support is implemented in user mode by the
|
||||
.Xr hostapd 8
|
||||
program.
|
||||
.It Ar dot1xsm
|
||||
802.1x state machine operation; not presently meaningful as 802.1x protocol
|
||||
support is implemented in user mode by the
|
||||
.Xr hostapd 8
|
||||
program.
|
||||
.It Ar radius
|
||||
radius backend operation as it relates to 802.1x operation;
|
||||
not presently meaningful as 802.1x protocol
|
||||
support is implemented in user mode by the
|
||||
.Xr hostapd 8
|
||||
program.
|
||||
.It Ar raddump
|
||||
dump packets exchanged with the radius backend for 802.1x operation;
|
||||
not presently meaningful as 802.1x protocol
|
||||
support is implemented in user mode by the
|
||||
.Xr hostapd 8
|
||||
program.
|
||||
.It Ar radkeys
|
||||
include key contents when dumping packets exchanged with the
|
||||
radius backend for 802.1x operation;
|
||||
not presently meaningful as 802.1x protocol
|
||||
support is implemented in user mode by the
|
||||
.Xr hostapd 8
|
||||
program.
|
||||
.It Ar wpa
|
||||
trace operation of the WPA protocol;
|
||||
only partly meaningful as WPA protocol
|
||||
support is mostly implemented in user mode by the
|
||||
.Xr hostapd 8
|
||||
and
|
||||
.Xr wpa_supplicant 8
|
||||
programs.
|
||||
.It Ar acl
|
||||
trace operation of the Access Control List (ACL) support; see
|
||||
.Xr wlan_acl 4
|
||||
for more details.
|
||||
.It Ar wme
|
||||
trace operation of WME/WMM protocol processing.
|
||||
.It Ar superg
|
||||
trace operation of Atheros SuperG protocol processing.
|
||||
.It Ar doth
|
||||
trace operation of IEEE 802.11h protocol processing.
|
||||
.It Ar inact
|
||||
trace station inactivity processing; in particular,
|
||||
show when stations associated to an access point are dropped due to
|
||||
inactivity.
|
||||
.It Ar roam
|
||||
trace station mode roaming between access points.
|
||||
.It Ar rate
|
||||
trace transmit rate control operation.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
The following might be used to debug basic station mode operation:
|
||||
.Pp
|
||||
.Dl "wlandebug -i ral0 scan+auth+assoc"
|
||||
.Pp
|
||||
it enables debug messages while scanning, authenticating to
|
||||
an access point, and associating to an access point.
|
||||
.Sh SEE ALSO
|
||||
.Xr ifconfig 8 ,
|
||||
.Xr wlanstats 8 ,
|
||||
.Xr athdebug 8 ,
|
||||
.Xr athstats 8 .
|
||||
.Sh NOTES
|
||||
Different wireless drivers support different debugging messages.
|
||||
Drivers such as
|
||||
.Xr ath 4
|
||||
and
|
||||
.Xr ral 4
|
||||
that depend on the
|
||||
.Xr wlan 4
|
||||
module for 802.11 protocol processing typically support
|
||||
most of the debugging messages while devices that
|
||||
implement parts of the 802.11 protocol in firmware do not.
|
||||
.Pp
|
||||
Some debugging messages are no longer meaningful
|
||||
because protocol processing has moved from the operating
|
||||
system to user mode programs such as
|
||||
.Xr hostapd 8
|
||||
and
|
||||
.Xr wpa_supplicant 8 .
|
@ -1,245 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
|
||||
* 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,
|
||||
* without modification.
|
||||
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
||||
* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
|
||||
* redistribution must be conditioned upon including a substantially
|
||||
* similar Disclaimer requirement for further binary redistribution.
|
||||
* 3. Neither the names of the above-listed copyright holders nor the names
|
||||
* of any contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* Alternatively, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") version 2 as published by the Free
|
||||
* Software Foundation.
|
||||
*
|
||||
* NO WARRANTY
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* wlandebug [-i interface] flags
|
||||
* (default interface is wlan.0).
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
|
||||
#define N(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
const char *progname;
|
||||
|
||||
#define IEEE80211_MSG_11N 0x80000000 /* 11n mode debug */
|
||||
#define IEEE80211_MSG_DEBUG 0x40000000 /* IFF_DEBUG equivalent */
|
||||
#define IEEE80211_MSG_DUMPPKTS 0x20000000 /* IFF_LINK2 equivalant */
|
||||
#define IEEE80211_MSG_CRYPTO 0x10000000 /* crypto work */
|
||||
#define IEEE80211_MSG_INPUT 0x08000000 /* input handling */
|
||||
#define IEEE80211_MSG_XRATE 0x04000000 /* rate set handling */
|
||||
#define IEEE80211_MSG_ELEMID 0x02000000 /* element id parsing */
|
||||
#define IEEE80211_MSG_NODE 0x01000000 /* node handling */
|
||||
#define IEEE80211_MSG_ASSOC 0x00800000 /* association handling */
|
||||
#define IEEE80211_MSG_AUTH 0x00400000 /* authentication handling */
|
||||
#define IEEE80211_MSG_SCAN 0x00200000 /* scanning */
|
||||
#define IEEE80211_MSG_OUTPUT 0x00100000 /* output handling */
|
||||
#define IEEE80211_MSG_STATE 0x00080000 /* state machine */
|
||||
#define IEEE80211_MSG_POWER 0x00040000 /* power save handling */
|
||||
#define IEEE80211_MSG_DOT1X 0x00020000 /* 802.1x authenticator */
|
||||
#define IEEE80211_MSG_DOT1XSM 0x00010000 /* 802.1x state machine */
|
||||
#define IEEE80211_MSG_RADIUS 0x00008000 /* 802.1x radius client */
|
||||
#define IEEE80211_MSG_RADDUMP 0x00004000 /* dump 802.1x radius packets */
|
||||
#define IEEE80211_MSG_RADKEYS 0x00002000 /* dump 802.1x keys */
|
||||
#define IEEE80211_MSG_WPA 0x00001000 /* WPA/RSN protocol */
|
||||
#define IEEE80211_MSG_ACL 0x00000800 /* ACL handling */
|
||||
#define IEEE80211_MSG_WME 0x00000400 /* WME protocol */
|
||||
#define IEEE80211_MSG_SUPERG 0x00000200 /* Atheros SuperG protocol */
|
||||
#define IEEE80211_MSG_DOTH 0x00000100 /* 802.11h support */
|
||||
#define IEEE80211_MSG_INACT 0x00000080 /* inactivity handling */
|
||||
#define IEEE80211_MSG_ROAM 0x00000040 /* sta-mode roaming */
|
||||
#define IEEE80211_MSG_RATECTL 0x00000020 /* tx rate control */
|
||||
|
||||
static struct {
|
||||
const char *name;
|
||||
u_int bit;
|
||||
} flags[] = {
|
||||
{ "11n", IEEE80211_MSG_11N },
|
||||
{ "debug", IEEE80211_MSG_DEBUG },
|
||||
{ "dumppkts", IEEE80211_MSG_DUMPPKTS },
|
||||
{ "crypto", IEEE80211_MSG_CRYPTO },
|
||||
{ "input", IEEE80211_MSG_INPUT },
|
||||
{ "xrate", IEEE80211_MSG_XRATE },
|
||||
{ "elemid", IEEE80211_MSG_ELEMID },
|
||||
{ "node", IEEE80211_MSG_NODE },
|
||||
{ "assoc", IEEE80211_MSG_ASSOC },
|
||||
{ "auth", IEEE80211_MSG_AUTH },
|
||||
{ "scan", IEEE80211_MSG_SCAN },
|
||||
{ "output", IEEE80211_MSG_OUTPUT },
|
||||
{ "state", IEEE80211_MSG_STATE },
|
||||
{ "power", IEEE80211_MSG_POWER },
|
||||
{ "dot1x", IEEE80211_MSG_DOT1X },
|
||||
{ "dot1xsm", IEEE80211_MSG_DOT1XSM },
|
||||
{ "radius", IEEE80211_MSG_RADIUS },
|
||||
{ "raddump", IEEE80211_MSG_RADDUMP },
|
||||
{ "radkeys", IEEE80211_MSG_RADKEYS },
|
||||
{ "wpa", IEEE80211_MSG_WPA },
|
||||
{ "acl", IEEE80211_MSG_ACL },
|
||||
{ "wme", IEEE80211_MSG_WME },
|
||||
{ "superg", IEEE80211_MSG_SUPERG },
|
||||
{ "doth", IEEE80211_MSG_DOTH },
|
||||
{ "inact", IEEE80211_MSG_INACT },
|
||||
{ "roam", IEEE80211_MSG_ROAM },
|
||||
{ "rate", IEEE80211_MSG_RATECTL },
|
||||
};
|
||||
|
||||
static u_int
|
||||
getflag(const char *name, int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < N(flags); i++)
|
||||
if (strncasecmp(flags[i].name, name, len) == 0)
|
||||
return flags[i].bit;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
getflagname(u_int flag)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < N(flags); i++)
|
||||
if (flags[i].bit == flag)
|
||||
return flags[i].name;
|
||||
return "???";
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf(stderr, "usage: %s [-i device] [flags]\n", progname);
|
||||
fprintf(stderr, "where flags are:\n");
|
||||
for (i = 0; i < N(flags); i++)
|
||||
printf("%s\n", flags[i].name);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const char *ifname = "ath0";
|
||||
const char *cp, *tp;
|
||||
const char *sep;
|
||||
int op, i, unit;
|
||||
u_int32_t debug, ndebug;
|
||||
size_t debuglen, parentlen;
|
||||
char oid[256], parent[256];
|
||||
|
||||
progname = argv[0];
|
||||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "-i") == 0) {
|
||||
if (argc < 2)
|
||||
errx(1, "missing interface name for -i option");
|
||||
ifname = argv[2];
|
||||
argc -= 2, argv += 2;
|
||||
} else if (strcmp(argv[1], "-?") == 0)
|
||||
usage();
|
||||
}
|
||||
|
||||
for (unit = 0; unit < 10; unit++) {
|
||||
#ifdef __linux__
|
||||
snprintf(oid, sizeof(oid), "net.wlan%d.%%parent", unit);
|
||||
#else
|
||||
snprintf(oid, sizeof(oid), "net.wlan.%d.%%parent", unit);
|
||||
#endif
|
||||
parentlen = sizeof(parent);
|
||||
if (sysctlbyname(oid, parent, &parentlen, NULL, 0) < 0)
|
||||
continue;
|
||||
if (strncmp(parent, ifname, parentlen) == 0)
|
||||
break;
|
||||
}
|
||||
if (unit == 10)
|
||||
errx(1, "%s: cannot locate wlan sysctl node.", ifname);
|
||||
#ifdef __linux__
|
||||
snprintf(oid, sizeof(oid), "net.wlan%d.debug", unit);
|
||||
#else
|
||||
snprintf(oid, sizeof(oid), "net.wlan.%d.debug", unit);
|
||||
#endif
|
||||
debuglen = sizeof(debug);
|
||||
if (sysctlbyname(oid, &debug, &debuglen, NULL, 0) < 0)
|
||||
err(1, "sysctl-get(%s)", oid);
|
||||
ndebug = debug;
|
||||
for (; argc > 1; argc--, argv++) {
|
||||
cp = argv[1];
|
||||
do {
|
||||
u_int bit;
|
||||
|
||||
if (*cp == '-') {
|
||||
cp++;
|
||||
op = -1;
|
||||
} else if (*cp == '+') {
|
||||
cp++;
|
||||
op = 1;
|
||||
} else
|
||||
op = 0;
|
||||
for (tp = cp; *tp != '\0' && *tp != '+' && *tp != '-';)
|
||||
tp++;
|
||||
bit = getflag(cp, tp-cp);
|
||||
if (op < 0)
|
||||
ndebug &= ~bit;
|
||||
else if (op > 0)
|
||||
ndebug |= bit;
|
||||
else {
|
||||
if (bit == 0) {
|
||||
int c = *cp;
|
||||
if (isdigit(c))
|
||||
bit = strtoul(cp, NULL, 0);
|
||||
else
|
||||
errx(1, "unknown flag %.*s",
|
||||
(int)(tp-cp), cp);
|
||||
}
|
||||
ndebug = bit;
|
||||
}
|
||||
} while (*(cp = tp) != '\0');
|
||||
}
|
||||
if (debug != ndebug) {
|
||||
printf("%s: 0x%x => ", oid, debug);
|
||||
if (sysctlbyname(oid, NULL, NULL, &ndebug, sizeof(ndebug)) < 0)
|
||||
err(1, "sysctl-set(%s)", oid);
|
||||
printf("0x%x", ndebug);
|
||||
debug = ndebug;
|
||||
} else
|
||||
printf("%s: 0x%x", oid, debug);
|
||||
sep = "<";
|
||||
for (i = 0; i < N(flags); i++)
|
||||
if (debug & flags[i].bit) {
|
||||
printf("%s%s", sep, flags[i].name);
|
||||
sep = ",";
|
||||
}
|
||||
printf("%s\n", *sep != '<' ? ">" : "");
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user