Skip to contentSkip to conversation

airo.c: add support for IW_ENCODE_TEMP (i.e. xsupplicant)

PATCH In review Dan Streetman 2 participants 2 messages Nov 11, 2005 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 airo.c: add support for IW_ENCODE_TEMP (i.e. xsupplicant)

Hello Jeff,

this patch changes causes the airo driver to not reset the card when a temporary WEP key is set, when the IW_ENCODE_TEMP flag is used. This is needed for xsupplicant as 802.1x, LEAP, etc. change WEP keys frequently after authentication and resetting the card causes infinite reauthentication.

Javier and Jean agree with the patch, Javier suggested I send this to you, can you apply this?

Thanks.

drivers/net/wireless/airo.c +8 -7
diff -urpN a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
@@ -4059,7 +4059,7 @@ static int PC4500_writerid(struct airo_i
 		Cmd cmd;
 		Resp rsp;
 
-		if (test_bit(FLAG_ENABLED, &ai->flags))
+		if (test_bit(FLAG_ENABLED, &ai->flags) && (RID_WEP_TEMP != rid))
 			printk(KERN_ERR
 				"%s: MAC should be disabled (rid=%04x)\n",
 				__FUNCTION__, rid);
@@ -5119,9 +5119,9 @@ static int set_wep_key(struct airo_info 
 		printk(KERN_INFO "Setting key %d\n", index);
 	}
 
-	disable_MAC(ai, lock);
+	if (perm) disable_MAC(ai, lock);
 	writeWepKeyRid(ai, &wkr, perm, lock);
-	enable_MAC(ai, &rsp, lock);
+	if (perm) enable_MAC(ai, &rsp, lock);
 	return 0;
 }
 
@@ -6202,6 +6202,8 @@ static int airo_set_encode(struct net_de
 {
 	struct airo_info *local = dev->priv;
 	CapabilityRid cap_rid;		/* Card capability info */
+	int perm = ( dwrq->flags & IW_ENCODE_TEMP ? 0 : 1 );
+	u16 currentAuthType = local->config.authType;
 
 	/* Is WEP supported ? */
 	readCapabilityRid(local, &cap_rid, 1);
@@ -6244,7 +6246,7 @@ static int airo_set_encode(struct net_de
 			/* Copy the key in the driver */
 			memcpy(key.key, extra, dwrq->length);
 			/* Send the key to the card */
-			set_wep_key(local, index, key.key, key.len, 1, 1);
+			set_wep_key(local, index, key.key, key.len, perm, 1);
 		}
 		/* WE specify that if a valid key is set, encryption
 		 * should be enabled (user may turn it off later)
@@ -6252,13 +6254,12 @@ static int airo_set_encode(struct net_de
 		if((index == current_index) && (key.len > 0) &&
 		   (local->config.authType == AUTH_OPEN)) {
 			local->config.authType = AUTH_ENCRYPT;
-			set_bit (FLAG_COMMIT, &local->flags);
 		}
 	} else {
 		/* Do we want to just set the transmit key index ? */
 		int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
 		if ((index >= 0) && (index < ((cap_rid.softCap & 0x80)?4:1))) {
-			set_wep_key(local, index, NULL, 0, 1, 1);
+			set_wep_key(local, index, NULL, 0, perm, 1);
 		} else
 			/* Don't complain if only change the mode */
 			if(!dwrq->flags & IW_ENCODE_MODE) {
@@ -6273,7 +6274,7 @@ static int airo_set_encode(struct net_de
 	if(dwrq->flags & IW_ENCODE_OPEN)
 		local->config.authType = AUTH_ENCRYPT;	// Only Wep
 	/* Commit the changes to flags if needed */
-	if(dwrq->flags & IW_ENCODE_MODE)
+	if (local->config.authType != currentAuthType)
 		set_bit (FLAG_COMMIT, &local->flags);
 	return -EINPROGRESS;		/* Call commit handler */
 }
#1 lore raw

This is a bit offtopic, but are there people interested in merging WPA in airo driver ?
I have a basic WPA-PSK working implementation at
http://castet.matthieu.free.fr/airo/ .

But I am quite busy ATM, and don't have time to finish the work.

Matthieu

PS : Jeff could you review these patches ?
http://marc.theaimsgroup.com/?l=linux-netdev&m=112793403827954&w=2
http://marc.theaimsgroup.com/?l=linux-netdev&m=112798430523291&w=2
http://marc.theaimsgroup.com/?l=linux-netdev&m=112793500427325&w=2