diff options
author | adrian <adrian@FreeBSD.org> | 2016-04-19 05:17:43 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2016-04-19 05:17:43 +0000 |
commit | 877d2ac2fd168a3d6fd2325534c05052ed138499 (patch) | |
tree | 0b233c9340d76d49c9f90dcc4d94f31c1df65c00 /sbin/ifconfig | |
parent | 5ebf5daae9fbf0c5ae4eb758e73598122b76ec40 (diff) | |
download | FreeBSD-src-877d2ac2fd168a3d6fd2325534c05052ed138499.zip FreeBSD-src-877d2ac2fd168a3d6fd2325534c05052ed138499.tar.gz |
Add VHT power envelope parsing to ifconfig.
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r-- | sbin/ifconfig/ifieee80211.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index 84daec9..416d3e3 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -2573,6 +2573,39 @@ printvhtinfo(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen) } static void +printvhtpwrenv(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen) +{ + printf("%s", tag); + static const char *txpwrmap[] = { + "20", + "40", + "80", + "160", + }; + if (verbose) { + const struct ieee80211_ie_vht_txpwrenv *vhtpwr = + (const struct ieee80211_ie_vht_txpwrenv *) ie; + int i, n; + const char *sep = ""; + + /* Get count; trim at ielen */ + n = (vhtpwr->tx_info & + IEEE80211_VHT_TXPWRENV_INFO_COUNT_MASK) + 1; + /* Trim at ielen */ + if (n > ielen - 3) + n = ielen - 3; + printf("<tx_info 0x%02x pwr:[", vhtpwr->tx_info); + for (i = 0; i < n; i++) { + printf("%s%s:%.2f", sep, txpwrmap[i], + ((float) ((int8_t) ie[i+3])) / 2.0); + sep = " "; + } + + printf("]>"); + } +} + +static void printhtcap(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen) { printf("%s", tag); @@ -3151,7 +3184,6 @@ iename(int elemid) case IEEE80211_ELEMID_IBSSDFS: return " IBSSDFS"; case IEEE80211_ELEMID_TPC: return " TPC"; case IEEE80211_ELEMID_CCKM: return " CCKM"; - case IEEE80211_ELEMID_VHT_PWR_ENV: return " VHTPWRENV"; } return " ???"; } @@ -3222,6 +3254,9 @@ printies(const u_int8_t *vp, int ielen, int maxcols) case IEEE80211_ELEMID_VHT_OPMODE: printvhtinfo(" VHTOPMODE", vp, 2+vp[1], maxcols); break; + case IEEE80211_ELEMID_VHT_PWR_ENV: + printvhtpwrenv(" VHTPWRENV", vp, 2+vp[1], maxcols); + break; case IEEE80211_ELEMID_BSSLOAD: printbssload(" BSSLOAD", vp, 2+vp[1], maxcols); break; |