summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2016-12-18 10:37:43 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2016-12-18 10:37:43 +0000
commit5057be34f0f18fb6a31daa1d060652c947941908 (patch)
treeb026567fa826eadc4a2ca5b6f30379ad0591a8c4
parent1dc7152c544d02c76a03a540d4032b71798e2f6d (diff)
While copying out channel flags to userspace, omit the HT channel flag if
we're not in 11n mode. This will allow tcpdump to show the mode correctly. ok mpi@
-rw-r--r--sys/dev/pci/if_iwm.c15
-rw-r--r--sys/dev/pci/if_iwn.c15
-rw-r--r--sys/net80211/ieee80211_ioctl.c4
3 files changed, 25 insertions, 9 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index 9dfdc8997c6..e3912b75060 100644
--- a/sys/dev/pci/if_iwm.c
+++ b/sys/dev/pci/if_iwm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.154 2016/12/10 19:03:53 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.155 2016/12/18 10:37:42 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -3339,14 +3339,17 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
if (sc->sc_drvbpf != NULL) {
struct mbuf mb;
struct iwm_rx_radiotap_header *tap = &sc->sc_rxtap;
+ uint16_t chan_flags;
tap->wr_flags = 0;
if (phy_info->phy_flags & htole16(IWM_PHY_INFO_FLAG_SHPREAMBLE))
tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
tap->wr_chan_freq =
htole16(ic->ic_channels[phy_info->channel].ic_freq);
- tap->wr_chan_flags =
- htole16(ic->ic_channels[phy_info->channel].ic_flags);
+ chan_flags = ic->ic_channels[phy_info->channel].ic_flags;
+ if (ic->ic_curmode != IEEE80211_MODE_11N)
+ chan_flags &= ~IEEE80211_CHAN_HT;
+ tap->wr_chan_flags = htole16(chan_flags);
tap->wr_dbm_antsignal = (int8_t)rssi;
tap->wr_dbm_antnoise = (int8_t)sc->sc_noise;
tap->wr_tsft = phy_info->system_timestamp;
@@ -3991,10 +3994,14 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac)
if (sc->sc_drvbpf != NULL) {
struct mbuf mb;
struct iwm_tx_radiotap_header *tap = &sc->sc_txtap;
+ uint16_t chan_flags;
tap->wt_flags = 0;
tap->wt_chan_freq = htole16(ni->ni_chan->ic_freq);
- tap->wt_chan_flags = htole16(ni->ni_chan->ic_flags);
+ chan_flags = ni->ni_chan->ic_flags;
+ if (ic->ic_curmode != IEEE80211_MODE_11N)
+ chan_flags &= ~IEEE80211_CHAN_HT;
+ tap->wt_chan_flags = htole16(chan_flags);
if ((ni->ni_flags & IEEE80211_NODE_HT) &&
!IEEE80211_IS_MULTICAST(wh->i_addr1) &&
type == IEEE80211_FC0_TYPE_DATA &&
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index be7825b8591..ed749947b79 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwn.c,v 1.178 2016/12/10 13:22:07 stsp Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.179 2016/12/18 10:37:42 stsp Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -2130,14 +2130,17 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
if (sc->sc_drvbpf != NULL) {
struct mbuf mb;
struct iwn_rx_radiotap_header *tap = &sc->sc_rxtap;
+ uint16_t chan_flags;
tap->wr_flags = 0;
if (stat->flags & htole16(IWN_STAT_FLAG_SHPREAMBLE))
tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
tap->wr_chan_freq =
htole16(ic->ic_channels[stat->chan].ic_freq);
- tap->wr_chan_flags =
- htole16(ic->ic_channels[stat->chan].ic_flags);
+ chan_flags = ic->ic_channels[stat->chan].ic_flags;
+ if (ic->ic_curmode != IEEE80211_MODE_11N)
+ chan_flags &= ~IEEE80211_CHAN_HT;
+ tap->wr_chan_flags = htole16(chan_flags);
tap->wr_dbm_antsignal = (int8_t)rssi;
tap->wr_dbm_antnoise = (int8_t)sc->noise;
tap->wr_tsft = stat->tstamp;
@@ -2908,10 +2911,14 @@ iwn_tx(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
if (sc->sc_drvbpf != NULL) {
struct mbuf mb;
struct iwn_tx_radiotap_header *tap = &sc->sc_txtap;
+ uint16_t chan_flags;
tap->wt_flags = 0;
tap->wt_chan_freq = htole16(ni->ni_chan->ic_freq);
- tap->wt_chan_flags = htole16(ni->ni_chan->ic_flags);
+ chan_flags = ni->ni_chan->ic_flags;
+ if (ic->ic_curmode != IEEE80211_MODE_11N)
+ chan_flags &= ~IEEE80211_CHAN_HT;
+ tap->wt_chan_flags = htole16(chan_flags);
if ((ni->ni_flags & IEEE80211_NODE_HT) &&
!IEEE80211_IS_MULTICAST(wh->i_addr1) &&
type == IEEE80211_FC0_TYPE_DATA) {
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 96ee7b6eb15..53248c92063 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_ioctl.c,v 1.44 2016/09/15 03:32:48 dlg Exp $ */
+/* $OpenBSD: ieee80211_ioctl.c,v 1.45 2016/12/18 10:37:42 stsp Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */
/*-
@@ -71,6 +71,8 @@ ieee80211_node2req(struct ieee80211com *ic, const struct ieee80211_node *ni,
/* Channel and rates */
nr->nr_channel = ieee80211_chan2ieee(ic, ni->ni_chan);
nr->nr_chan_flags = ni->ni_chan->ic_flags;
+ if (ic->ic_curmode != IEEE80211_MODE_11N)
+ nr->nr_chan_flags &= ~IEEE80211_CHAN_HT;
nr->nr_nrates = ni->ni_rates.rs_nrates;
bcopy(ni->ni_rates.rs_rates, nr->nr_rates, IEEE80211_RATE_MAXSIZE);