Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Feb 2006 11:52:25 -0800
From:      Sam Leffler <sam@errno.com>
To:        freebsd-current@freebsd.org
Subject:   CFT: wpa_supplicant key handling fix
Message-ID:  <43F62979.4050300@errno.com>
In-Reply-To: <4367E716.1080903@getsomewhere.net>
References:  <43543086.7020705@getsomewhere.net> <43552198.2070806@errno.com> <435570F5.6060308@getsomewhere.net> <435C63D1.6060907@errno.com> <435D7546.1020604@getsomewhere.net> <435D779A.5070803@errno.com> <435D8702.1030705@getsomewhere.net> <435D883E.5090406@errno.com> <435DB985.2000902@getsomewhere.net> <435F230D.2080202@errno.com> <43613C44.1020906@getsomewhere.net> <43613EAA.7010703@errno.com> <43614400.50302@getsomewhere.net> <4361467E.8030506@errno.com> <43614D7F.6060301@getsomewhere.net> <436150D6.9040704@errno.com> <43615A7F.1010208@getsomewhere.net> <43615C5E.6070403@errno.com> <43615EB4.80606@getsomewhere.net> <43615FA1.6030005@errno.com> <4361607A.2070601@getsomewhere.net> <43616145.5010801@errno.com> <4367E716.1080903@getsomewhere.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------000608020003010405050501
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Attached are two changes; one for wpa_supplicant/driver_freebsd.c that 
corrects how what it passes into the kernel when requesting a key with a 
fixed key index.  The other is a fix to 
src/sys/net80211/ieee80211_ioctl.c so that setting a key in slots 0-3 
[1-4] forces them to be set there (previously the driver was permitted 
to assign a different hardware key index).  I believe these two changes 
together fix problems people have reported with ap's that want stations 
to plumb keys at key indices > 0.  This should also fix similar issues 
with setup of shared key wep at non-zero indices.

Please test and report any issues directly to me.  I've tested wpa-psk 
and the code's been otherwise reviewed so should be safe to use.

	Sam


--------------000608020003010405050501
Content-Type: text/plain;
 name="wpa_supplicant.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="wpa_supplicant.patch"

? wpa_supplicant.patch
Index: driver_freebsd.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c,v
retrieving revision 1.8
diff -u -r1.8 driver_freebsd.c
--- driver_freebsd.c	30 Aug 2005 15:59:49 -0000	1.8
+++ driver_freebsd.c	8 Feb 2006 17:55:03 -0000
@@ -311,10 +311,11 @@
 	if (bcmp(addr, "\xff\xff\xff\xff\xff\xff", IEEE80211_ADDR_LEN) == 0) {
 		wk.ik_flags |= IEEE80211_KEY_GROUP;
 		wk.ik_keyix = key_idx;
-		if (set_tx)
-			wk.ik_flags |= IEEE80211_KEY_DEFAULT;
-	} else
-		wk.ik_keyix = IEEE80211_KEYIX_NONE;
+	} else {
+		wk.ik_keyix = (key_idx == 0 ? IEEE80211_KEYIX_NONE : key_idx);
+	}
+	if (wk.ik_keyix != IEEE80211_KEYIX_NONE && set_tx)
+		wk.ik_flags |= IEEE80211_KEY_DEFAULT;
 	wk.ik_keylen = key_len;
 	memcpy(&wk.ik_keyrsc, seq, seq_len);
 	memcpy(wk.ik_keydata, key, key_len);


--------------000608020003010405050501
Content-Type: text/plain;
 name="ioctl.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ioctl.patch"

Index: ieee80211_ioctl.c
===================================================================
RCS file: /usr/ncvs/src/sys/net80211/ieee80211_ioctl.c,v
retrieving revision 1.43
diff -u -r1.43 ieee80211_ioctl.c
--- ieee80211_ioctl.c	18 Jan 2006 22:17:50 -0000	1.43
+++ ieee80211_ioctl.c	7 Feb 2006 16:58:15 -0000
@@ -1718,6 +1718,12 @@
 		if (kid >= IEEE80211_WEP_NKID)
 			return EINVAL;
 		wk = &ic->ic_nw_keys[kid];
+		/*
+		 * Global slots start off w/o any assigned key index.
+		 * Force one here for consistency with IEEE80211_IOC_WEPKEY.
+		 */
+		if (wk->wk_keyix == IEEE80211_KEYIX_NONE)
+			wk->wk_keyix = kid;
 		ni = NULL;
 	}
 	error = 0;


--------------000608020003010405050501--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43F62979.4050300>