Skip to contentSkip to conversation

mac80211: Allow scan to be requested in AP mode

PATCH In review Jouni Malinen 3 participants 4 messages Apr 16, 2009 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: Allow scan to be requested in AP mode

We can allow scan requests in AP mode as long as the interface has not yet been configured to send out Beacon frames (or if beaconing has been disabled prior to the scan request). This makes it easier to scan for neighboring BSSes during AP initialization and makes it possible to run a scan without setting the interface down, if needed. Without this change, the only available option would be to set the interface down, move into station mode, and set the interface up, prior to requesting the scan.

---
 net/mac80211/cfg.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +2 -1
@@ -1167,7 +1167,8 @@ static int ieee80211_scan(struct wiphy *
 
 	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
 	    sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
+	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
+	    (sdata->vif.type != NL80211_IFTYPE_AP || sdata->u.ap.beacon))
 		return -EOPNOTSUPP;
 
 	return ieee80211_request_scan(sdata, req);
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
maintainer
#1 lore raw
Quoted 18 lines · Jouni Malinen

We can allow scan requests in AP mode as long as the interface has not yet been configured to send out Beacon frames (or if beaconing has been disabled prior to the scan request). This makes it easier to scan for neighboring BSSes during AP initialization and makes it possible to run a scan without setting the interface down, if needed. Without this change, the only available option would be to set the interface down, move into station mode, and set the interface up, prior to requesting the scan.

---
 net/mac80211/cfg.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

net/mac80211/cfg.c static int ieee80211_scan(struct wiphy * · line 1172

Quoted 7 lines
net/mac80211/cfg.c +2 -1
@@ -1167,7 +1167,8 @@ static int ieee80211_scan(struct wiphy *
 
 	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
 	    sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
+	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
+	    (sdata->vif.type != NL80211_IFTYPE_AP || sdata->u.ap.beacon))
 		return -EOPNOTSUPP;

Should this return a different error code for AP then? Maybe -EBUSY for AP && beacon? Then again, EBUSY is already returned for "already scanning". hmm.

johannes

#2 lore raw
Quoted 5 lines · Johannes Berg
Quoted 4 lines · Jouni Malinen
net/mac80211/cfg.c +0 -0
@@ -1167,7 +1167,8 @@ static int ieee80211_scan(struct wiphy *
 
Quoted 10 lines

net/mac80211/cfg.c static int ieee80211_scan(struct wiphy * · line 1172

Quoted 6 lines
net/mac80211/cfg.c +2 -1
 	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
 	    sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
+	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
+	    (sdata->vif.type != NL80211_IFTYPE_AP || sdata->u.ap.beacon))
 		return -EOPNOTSUPP;

Should this return a different error code for AP then? Maybe -EBUSY for AP && beacon? Then again, EBUSY is already returned for "already scanning". hmm.

I thought about that for a moment, but did not come up with a good error code.. ;-) EBUSY is not a good option here since that could be used by applications to decide that they should try again (which would not help here at all). If someone has a better one in mind, I would have no problems changing this, but I don't see much problems with EOPNOTSUPP either.

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
maintainer
#3 lore raw
Quoted 17 lines · Jouni Malinen
Quoted 5 lines · Johannes Berg
Quoted 4 lines · Jouni Malinen
net/mac80211/cfg.c +0 -0
@@ -1167,7 +1167,8 @@ static int ieee80211_scan(struct wiphy *
 
Quoted 10 lines

net/mac80211/cfg.c static int ieee80211_scan(struct wiphy * · line 1172

Quoted 6 lines
net/mac80211/cfg.c +2 -1
 	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
 	    sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
+	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
+	    (sdata->vif.type != NL80211_IFTYPE_AP || sdata->u.ap.beacon))
 		return -EOPNOTSUPP;

Should this return a different error code for AP then? Maybe -EBUSY for AP && beacon? Then again, EBUSY is already returned for "already scanning". hmm.

Quoted 6 lines

I thought about that for a moment, but did not come up with a good error code.. ;-) EBUSY is not a good option here since that could be used by applications to decide that they should try again (which would not help here at all). If someone has a better one in mind, I would have no problems changing this, but I don't see much problems with EOPNOTSUPP either.

Ok. Good enough for me :)

johannes