diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2017-10-18 15:47:40 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2017-10-18 15:47:40 +0000 |
commit | 79ba768e2827b45991cf8ba2dfb1487ddfaa92b0 (patch) | |
tree | d6c7c36de7d6893db4f2c33058408458dc2a3ac9 /sys/dev/ic | |
parent | 078ccc4d89b142843b0259a376b4b5a46db70026 (diff) |
Read and extract the channel number from the chanspec to beautify the
scan results. Since the channel number is encoded on both IO types in
the same way, we don't need to implement per IO type helpers for now.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/bwfm.c | 7 | ||||
-rw-r--r-- | sys/dev/ic/bwfmreg.h | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index 1215bb0570f..7838ce07461 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.9 2017/10/18 13:00:27 mpi Exp $ */ +/* $OpenBSD: bwfm.c,v 1.10 2017/10/18 15:47:39 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -1411,6 +1411,7 @@ bwfm_scan_node(struct bwfm_softc *sc, struct bwfm_bss_info *bss, size_t len) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_node *ni; + int chan; ni = ieee80211_alloc_node(ic, bss->bssid); IEEE80211_ADDR_COPY(ni->ni_macaddr, bss->bssid); @@ -1418,6 +1419,8 @@ bwfm_scan_node(struct bwfm_softc *sc, struct bwfm_bss_info *bss, size_t len) ni->ni_esslen = min(bss->ssid_len, sizeof(bss->ssid)); ni->ni_esslen = min(ni->ni_esslen, IEEE80211_NWID_LEN); memcpy(ni->ni_essid, bss->ssid, ni->ni_esslen); - ni->ni_chan = ic->ic_ibss_chan; + chan = (bss->chanspec >> BWFM_CHANSPEC_CHAN_SHIFT) + & BWFM_CHANSPEC_CHAN_MASK; + ni->ni_chan = &ic->ic_channels[chan]; ni->ni_rssi = letoh32(bss->rssi); } diff --git a/sys/dev/ic/bwfmreg.h b/sys/dev/ic/bwfmreg.h index cad0a58c4a6..b963ce9a052 100644 --- a/sys/dev/ic/bwfmreg.h +++ b/sys/dev/ic/bwfmreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfmreg.h,v 1.6 2017/10/18 15:45:38 patrick Exp $ */ +/* $OpenBSD: bwfmreg.h,v 1.7 2017/10/18 15:47:39 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -156,6 +156,8 @@ #define BWFM_WSEC_AES (1 << 2) /* Channel Parameters */ +#define BWFM_CHANSPEC_CHAN_MASK 0xff +#define BWFM_CHANSPEC_CHAN_SHIFT 0 #define BWFM_BAND_AUTO 0 #define BWFM_BAND_5G 1 #define BWFM_BAND_2G 2 |