Skip to contentSkip to conversation

staging: wlags49_h2: Improve WEXT support

PATCH Applied David Kilroy 4 participants 12 messages Sep 19, 2011 – Sep 21, 2011 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: wlags49_h2: Improve WEXT support

There are reports of issues using WPA with this driver. This series of patches fixes a few obvious issues with the WEXT support in this driver.

The changes have not recieved any testing. YMMV.

David Kilroy (3):
staging: wlags49_h2: Remove old WIRELESS_EXT support
staging: wlags49_h2: Support standard WEXT events
staging: wlags49_h2: Declare support for WEXT 21

 drivers/staging/wlags49_h2/wl_internal.h |    7 --
 drivers/staging/wlags49_h2/wl_version.h  |    6 +-
 drivers/staging/wlags49_h2/wl_wext.c     |  152 ++++--------------------------
 drivers/staging/wlags49_h2/wl_wext.h     |    8 --
 4 files changed, 20 insertions(+), 153 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/3 staging: wlags49_h2: Remove old WIRELESS_EXT support

Since the driver is now in-kernel remove support for building against ancient WIRELESS_EXT versions.

---
 drivers/staging/wlags49_h2/wl_internal.h |    7 --
 drivers/staging/wlags49_h2/wl_version.h  |    3 -
 drivers/staging/wlags49_h2/wl_wext.c     |   96 ------------------------------
 drivers/staging/wlags49_h2/wl_wext.h     |    8 ---
 4 files changed, 0 insertions(+), 114 deletions(-)
drivers/staging/wlags49_h2/wl_internal.h +0 -7
index cd129b3..1508063 100644
@@ -75,15 +75,8 @@
 #include <pcmcia/ds.h>
 #endif  // BUS_PCMCIA
 
-#ifdef HAS_WIRELESS_EXTENSIONS
 #include <linux/wireless.h>
-#if WIRELESS_EXT > 13
 #include <net/iw_handler.h>
-#endif // WIRELESS_EXT > 13
-#define USE_DBM
-#define RETURN_CURRENT_NETWORKNAME
-#define USE_FREQUENCY
-#endif // HAS_WIRELESS_EXTENSIONS/
 
 #include <linux/list.h>
 
drivers/staging/wlags49_h2/wl_version.h +0 -3
index a5e604c..872d085 100644
@@ -158,9 +158,6 @@ err: define bus type;
  * There doesn't seem to be a difference for PCMCIA and PCI anymore, at least
  * for PCMCIA the same defines are needed now as previously only used for PCI
  */
-#if USE_WEXT
-#define HAS_WIRELESS_EXTENSIONS
-#endif  // USE_WEXT
 
 #define NEW_MULTICAST
 #define ALLOC_SKB(len)   dev_alloc_skb(len+2)
drivers/staging/wlags49_h2/wl_wext.c +0 -96

354 lines not on this page · raw message

drivers/staging/wlags49_h2/wl_wext.h +0 -8
index 39d39a4..a713058 100644
@@ -62,9 +62,6 @@
 #define __WL_WEXT_H__
 
 
-#ifdef WIRELESS_EXT
-
-
 /*******************************************************************************
  *  function protoypes
  ******************************************************************************/
@@ -88,9 +85,4 @@ void wl_wext_event_assoc_ie( struct net_device *dev );
 
 extern const struct iw_handler_def wl_iw_handler_def;
 
-#else
-#error WIRELESS_EXT
-#endif // WIRELESS_EXT
-
-
 #endif  // __WL_WEXT_H__
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/3 staging: wlags49_h2: Support standard WEXT events

In reply to David Kilroy

... instead of using IWEVCUSTOM. Use the defined events for michael mic failure, association request info and association response info.

---
 drivers/staging/wlags49_h2/wl_wext.c |   56 +++++++++++-----------------------
 1 files changed, 18 insertions(+), 38 deletions(-)
