doing RSN with wpa_supplicant and madwifi

Jouni Malinen jkmaline at cc.hut.fi
Sat Jun 26 16:16:27 EDT 2004


On Sat, Jun 26, 2004 at 09:36:11PM +0200, Wilfried Klaebe wrote:

> start wpa_supplicant
> 
> _after_ it giving the message "wpa_driver_madwifi_set_wpa: enabled=1",
> do "iwpriv ath0 wpa 2" to tell madwifi to do WPA2 instead of WPA1.

This (untested) patch might be enough to do this automatically. I don't
know whether there is a way to configure madwifi driver to do both WPA
and WPA2 at the same time, but if not, something similar to this patch
could be useful.



Index: wpa_supplicant/driver_madwifi.c
===================================================================
RCS file: /home/jm/cvsroot/hostap/wpa_supplicant/driver_madwifi.c,v
retrieving revision 1.2
diff -u -p -r1.2 driver_madwifi.c
--- wpa_supplicant/driver_madwifi.c	25 Jun 2004 03:07:16 -0000	1.2
+++ wpa_supplicant/driver_madwifi.c	26 Jun 2004 20:15:10 -0000
@@ -24,6 +24,7 @@
 #include "driver_wext.h"
 #include "eloop.h"
 #include "wpa_supplicant.h"
+#include "hostap_common.h"
 
 #include <include/compat.h>
 #include <net80211/ieee80211.h>
@@ -317,7 +318,7 @@ wpa_driver_madwifi_associate(const char 
 {
 	struct ieee80211req_mlme mlme;
 
-	int ret = 0;
+	int ret = 0, wpa_ver = 1;
 
 	wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
 
@@ -331,6 +332,10 @@ wpa_driver_madwifi_associate(const char 
 	/* XXX error handling is wrong but unclear what to do... */
 	if (wpa_driver_madwifi_set_wpa_ie(ifname, wpa_ie, wpa_ie_len) < 0)
 		ret = -1;
+	if (wpa_ie && wpa_ie_len > 0 && wpa_ie[0] == WLAN_EID_RSN)
+		wpa_ver = 2;
+	if (set80211param(ifname, IEEE80211_PARAM_WPA, wpa_ver, 1) < 0)
+		ret = -1;
 	if (wpa_driver_wext_set_ssid(ifname, ssid, ssid_len) < 0)
 		ret = -1;
 	memset(&mlme, 0, sizeof(mlme));


-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the HostAP mailing list