mac80211: don't connect to IBSS network with different privacy
Johannes Berg
maintainerPATCH 1/1 mac80211: don't connect to IBSS network with different privacy
Even when we find an IBSS with the SSID we're looking for, we may not be able to connect to it because it has a key and we don't, or vice versa. Avoid such situations by checking the privacy capability bit.
Signed-off-by Johannes Berg <[email protected]>
--- net/mac80211/ibss.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/mac80211/ibss.c +8 -2
@@ -499,6 +499,7 @@ static void ieee80211_sta_find_ibss(strustruct ieee80211_channel *chan =NULL ;const u8 *bssid =NULL ;int active_ibss; +u16 capability; active_ibss =ieee80211_sta_active_ibss (sdata);#ifdef CONFIG_MAC80211_IBSS_DEBUG
@@ -509,6 +510,10 @@ static void ieee80211_sta_find_ibss(struif (active_ibss)return ; + capability =WLAN_CAPABILITY_IBSS ; +if (sdata->default_key) + capability |=WLAN_CAPABILITY_PRIVACY ; +if (ifibss->fixed_bssid) bssid = ifibss->bssid;if (ifibss->fixed_channel)
@@ -517,8 +522,9 @@ static void ieee80211_sta_find_ibss(stru bssid = ifibss->bssid; bss = (void *)cfg80211_get_bss (local->hw.wiphy, chan, bssid, ifibss->ssid, ifibss->ssid_len, -WLAN_CAPABILITY_IBSS , -WLAN_CAPABILITY_IBSS ); + capability, +WLAN_CAPABILITY_IBSS | +WLAN_CAPABILITY_PRIVACY );#ifdef CONFIG_MAC80211_IBSS_DEBUG if (bss)