@@ -3103,10 +3103,16 @@ enum nl80211_connect_failed_reason {
*
* @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority
* @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning
+ * @NL80211_SCAN_FLAG_FORCE: force a scan even if the interface is configured
+ * as AP and the beaconing has already been configured. This attribute is
+ * dangerous because will destroy stations performance as a lot of frames
+ * will be lost while scanning off-channel, therefore it must be used only
+ * when really needed
*/
enum nl80211_scan_flags {
NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0,
NL80211_SCAN_FLAG_FLUSH = 1<<1,
+ NL80211_SCAN_FLAG_FORCE = 1<<2,
};
#endif /* __LINUX_NL80211_H */
@@ -1855,7 +1855,15 @@ static int ieee80211_scan(struct wiphy *wiphy,
* beaconing hasn't been configured yet
*/
case NL80211_IFTYPE_AP:
- if (sdata->u.ap.beacon)
+ /*
+ * If the scan has been forced, don't care about being beaconing
+ * already.
+ * This will create problems to the attached stations (e.g. all
+ * the frames sent while scanning on other channel will be
+ * lost)
+ */
+ if (sdata->u.ap.beacon &&
+ !(req->flags & NL80211_SCAN_FLAG_FORCE))
return -EOPNOTSUPP;
break;
default:
If the user wants to scan using a vif configured as AP, cfg80211 must give him a chance to do it, even if this will disrupt the stations performance due to off-channel scanning. To do so, this patch adds a 'force' flag to the SCAN_TRIGGER command which tells cfg80211 to perform the scanning operation even if the vif is an AP and the beaconing has already started. Signed-off-by: Antonio Quartulli <ordex@autistici.org> --- v2: rebased on top of latest mac80211-next/master, in particular this introduced Bing's patchset on scan_flags Cheers, include/linux/nl80211.h | 6 ++++++ net/mac80211/cfg.c | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)