Skip to contentSkip to conversation

mac80211: enable to inject a-msdu frames using monitor interface

PATCH Superseded Michael Braun 2 participants 2 messages Oct 7, 2016 – Oct 10, 2016 mac80211

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: enable to inject a-msdu frames using monitor interface

Problem: When injecting an A-MSDU using a PF_PACKET socket, the qos flag IEEE80211_QOS_CTL_A_MSDU_PRESENT is cleared.

How to reproduce: Inject a frame on a mac80211 hwsim monitor interface and have tshark sniffing on this monitor interface.
You'll see the packet twice: Once with correct flag and once with flag cleared. On hwsim0, you'll only see the packet with a cleared flag.

I guess the same is needed for packets with IEEE80211_TX_CTRL_AMSDU set.

---
 net/mac80211/wme.c | 7 +++++++
 1 file changed, 7 insertions(+)
net/mac80211/wme.c +7 -0
index 9eb0aee..3faa972 100644
@@ -248,6 +248,13 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
 	/* preserve EOSP bit */
 	ack_policy = *p & IEEE80211_QOS_CTL_EOSP;
 
+	/* preserve A-MSDU bit for MONITOR interfaces to allow injecting
+	 * A-MSDU frames
+	 */
+	if (info->flags & IEEE80211_TX_CTL_INJECTED ||
+	    info->control.flags & IEEE80211_TX_CTRL_AMSDU)
+		ack_policy |= *p & IEEE80211_QOS_CTL_A_MSDU_PRESENT;
+
 	if (is_multicast_ether_addr(hdr->addr1) ||
 	    sdata->noack_map & BIT(tid)) {
 		ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 3 lines · Michael Braun


I guess the same is needed for packets with IEEE80211_TX_CTRL_AMSDU set.

I don't think that's true, since we don't get here after A-MSDU building in mac80211.

net/mac80211/wme.c void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, · line 256

Quoted 10 lines

  /* preserve EOSP bit */
  ack_policy = *p & IEEE80211_QOS_CTL_EOSP;

(quoted diff) +1 -0
+	/* preserve A-MSDU bit for MONITOR interfaces to allow

injecting

net/mac80211/wme.c +5 -0
+	 * A-MSDU frames
+	 */
+	if (info->flags & IEEE80211_TX_CTL_INJECTED ||
+	    info->control.flags & IEEE80211_TX_CTRL_AMSDU)
+		ack_policy |= *p & IEEE80211_QOS_CTL_A_MSDU_PRESENT;

However, why not just unconditionally preserve it?

johannes