Skip to content

Commit 7c8d5e0

Browse files
ilanpeer2jmberg-intel
authored andcommitted
cfg80211: send stop AP event only due to internal reason
Commit "nl80211: send event when AP operation is stopped" added an event to notify user space that an AP interface has been stopped, to handle cases such as suspend etc. The event is sent regardless if the stop AP flow was triggered by user space or due to internal state change. This might cause issues with wpa_supplicant/hostapd flows that consider stop AP flow as a synchronous one, e.g., AP/GO channel change in the absence of CSA support. In such cases, the flow will restart the AP immediately after the stop AP flow is done, and only handle the stop AP event after the current flow is done, and as a result stop the AP again. Change the current implementation to only send the event in case the stop AP was triggered due to an internal reason. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 31559f3 commit 7c8d5e0

5 files changed

Lines changed: 9 additions & 8 deletions

File tree

‎net/wireless/ap.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
static int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
10-
struct net_device *dev)
10+
struct net_device *dev, bool notify)
1111
{
1212
struct wireless_dev *wdev = dev->ieee80211_ptr;
1313
int err;
@@ -30,20 +30,21 @@ static int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
3030
memset(&wdev->chandef, 0, sizeof(wdev->chandef));
3131
wdev->ssid_len = 0;
3232
rdev_set_qos_map(rdev, dev, NULL);
33-
nl80211_send_ap_stopped(wdev);
33+
if (notify)
34+
nl80211_send_ap_stopped(wdev);
3435
}
3536

3637
return err;
3738
}
3839

3940
int cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
40-
struct net_device *dev)
41+
struct net_device *dev, bool notify)
4142
{
4243
struct wireless_dev *wdev = dev->ieee80211_ptr;
4344
int err;
4445

4546
wdev_lock(wdev);
46-
err = __cfg80211_stop_ap(rdev, dev);
47+
err = __cfg80211_stop_ap(rdev, dev, notify);
4748
wdev_unlock(wdev);
4849

4950
return err;

‎net/wireless/core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev,
783783
break;
784784
case NL80211_IFTYPE_AP:
785785
case NL80211_IFTYPE_P2P_GO:
786-
cfg80211_stop_ap(rdev, dev);
786+
cfg80211_stop_ap(rdev, dev, true);
787787
break;
788788
default:
789789
break;

‎net/wireless/core.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ int cfg80211_set_mesh_channel(struct cfg80211_registered_device *rdev,
283283

284284
/* AP */
285285
int cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
286-
struct net_device *dev);
286+
struct net_device *dev, bool notify);
287287

288288
/* MLME */
289289
int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,

‎net/wireless/nl80211.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3332,7 +3332,7 @@ static int nl80211_stop_ap(struct sk_buff *skb, struct genl_info *info)
33323332
struct cfg80211_registered_device *rdev = info->user_ptr[0];
33333333
struct net_device *dev = info->user_ptr[1];
33343334

3335-
return cfg80211_stop_ap(rdev, dev);
3335+
return cfg80211_stop_ap(rdev, dev, false);
33363336
}
33373337

33383338
static const struct nla_policy sta_flags_policy[NL80211_STA_FLAG_MAX + 1] = {

‎net/wireless/util.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
886886

887887
switch (otype) {
888888
case NL80211_IFTYPE_AP:
889-
cfg80211_stop_ap(rdev, dev);
889+
cfg80211_stop_ap(rdev, dev, true);
890890
break;
891891
case NL80211_IFTYPE_ADHOC:
892892
cfg80211_leave_ibss(rdev, dev, false);

0 commit comments

Comments
 (0)