diff options
| author | Johannes Berg <johannes@sipsolutions.net> | 2007-11-03 09:11:10 -0400 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2007-11-11 01:01:25 -0500 |
| commit | 5b98b1f7daf6d52ccc446486aca0b8bc9a588b2c (patch) | |
| tree | 47d80c61cdebd35ebb8d9b0e577a0e5fd334cde1 | |
| parent | 56db6c52bb61509c114b9f1b1eecc7461229770a (diff) | |
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: Johannes Berg <johannes@sipsolutions.net>
Cc: Jouni Malinen <j@w1.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
| -rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
| -rw-r--r-- | net/mac80211/ieee80211_ioctl.c | 16 | ||||
| -rw-r--r-- | net/mac80211/ieee80211_sta.c | 18 |
3 files changed, 21 insertions, 15 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 4b4ed2a5803c..b4e32ab3664d 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
| @@ -230,6 +230,7 @@ struct ieee80211_if_vlan { | |||
| 230 | #define IEEE80211_STA_AUTO_SSID_SEL BIT(10) | 230 | #define IEEE80211_STA_AUTO_SSID_SEL BIT(10) |
| 231 | #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) | 231 | #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) |
| 232 | #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) | 232 | #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) |
| 233 | #define IEEE80211_STA_PRIVACY_INVOKED BIT(13) | ||
| 233 | struct ieee80211_if_sta { | 234 | struct ieee80211_if_sta { |
| 234 | enum { | 235 | enum { |
| 235 | IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, | 236 | IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, |
| @@ -259,7 +260,6 @@ struct ieee80211_if_sta { | |||
| 259 | unsigned long request; | 260 | unsigned long request; |
| 260 | struct sk_buff_head skb_queue; | 261 | struct sk_buff_head skb_queue; |
| 261 | 262 | ||
| 262 | int key_management_enabled; | ||
| 263 | unsigned long last_probe; | 263 | unsigned long last_probe; |
| 264 | 264 | ||
| 265 | #define IEEE80211_AUTH_ALG_OPEN BIT(0) | 265 | #define IEEE80211_AUTH_ALG_OPEN BIT(0) |
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c index 3645660a364a..7027eed4d4ae 100644 --- a/net/mac80211/ieee80211_ioctl.c +++ b/net/mac80211/ieee80211_ioctl.c | |||
| @@ -926,19 +926,21 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, | |||
| 926 | case IW_AUTH_CIPHER_GROUP: | 926 | case IW_AUTH_CIPHER_GROUP: |
| 927 | case IW_AUTH_WPA_ENABLED: | 927 | case IW_AUTH_WPA_ENABLED: |
| 928 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | 928 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 929 | case IW_AUTH_PRIVACY_INVOKED: | ||
| 930 | break; | ||
| 931 | case IW_AUTH_KEY_MGMT: | 929 | case IW_AUTH_KEY_MGMT: |
| 930 | break; | ||
| 931 | case IW_AUTH_PRIVACY_INVOKED: | ||
| 932 | if (sdata->type != IEEE80211_IF_TYPE_STA) | 932 | if (sdata->type != IEEE80211_IF_TYPE_STA) |
| 933 | ret = -EINVAL; | 933 | ret = -EINVAL; |
| 934 | else { | 934 | else { |
| 935 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; | ||
| 935 | /* | 936 | /* |
| 936 | * Key management was set by wpa_supplicant, | 937 | * Privacy invoked by wpa_supplicant, store the |
| 937 | * we only need this to associate to a network | 938 | * value and allow associating to a protected |
| 938 | * that has privacy enabled regardless of not | 939 | * network without having a key up front. |
| 939 | * having a key. | ||
| 940 | */ | 940 | */ |
| 941 | sdata->u.sta.key_management_enabled = !!data->value; | 941 | if (data->value) |
| 942 | sdata->u.sta.flags |= | ||
| 943 | IEEE80211_STA_PRIVACY_INVOKED; | ||
| 942 | } | 944 | } |
| 943 | break; | 945 | break; |
| 944 | case IW_AUTH_80211_AUTH_ALG: | 946 | case IW_AUTH_80211_AUTH_ALG: |
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c index fda0e06453e8..2079e988fc56 100644 --- a/net/mac80211/ieee80211_sta.c +++ b/net/mac80211/ieee80211_sta.c | |||
| @@ -704,10 +704,11 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, | |||
| 704 | { | 704 | { |
| 705 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 705 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 706 | struct ieee80211_sta_bss *bss; | 706 | struct ieee80211_sta_bss *bss; |
| 707 | int res = 0; | 707 | int bss_privacy; |
| 708 | int wep_privacy; | ||
| 709 | int privacy_invoked; | ||
| 708 | 710 | ||
| 709 | if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL) || | 711 | if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL)) |
| 710 | ifsta->key_management_enabled) | ||
| 711 | return 0; | 712 | return 0; |
| 712 | 713 | ||
| 713 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel, | 714 | 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 | if (!bss) | 716 | if (!bss) |
| 716 | return 0; | 717 | return 0; |
| 717 | 718 | ||
| 718 | if (ieee80211_sta_wep_configured(dev) != | 719 | bss_privacy = !!(bss->capability & WLAN_CAPABILITY_PRIVACY); |
| 719 | !!(bss->capability & WLAN_CAPABILITY_PRIVACY)) | 720 | wep_privacy = !!ieee80211_sta_wep_configured(dev); |
| 720 | res = 1; | 721 | privacy_invoked = !!(ifsta->flags & IEEE80211_STA_PRIVACY_INVOKED); |
| 721 | 722 | ||
| 722 | ieee80211_rx_bss_put(dev, bss); | 723 | ieee80211_rx_bss_put(dev, bss); |
| 723 | 724 | ||
| 724 | return res; | 725 | if ((bss_privacy == wep_privacy) || (bss_privacy == privacy_invoked)) |
| 726 | return 0; | ||
| 727 | |||
| 728 | return 1; | ||
| 725 | } | 729 | } |
| 726 | 730 | ||
| 727 | 731 | ||
