* [PATCH wireless v2] wifi: mac80211: apply ap_isolate to AP_VLAN stations
@ 2026-12-02 14:09 Christopher Hill
0 siblings, 0 replies; only message in thread
From: Christopher Hill @ 2026-12-02 14:09 UTC (permalink / raw)
To: Johannes Berg; +Cc: Christopher Hill, linux-wireless, Miroslav Rýzek
ap_isolate is set via nl80211 SET_BSS, which is only accepted on AP and
P2P GO interfaces, so ieee80211_change_bss() sets
IEEE80211_SDATA_DONT_BRIDGE_PACKETS on the AP sdata only. AP_VLAN
interfaces never get it, but the intra-BSS forwarding decisions in
ieee80211_deliver_skb() and ieee80211_check_fast_rx() test the flag on
the station's own sdata, which is the AP_VLAN for stations assigned to a
VLAN (e.g. hostapd dynamic_vlan). As a result, mac80211 keeps forwarding
frames between stations of the same AP_VLAN although ap_isolate is
enabled, and client isolation is silently ineffective for them.
Copy the flag from the AP to an AP_VLAN when the AP_VLAN is opened, like
the control port settings, and apply a change of ap_isolate to the open
AP_VLANs of the AP as well. ieee80211_check_fast_rx_iface() already
re-evaluates the fast-rx state of the AP_VLAN stations afterwards. An
AP_VLAN that is not open takes the current value when it is opened.
Fixes: 7b7b5e56d7bd ("mac80211: implement ap isolation support")
Closes: https://lore.kernel.org/linux-wireless/20E87267-920A-4FD9-9443-050AE7676E45@gmail.com/
Signed-off-by: Christopher Hill <ch6574@gmail.com>
---
Changes in v2:
- Keep IEEE80211_SDATA_DONT_BRIDGE_PACKETS per interface and copy it to
the AP_VLANs, instead of moving the setting to struct ieee80211_if_ap
and reading it via sdata->bss. The debugfs "flags" file keeps showing
the isolation bit, now on AP_VLAN interfaces too. No change for
userspace.
- Dropped Miroslav's Tested-by from v1, as the code changed.
- More idiomatic code style.
v1: https://lore.kernel.org/linux-wireless/20261107035220.50480-1-ch6574@gmail.com/
v1 RESEND: https://lore.kernel.org/linux-wireless/20261120235359.3424212-1-miroslav.ryzek@gmail.com/
Tested on a Linksys E8450 (MT7622 + MT7915E, mt76), OpenWrt 25.12.6
with mac80211 from backports 6.18.55 (patch applied with line offsets
only), hostapd dynamic_vlan=2 with VLANs from wpa_psk_file, four AP_VLANs
per radio, hairpin off on the AP_VLAN bridge ports, two stations on the
same radio and AP_VLAN:
- ap_isolate=0, with and without multicast_to_unicast=1: debugfs flags
AP 0x20, AP_VLANs 0x1; the stations reach each other.
- ap_isolate=1 on both radios: AP 0x28, all AP_VLANs 0x9 (before: 0x1);
no unicast or multicast replies between the stations, wired hosts
still reachable.
- ap_isolate changed at runtime on one radio (hostapd_cli SET ap_isolate
and UPDATE_BEACON) with the stations associated: that radio's AP_VLANs
followed (0x9 -> 0x1) and the stations reached each other again; the
other radio's AP_VLANs stayed at 0x9.
- No warnings in dmesg.
Build-tested on wireless/main (c4328134f) with W=1 (partial build of
net/mac80211): cfg.c and iface.c compile without warnings.
Not tested: the copy in ieee80211_do_open() on its own (an AP_VLAN
opened after ap_isolate was set), mac80211_hwsim, lockdep, 4-addr
AP_VLANs, MLO.
net/mac80211/cfg.c | 10 ++++++++++
net/mac80211/iface.c | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9608c07bce..18762c1538 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3706,10 +3706,20 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
}
if (params->ap_isolate >= 0) {
+ struct ieee80211_sub_if_data *vlan;
+
if (params->ap_isolate)
sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
else
sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
+
+ list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
+ if (params->ap_isolate)
+ vlan->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
+ else
+ vlan->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
+ }
+
ieee80211_check_fast_rx_iface(sdata);
}
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index d0b0a503b2..e8d03a1c16 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1432,6 +1432,11 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
sizeof(sdata->vif.hw_queue));
sdata->vif.bss_conf.chanreq = master->vif.bss_conf.chanreq;
+ if (master->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS)
+ sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
+ else
+ sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
+
sdata->crypto_tx_tailroom_needed_cnt +=
master->crypto_tx_tailroom_needed_cnt;
--
2.50.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 14:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 14:09 [PATCH wireless v2] wifi: mac80211: apply ap_isolate to AP_VLAN stations Christopher Hill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox