Skip to content

Commit

Permalink
mac80211: don't connect to IBSS network with different privacy
Browse files Browse the repository at this point in the history
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 <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed May 13, 2009
1 parent e0502de commit e0d6188
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions net/mac80211/ibss.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
struct 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
Expand All @@ -509,6 +510,10 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
if (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)
Expand All @@ -517,8 +522,9 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
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)
Expand Down

0 comments on commit e0d6188

Please sign in to comment.