--- old/Makefile	2005-10-28 00:28:33.000000000 -0300
+++ new/Makefile	2005-11-08 20:08:47.000000000 -0300
@@ -50,6 +50,10 @@
 CONFIG_L2_PACKET=y
 endif
 
+ifdef CONFIG_DRIVER_MADWIFI_NG
+CFLAGS += -DCONFIG_DRIVER_MADWIFI_NG
+endif
+
 ifdef CONFIG_DRIVER_PRISM54
 CFLAGS += -DCONFIG_DRIVER_PRISM54
 OBJS += driver_prism54.o
@@ -192,7 +196,7 @@
 	fi
 
 install: all
-	for i in $(ALL); do cp $$i /usr/local/bin/$$i; done
+	for i in $(ALL); do cp $$i $(PREFIX)/sbin/$$i; done
 
 hostapd: $(OBJS)
 	$(CC) -o hostapd $(OBJS) $(LIBS)
--- old/defconfig	2005-09-17 14:27:42.000000000 -0300
+++ new/defconfig	2005-11-08 20:11:30.000000000 -0300
@@ -15,8 +15,16 @@
 # Driver interface for wired authenticator
 #CONFIG_DRIVER_WIRED=y
 
-# Driver interface for madwifi driver
+# Driver interface for obsolete madwifi driver from http://sourceforge.net/projects/madwifi/
+# Must be enabled if CONFIG_DRIVER_MADWIFI_NG is used
 #CONFIG_DRIVER_MADWIFI=y
+# Driver interface for new madwifi driver from http://www.madwifi.org
+# Don't forget to enable also CONFIG_DRIVER_MADWIFI
+#CONFIG_DRIVER_MADWIFI_NG=y
+#CFLAGS += -I../head # change to reflect local setup; directory for madwifi src
+
+# Driver interface for new madwifi driver from http://www.madwifi.org
+#CONFIG_DRIVER_MADWIFI_NG=y
 #CFLAGS += -I../head # change to reflect local setup; directory for madwifi src
 
 # Driver interface for Prism54 driver
--- old/driver_madwifi.c	2005-10-21 00:45:52.000000000 -0300
+++ ndw/driver_madwifi.c	2005-11-08 18:35:27.000000000 -0300
@@ -97,27 +97,50 @@
 	}
 
 	if (ioctl(drv->ioctl_sock, op, &iwr) < 0) {
+#ifndef CONFIG_DRIVER_MADWIFI_NG
+                static const char *opnames[] = {
+                        "ioctl[IEEE80211_IOCTL_SETPARAM]",
+                        "ioctl[IEEE80211_IOCTL_GETPARAM]",
+                        "ioctl[IEEE80211_IOCTL_SETKEY]",
+                        "ioctl[SIOCIWFIRSTPRIV+3]",
+                        "ioctl[IEEE80211_IOCTL_DELKEY]",
+                        "ioctl[SIOCIWFIRSTPRIV+5]",
+                        "ioctl[IEEE80211_IOCTL_SETMLME]",
+                        "ioctl[SIOCIWFIRSTPRIV+7]",
+                        "ioctl[IEEE80211_IOCTL_SETOPTIE]",
+                        "ioctl[IEEE80211_IOCTL_GETOPTIE]",
+                        "ioctl[IEEE80211_IOCTL_ADDMAC]",
+                        "ioctl[SIOCIWFIRSTPRIV+11]",
+                        "ioctl[IEEE80211_IOCTL_DELMAC]",
+                        "ioctl[SIOCIWFIRSTPRIV+13]",
+                        "ioctl[IEEE80211_IOCTL_CHANLIST]",
+                        "ioctl[SIOCIWFIRSTPRIV+15]",
+                        "ioctl[IEEE80211_IOCTL_GETRSN]",
+                        "ioctl[SIOCIWFIRSTPRIV+17]",
+                        "ioctl[IEEE80211_IOCTL_GETKEY]",
+                };
+#else
 		static const char *opnames[] = {
 			"ioctl[IEEE80211_IOCTL_SETPARAM]",
 			"ioctl[IEEE80211_IOCTL_GETPARAM]",
 			"ioctl[IEEE80211_IOCTL_SETKEY]",
-			"ioctl[SIOCIWFIRSTPRIV+3]",
+			"ioctl[IEEE80211_IOCTL_SETWMMPARAMS]",
 			"ioctl[IEEE80211_IOCTL_DELKEY]",
-			"ioctl[SIOCIWFIRSTPRIV+5]",
+			"ioctl[IEEE80211_IOCTL_GETWMMPARAMS]",
 			"ioctl[IEEE80211_IOCTL_SETMLME]",
-			"ioctl[SIOCIWFIRSTPRIV+7]",
+			"ioctl[IEEE80211_IOCTL_GETCHANINFO]",
 			"ioctl[IEEE80211_IOCTL_SETOPTIE]",
 			"ioctl[IEEE80211_IOCTL_GETOPTIE]",
 			"ioctl[IEEE80211_IOCTL_ADDMAC]",
 			"ioctl[SIOCIWFIRSTPRIV+11]",
 			"ioctl[IEEE80211_IOCTL_DELMAC]",
-			"ioctl[SIOCIWFIRSTPRIV+13]",
-			"ioctl[IEEE80211_IOCTL_CHANLIST]",
+			"ioctl[IEEE80211_IOCTL_GETCHANLIST]",
+			"ioctl[IEEE80211_IOCTL_SETCHANLIST]",
 			"ioctl[SIOCIWFIRSTPRIV+15]",
-			"ioctl[IEEE80211_IOCTL_GETRSN]",
-			"ioctl[SIOCIWFIRSTPRIV+17]",
-			"ioctl[IEEE80211_IOCTL_GETKEY]",
+			"ioctl[IEEE80211_IOCTL_SETMODE]",
+			"ioctl[IEEE80211_IOCTL_GETMODE]",
 		};
+#endif
 		op -= SIOCIWFIRSTPRIV;
 		if (0 <= op && op < N(opnames))
 			perror(opnames[op]);
@@ -505,7 +528,11 @@
 	 */
 	memset(&stats, 0, sizeof(stats));
 	memcpy(stats.is_u.macaddr, addr, IEEE80211_ADDR_LEN);
-	if (set80211priv(drv, IEEE80211_IOCTL_GETSTASTATS, &stats,
+#ifndef CONFIG_DRIVER_MADWIFI_NG
+        if (set80211priv(drv, IEEE80211_IOCTL_GETSTASTATS, &stats,
+#else
+	if (set80211priv(drv, IEEE80211_IOCTL_STA_STATS, &stats,
+#endif
 			 sizeof(stats))) {
 		if (memcmp(addr, drv->acct_mac, ETH_ALEN) == 0) {
 			memcpy(data, &drv->acct_data, sizeof(*data));

