Please note: This project is no longer active. The website is kept online for historic purposes only.
If you´re looking for a Linux driver for your Atheros WLAN device, you should continue here .

Ticket #77 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

wpa_supplicant-0.4.x fails to compile with madwifi driver

Reported by: dussi Assigned to:
Priority: major Milestone: version 0.9.0 - move to new codebase
Component: madwifi: 802.11 stack Version: trunk
Keywords: Cc:
Patch is attached: Pending:

Description (Last modified by matt)


when enabling the madwifi driver in wpa_supplicant, the essential element to get WLAN working, then it fails to compile with the following output:

cc -MMD -O2 -Wall -g -I. -I../utils -I../hostapd -I/usr/src/madwifi-ng -DCONFIG_                                            DRIVER_WEXT -DCONFIG_DRIVER_MADWIFI -DCONFIG_DRIVER_WIRED -DCONFIG_WIRELESS_EXTE                                            NSION -DCONFIG_CTRL_IFACE -DCONFIG_READLINE   -c -o driver_madwifi.o driver_madw                                            ifi.c
In file included from /usr/src/madwifi-ng/net80211/ieee80211_ioctl.h:502,
                 from driver_madwifi.c:39:
/usr/include/linux/if.h:95: error: redefinition of ‘struct ifmap’
/usr/include/linux/if.h:131: error: redefinition of ‘struct ifreq’
/usr/include/linux/if.h:181: error: redefinition of ‘struct ifconf’
driver_madwifi.c: In function ‘set80211priv’:
driver_madwifi.c:91: error: ‘IEEE80211_IOCTL_CHANLIST’ undeclared (first use in                                             this function)
driver_madwifi.c:91: error: (Each undeclared identifier is reported only once
driver_madwifi.c:91: error: for each function it appears in.)
make: *** [driver_madwifi.o] Fehler 1

Tested with wpa_supplicant versions 0.4.4 and 0.4.6. 0.4.4 compiles fine with old madwifi driver.


driver_madwifi.patch (3.4 kB) - added by benoitc on 11/13/05 01:44:56.
wpa_supplicant patch to support madwifi driver

Change History

10/29/05 01:44:54 changed by kelmo

Did you apply the patch found in the "patches" dir of the madwifi-ng checkout?

10/29/05 10:44:10 changed by dussi

Ok, applied it now (the patch is mentioned nowhere outside that dir). However, it still fails:

cc -MMD -O2 -Wall -g -I. -I../utils -I../hostapd -I/usr/src/madwifi-ng -DCONFIG_DRIVER_WEXT -DCONFIG_DRIVER_MADWIFI -DCONFIG_DRIVER_WIRED -DCONFIG_WIRELESS_EXTENSION -DCONFIG_CTRL_IFACE -DCONFIG_READLINE   -c -o driver_madwifi.o driver_madwifi.c
In file included from /usr/src/madwifi-ng/net80211/ieee80211_ioctl.h:502,
                 from driver_madwifi.c:40:
/usr/include/linux/if.h:95: error: redefinition of ‘struct ifmap’
/usr/include/linux/if.h:131: error: redefinition of ‘struct ifreq’
/usr/include/linux/if.h:181: error: redefinition of ‘struct ifconf’
make: *** [driver_madwifi.o] Fehler 1

10/29/05 10:55:10 changed by dussi

Or maybe trying the other way: is it possible to use the driver completely with the WE-19 from linux-2.6.14? In this case, wpa_supplicant-0.4.6 would not have to be compiled with a madwifi driver.

10/29/05 15:05:57 changed by matt

  • description changed.

11/01/05 15:15:09 changed by bmeier

If you want compile wpa_supplicant-0.4.6 you have to copy original wirless.h to wireless_copy.h and You must include

#include <sys/socket.h>

in the following files: driver_hostap.c driver_atmel.c

11/01/05 16:15:22 changed by dussi

I don't compile in hostap and atmel, only madwifi and wext. wpa_supplicant will not compile with an original wireless.h, at least not if it is based on WE 18 or less:

