2007-08-15 14:57:51

by Johannes Berg

[permalink] [raw]
Subject: [PATCH 14/20] mac80211: kill key_mgmt variable, use privacy_enabled

The key_mgmt variable for STA interfaces doesn't seem well-defined
nor do we actually use the values other than "NONE", so change it to
be named better.

Signed-off-by: Johannes Berg <[email protected]>
---
net/mac80211/hostapd_ioctl.h | 8 --------
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/ieee80211_ioctl.c | 24 +++++++++---------------
net/mac80211/ieee80211_sta.c | 2 +-
4 files changed, 11 insertions(+), 25 deletions(-)

--- wireless-dev.orig/net/mac80211/ieee80211_i.h 2007-08-15 14:09:54.916516958 +0200
+++ wireless-dev/net/mac80211/ieee80211_i.h 2007-08-15 14:11:55.656516958 +0200
@@ -277,7 +277,7 @@ struct ieee80211_if_sta {
unsigned long request;
struct sk_buff_head skb_queue;

- int key_mgmt;
+ int privacy_enabled;
unsigned long last_probe;

#define IEEE80211_AUTH_ALG_OPEN BIT(0)
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c 2007-08-15 14:11:49.086516958 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c 2007-08-15 14:11:55.666516958 +0200
@@ -2245,22 +2245,16 @@ static int ieee80211_ioctl_siwauth(struc
ret = -EINVAL;
else {
/*
- * TODO: sdata->u.sta.key_mgmt does not match with WE18
- * value completely; could consider modifying this to
- * be closer to WE18. For now, this value is not really
- * used for anything else than Privacy matching, so the
- * current code here should be more or less OK.
+ * What are the semantics in wext supposed to be?
+ *
+ * Don't bother figuring that out... It's wext after
+ * all so figuring it out will most likely require a
+ * moderate amount of clairvoyance.
+ *
+ * TODO: remove in favour of something well-defined
+ * in cfg80211/nl80211.
*/
- if (data->value & IW_AUTH_KEY_MGMT_802_1X) {
- sdata->u.sta.key_mgmt =
- IEEE80211_KEY_MGMT_WPA_EAP;
- } else if (data->value & IW_AUTH_KEY_MGMT_PSK) {
- sdata->u.sta.key_mgmt =
- IEEE80211_KEY_MGMT_WPA_PSK;
- } else {
- sdata->u.sta.key_mgmt =
- IEEE80211_KEY_MGMT_NONE;
- }
+ sdata->u.sta.privacy_enabled = !!data->value;
}
break;
case IW_AUTH_80211_AUTH_ALG:
--- wireless-dev.orig/net/mac80211/ieee80211_sta.c 2007-08-15 14:08:54.646516958 +0200
+++ wireless-dev/net/mac80211/ieee80211_sta.c 2007-08-15 14:11:55.676516958 +0200
@@ -1168,7 +1168,7 @@ static int ieee80211_privacy_mismatch(st
struct ieee80211_sta_bss *bss;
int res = 0;

- if (!ifsta || ifsta->key_mgmt != IEEE80211_KEY_MGMT_NONE)
+ if (!ifsta || !ifsta->privacy_enabled)
return 0;

bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h 2007-08-15 14:11:52.406516958 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h 2007-08-15 14:11:55.676516958 +0200
@@ -180,14 +180,6 @@ struct prism2_hostapd_param {

#define HOSTAP_HW_FLAG_NULLFUNC_OK BIT(0)

-enum {
- IEEE80211_KEY_MGMT_NONE = 0,
- IEEE80211_KEY_MGMT_IEEE8021X = 1,
- IEEE80211_KEY_MGMT_WPA_PSK = 2,
- IEEE80211_KEY_MGMT_WPA_EAP = 3,
-};
-
-
/* Data structures used for get_hw_features ioctl */
struct hostapd_ioctl_hw_modes_hdr {
int mode;

--



2007-08-18 04:00:19

by Jouni Malinen

[permalink] [raw]
Subject: Re: [PATCH 14/20] mac80211: kill key_mgmt variable, use privacy_enabled

On Wed, Aug 15, 2007 at 04:49:34PM +0200, Johannes Berg wrote:

> The key_mgmt variable for STA interfaces doesn't seem well-defined
> nor do we actually use the values other than "NONE", so change it to
> be named better.

Most drivers should not need key_mgmt configuration. The only exception
that I'm aware of is firmware designs that insist on generating WPA/RSN
IE internally. None of them are likely to be using mac80211, though.

> + * What are the semantics in wext supposed to be?
> + *
> + * Don't bother figuring that out... It's wext after
> + * all so figuring it out will most likely require a
> + * moderate amount of clairvoyance.

Isn't this a bit unnecessary?

> + sdata->u.sta.privacy_enabled = !!data->value;

This looks a bit odd, though, taken into account that this is coming
from IW_AUTH_KEY_MGMT and not IW_AUTH_PRIVACY_INVOKED.. It would
probably be better to just remove all the crab from here can ignore the
IW_AUTH_KEY_MGMT value in mac80211. The only place that actually used it
in the client code (mixed cell configuration) had already been broken,
so this could all be just removed completely unless someone has plans on
fixing privacy mismatch detection.

--
Jouni Malinen PGP id EFC895FA

2007-08-17 10:12:17

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 14/20] mac80211: kill key_mgmt variable, use privacy_enabled

On Wed, 2007-08-15 at 16:49 +0200, Johannes Berg wrote:

> - if (!ifsta || ifsta->key_mgmt != IEEE80211_KEY_MGMT_NONE)
> + if (!ifsta || !ifsta->privacy_enabled)
^ be gone!

That privacy_enabled test is inverted.

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-08-17 11:25:07

by Johannes Berg

[permalink] [raw]
Subject: [PATCH v2 14/20] mac80211: kill key_mgmt variable, use privacy_enabled

The key_mgmt variable for STA interfaces doesn't seem well-defined
nor do we actually use the values other than "NONE", so change it to
be named better.

Signed-off-by: Johannes Berg <[email protected]>
---
net/mac80211/hostapd_ioctl.h | 8 --------
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/ieee80211_ioctl.c | 24 +++++++++---------------
net/mac80211/ieee80211_sta.c | 2 +-
4 files changed, 11 insertions(+), 25 deletions(-)

--- wireless-dev.orig/net/mac80211/ieee80211_i.h 2007-08-16 23:26:41.153466559 +0200
+++ wireless-dev/net/mac80211/ieee80211_i.h 2007-08-16 23:49:41.323466559 +0200
@@ -277,7 +277,7 @@ struct ieee80211_if_sta {
unsigned long request;
struct sk_buff_head skb_queue;

- int key_mgmt;
+ int privacy_enabled;
unsigned long last_probe;

#define IEEE80211_AUTH_ALG_OPEN BIT(0)
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c 2007-08-16 23:26:36.253466559 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c 2007-08-16 23:49:36.263466559 +0200
@@ -2245,22 +2245,16 @@ static int ieee80211_ioctl_siwauth(struc
ret = -EINVAL;
else {
/*
- * TODO: sdata->u.sta.key_mgmt does not match with WE18
- * value completely; could consider modifying this to
- * be closer to WE18. For now, this value is not really
- * used for anything else than Privacy matching, so the
- * current code here should be more or less OK.
+ * What are the semantics in wext supposed to be?
+ *
+ * Don't bother figuring that out... It's wext after
+ * all so figuring it out will most likely require a
+ * moderate amount of clairvoyance.
+ *
+ * TODO: remove in favour of something well-defined
+ * in cfg80211/nl80211.
*/
- if (data->value & IW_AUTH_KEY_MGMT_802_1X) {
- sdata->u.sta.key_mgmt =
- IEEE80211_KEY_MGMT_WPA_EAP;
- } else if (data->value & IW_AUTH_KEY_MGMT_PSK) {
- sdata->u.sta.key_mgmt =
- IEEE80211_KEY_MGMT_WPA_PSK;
- } else {
- sdata->u.sta.key_mgmt =
- IEEE80211_KEY_MGMT_NONE;
- }
+ sdata->u.sta.privacy_enabled = !!data->value;
}
break;
case IW_AUTH_80211_AUTH_ALG:
--- wireless-dev.orig/net/mac80211/ieee80211_sta.c 2007-08-16 23:26:38.253466559 +0200
+++ wireless-dev/net/mac80211/ieee80211_sta.c 2007-08-16 23:50:29.983466559 +0200
@@ -1168,7 +1168,7 @@ static int ieee80211_privacy_mismatch(st
struct ieee80211_sta_bss *bss;
int res = 0;

- if (!ifsta || ifsta->key_mgmt != IEEE80211_KEY_MGMT_NONE)
+ if (!ifsta || ifsta->privacy_enabled)
return 0;

bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h 2007-08-16 23:26:35.603466559 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h 2007-08-16 23:49:35.443466559 +0200
@@ -180,14 +180,6 @@ struct prism2_hostapd_param {

#define HOSTAP_HW_FLAG_NULLFUNC_OK BIT(0)

-enum {
- IEEE80211_KEY_MGMT_NONE = 0,
- IEEE80211_KEY_MGMT_IEEE8021X = 1,
- IEEE80211_KEY_MGMT_WPA_PSK = 2,
- IEEE80211_KEY_MGMT_WPA_EAP = 3,
-};
-
-
/* Data structures used for get_hw_features ioctl */
struct hostapd_ioctl_hw_modes_hdr {
int mode;



2007-08-18 09:03:31

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 14/20] mac80211: kill key_mgmt variable, use privacy_enabled

On Fri, 2007-08-17 at 20:59 -0700, Jouni Malinen wrote:

> This looks a bit odd, though, taken into account that this is coming
> from IW_AUTH_KEY_MGMT and not IW_AUTH_PRIVACY_INVOKED.. It would
> probably be better to just remove all the crab from here can ignore the
> IW_AUTH_KEY_MGMT value in mac80211. The only place that actually used it
> in the client code (mixed cell configuration) had already been broken,
> so this could all be just removed completely unless someone has plans on
> fixing privacy mismatch detection.

Yeah, it should probably be called "key_management_enabled". However,
privacy mismatch detection does work for WPA, just not for Volker with
dynamic WEP for some reason.

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part