Date: Thu, 8 May 2008 21:48:44 GMT From: Andrew Thompson <thompsa@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 141342 for review Message-ID: <200805082148.m48LmiAG004410@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=141342 Change 141342 by thompsa@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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805082148.m48LmiAG004410>