Commit 5b98b1f7 authored by Johannes Berg's avatar Johannes Berg Committed by David S. Miller

mac80211: use IW_AUTH_PRIVACY_INVOKED rather than IW_AUTH_KEY_MGMT

In the long bug-hunt for why dynamic WEP networks didn't work it
turned out that mac80211 incorrectly uses IW_AUTH_KEY_MGMT while
it should use IW_AUTH_PRIVACY_INVOKED to determine whether to
associate to protected networks or not.

This patch changes the behaviour to be that way and clarifies the
existing code.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Cc: Jouni Malinen <j@w1.fi>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 56db6c52
...@@ -230,6 +230,7 @@ struct ieee80211_if_vlan { ...@@ -230,6 +230,7 @@ struct ieee80211_if_vlan {
#define IEEE80211_STA_AUTO_SSID_SEL BIT(10) #define IEEE80211_STA_AUTO_SSID_SEL BIT(10)
#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11)
#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
#define IEEE80211_STA_PRIVACY_INVOKED BIT(13)
struct ieee80211_if_sta { struct ieee80211_if_sta {
enum { enum {
IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
...@@ -259,7 +260,6 @@ struct ieee80211_if_sta { ...@@ -259,7 +260,6 @@ struct ieee80211_if_sta {
unsigned long request; unsigned long request;
struct sk_buff_head skb_queue; struct sk_buff_head skb_queue;
int key_management_enabled;
unsigned long last_probe; unsigned long last_probe;
#define IEEE80211_AUTH_ALG_OPEN BIT(0) #define IEEE80211_AUTH_ALG_OPEN BIT(0)
......
...@@ -926,19 +926,21 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, ...@@ -926,19 +926,21 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
case IW_AUTH_CIPHER_GROUP: case IW_AUTH_CIPHER_GROUP:
case IW_AUTH_WPA_ENABLED: case IW_AUTH_WPA_ENABLED:
case IW_AUTH_RX_UNENCRYPTED_EAPOL: case IW_AUTH_RX_UNENCRYPTED_EAPOL:
case IW_AUTH_PRIVACY_INVOKED:
break;
case IW_AUTH_KEY_MGMT: case IW_AUTH_KEY_MGMT:
break;
case IW_AUTH_PRIVACY_INVOKED:
if (sdata->type != IEEE80211_IF_TYPE_STA) if (sdata->type != IEEE80211_IF_TYPE_STA)
ret = -EINVAL; ret = -EINVAL;
else { else {
sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
/* /*
* Key management was set by wpa_supplicant, * Privacy invoked by wpa_supplicant, store the
* we only need this to associate to a network * value and allow associating to a protected
* that has privacy enabled regardless of not * network without having a key up front.
* having a key.
*/ */
sdata->u.sta.key_management_enabled = !!data->value; if (data->value)
sdata->u.sta.flags |=
IEEE80211_STA_PRIVACY_INVOKED;
} }
break; break;
case IW_AUTH_80211_AUTH_ALG: case IW_AUTH_80211_AUTH_ALG:
......
...@@ -704,10 +704,11 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, ...@@ -704,10 +704,11 @@ static int ieee80211_privacy_mismatch(struct net_device *dev,
{ {
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_sta_bss *bss; struct ieee80211_sta_bss *bss;
int res = 0; int bss_privacy;
int wep_privacy;
int privacy_invoked;
if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL) || if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL))
ifsta->key_management_enabled)
return 0; return 0;
bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel, bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel,
...@@ -715,13 +716,16 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, ...@@ -715,13 +716,16 @@ static int ieee80211_privacy_mismatch(struct net_device *dev,
if (!bss) if (!bss)
return 0; return 0;
if (ieee80211_sta_wep_configured(dev) != bss_privacy = !!(bss->capability & WLAN_CAPABILITY_PRIVACY);
!!(bss->capability & WLAN_CAPABILITY_PRIVACY)) wep_privacy = !!ieee80211_sta_wep_configured(dev);
res = 1; privacy_invoked = !!(ifsta->flags & IEEE80211_STA_PRIVACY_INVOKED);
ieee80211_rx_bss_put(dev, bss); ieee80211_rx_bss_put(dev, bss);
return res; if ((bss_privacy == wep_privacy) || (bss_privacy == privacy_invoked))
return 0;
return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment