wifi: mac80211: remove TDLS peers only on affected link
authorJohannes Berg <johannes.berg@intel.com>
Wed, 28 Feb 2024 08:55:47 +0000 (09:55 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 4 Mar 2024 13:34:03 +0000 (14:34 +0100)
If a link does CSA, or if it changes SMPS mode, we need to
drop the TDLS peers, but we really should drop them only on
the affected link. Fix that.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://msgid.link/20240228095719.00d1d793f5b8.Ia9971316c6b3922dd371d64ac2198f91ed5ad9d2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c
net/mac80211/ieee80211_i.h
net/mac80211/mlme.c
net/mac80211/tdls.c

index 3a9d2ceec75238f674ec51ba32252144120fa786..f03452dc716d5d9588fe5c50a09888ae78c75402 100644 (file)
@@ -3242,7 +3242,7 @@ int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
        if (err)
                link->u.mgd.req_smps = old_req;
        else if (smps_mode != IEEE80211_SMPS_OFF && tdls_peer_found)
-               ieee80211_teardown_tdls_peers(sdata);
+               ieee80211_teardown_tdls_peers(link);
 
        return err;
 }
index cfd0c03e4bd6a22f29e9873748674e124662def1..b6fead612b66b51df10c52e0dad6a3ed05aaabbf 100644 (file)
@@ -2611,7 +2611,7 @@ int ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev,
 void ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy,
                                          struct net_device *dev,
                                          const u8 *addr);
-void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata);
+void ieee80211_teardown_tdls_peers(struct ieee80211_link_data *link);
 void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata,
                                      const u8 *peer, u16 reason);
 void
index 2180b1ba0e4205d69fed0e9a77d6d43e3d1fb6e1..47a2cba8313f04c3d86c6ce424395a0aca2b7cc1 100644 (file)
@@ -2115,12 +2115,13 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
        }
 
        /*
-        * Drop all TDLS peers - either we disconnect or move to a different
-        * channel from this point on. There's no telling what our peer will do.
+        * Drop all TDLS peers on the affected link - either we disconnect or
+        * move to a different channel from this point on. There's no telling
+        * what our peer will do.
         * The TDLS WIDER_BW scenario is also problematic, as peers might now
         * have an incompatible wider chandef.
         */
-       ieee80211_teardown_tdls_peers(sdata);
+       ieee80211_teardown_tdls_peers(link);
 
        conf = rcu_dereference_protected(link->conf->chanctx_conf,
                                         lockdep_is_held(&local->hw.wiphy->mtx));
index 42d9c06cbb845556bdd5e83ef3bc6257b7a49440..f07b409164854ce2046719ff8edd900c43621391 100644 (file)
@@ -2028,8 +2028,9 @@ ieee80211_process_tdls_channel_switch(struct ieee80211_sub_if_data *sdata,
        }
 }
 
-void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata)
+void ieee80211_teardown_tdls_peers(struct ieee80211_link_data *link)
 {
+       struct ieee80211_sub_if_data *sdata = link->sdata;
        struct sta_info *sta;
        u16 reason = WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED;
 
@@ -2039,6 +2040,9 @@ void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata)
                    !test_sta_flag(sta, WLAN_STA_AUTHORIZED))
                        continue;
 
+               if (sta->deflink.link_id != link->link_id)
+                       continue;
+
                ieee80211_tdls_oper_request(&sdata->vif, sta->sta.addr,
                                            NL80211_TDLS_TEARDOWN, reason,
                                            GFP_ATOMIC);