mac80211: don't overwrite QoS TID of injected frames
authorMathy Vanhoef <Mathy.Vanhoef@kuleuven.be>
Wed, 4 Nov 2020 06:18:21 +0000 (10:18 +0400)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 6 Nov 2020 10:02:42 +0000 (11:02 +0100)
Currently ieee80211_set_qos_hdr sets the QoS TID of all frames based
on the value assigned to skb->priority. This means it will also
overwrite the QoS TID of injected frames. The commit 753ffad3d624
("mac80211: fix TID field in monitor mode transmit") prevented
injected frames from being modified because of this by setting
skb->priority to the TID of the injected frame, which assured the
QoS TID will not be changed to a different value. Unfortunately,
this workaround complicates the handling of injected frames because
we can't set skb->priority without affecting the TID value in the
QoS field of injected frames.

To avoid this, and to simplify the next patch, detect if a frame is
injected in ieee80211_set_qos_hdr and if so do not change its QoS
field.

Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@kuleuven.be>
Link: https://lore.kernel.org/r/20201104061823.197407-4-Mathy.Vanhoef@kuleuven.be
[fix typos in commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/tx.c
net/mac80211/wme.c

index d4e1a27208073214e887f0b17ab2f366d4506704..8bf80b6757dcc19818c71ec2266c9fdcde84fd4a 100644 (file)
@@ -2271,10 +2271,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
                                                    payload[7]);
        }
 
-       /*
-        * Initialize skb->priority for QoS frames. This is put in the TID field
-        * of the frame before passing it to the driver.
-        */
+       /* Initialize skb->priority for QoS frames */
        if (ieee80211_is_data_qos(hdr->frame_control)) {
                u8 *p = ieee80211_get_qos_ctl(hdr);
                skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK;
index 3d7dea387e3dcd3caca071be3589e79dd4bad195..2702d314ef59cfbd217ab594375d921b7ce62da5 100644 (file)
@@ -252,6 +252,14 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
 
        p = ieee80211_get_qos_ctl(hdr);
 
+       /* don't overwrite the QoS field of injected frames */
+       if (info->flags & IEEE80211_TX_CTL_INJECTED) {
+               /* do take into account Ack policy of injected frames */
+               if (*p & IEEE80211_QOS_CTL_ACK_POLICY_NOACK)
+                       info->flags |= IEEE80211_TX_CTL_NO_ACK;
+               return;
+       }
+
        /* set up the first byte */
 
        /*