Allow wlandebug to set the default debug level which is inherited when vaps are

created.
This commit is contained in:
Andrew Thompson 2008-05-19 17:49:57 +00:00
parent f7916f9caf
commit 433b4c16de
2 changed files with 20 additions and 6 deletions

View File

@ -32,7 +32,7 @@
.Nd "set/query 802.11 wireless debugging messages"
.Sh SYNOPSIS
.Nm
.Op Fl i Ar ifnet
.Op Fl d | Fl i Ar ifnet
.Op Fl flag|+flag Ar ...
.Sh DESCRIPTION
The
@ -46,6 +46,10 @@ Running
without any options will display the current messages
enabled for the specified network interface
(by default, ``ath0').
The default debugging level for new interfaces can be set
by specifying the
.Ar -d
option.
When run as the super-user
.Nm
can be used to enable and/or disable debugging messages.

View File

@ -149,7 +149,7 @@ usage(void)
{
int i;
fprintf(stderr, "usage: %s [-i device] [flags]\n", progname);
fprintf(stderr, "usage: %s [-d | -i device] [flags]\n", progname);
fprintf(stderr, "where flags are:\n");
for (i = 0; i < N(flags); i++)
printf("%s\n", flags[i].name);
@ -160,11 +160,18 @@ static void
setoid(char oid[], size_t oidlen, const char *wlan)
{
#ifdef __linux__
snprintf(oid, oidlen, "net.%s.debug", wlan);
if (wlan)
snprintf(oid, oidlen, "net.%s.debug", wlan);
#elif __FreeBSD__
snprintf(oid, oidlen, "net.wlan.%s.debug", wlan+4);
if (wlan)
snprintf(oid, oidlen, "net.wlan.%s.debug", wlan+4);
else
snprintf(oid, oidlen, "net.wlan.debug");
#elif __NetBSD__
snprintf(oid, oidlen, "net.link.ieee80211.%s.debug", wlan+4);
if (wlan)
snprintf(oid, oidlen, "net.link.ieee80211.%s.debug", wlan+4);
else
snprintf(oid, oidlen, "net.link.ieee80211.debug");
#else
#error "No support for this system"
#endif
@ -183,7 +190,10 @@ main(int argc, char *argv[])
progname = argv[0];
setoid(oid, sizeof(oid), "wlan0");
if (argc > 1) {
if (strcmp(argv[1], "-i") == 0) {
if (strcmp(argv[1], "-d") == 0) {
setoid(oid, sizeof(oid), NULL);
argc -= 1, argv += 1;
} else if (strcmp(argv[1], "-i") == 0) {
if (argc < 2)
errx(1, "missing interface name for -i option");
if (strncmp(argv[2], "wlan", 4) != 0)