Enable WPA with wlags49_h2
cover Enable WPA with wlags49_h2
This series makes WPA work on the Hermes II based cards. This has been tested with a PCMCIA Speedtouch 110 (by Henk de Groot). WEP is confirmed to still work.
ap_scan=2 must be set on wpa_supplicant: the driver manages roaming within the SSID and does not support SIOCSIWAP. ap_scan=1 does not work, which is also my experience with orinoco Agere cards (although there have been reports of that working). Because of this, NetworkManager doesn't work when set to use WPA.
Patches 2, 5 and 6 are where the main work is done. The other patches just clean a few things up.
David Kilroy (7):
staging: wlags49_h2: Handle sysfs_create_group return correctly
staging: wlags49_h2: Enable WPA in the HCF
staging: wlags49_h2: Remove useless IWE_STREAM_ADD_XXX defines
staging: wlags49_h2: Report WPA IE in scan results with IWEVGENIE
staging: wlags49_h2: Make key setting more reliable
staging: wlags49_h2: Fixup IW_AUTH handling
staging: wlags49_h2: Fixup SIOCSIWGENIE
drivers/staging/wlags49_h2/Makefile | 1 - drivers/staging/wlags49_h2/hcfcfg.h | 19 +- drivers/staging/wlags49_h2/wl_internal.h | 8 +- drivers/staging/wlags49_h2/wl_main.c | 6 +- drivers/staging/wlags49_h2/wl_sysfs.c | 18 +- drivers/staging/wlags49_h2/wl_wext.c | 917 +++++++++++++++--------------- drivers/staging/wlags49_h25/Makefile | 1 - 7 files changed, 501 insertions(+), 469 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/7 staging: wlags49_h2: Handle sysfs_create_group return correctly
The function returns 0 on success and non-zero on error. So correctly record the status so it is freed appropriately.
--- drivers/staging/wlags49_h2/wl_internal.h | 2 +- drivers/staging/wlags49_h2/wl_sysfs.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/staging/wlags49_h2/wl_internal.h +1 -1
@@ -883,7 +883,7 @@ struct wl_privateint is_registered;int is_handling_int;int firmware_present; -char sysfsCreated; +bool sysfsCreated;CFG_DRV_INFO_STRCT driverInfo;CFG_IDENTITY_STRCT driverIdentity;CFG_FW_IDENTITY_STRCT StationIdentity;
drivers/staging/wlags49_h2/wl_sysfs.c +10 -8
@@ -120,17 +120,19 @@ static struct attribute_group wlags_group = {void register_wlags_sysfs (struct net_device *net) { -struct device *dev = &(net->dev); -struct wl_private *lp =wl_priv (net); - - lp->sysfsCreated =sysfs_create_group (&dev->kobj, &wlags_group); +struct device *dev = &(net->dev); +struct wl_private *lp =wl_priv (net); +int err; + err =sysfs_create_group (&dev->kobj, &wlags_group); +if (!err) + lp->sysfsCreated = true; }void unregister_wlags_sysfs (struct net_device *net) { -struct device *dev = &(net->dev); -struct wl_private *lp =wl_priv (net); +struct device *dev = &(net->dev); +struct wl_private *lp =wl_priv (net); -if (lp->sysfsCreated) -sysfs_remove_group (&dev->kobj, &wlags_group); +if (lp->sysfsCreated) +sysfs_remove_group (&dev->kobj, &wlags_group); }
Signature · 1 line
1.7.4.1
PATCH 2/7 staging: wlags49_h2: Enable WPA in the HCF
In reply to David KilroyWPA has been disabled in the HCF layer. The firmware does support it (it is used on other platforms). Enable it so we can work through the issues.
Note that we also enable this for the HERMES 2.5 non-WARP firmware cards.
--- drivers/staging/wlags49_h2/Makefile | 1 - drivers/staging/wlags49_h2/hcfcfg.h | 19 ++++++++++++++----- drivers/staging/wlags49_h25/Makefile | 1 - 3 files changed, 14 insertions(+), 7 deletions(-)
drivers/staging/wlags49_h2/Makefile +0 -1
@@ -15,7 +15,6 @@ INSTALLDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless ccflags-y := -I$(KERNELDIR)/include ccflags-y += -I$(src) \ -DBUS_PCMCIA \ - -DUSE_WPA \ -DUSE_WEXT \ -DSTA_ONLY \ -DWVLAN_49 \
drivers/staging/wlags49_h2/hcfcfg.h +14 -5
@@ -316,16 +316,25 @@ typedef unsigned long hcf_32;//#define HCF_SLEEP (HCF_CDS | HCF_DDS ) #define HCF_SLEEP (HCF_CDS) -//#define HCF_TYPE (HCF_TYPE_HII5|HCF_TYPE_STA|HCF_TYPE_AP) +/* Note: Non-WARP firmware all support WPA. However the original Agere +* linux driver does not enable WPA. Enabling WPA here causes whatever +* preliminary WPA logic to be included, some of which may be specific +* to HERMESI. +* +* Various comment are clear that WARP and WPA are not compatible +* (which may just mean WARP does WPA in a different fashion). +*/ + +/* #define HCF_TYPE (HCF_TYPE_HII5|HCF_TYPE_STA|HCF_TYPE_AP) */ #ifdef HERMES25 #ifdef WARP #define HCF_TYPE ( HCF_TYPE_WARP | HCF_TYPE_HII5 )#else -#define HCF_TYPE HCF_TYPE_HII5 -#endif // WARP +#define HCF_TYPE (HCF_TYPE_HII5 | HCF_TYPE_WPA) +#endif /* WARP */ #else -#define HCF_TYPE HCF_TYPE_NONE -#endif // HERMES25 +#define HCF_TYPE HCF_TYPE_WPA +#endif /* HERMES25 */ #ifdef ENABLE_DMA #define HCF_DMA 1
drivers/staging/wlags49_h25/Makefile +0 -1
@@ -15,7 +15,6 @@ INSTALLDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless ccflags-y := -I$(KERNELDIR)/include ccflags-y += -I$(src) \ -DBUS_PCMCIA \ - -DUSE_WPA \ -DUSE_WEXT \ -DSTA_ONLY \ -DWVLAN_49 \
Signature · 1 line
1.7.4.1
PATCH 4/7 staging: wlags49_h2: Report WPA IE in scan results with IWEVGENIE
In reply to David KilroyReport the IE using the appropriate event instead of a custom one.
--- drivers/staging/wlags49_h2/wl_wext.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
drivers/staging/wlags49_h2/wl_wext.c +5 -7
@@ -2759,21 +2759,19 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *inf buf =iwe_stream_add_point (info, buf, buf_end, &iwe, msg); -/* Custom info (WPA-IE) */ +/* WPA-IE */ wpa_ie =NULL ; wpa_ie_len =0 ; wpa_ie =wl_parse_wpa_ie ( probe_resp, &wpa_ie_len );if ( wpa_ie !=NULL ) { -memset ( &iwe,0 ,sizeof ( iwe )); -memset ( msg,0 ,sizeof ( msg )); +memset (&iwe,0 ,sizeof (iwe)); - iwe.cmd =IWEVCUSTOM ; -sprintf ( msg,"wpa_ie=%s" ,wl_print_wpa_ie ( wpa_ie, wpa_ie_len )); - iwe.u.data.length =strlen ( msg ); + iwe.cmd =IWEVGENIE ; + iwe.u.data.length = wpa_ie_len; buf =iwe_stream_add_point (info, buf, buf_end, - &iwe, msg); + &iwe, wpa_ie); }/* Add other custom info in formatted string format as needed... */
Signature · 1 line
1.7.4.1
PATCH 5/7 staging: wlags49_h2: Make key setting more reliable
In reply to David KilroyShare logic between encodeext and encode, so that we can handle subtle differences between them (implied set_tx), and clear the appropriate keys if you attempt to switch straight from WPA to WEP and vice versa.
Also reinstate the TX buffer flush, and ensure the key index is written to the card little endian.
--- drivers/staging/wlags49_h2/wl_internal.h | 6 + drivers/staging/wlags49_h2/wl_wext.c | 655 +++++++++++++++--------------- 2 files changed, 340 insertions(+), 321 deletions(-)
drivers/staging/wlags49_h2/wl_internal.h +6 -0
@@ -980,6 +980,12 @@ struct wl_private#ifdef USE_WDS WVLAN_WDS_IF wds_port[NUM_WDS_PORTS ];#endif // USE_WDS + +/* Track whether the card is using WEP encryption or WPA +* so we know what to disable next time through. +* IW_ENCODE_ALG_NONE, IW_ENCODE_ALG_WEP, IW_ENCODE_ALG_TKIP +*/ +int wext_enc; };// wl_private #define wl_priv (dev) ((struct wl_private *) netdev_priv(dev))
drivers/staging/wlags49_h2/wl_wext.c +334 -321
736 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 6/7 staging: wlags49_h2: Fixup IW_AUTH handling
In reply to David KilroyHandle more cases in IW_AUTH.
Avoid reporting errors (invalid parameter) on operations that we can't do anything with.
Return -EINPROGRESS from some operations to get wpa_supplicant to batch and commit changes.
In other operations apply the changes immediately.
Avoid writing WEP keys from the commit handler when WEP is not being used.
Accept WPA_VERSION_DISABLED, which is received from wpa_supplicant during WEP.
--- drivers/staging/wlags49_h2/wl_main.c | 6 +- drivers/staging/wlags49_h2/wl_wext.c | 179 ++++++++++++++++++++-------------- 2 files changed, 109 insertions(+), 76 deletions(-)
drivers/staging/wlags49_h2/wl_main.c +4 -2
@@ -1993,8 +1993,10 @@ int wl_put_ltv( struct wl_private *lp ) lp->ltvRecord.typ =CFG_SET_WPA_AUTH_KEY_MGMT_SUITE ; lp->ltvRecord.u.u16[0 ] =CNV_INT_TO_LITTLE ( lp->AuthKeyMgmtSuite ); hcf_status =hcf_put_info ( &lp->hcfCtx, (LTVP )&( lp->ltvRecord )); -/* WEP Keys */ -wl_set_wep_keys ( lp ); + +/* If WEP (or no) keys are being used, write (or clear) them */ +if (lp->wext_enc !=IW_ENCODE_ALG_TKIP ) +wl_set_wep_keys (lp);/* Country Code */ /* countryInfo, ltvCountryInfo, CFG_CNF_COUNTRY_INFO */
drivers/staging/wlags49_h2/wl_wext.c +105 -74
215 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 7/7 staging: wlags49_h2: Fixup SIOCSIWGENIE
In reply to David KilroySetting the key management scheme is done in SIOCSIWAUTH, so no need to do anything in SIOCSIWGENIE.
Fix up function name.
--- drivers/staging/wlags49_h2/wl_wext.c | 40 +++++++-------------------------- 1 files changed, 9 insertions(+), 31 deletions(-)
drivers/staging/wlags49_h2/wl_wext.c +9 -31
@@ -3196,42 +3196,20 @@ out: -static int wireless_get_genie (struct net_device *dev, -struct iw_request_info *info, -struct iw_point *data,char *extra) +static int wireless_set_genie (struct net_device *dev, +struct iw_request_info *info, +struct iw_point *data,char *extra) { -struct wl_private *lp =wl_priv (dev); -unsigned long flags;int ret =0 ; -ltv_t ltv; - -DBG_FUNC ("wireless_get_genie" ); -DBG_ENTER ( DbgInfo ); - -if (lp->portState ==WVLAN_PORT_STATE_DISABLED ) { - ret = -EBUSY ; - goto out; - } - -wl_lock ( lp, &flags ); -wl_act_int_off ( lp ); - -memset (<v,0 ,sizeof (ltv)); - ltv.len =2 ; - ltv.typ =CFG_SET_WPA_AUTH_KEY_MGMT_SUITE ; - lp->AuthKeyMgmtSuite = ltv.u.u16[0 ] =4 ; - ltv.u.u16[0 ] =CNV_INT_TO_LITTLE (ltv.u.u16[0 ]); - - ret =hcf_put_info (&(lp->hcfCtx), (LTVP )<v); - -wl_act_int_on ( lp ); +DBG_ENTER (DbgInfo); -wl_unlock (lp, &flags); +/* We can't write this to the card, but apparently this +* operation needs to succeed */ + ret =0 ; -out: -DBG_LEAVE ( DbgInfo ); +DBG_LEAVE (DbgInfo);return ret; }/*============================================================================*/
@@ -3970,7 +3948,7 @@ static const iw_handler wl_handler[] =IW_HANDLER (SIOCGIWENCODE , (iw_handler ) wireless_get_encode),IW_HANDLER (SIOCSIWPOWER , (iw_handler ) wireless_set_power),IW_HANDLER (SIOCGIWPOWER , (iw_handler ) wireless_get_power), -IW_HANDLER (SIOCSIWGENIE , (iw_handler ) wireless_get_genie), +IW_HANDLER (SIOCSIWGENIE , (iw_handler ) wireless_set_genie),IW_HANDLER (SIOCSIWAUTH , (iw_handler ) wireless_set_auth), IW_HANDLER(SIOCSIWENCODEEXT, (iw_handler) wireless_set_encodeext), };
Signature · 1 line
1.7.4.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 3/7] staging: wlags49_h2: Remove useless IWE_STREAM_ADD_YYY defines
LKML didn't like the original title of this patch and rejected the email.
Greg: please let me know if you want me to resend this with an 'acceptable' title, otherwise you might consider removing the treble X from the patch title.
Regards,
Dave
---
Quoted 107 lines · David Kilroy
These macros don't map to anything different. Just remove them.
Signed-off-by David Kilroy<[email protected]>--- drivers/staging/wlags49_h2/wl_wext.c | 33 ++++++++++++++------------------- 1 files changed, 14 insertions(+), 19 deletions(-)drivers/staging/wlags49_h2/wl_wext.c +14
-19@@ -75,15 +75,6 @@#include <wl_wext.h> #include <wl_priv.h> - - -#define IWE_STREAM_ADD_EVENT (info, buf, end, iwe, len) \ - iwe_stream_add_event(info, buf, end, iwe, len) -#define IWE_STREAM_ADD_POINT (info, buf, end, iwe, msg) \ - iwe_stream_add_point(info, buf, end, iwe, msg) - - -/******************************************************************************* * global definitions ******************************************************************************/ @@ -2681,8 +2672,8 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *infmemcpy ( iwe.u.ap_addr.sa_data, probe_resp->BSSID,ETH_ALEN ); iwe.len =IW_EV_ADDR_LEN ; - buf =IWE_STREAM_ADD_EVENT (info, buf, buf_end,&iwe,IW_EV_ADDR_LEN ); - + buf =iwe_stream_add_event (info, buf, buf_end, + &iwe,IW_EV_ADDR_LEN );/* Use the mode to indicate if it's a station or AP */ /* Won't always be an AP if in IBSS mode */ @@ -2698,8 +2689,8 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *inf iwe.len =IW_EV_UINT_LEN ; - buf =IWE_STREAM_ADD_EVENT (info, buf, buf_end,&iwe,IW_EV_UINT_LEN ); - + buf =iwe_stream_add_event (info, buf, buf_end, + &iwe,IW_EV_UINT_LEN );/* Any quality information */ memset (&iwe,0 ,sizeof (iwe));@@ -2711,7 +2702,8 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *inf iwe.u.qual.updated = lp->probe_results.scan_complete |IW_QUAL_DBM ; iwe.len =IW_EV_QUAL_LEN ; - buf =IWE_STREAM_ADD_EVENT (info, buf, buf_end,&iwe,IW_EV_QUAL_LEN ); + buf =iwe_stream_add_event (info, buf, buf_end, + &iwe,IW_EV_QUAL_LEN );/* ESSID information */ @@ -2722,7 +2714,8 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *inf iwe.u.data.length = probe_resp->rawData[1 ]; iwe.u.data.flags =1 ; - buf =IWE_STREAM_ADD_POINT (info, buf, buf_end,&iwe,&probe_resp->rawData[2 ]); + buf =iwe_stream_add_point (info, buf, buf_end, + &iwe,&probe_resp->rawData[2 ]); }@@ -2740,7 +2733,7 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *inf iwe.u.data.flags |=IW_ENCODE_DISABLED ; } - buf =IWE_STREAM_ADD_POINT (info, buf, buf_end,&iwe,NULL ); + buf =iwe_stream_add_point (info, buf, buf_end,&iwe,NULL );/* Frequency Info */ @@ -2751,7 +2744,8 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *inf iwe.u.freq.m =wl_parse_ds_ie ( probe_resp ); iwe.u.freq.e =0 ; - buf =IWE_STREAM_ADD_EVENT (info, buf, buf_end,&iwe,IW_EV_FREQ_LEN ); + buf =iwe_stream_add_event (info, buf, buf_end, + &iwe,IW_EV_FREQ_LEN );/* Custom info (Beacon Interval) */ @@ -2762,7 +2756,7 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *infsprintf ( msg,"beacon_interval=%d" , probe_resp->beaconInterval ); iwe.u.data.length =strlen ( msg ); - buf =IWE_STREAM_ADD_POINT (info, buf, buf_end,&iwe, msg); + buf =iwe_stream_add_point (info, buf, buf_end,&iwe, msg);/* Custom info (WPA-IE) */ @@ -2778,7 +2772,8 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *infsprintf ( msg,"wpa_ie=%s" ,wl_print_wpa_ie ( wpa_ie, wpa_ie_len )); iwe.u.data.length =strlen ( msg ); - buf =IWE_STREAM_ADD_POINT (info, buf, buf_end,&iwe, msg); + buf =iwe_stream_add_point (info, buf, buf_end, + &iwe, msg); }/* Add other custom info in formatted string format as needed... */
Re: [PATCH 3/7] staging: wlags49_h2: Remove useless IWE_STREAM_ADD_YYY defines
Quoted 5 lines · Dave Kilroy
LKML didn't like the original title of this patch and rejected the email.
Greg: please let me know if you want me to resend this with an 'acceptable' title, otherwise you might consider removing the treble X from the patch title.
I got it, don't worry about it, I'll queue it up in a bit.
greg k-h