PERFORCE change 141342 for review
Andrew Thompson
thompsa at FreeBSD.org
Thu May 8 21:48:45 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=141342
Change 141342 by thompsa at thompsa_burger on 2008/05/08 21:48:00
Allow wlandebug to set the default debug level.
Affected files ...
.. //depot/projects/vap/usr.sbin/wlandebug/wlandebug.8#3 edit
.. //depot/projects/vap/usr.sbin/wlandebug/wlandebug.c#6 edit
Differences ...
==== //depot/projects/vap/usr.sbin/wlandebug/wlandebug.8#3 (text+ko) ====
@@ -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 @@
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.
==== //depot/projects/vap/usr.sbin/wlandebug/wlandebug.c#6 (text+ko) ====
@@ -149,7 +149,7 @@
{
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 @@
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 @@
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)
More information about the p4-projects
mailing list