summaryrefslogtreecommitdiffstats
path: root/usr.sbin/wlandebug/wlandebug.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2008-04-20 20:41:47 +0000
committersam <sam@FreeBSD.org>2008-04-20 20:41:47 +0000
commita56ef47966af832916ae8cf683710c11bc9532f3 (patch)
treef755b0f342049fa83d9d16351683cf94a9ca36f2 /usr.sbin/wlandebug/wlandebug.c
parent0235df2313108a3b2e09472cf954afc7a6bd4716 (diff)
downloadFreeBSD-src-a56ef47966af832916ae8cf683710c11bc9532f3.zip
FreeBSD-src-a56ef47966af832916ae8cf683710c11bc9532f3.tar.gz
update for vaps
Supported by: Hobnob
Diffstat (limited to 'usr.sbin/wlandebug/wlandebug.c')
-rw-r--r--usr.sbin/wlandebug/wlandebug.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/usr.sbin/wlandebug/wlandebug.c b/usr.sbin/wlandebug/wlandebug.c
index dbc99d7..71f552e 100644
--- a/usr.sbin/wlandebug/wlandebug.c
+++ b/usr.sbin/wlandebug/wlandebug.c
@@ -80,6 +80,10 @@ const char *progname;
#define IEEE80211_MSG_INACT 0x00000080 /* inactivity handling */
#define IEEE80211_MSG_ROAM 0x00000040 /* sta-mode roaming */
#define IEEE80211_MSG_RATECTL 0x00000020 /* tx rate control */
+#define IEEE80211_MSG_ACTION 0x00000010 /* action frame handling */
+#define IEEE80211_MSG_WDS 0x00000008 /* WDS handling */
+#define IEEE80211_MSG_IOCTL 0x00000004 /* ioctl handling */
+#define IEEE80211_MSG_ADDBA 0x00000002 /* ADDBA handling */
static struct {
const char *name;
@@ -112,6 +116,10 @@ static struct {
{ "inact", IEEE80211_MSG_INACT },
{ "roam", IEEE80211_MSG_ROAM },
{ "rate", IEEE80211_MSG_RATECTL },
+ { "action", IEEE80211_MSG_ACTION },
+ { "wds", IEEE80211_MSG_WDS },
+ { "ioctl", IEEE80211_MSG_IOCTL },
+ { "addba", IEEE80211_MSG_ADDBA },
};
static u_int
@@ -148,47 +156,44 @@ usage(void)
exit(-1);
}
+static void
+setoid(char oid[], size_t oidlen, const char *wlan)
+{
+#ifdef __linux__
+ snprintf(oid, oidlen, "net.%s.debug", wlan);
+#elif __FreeBSD__
+ snprintf(oid, oidlen, "net.wlan.%s.debug", wlan+4);
+#elif __NetBSD__
+ snprintf(oid, oidlen, "net.link.ieee80211.%s.debug", wlan+4);
+#else
+#error "No support for this system"
+#endif
+}
+
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];
+ char oid[256];
progname = argv[0];
+ setoid(oid, sizeof(oid), "wlan0");
if (argc > 1) {
if (strcmp(argv[1], "-i") == 0) {
if (argc < 2)
errx(1, "missing interface name for -i option");
- ifname = argv[2];
+ if (strncmp(argv[2], "wlan", 4) != 0)
+ errx(1, "expecting a wlan interface name");
+ setoid(oid, sizeof(oid), 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);
OpenPOWER on IntegriCloud