diff options
author | Antonio Quartulli <ordex@autistici.org> | 2012-10-16 02:39:22 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-10-18 11:21:22 -0400 |
commit | 5c95b940bd97e744267249e3b0780e6ef04b029c (patch) | |
tree | a781656df4682ebd39669fea9ea11d28adef55e2 | |
parent | 4ee3e063f10acf6fd17c0ee6f1d0a95726e74cb2 (diff) |
nl/cfg80211: force scan using an AP vif if requested
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>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | include/uapi/linux/nl80211.h | 8 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 11 | ||||
-rw-r--r-- | net/mac80211/main.c | 4 |
3 files changed, 21 insertions, 2 deletions
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 0e6277a06c29..617d0fbfc96f 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
@@ -3050,6 +3050,7 @@ enum nl80211_ap_sme_features { | |||
3050 | * mode | 3050 | * mode |
3051 | * @NL80211_FEATURE_LOW_PRIORITY_SCAN: This driver supports low priority scan | 3051 | * @NL80211_FEATURE_LOW_PRIORITY_SCAN: This driver supports low priority scan |
3052 | * @NL80211_FEATURE_SCAN_FLUSH: Scan flush is supported | 3052 | * @NL80211_FEATURE_SCAN_FLUSH: Scan flush is supported |
3053 | * @NL80211_FEATURE_AP_SCAN: Support scanning using an AP vif | ||
3053 | */ | 3054 | */ |
3054 | enum nl80211_feature_flags { | 3055 | enum nl80211_feature_flags { |
3055 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, | 3056 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, |
@@ -3060,6 +3061,7 @@ enum nl80211_feature_flags { | |||
3060 | NL80211_FEATURE_SAE = 1 << 5, | 3061 | NL80211_FEATURE_SAE = 1 << 5, |
3061 | NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6, | 3062 | NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6, |
3062 | NL80211_FEATURE_SCAN_FLUSH = 1 << 7, | 3063 | NL80211_FEATURE_SCAN_FLUSH = 1 << 7, |
3064 | NL80211_FEATURE_AP_SCAN = 1 << 8, | ||
3063 | }; | 3065 | }; |
3064 | 3066 | ||
3065 | /** | 3067 | /** |
@@ -3103,10 +3105,16 @@ enum nl80211_connect_failed_reason { | |||
3103 | * | 3105 | * |
3104 | * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority | 3106 | * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority |
3105 | * @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning | 3107 | * @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning |
3108 | * @NL80211_SCAN_FLAG_AP: force a scan even if the interface is configured | ||
3109 | * as AP and the beaconing has already been configured. This attribute is | ||
3110 | * dangerous because will destroy stations performance as a lot of frames | ||
3111 | * will be lost while scanning off-channel, therefore it must be used only | ||
3112 | * when really needed | ||
3106 | */ | 3113 | */ |
3107 | enum nl80211_scan_flags { | 3114 | enum nl80211_scan_flags { |
3108 | NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0, | 3115 | NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0, |
3109 | NL80211_SCAN_FLAG_FLUSH = 1<<1, | 3116 | NL80211_SCAN_FLAG_FLUSH = 1<<1, |
3117 | NL80211_SCAN_FLAG_AP = 1<<2, | ||
3110 | }; | 3118 | }; |
3111 | 3119 | ||
3112 | #endif /* __LINUX_NL80211_H */ | 3120 | #endif /* __LINUX_NL80211_H */ |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 5739bfbf2999..5eab1325a0f6 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1855,7 +1855,16 @@ static int ieee80211_scan(struct wiphy *wiphy, | |||
1855 | * beaconing hasn't been configured yet | 1855 | * beaconing hasn't been configured yet |
1856 | */ | 1856 | */ |
1857 | case NL80211_IFTYPE_AP: | 1857 | case NL80211_IFTYPE_AP: |
1858 | if (sdata->u.ap.beacon) | 1858 | /* |
1859 | * If the scan has been forced (and the driver supports | ||
1860 | * forcing), don't care about being beaconing already. | ||
1861 | * This will create problems to the attached stations (e.g. all | ||
1862 | * the frames sent while scanning on other channel will be | ||
1863 | * lost) | ||
1864 | */ | ||
1865 | if (sdata->u.ap.beacon && | ||
1866 | (!(wiphy->features & NL80211_FEATURE_AP_SCAN) || | ||
1867 | !(req->flags & NL80211_SCAN_FLAG_AP))) | ||
1859 | return -EOPNOTSUPP; | 1868 | return -EOPNOTSUPP; |
1860 | break; | 1869 | break; |
1861 | default: | 1870 | default: |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index ba5a23249771..c42094be2f0b 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -603,7 +603,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
603 | NL80211_FEATURE_HT_IBSS; | 603 | NL80211_FEATURE_HT_IBSS; |
604 | 604 | ||
605 | if (!ops->hw_scan) | 605 | if (!ops->hw_scan) |
606 | wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN; | 606 | wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN | |
607 | NL80211_FEATURE_AP_SCAN; | ||
608 | |||
607 | 609 | ||
608 | if (!ops->set_key) | 610 | if (!ops->set_key) |
609 | wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 611 | wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |