Skip to contentSkip to conversation

mac80211: flush AP_VLAN stations when tearing down the BSS AP

PATCH Applied Felix Fietkau 2 participants 4 messages Dec 10, 2012 – Dec 11, 2012 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 mac80211: flush AP_VLAN stations when tearing down the BSS AP

---
 net/mac80211/cfg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +3 -1
index 5c61677..a5d4361 100644
@@ -998,8 +998,10 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 	old_probe_resp = rtnl_dereference(sdata->u.ap.probe_resp);
 
 	/* turn off carrier for this interface and dependent VLANs */
-	list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
+	list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
+		sta_info_flush(local, vlan);
 		netif_carrier_off(vlan->dev);
+	}
 	netif_carrier_off(dev);
 
 	/* remove beacon and probe response */
Signature · 1 line
1.7.12.2
#1 lore raw

PATCH v2 2/2 mac80211: fix AP_VLAN channel context handling

When .start_ap is called, copy the channel context to all active AP VLANs. Also copy the channel context when bringing up/down an AP VLAN if the AP has been started already.

---
 net/mac80211/cfg.c   |  5 +++++
 net/mac80211/iface.c | 13 ++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)
net/mac80211/cfg.c +5 -0
index a5d4361..b0a20ac 100644
@@ -915,6 +915,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
 	if (err)
 		return err;
 
+	list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
+		rcu_assign_pointer(vlan->vif.chanctx_conf,
+				   rcu_access_pointer(sdata->vif.chanctx_conf));
+
 	/*
 	 * Apply control port protocol, this allows us to
 	 * not encrypt dynamic WEP control frames.
@@ -1001,6 +1005,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 	list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
 		sta_info_flush(local, vlan);
 		netif_carrier_off(vlan->dev);
+		rcu_assign_pointer(sdata->vif.chanctx_conf, NULL);
 	}
 	netif_carrier_off(dev);
 
net/mac80211/iface.c +10 -3
index 40c36d5..c2deb2a 100644
@@ -508,6 +508,7 @@ static void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
 int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+	struct ieee80211_sub_if_data *ap;
 	struct net_device *dev = wdev->netdev;
 	struct ieee80211_local *local = sdata->local;
 	struct sta_info *sta;
@@ -587,10 +588,15 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
 	switch (sdata->vif.type) {
 	case NL80211_IFTYPE_AP_VLAN:
 		/* no need to tell driver, but set carrier */
-		if (rtnl_dereference(sdata->bss->beacon))
-			netif_carrier_on(dev);
-		else
+		if (!rtnl_dereference(sdata->bss->beacon)) {
 			netif_carrier_off(dev);
+			break;
+		}
+
+		ap = get_bss_sdata(sdata);
+		rcu_assign_pointer(sdata->vif.chanctx_conf,
+				   rcu_access_pointer(ap->vif.chanctx_conf));
+		netif_carrier_on(dev);
 		break;
 	case NL80211_IFTYPE_MONITOR:
 		if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) {
@@ -839,6 +845,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
 	switch (sdata->vif.type) {
 	case NL80211_IFTYPE_AP_VLAN:
 		list_del(&sdata->u.vlan.list);
+		rcu_assign_pointer(sdata->vif.chanctx_conf, NULL);
 		/* no need to tell driver */
 		break;
 	case NL80211_IFTYPE_MONITOR:
Signature · 1 line
1.7.12.2
maintainer
#3 lore raw
Quoted 1 line · Johannes Berg

Applied.

Ok looking at the code I changed my mind ... I don't love the double iteration but I think it's better than getting the ordering wrong so I changed the patch a bit.

johannes