drivers/staging/wlags49_h2/wl_wext.c +18 -38
index fc453a8..917c949 100644
@@ -3805,9 +3805,9 @@ void wl_wext_event_expired_sta( struct net_device *dev )
  ******************************************************************************/
 void wl_wext_event_mic_failed( struct net_device *dev )
 {
-	char               msg[512];
 	union iwreq_data   wrqu;
 	struct wl_private *lp = wl_priv(dev);
+	struct iw_michaelmicfailure wxmic;
 	int                key_idx;
 	char              *addr1;
 	char              *addr2;
@@ -3829,30 +3829,17 @@ void wl_wext_event_mic_failed( struct net_device *dev )
 	DBG_PRINT( "MIC FAIL - KEY USED : %d, STATUS : 0x%04x\n", key_idx,
 			   hdr->status );
 
-	memset( &wrqu, 0, sizeof( wrqu ));
-	memset( msg, 0, sizeof( msg ));
-
+	memset(&wrqu, 0, sizeof(wrqu));
+	memset(&wxmic, 0, sizeof(wxmic));
 
-	/* Because MIC failures are not part of the Wireless Extensions yet, they
-	   must be passed as a string using an IWEVCUSTOM event. In order for the
-	   event to be effective, the string format must be known by both the
-	   driver and the supplicant. The following is the string format used by the
-	   hostap project's WPA supplicant, and will be used here until the Wireless
-	   Extensions interface adds this support:
+	wxmic.flags = key_idx & IW_MICFAILURE_KEY_ID;
+	wxmic.flags |= (addr1[0] & 1) ?
+		IW_MICFAILURE_GROUP : IW_MICFAILURE_PAIRWISE;
+	wxmic.src_addr.sa_family = ARPHRD_ETHER;
+	memcpy(wxmic.src_addr.sa_data, addr2, ETH_ALEN);
 
-	   MLME-MICHAELMICFAILURE.indication(keyid=# broadcast/unicast addr=addr2)
-   */
-
-	/* NOTE: Format of MAC address (using colons to separate bytes) may cause
-			 a problem in future versions of the supplicant, if they ever
-			 actually parse these parameters */
-#if DBG
-	sprintf(msg, "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast "
-			"addr=%pM)", key_idx, addr1[0] & 0x01 ? "broad" : "uni",
-			addr2);
-#endif
-	wrqu.data.length = strlen( msg );
-	wireless_send_event( dev, IWEVCUSTOM, &wrqu, msg );
+	wrqu.data.length = sizeof(wxmic);
+	wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&wxmic);
 
 	return;
 } // wl_wext_event_mic_failed
@@ -3882,7 +3869,6 @@ void wl_wext_event_mic_failed( struct net_device *dev )
  ******************************************************************************/
 void wl_wext_event_assoc_ie( struct net_device *dev )
 {
-	char               msg[512];
 	union iwreq_data   wrqu;
 	struct wl_private *lp = wl_priv(dev);
 	int status;
@@ -3893,7 +3879,6 @@ void wl_wext_event_assoc_ie( struct net_device *dev )
 
 
 	memset( &wrqu, 0, sizeof( wrqu ));
-	memset( msg, 0, sizeof( msg ));
 
 	/* Retrieve the Association Request IE */
 	lp->ltvRecord.len = 45;
@@ -3906,21 +3891,16 @@ void wl_wext_event_assoc_ie( struct net_device *dev )
 		memcpy( &data.rawData, &( lp->ltvRecord.u.u8[1] ), 88 );
 		wpa_ie = wl_parse_wpa_ie( &data, &length );
 
-		/* Because this event (Association WPA-IE) is not part of the Wireless
-		Extensions yet, it must be passed as a string using an IWEVCUSTOM event.
-		In order for the event to be effective, the string format must be known
-		by both the driver and the supplicant. The following is the string format
-		used by the hostap project's WPA supplicant, and will be used here until
-		the Wireless Extensions interface adds this support:
-
-		ASSOCINFO(ReqIEs=WPA-IE RespIEs=WPA-IE)
-		*/
-
 		if( length != 0 )
 		{
-			sprintf( msg, "ASSOCINFO(ReqIEs=%s)", wl_print_wpa_ie( wpa_ie, length ));
-			wrqu.data.length = strlen( msg );
-			wireless_send_event( dev, IWEVCUSTOM, &wrqu, msg );
+			wrqu.data.length = wpa_ie[1] + 2;
+			wireless_send_event(dev, IWEVASSOCREQIE,
+					    &wrqu, wpa_ie);
+
+			/* This bit is a hack. We send the respie
+			 * event at the same time */
+			wireless_send_event(dev, IWEVASSOCRESPIE,
+					    &wrqu, wpa_ie);
 		}
 	}
 
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 3/3 staging: wlags49_h2: Declare support for WEXT 21

