Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2422412rbb; Wed, 28 Feb 2024 00:57:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXSF822zwVjrwzqyWx5wOB7ZdSeuVuh13Wd7+wYhRKfPniJlUvdlgmUuzKifQuEnCEgwPOXHo5fvSYDj5fEoD+ytoR7y7c4jgeSHlSlcA== X-Google-Smtp-Source: AGHT+IF+ork9XguyPez/yyhpFy95y+ARCeDSDcbDZViiVHARTgn+wFMLo9XgqIH1gBPs6Y0LNmo6 X-Received: by 2002:a05:6a21:398f:b0:19e:a448:71cf with SMTP id ad15-20020a056a21398f00b0019ea44871cfmr5348148pzc.24.1709110679456; Wed, 28 Feb 2024 00:57:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709110679; cv=pass; d=google.com; s=arc-20160816; b=nURkWUOFIEYrNAF3Ep8a17bhfiX26BYqEL6Vho2Xo7mfl1hSy1ECQD1ecT8rJaCBWW yxCmxfiP4U0UsnOgmAUe94IY0lhC6sABs2XdC4POht+a8O6PbhjNJuKocj1v+8n+R5AM J2v6rT50AEpcxrAdmEGMihuafc31HAxN4qYLOCH8XKwPl9HrJSc7CWUOS6+SB9JgHKru 1alAXQsiX/JhAJw52pLEuLB2NVbPfX7xXK7qWlWALwgpLCXYUJ+sK8WLHY2uwYwywPrs 3Fxk5wAZls7DxEKLQyz0C145oWynKVwsw4whYGabmP3g50SdLf7HywaD/3+X2cqGbA/V Cs3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9aAUzDdHoPlA6zNv3RgK6D66msgBn41r1t5Sk5GvZBE=; fh=MXeo9FgI6ydrvEkRawK6nu6GWVcuW0kQw/ykZ9kpFYQ=; b=pDPBrSUvUcI6Gr7pGrm4LdqtDEWOORkpqramEkn4bKlRxLlDHwSGGvmnSdcQ4afxEI pA5bywJHic1EU8I4WGPeuB1Y1fsJ4MmQkyBquZUATk8oDU8vsH1xrkFisMCVUvecM2g9 2+AS+pzDxce+gGlhO1CZJ7b9wrcQgkQU42ZcCH/W0mLYyzINtg1q25YulCFD75a6xGDw d6wQg3eLNN/q4CSVo99Vex1eSRBaf5LBIozNwdvGDOdpsWiwPKkPrWjnB3Uya5KuYgmT 6nNQvgVQtf5DpxTuONhKl23O2eTqVR29ze5mYBRebD6I1zvF2Jx3gabB7SjkyJkHBzw4 e7pA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=LQ01Ctq5; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-4163-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4163-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id sj16-20020a17090b2d9000b0029a9c2a22c0si998021pjb.61.2024.02.28.00.57.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:57:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4163-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=LQ01Ctq5; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-4163-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4163-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2E2AA2877CD for ; Wed, 28 Feb 2024 08:57:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55B343613D; Wed, 28 Feb 2024 08:57:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="LQ01Ctq5" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03D61339BD for ; Wed, 28 Feb 2024 08:57:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709110651; cv=none; b=f0m5tCQlaB7jA0NSmt8Z8wUS0yVfv2bk4hYMUXumWz47VVluWMknhkdxnSgUGpOvRjIQbnnwsV1iJEiuv7h/MzjYji4LkzHNioyOP43dc8uyTLGPZE+R2l1SXGklxp7UyDdroGxI3RXL6P/0+WiPNkjN9eB0n7fh5V5Xf/0XcFA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709110651; c=relaxed/simple; bh=y8t2zj9P4gXoK9K/Ru3P78cTK5H2vKIMZVaZ9MxzqcU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gcgrvLA3D8SfRCbBbMIBaghgTf1VsGSnio3xNFxMcA1dybeIzuVqqxXQPcVjHL0Q5NyVY2nM79P6f84Wfok/v2jIaGzuMTiKFQdlJgfJbtp8qNUEhMSLZ663NCB/603ZRTyPafToYxZ9HnvMRIl4Rs+M8fhPTHuJJriLKwI0j78= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=LQ01Ctq5; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=9aAUzDdHoPlA6zNv3RgK6D66msgBn41r1t5Sk5GvZBE=; t=1709110649; x=1710320249; b=LQ01Ctq5s+womSxlR4LuzhfdYh8oRihJDOeg6pxqTSLVpVQ ht9D4o41wew71kIA3p3jL2TwzHh/ntMHwk0XVCT9R/ylduT5DEWq2L64zsAABG2sMgwljPgANWmkO PM9mIM71wY/fLFNfVBpBWyVIPgCtZOm1QIIeJn/nAo0othC+WBAfhc9W6WL03Pnoi/jmkfmrgdLm4 KiWYKUELuaNRZ47FJkItvLQOrWeApt+2oPiBt02F926rKiKrvx0Qz+BzXv8dxNiSl6mvhM3cusJZQ WbIGYBQTXFMvXP8Tf0pnCC20E6zbwMtksgZETcFpl9iALRlHFuXA/gJJqiXE9w6A==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rfFkj-0000000C0hJ-3f5U; Wed, 28 Feb 2024 09:57:26 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit , Emmanuel Grumbach Subject: [PATCH 7/8] wifi: mac80211: remove TDLS peers only on affected link Date: Wed, 28 Feb 2024 09:55:47 +0100 Message-ID: <20240228095719.00d1d793f5b8.Ia9971316c6b3922dd371d64ac2198f91ed5ad9d2@changeid> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228085718.21171-10-johannes@sipsolutions.net> References: <20240228085718.21171-10-johannes@sipsolutions.net> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Johannes Berg 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 Reviewed-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- net/mac80211/cfg.c | 2 +- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/mlme.c | 7 ++++--- net/mac80211/tdls.c | 6 +++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 692f5c9f9678..54c58530cc6d 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3208,7 +3208,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; } diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 2f1e24a5d030..c97e237608c6 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -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 diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 563b001496ce..a95468c98818 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -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)); diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index 42d9c06cbb84..f07b40916485 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c @@ -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); -- 2.43.2