Fix cipher overwide problem for 802.1X WEP
PATCH 1/1 Fix cipher overwide problem for 802.1X WEP
We set the cipher_pairwise and cipher_group to WEP104 only if they are not set already. Otherwise WEP40 has no way to be configured. This problem is found on 802.1X with static WEP.
--- wpa_supplicant/wpa_supplicant.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
wpa_supplicant/wpa_supplicant.c +2 -1
@@ -1116,7 +1116,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, EAPOL_FLAG_REQUIRE_KEY_BROADCAST)) == 0 && !wep_keys_set) { use_crypt =0 ; - } else { + } else if (cipher_pairwise == WPA_CIPHER_NONE && + cipher_group == WPA_CIPHER_NONE) {/* Assume that dynamic WEP-104 keys will be used and * set cipher suites in order for drivers to expect * encryption. */
Signature · 1 line
1.6.0.4
PATCH 1/1 nl80211 connect API support
--- src/common/ieee802_11_defs.h | 15 ++ src/common/nl80211_copy.h | 65 +++++++++ src/drivers/driver.h | 28 +++- src/drivers/driver_nl80211.c | 289 ++++++++++++++++++++++++++++++++++++- wpa_supplicant/driver_i.h | 18 +++ wpa_supplicant/sme.c | 43 +++++-- wpa_supplicant/sme.h | 15 ++- wpa_supplicant/wpa_supplicant.c | 9 +- wpa_supplicant/wpa_supplicant_i.h | 2 + 9 files changed, 455 insertions(+), 29 deletions(-)
src/common/ieee802_11_defs.h +15 -0
@@ -679,4 +679,19 @@ enum {#define VENDOR_HT_CAPAB_OUI_TYPE 0x33/* 00-90-4c:0x33 */ +/* cipher suite selectors */ +#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00 +#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01 +#define WLAN_CIPHER_SUITE_TKIP 0x000FAC02 +/* reserved: 0x000FAC03 */ +#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04 +#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 +#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06 + +/* AKM suite selectors */ +#define WLAN_AKM_SUITE_8021X 0x000FAC01 +#define WLAN_AKM_SUITE_PSK 0x000FAC02 + +#define WLAN_MAX_KEY_LEN 32 +#endif /* IEEE802_11_DEFS_H */
src/common/nl80211_copy.h +65 -0
81 lines not on this page · raw message
src/drivers/driver.h +22 -6
@@ -444,6 +444,8 @@ struct wpa_driver_capa {#define WPA_DRIVER_FLAGS_SME 0x00000020/* Driver supports AP mode */ #define WPA_DRIVER_FLAGS_AP 0x00000040 +/* Driver supports connect API */ +#define WPA_DRIVER_FLAGS_CONNECT 0x00000080unsigned int flags;int max_scan_ssids;
@@ -1184,16 +1186,14 @@ struct wpa_driver_ops {int (*scan2)(void *priv,struct wpa_driver_scan_params *params);/** -* authenticate - Request driver to authenticate +* authenticate - Request driver to authenticate (deprecated) * @priv: private driver interface data * @params: authentication parameters * Returns: 0 on success, -1 on failure * -* This is an optional function that can be used with drivers that -* support separate authentication and association steps, i.e., when -* wpa_supplicant can act as the SME. If not implemented, associate() -* function is expected to take care of IEEE 802.11 authentication, -* too. +* This is an optional function that to make compatibility for wireless +* stack that doesn't support connect API when driver SME is used +* (WPA_DRIVER_FLAGS_SME). */ int (*authenticate)(void *priv,struct wpa_driver_auth_params *params);
@@ -1333,6 +1333,22 @@ struct wpa_driver_ops {* Returns: 0 on success, -1 on failure */ int (*set_supp_port)(void *priv,int authorized); + +/** +* connect - Request driver to connect +* @priv: private driver interface data +* @params: connect parameters +* Returns: 0 on success, -1 on failure +* +* This is an optional function that can be used with drivers that +* support connect (both authentication and association) step, i.e., +* when wpa_supplicant can act as the SME. If driver SME is not +* supported (both connect and authenticate are not implemented), +* associate() function is expected to take care of IEEE 802.11 +* authentication, too. +*/ +int (*connect)(void *priv,struct wpa_driver_associate_params *params); +int (*disconnect)(void *priv,u8 *addr,int reason_code); };/**
src/drivers/driver_nl80211.c +284 -5
351 lines not on this page · raw message
wpa_supplicant/driver_i.h +18 -0
@@ -448,4 +448,22 @@ static inline int wpa_drv_set_supp_port(struct wpa_supplicant *wpa_s, return 0; } +static inline int wpa_drv_connect (struct wpa_supplicant *wpa_s, +struct wpa_driver_associate_params *params) +{ +if (wpa_s->driver->connect) +return wpa_s->driver->connect (wpa_s->drv_priv, params); + +return -EOPNOTSUPP ; +} + +static inline int wpa_drv_disconnect (struct wpa_supplicant *wpa_s,u8 *addr, +int reason_code) +{ +if (wpa_s->driver->disconnect) +return wpa_s->driver->disconnect (wpa_s->drv_priv, addr, + reason_code); +return -EOPNOTSUPP ; +} +#endif /* DRIVER_I_H */
wpa_supplicant/sme.c +34 -9
62 lines not on this page · raw message
wpa_supplicant/sme.h +10 -5
@@ -17,8 +17,8 @@#ifdef CONFIG_SME -void sme_authenticate (struct wpa_supplicant *wpa_s, -struct wpa_scan_res *bss,struct wpa_ssid *ssid); +void sme_connect (struct wpa_supplicant *wpa_s,struct wpa_scan_res *bss, +struct wpa_ssid *ssid);void sme_event_auth (struct wpa_supplicant *wpa_s,union wpa_event_data *data);int sme_update_ft_ies (struct wpa_supplicant *wpa_s,const u8 *md,const u8 *ies,size_t ies_len);
@@ -31,9 +31,9 @@ void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s,#else /* CONFIG_SME */ -static inline void sme_authenticate (struct wpa_supplicant *wpa_s, -struct wpa_scan_res *bss, -struct wpa_ssid *ssid) +static inline void sme_connect (struct wpa_supplicant *wpa_s, +struct wpa_scan_res *bss, +struct wpa_ssid *ssid) { }
@@ -64,6 +64,11 @@ static inline void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s, { } +void sme_connect (struct wpa_supplicant *wpa_s, +struct wpa_scan_res *bss,struct wpa_ssid *ssid); +{ +} +#endif /* CONFIG_SME */ #endif /* SME_H */
wpa_supplicant/wpa_supplicant.c +5 -4
@@ -640,7 +640,7 @@ static void wpa_supplicant_reconfig(int sig, void *eloop_ctx, } -static wpa_cipher cipher_suite2driver (int cipher) +wpa_cipher cipher_suite2driver (int cipher) {switch (cipher) {case WPA_CIPHER_NONE :
@@ -658,7 +658,7 @@ static wpa_cipher cipher_suite2driver(int cipher) } -static wpa_key_mgmt key_mgmt2driver (int key_mgmt) +wpa_key_mgmt key_mgmt2driver (int key_mgmt) {switch (key_mgmt) {case WPA_KEY_MGMT_NONE :
@@ -966,7 +966,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, }if (wpa_s->drv_flags &WPA_DRIVER_FLAGS_SME ) { -sme_authenticate (wpa_s, bss, ssid); +sme_connect (wpa_s, bss, ssid);return ; }
@@ -1303,7 +1303,8 @@ void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,if (!is_zero_ether_addr (wpa_s->bssid)) {if (wpa_s->drv_flags &WPA_DRIVER_FLAGS_USER_SPACE_MLME )ieee80211_sta_deauthenticate (wpa_s, reason_code); -else +else if (wpa_drv_disconnect (wpa_s, wpa_s->bssid, reason_code) + == -EOPNOTSUPP )wpa_drv_deauthenticate (wpa_s, wpa_s->bssid, reason_code); addr = wpa_s->bssid;
wpa_supplicant/wpa_supplicant_i.h +2 -0
@@ -392,6 +392,8 @@ int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);const char *wpa_supplicant_state_txt (int state);int wpa_supplicant_driver_init (struct wpa_supplicant *wpa_s); +wpa_cipher cipher_suite2driver (int cipher); +wpa_key_mgmt key_mgmt2driver (int key_mgmt); int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s, struct wpa_scan_res *bss, struct wpa_ssid *ssid,
Signature · 1 line
1.6.0.4
Re: [PATCH] nl80211 connect API support
src/drivers/driver.h struct wpa_driver_ops { · line 1196
Quoted 6 lines · Zhu Yi
src/drivers/driver.h +4
-1-* authenticate - Request driver to authenticate +* authenticate - Request driver to authenticate (deprecated) +* This is an optional function that to make compatibility for wireless +* stack that doesn't support connect API when driver SME is used +* (WPA_DRIVER_FLAGS_SME).
Thanks for the patch. If I understood this correctly, wpa_supplicant would be converted to use the new connect command whenever it is supported. While it is nice to get support for connect added, this is not how it should be done as it breaks all the new work we have been enabling with mac80211. The separate auth/assoc commands should be the default operation and only if the driver does not support this, should the connect command be used.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Re: [PATCH] nl80211 connect API support
Hi Jouni,
Quoted 5 lines · Jouni Malinen
Quoted 2 lines · Zhu Yi
src/drivers/driver.h +1
-1-* authenticate - Request driver to authenticate +* authenticate - Request driver to authenticate (deprecated)
Quoted 11 lines
src/drivers/driver.h struct wpa_driver_ops { · line 1196
Quoted 3 lines
src/drivers/driver.h +3
-0+* This is an optional function that to make compatibility for wireless +* stack that doesn't support connect API when driver SME is used +* (WPA_DRIVER_FLAGS_SME). Thanks for the patch. If I understood this correctly,
wpa_supplicantwould be converted to use the new connect command whenever it is supported. While it is nice to get support for connect added, this is not how it should be done as it breaks all the new work we have been enabling with mac80211. The separate auth/assoc commands should be the default operation and only if the driver does not support this, should the connect command be used.
The connect API wraps auth/assoc commands in cfg80211 SME. For example, when cfg80211 receives NL80211_CMD_CONNECT (cfg80211_connect), it checks if connect API is supported or not. If it is not supported (for all mac80211 based drivers), it uses the common cfg80211_conn_do_work() to do auth/assoc the same way as it handles NL80211_CMD_AUTHENTICATE. So from user space point of view, if connect API is supported, it can use it directly and let cfg80211 to maintain the state of auth and assoc.
Thanks,
-yi
Re: [PATCH] nl80211 connect API support
Quoted 7 lines · Zhu Yi
The connect API wraps auth/assoc commands in cfg80211 SME. For example, when cfg80211 receives
NL80211_CMD_CONNECT(cfg80211_connect), it checks if connect API is supported or not. If it is not supported (for all mac80211 based drivers), it uses the commoncfg80211_conn_do_work()to do auth/assoc the same way as it handlesNL80211_CMD_AUTHENTICATE. So from user space point of view, if connect API is supported, it can use it directly and let cfg80211 to maintain the state of auth and assoc.
It is not about whether it would be possible to use connect or not; it is about whether the additional features provided by separate auth/assoc commands are of use--and they are. wpa_supplicant will provide more functionality, e.g., FT, when using these commands. Any change to add support for the new NL80211_CMD_CONNECT must not break this existing mechanism; it is only to add support for drivers that cannot support the auth/assoc interface that provides more control to user space.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Re: [PATCH] nl80211 connect API support
Quoted 7 lines · Jouni Malinen
It is not about whether it would be possible to use connect or not; it is about whether the additional features provided by separate auth/assoc commands are of use--and they are.
wpa_supplicantwill provide more functionality, e.g., FT, when using these commands. Any change to add support for the newNL80211_CMD_CONNECTmust not break this existing mechanism; it is only to add support for drivers that cannot support the auth/assoc interface that provides more control to user space.
Ah, I see. This makes sense to me. I ignored the 11r code when I wrote the code. Now I realized what it is used for (i.e. sme_event_auth). I'm not sure if it can be done in cfg80211 SME easily, but it doesn't help for connect API anyway. I'll send V2 according to your suggestion.
Johannes, I think we need a way in cfg80211 to tell connect vs. auth/assoc. The current capability method (nl80211_send_wiphy) cannot do this. For example,
if (dev->ops->connect || dev->ops->auth) NLA_PUT_U32(msg, i, NL80211_CMD_CONNECT);
We need to either make NL80211_CMD_CONNECT only depends on ops->connect or make NL80211_CMD_AUTH depends on ops->auth. Johannes, which one do you prefer?
Thanks,
-yi
Re: [PATCH] nl80211 connect API support
Quoted 10 lines · Zhu Yi
Johannes, I think we need a way in cfg80211 to tell connect vs. auth/assoc. The current capability method (
nl80211_send_wiphy) cannot do this. For example,if (dev->ops->connect || dev->ops->auth) NLA_PUT_U32(msg, i, NL80211_CMD_CONNECT);We need to either make
NL80211_CMD_CONNECTonly depends onops->connector makeNL80211_CMD_AUTHdepends onops->auth. Johannes, which one do you prefer?
The latter is already there as far as I can see?
CMD(auth, AUTHENTICATE);
CMD(assoc, ASSOCIATE);
CMD(deauth, DEAUTHENTICATE);
CMD(disassoc, DISASSOCIATE);so you should be able to check for these.
johannes
Re: [PATCH] nl80211 connect API support
Quoted 13 lines · Johannes Berg
Quoted 10 lines · Zhu Yi
Johannes, I think we need a way in cfg80211 to tell connect vs. auth/assoc. The current capability method (
nl80211_send_wiphy) cannot do this. For example,if (dev->ops->connect || dev->ops->auth) NLA_PUT_U32(msg, i, NL80211_CMD_CONNECT);We need to either make
NL80211_CMD_CONNECTonly depends onops->connector makeNL80211_CMD_AUTHdepends onops->auth. Johannes, which one do you prefer?
Quoted 8 lines
The latter is already there as far as I can see?
CMD(auth, AUTHENTICATE); CMD(assoc, ASSOCIATE); CMD(deauth, DEAUTHENTICATE); CMD(disassoc, DISASSOCIATE);so you should be able to check for these.
My bad. I'll use NL80211_CMD_AUTHENTICATE.
Thanks,
-yi