driver_wext.c: In function ‘wpa_driver_wext_event_wireless’:
driver_wext.c:443: error: ‘IW_EV_POINT_OFF’ undeclared (first use in this function)
driver_wext.c:443: error: (Each undeclared identifier is reported only once
driver_wext.c:443: error: for each function it appears in.)
driver_wext.c: In function ‘wpa_driver_wext_init’:
driver_wext.c:768: warning: implicit declaration of function ‘if_nametoindex’
driver_wext.c: In function ‘wpa_driver_wext_get_scan_results’:
driver_wext.c:1001: error: ‘IW_EV_POINT_OFF’ undeclared (first use in this function)

You might think to get rid of the error in line 768 with an

#include <net/if.h>

but in this case, you get others:

/usr/include/linux/if.h:95: error: redefinition of ‘struct ifmap’
/usr/include/linux/if.h:131: error: redefinition of ‘struct ifreq’
/usr/include/linux/if.h:181: error: redefinition of ‘struct ifconf’

That is due to linux/wireless.h including linux/if.h which declares the same structs but not the if_nametoindex function (what a mess!). However, that's not important: C default to a default return value of int and that's correct for if_nametoindex().

The IW_EV_POINT_OFF can only be found in wireless.h from WE 19. However, driver_madwifi.c compile fine with the wireless.h from the system (which is WE 18).

I think I'll point the wpa_supplicant maintainer to this thread.


11/01/05 16:25:19 changed by dussi

The problem is the following line:

ieee80211_ioctl.h:502:#include <linux/if.h>

If you change that to

#include <net/if.h>

then wpa_supplicant compiles fine (no change except the patch from the patches subdir). However, madwifi-ng itself does not compile with this change.

The problem are the different C header guards for linux/if.h and net/if.h, so adjust the solution a bit:

--- ieee80211_ioctl.h~  2005-11-01 16:23:06.000000000 +0100
+++ ieee80211_ioctl.h   2005-11-01 16:19:34.000000000 +0100
@@ -499,7 +499,9 @@
  * NB: Even-numbered ioctl numbers have set semantics and are privileged!
  *     (regardless of the incorrect comment in wireless.h!)
+#ifndef _NET_IF_H
 #include <linux/if.h>
 #define        IEEE80211_IOCTL_SETPARAM        (SIOCIWFIRSTPRIV+0)
 #define        IEEE80211_IOCTL_GETPARAM        (SIOCIWFIRSTPRIV+1)
 #define        IEEE80211_IOCTL_SETKEY          (SIOCIWFIRSTPRIV+2)

This patch works and completely solves this problem (and wireless_copy.h can stay in its place). Please include it.

11/02/05 15:10:27 changed by kelmo

This patch, plus the patch from ticket #108, plus the patch provided by atheros enabled my lappy to go wireless on a secure connection for the first time with madwifi-ng ; )

11/07/05 01:16:39 changed by anonymous

I also applied these patches and WPA works, however I am getting system lockups using this combo.

Card - AR5212 (ibm a/b/g, thinkpad x40) Kernel - 2.6.14 madwifi-ng build 1306 wpa-supplicant 0.4.6 (with wext scan change and patch from patches dir)

This has become hard to reproduce, and results in a complete lockup. I assume I am getting an oops, but have yet to catch the output. Just wondering if anyone else is experiencing this ..

11/12/05 05:40:13 changed by Jouni Malinen <>

Most of the patches mentioned here do not look like a clean way for supporting both madwifi-ng and madwifi-old. I added support for madwifi-ng to the development branch in wpa_supplicant and the next version (0.4.7) will work with madwifi-ng without requiring any changes. You can also download the current snapshot from to get the modified version now.

11/13/05 01:44:56 changed by benoitc

  • attachment driver_madwifi.patch added.

wpa_supplicant patch to support madwifi driver

11/13/05 01:46:39 changed by

Find a patched based on cvs version to allow wpa_supplicant to be compiled with support for madwifi-ng.

11/23/05 03:00:38 changed by

Fixed with the released wpa_supplicant 0.4.7

11/23/05 03:10:12 changed by kelmo

  • status changed from new to closed.
  • resolution set to fixed.