In reply to David Kilroy

There may be a few areas where we don't actually support WE21, but by doing this it will make it easier to find those places.

---
 drivers/staging/wlags49_h2/wl_version.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/wlags49_h2/wl_version.h +2 -1
index 872d085..a68159a 100644
@@ -144,7 +144,8 @@ err: define bus type;
 							" for " BUS_TYPE ", " 											   	 \
 							MODULE_DATE " by " VENDOR_NAME
 
-#define WIRELESS_SUPPORT    15  // The version of wireless extensions we support
+/* The version of wireless extensions we support */
+#define WIRELESS_SUPPORT    21
 
 //#define DBG_MOD_NAME         DRIVER_NAME ":" BUS_TYPE ":" HW_TYPE ":" FW_TYPE
 #define DBG_MOD_NAME        MODULE_NAME
Signature · 1 line
1.7.4.1
#4 lore raw

Re: [PATCH 3/3] staging: wlags49_h2: Declare support for WEXT 21

Quoted 2 lines · David Kilroy

There may be a few areas where we don't actually support WE21, but by doing this it will make it easier to find those places.

I'll bite - what happens when we find such a place? Kernel fails to build, or user has a suboptimal usage experience, or?

What are the expected chances that sticking this in linux-next for a cycle will result in most/all of the places being found before this all appears in an official release? I'm thinking this should probably go in linux-next right after the next merge window closes, to maximize the chances we'll shake it all out during almost 2 cycles before it hits the streets. (And yes, I know it's a staging/ driver - if somebody else says "one cycle is more than enough" I'm OK with that too...)

#5 lore raw

Re: [PATCH 3/3] staging: wlags49_h2: Declare support for WEXT 21

Quoted 6 lines · On 19/09/2011 21:22, [email protected] wrote:
Quoted 2 lines · David Kilroy

There may be a few areas where we don't actually support WE21, but by doing this it will make it easier to find those places.

I'll bite - what happens when we find such a place? Kernel fails to build, or user has a suboptimal usage experience, or?

The user would have a sub-optimal experience. iwconfig may not display a few things correctly (ESSID?) in particular scenarios.

The reason I included this patch was that I'm not sure whether wpa-supplicant requires WEXT version to be above a certain threshold to use the events in the previous patch. I'm happy to drop this one if it just works.

Quoted 7 lines

What are the expected chances that sticking this in linux-next for a cycle will result in most/all of the places being found before this all appears in an official release? I'm thinking this should probably go in linux-next right after the next merge window closes, to maximize the chances we'll shake it all out during almost 2 cycles before it hits the streets. (And yes, I know it's a staging/ driver - if somebody else says "one cycle is more than enough" I'm OK with that too...)

This hardware is old, and as far as I can tell quite rare. I'd hope we can get some feedback from Henk on the series before applying this patch.

Thanks,

Dave.

Applied
#6 lore raw

Re: [PATCH 3/3] staging: wlags49_h2: Declare support for WEXT 21

Quoted 24 lines · Dave Kilroy
Quoted 6 lines · On 19/09/2011 21:22, [email protected] wrote:
Quoted 2 lines · David Kilroy

There may be a few areas where we don't actually support WE21, but by doing this it will make it easier to find those places.

