Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Apr 2019 13:26:46 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r346006 - in stable: 11/sys/dev/usb/wlan 12/sys/dev/usb/wlan
Message-ID:  <201904071326.x37DQk5w037603@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Sun Apr  7 13:26:45 2019
New Revision: 346006
URL: https://svnweb.freebsd.org/changeset/base/346006

Log:
  MFC r345754:
  run(4): properly set F_DATAPAD radiotap flag if frame has padding between
  frame header and data.
  
  This will fix 'Mysterious OLPC stuff' for received frames and wrong
  CCMP / TKIP / data decoding for transmitted frames in net/wireshark
  dissector.
  
  While here, drop unneeded comment - net80211 handles padding requirements
  for Tx & Rx without driver adjustment.
  
  Was tested with D-Link DWA-140 rev B3, STA mode.

Modified:
  stable/12/sys/dev/usb/wlan/if_run.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/usb/wlan/if_run.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/dev/usb/wlan/if_run.c
==============================================================================
--- stable/12/sys/dev/usb/wlan/if_run.c	Sun Apr  7 13:11:40 2019	(r346005)
+++ stable/12/sys/dev/usb/wlan/if_run.c	Sun Apr  7 13:26:45 2019	(r346006)
@@ -2851,10 +2851,6 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin
 	}
 
 	if (flags & RT2860_RX_L2PAD) {
-		/*
-		 * XXX OpenBSD removes padding between header
-		 * and payload here...
-		 */
 		RUN_DPRINTF(sc, RUN_DEBUG_RECV,
 		    "received RT2860_RX_L2PAD frame\n");
 		len += 2;
@@ -2896,6 +2892,8 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin
 		uint16_t phy;
 
 		tap->wr_flags = 0;
+		if (flags & RT2860_RX_L2PAD)
+			tap->wr_flags |= IEEE80211_RADIOTAP_F_DATAPAD;
 		tap->wr_antsignal = rssi;
 		tap->wr_antenna = ant;
 		tap->wr_dbm_antsignal = run_rssi2dbm(sc, rssi, ant);
@@ -3162,14 +3160,23 @@ tr_setup:
 
 		vap = data->ni->ni_vap;
 		if (ieee80211_radiotap_active_vap(vap)) {
+			const struct ieee80211_frame *wh;
 			struct run_tx_radiotap_header *tap = &sc->sc_txtap;
 			struct rt2860_txwi *txwi = 
 			    (struct rt2860_txwi *)(&data->desc + sizeof(struct rt2870_txd));
+			int has_l2pad;
+
+			wh = mtod(m, struct ieee80211_frame *);
+			has_l2pad = IEEE80211_HAS_ADDR4(wh) !=
+			    IEEE80211_QOS_HAS_SEQ(wh);
+
 			tap->wt_flags = 0;
 			tap->wt_rate = rt2860_rates[data->ridx].rate;
 			tap->wt_hwqueue = index;
 			if (le16toh(txwi->phy) & RT2860_PHY_SHPRE)
 				tap->wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
+			if (has_l2pad)
+				tap->wt_flags |= IEEE80211_RADIOTAP_F_DATAPAD;
 
 			ieee80211_radiotap_tx(vap, m);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904071326.x37DQk5w037603>