diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2016-12-18 10:37:43 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2016-12-18 10:37:43 +0000 |
commit | 5057be34f0f18fb6a31daa1d060652c947941908 (patch) | |
tree | b026567fa826eadc4a2ca5b6f30379ad0591a8c4 /sys/dev | |
parent | 1dc7152c544d02c76a03a540d4032b71798e2f6d (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@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_iwm.c | 15 | ||||
-rw-r--r-- | sys/dev/pci/if_iwn.c | 15 |
2 files changed, 22 insertions, 8 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) { |