]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mac80211: add support for the monitor SKIP_TX flag
authorFelix Fietkau <nbd@nbd.name>
Wed, 9 Oct 2024 08:25:50 +0000 (10:25 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 23 Oct 2024 14:46:13 +0000 (16:46 +0200)
Do not pass locally sent packets to monitor interfaces with this flag set.
Skip processing tx packets on the status call entirely if no monitor
interfaces without this flag are present.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://patch.msgid.link/c327bb57ef8dadaa6a0e8e4dc2f5f99ae8123e6c.1728462320.git-series.nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/status.c

index d20c2e796703e5cfc9e20a36ba9b882c862b7b10..7dcb46120abc4dffa0786c314cfb67598edd9076 100644 (file)
@@ -1368,7 +1368,7 @@ struct ieee80211_local {
        spinlock_t queue_stop_reason_lock;
 
        int open_count;
-       int monitors, cooked_mntrs;
+       int monitors, cooked_mntrs, tx_mntrs;
        /* number of interfaces with corresponding FIF_ flags */
        int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
            fif_probe_req;
index 683cc50cc26655adc6e9ef5c4807cb3457c848f1..57f6fac343eba815fbccb17545299cf6c132f87e 100644 (file)
@@ -1094,6 +1094,8 @@ void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
        ADJUST(CONTROL, control);
        ADJUST(CONTROL, pspoll);
        ADJUST(OTHER_BSS, other_bss);
+       if (!(flags & MONITOR_FLAG_SKIP_TX))
+               local->tx_mntrs += offset;
 
 #undef ADJUST
 }
index b41b867f43b2e6707997c2ef3bc8470a012ac0f3..5f28f3633fa0a45f299ed88916b4a8c7eb8209f0 100644 (file)
@@ -927,6 +927,9 @@ void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
                        if (!ieee80211_sdata_running(sdata))
                                continue;
 
+                       if (sdata->u.mntr.flags & MONITOR_FLAG_SKIP_TX)
+                               continue;
+
                        if ((sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES) &&
                            !send_to_cooked)
                                continue;
@@ -1099,7 +1102,7 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,
         * This is a bit racy but we can avoid a lot of work
         * with this test...
         */
-       if (!local->monitors && (!send_to_cooked || !local->cooked_mntrs)) {
+       if (!local->tx_mntrs && (!send_to_cooked || !local->cooked_mntrs)) {
                if (status->free_list)
                        list_add_tail(&skb->list, status->free_list);
                else