I'll bite - what happens when we find such a place? Kernel fails to build, or user has a suboptimal usage experience, or?

The user would have a sub-optimal experience. iwconfig may not display a few things correctly (ESSID?) in particular scenarios.

The reason I included this patch was that I'm not sure whether wpa-supplicant requires WEXT version to be above a certain threshold to use the events in the previous patch. I'm happy to drop this one if it just works.

Quoted 7 lines

What are the expected chances that sticking this in linux-next for a cycle will result in most/all of the places being found before this all appears in an official release? I'm thinking this should probably go in linux-next right after the next merge window closes, to maximize the chances we'll shake it all out during almost 2 cycles before it hits the streets. (And yes, I know it's a staging/ driver - if somebody else says "one cycle is more than enough" I'm OK with that too...)

Quoted 3 lines

This hardware is old, and as far as I can tell quite rare. I'd hope we can get some feedback from Henk on the series before applying this patch.

I've applied the first 2 of these, if you want me to apply the third one, please resend it after it's been tested by someone.

thanks,

greg k-h

#7 lore raw

Re: [PATCH 3/3] staging: wlags49_h2: Declare support for WEXT 21

Hello Greg,

Op 20-9-2011 21:52, Greg KH schreef:

Quoted 7 lines

I've applied the first 2 of these, if you want me to apply the third one, please resend it after it's been tested by someone.

thanks,

greg k-h

I have the patched driver running on the 2.6.38-11-generic #48 Ubuntu 11.04 Natty Narwhal kernel, which, as far as I could determine, uses WEXT version 22. The patch didn't improve anything other than the code itself, but didn't break anything either. Tested with WEP accesspoint, WPA still not functional. The still appears to be stable.

Henk.

#8 lore raw

Re: [PATCH 3/3] staging: wlags49_h2: Declare support for WEXT 21

Quoted 11 lines · Henk de Groot

Hello Greg,

Op 20-9-2011 21:52, Greg KH schreef:

Quoted 7 lines

I've applied the first 2 of these, if you want me to apply the third one, please resend it after it's been tested by someone.

thanks,

greg k-h

Quoted 6 lines

I have the patched driver running on the 2.6.38-11-generic #48 Ubuntu 11.04 Natty Narwhal kernel, which, as far as I could determine, uses WEXT version 22. The patch didn't improve anything other than the code itself, but didn't break anything either. Tested with WEP accesspoint, WPA still not functional. The still appears to be stable.

So, should I apply this patch or not?

confused,

greg k-h

#9 lore raw

Re: [PATCH 3/3] staging: wlags49_h2: Declare support for WEXT 21

Op 20-9-2011 23:02, Greg KH schreef:

Quoted 5 lines

So, should I apply this patch or not?

confused,

greg k-h

It doesn't break anything and is was there to make sure the previous patches work, so yes, why not.

Henk.

#10 lore raw

Re: [PATCH 3/3] staging: wlags49_h2: Declare support for WEXT 21

Quoted 9 lines · Henk de Groot

Op 20-9-2011 23:02, Greg KH schreef:

Quoted 5 lines

So, should I apply this patch or not?

confused,

greg k-h

It doesn't break anything and is was there to make sure the previous patches work, so yes, why not.

Ok, can someone please resend it then, it's long-gone from my patch queue at this point in time.

greg k-h

#11 lore raw

Re: [PATCH 3/3] staging: wlags49_h2: Declare support for WEXT 21

Quoted 8 lines · Greg KH
Quoted 7 lines · Henk de Groot

Op 20-9-2011 23:02, Greg KH schreef:

Quoted 5 lines

So, should I apply this patch or not?

confused,

greg k-h

Quoted 7 lines
Quoted 2 lines

It doesn't break anything and is was there to make sure the previous patches work, so yes, why not.

Ok, can someone please resend it then, it's long-gone from my patch queue at this point in time.

greg k-h

Thanks Greg. I'll take the time to find out what's actually changed in the WEXT versions, and resend towards the end of this week with any necessary fixes.

Dave.