From a373c6d4d13cb14415a0ff2585b7108090614af9 Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Sun, 19 Jul 2015 02:49:55 +0000 Subject: In tcpdump, show 11n HTOP primary and secondary channel numbers for 40MHz BSS, instead of showing just the primary one and "above" or "below" for secondary. ok sthen --- usr.sbin/tcpdump/print-802_11.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/tcpdump/print-802_11.c b/usr.sbin/tcpdump/print-802_11.c index fe7c0727637..4d30bda1467 100644 --- a/usr.sbin/tcpdump/print-802_11.c +++ b/usr.sbin/tcpdump/print-802_11.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-802_11.c,v 1.23 2015/07/18 23:35:01 stsp Exp $ */ +/* $OpenBSD: print-802_11.c,v 1.24 2015/07/19 02:49:54 stsp Exp $ */ /* * Copyright (c) 2005 Reyk Floeter @@ -373,13 +373,27 @@ ieee80211_print_htop(u_int8_t *data, u_int len) primary_chan = data[0]; sco = ((htopinfo[0] & IEEE80211_HTOP0_SCO_MASK) >> IEEE80211_HTOP0_SCO_SHIFT); - if (sco == 0) + if (sco == 0) /* no secondary channel */ printf("20MHz chan %d", primary_chan); - else if (sco == 1) - printf("40MHz primary chan %d secondary above", primary_chan); - else if (sco == 3) - printf("40MHz primary chan %d secondary below", primary_chan); - else + else if (sco == 1) { /* secondary channel above */ + if (primary_chan >= 1 && primary_chan <= 13) /* 2GHz */ + printf("40MHz chan %d:%d", primary_chan, + primary_chan + 1); + else if (primary_chan >= 34) /* 5GHz */ + printf("40MHz chan %d:%d", primary_chan, + primary_chan + 4); + else + printf("[invalid 40MHz chan %d+]", primary_chan); + } else if (sco == 3) { /* secondary channel below */ + if (primary_chan >= 2 && primary_chan <= 14) /* 2GHz */ + printf("40MHz chan %d:%d", primary_chan, + primary_chan - 1); + else if (primary_chan >= 40) /* 5GHz */ + printf("40MHz chan %d:%d", primary_chan, + primary_chan - 4); + else + printf("[invalid 40MHz chan %d-]", primary_chan); + } else printf("chan %d [invalid secondary channel offset %d]", primary_chan, sco); -- cgit v1.2.3