aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-01-23 08:28:26 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-01-23 08:28:26 +0000
commit0f6446ce4c3c2b18edbeaf671cc08027c9f70cff (patch)
tree76570bd515c1b16edfd03ecc34cba3c45baceb55
parent1fe0eac4f4c98d810007536f207ade6b4de5414d (diff)
downloadupstream-0f6446ce4c3c2b18edbeaf671cc08027c9f70cff.tar.gz
upstream-0f6446ce4c3c2b18edbeaf671cc08027c9f70cff.tar.bz2
upstream-0f6446ce4c3c2b18edbeaf671cc08027c9f70cff.zip
hostapd: add a build variant for wpa_supplicant and one for a multicall hostapd+supplicant program (wpad) and remove the old wpa_supplicant package
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19286 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/hostapd/Config.in (renamed from package/wpa_supplicant/Config.in)7
-rw-r--r--package/hostapd/Makefile192
-rw-r--r--package/hostapd/files/hostapd-full.config (renamed from package/hostapd/files/full.config)0
-rw-r--r--package/hostapd/files/hostapd-mini.config (renamed from package/hostapd/files/mini.config)0
-rw-r--r--package/hostapd/files/multicall.c28
-rw-r--r--package/hostapd/files/wpa_supplicant-full.config (renamed from package/wpa_supplicant/config)82
-rw-r--r--package/hostapd/files/wpa_supplicant-mini.config (renamed from package/wpa_supplicant/files/config.brcm-2.4)104
-rw-r--r--package/hostapd/files/wpa_supplicant.sh (renamed from package/wpa_supplicant/files/wpa_supplicant.sh)1
-rw-r--r--package/hostapd/patches/200-multicall.patch236
-rw-r--r--package/hostapd/patches/300-timestamp_check.patch (renamed from package/wpa_supplicant/patches/100-timestamp_check.patch)2
-rw-r--r--package/hostapd/patches/310-scan_ssid.patch37
-rw-r--r--package/hostapd/patches/320-rescan_immediately.patch11
-rw-r--r--package/hostapd/patches/330-madwifi_merge.patch767
-rw-r--r--package/wpa_supplicant/Makefile94
l---------package/wpa_supplicant/files/config.brcm47xx1
l---------package/wpa_supplicant/files/config.brcm63xx1
-rw-r--r--package/wpa_supplicant/patches/110-roaming.patch46
-rw-r--r--package/wpa_supplicant/patches/120-ssid_scan.patch41
-rw-r--r--package/wpa_supplicant/patches/130-scanning.patch175
-rw-r--r--package/wpa_supplicant/patches/140-quality.patch33
-rw-r--r--package/wpa_supplicant/patches/150-Remove-PS3-gelic-legacy-wpa-support.patch251
21 files changed, 1384 insertions, 725 deletions
diff --git a/package/wpa_supplicant/Config.in b/package/hostapd/Config.in
index 10b8a43a87..e185820e5b 100644
--- a/package/wpa_supplicant/Config.in
+++ b/package/hostapd/Config.in
@@ -1,14 +1,15 @@
# wpa_supplicant config
config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
bool "Disable timestamp check"
- depends PACKAGE_wpa-supplicant
+ depends PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mini || PACKAGE_wpad || PACKAGE_wpad-mini
default n
help
This disables the timestamp check for certificates in wpa_supplicant
Useful for devices without RTC that cannot reliably get the real date/time
+
choice
- prompt "Choose TLS provider"
- default WPA_SUPPLICANT_INTERNAL
+ prompt "Choose TLS provider"
+ default WPA_SUPPLICANT_INTERNAL
depends PACKAGE_wpa-supplicant
config WPA_SUPPLICANT_INTERNAL
diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile
index 682d6ab852..cb31b58644 100644
--- a/package/hostapd/Makefile
+++ b/package/hostapd/Makefile
@@ -23,6 +23,7 @@ PKG_BUILD_DEPENDS:= \
PACKAGE_kmod-mac80211:mac80211 \
PKG_CONFIG_DEPENDS:= \
+ CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
CONFIG_PACKAGE_kmod-ath9k \
CONFIG_PACKAGE_kmod-mac80211 \
CONFIG_PACKAGE_kmod-madwifi \
@@ -30,6 +31,21 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_hostapd-mini \
CONFIG_PACKAGE_kmod-hostap
+LOCAL_TYPE=$(strip \
+ $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
+ $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
+ hostapd \
+ )))
+LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
+
+ifeq ($(LOCAL_TYPE),supplicant)
+ ifeq ($(LOCAL_VARIANT),full)
+ PKG_CONFIG_DEPENDS += \
+ CONFIG_WPA_SUPPLICANT_INTERNAL \
+ CONFIG_WPA_SUPPLICANT_OPENSSL
+ endif
+endif
+
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
@@ -38,8 +54,21 @@ DRIVER_MAKEOPTS= \
CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-mac80211) \
CONFIG_DRIVER_MADWIFI=$(CONFIG_PACKAGE_kmod-madwifi) \
CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
+ CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch) \
CONFIG_IEEE80211N=$(CONFIG_PACKAGE_kmod-ath9k)
+ifeq ($(LOCAL_TYPE),supplicant)
+ ifeq ($(LOCAL_VARIANT),full)
+ DRIVER_MAKEOPTS += $(if $(CONFIG_WPA_SUPPLICANT_OPENSSL),CONFIG_TLS=openssl)
+ endif
+endif
+
+ifneq ($(LOCAL_TYPE),hostapd)
+ ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
+ TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
+ endif
+endif
+
define Package/hostapd/Default
SECTION:=net
CATEGORY:=Network
@@ -80,11 +109,79 @@ define Package/hostapd-utils/description
IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
endef
+define Package/wpad/Default
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=IEEE 802.1x Authenticator/Supplicant
+ URL:=http://hostap.epitest.fi/
+ DEPENDS:=@!TARGET_avr32 @!TARGET_etrax +PACKAGE_kmod-mac80211:libnl-tiny
+endef
+
+define Package/wpad
+$(call Package/wpad/Default)
+ TITLE+= (full)
+ VARIANT:=wpad-full
+endef
+
+define Package/wpad/description
+ This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
+ Authenticator and Supplicant
+endef
+
+define Package/wpad-mini
+$(call Package/wpad/Default)
+ TITLE+= (WPA-PSK only)
+ VARIANT:=wpad-mini
+endef
+
+define Package/wpad-mini/description
+ This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
+endef
+
+define Package/wpa-supplicant
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=WPA Supplicant
+ URL:=http://hostap.epitest.fi/wpa_supplicant/
+ VARIANT:=supplicant-full
+endef
+
+define Package/wpa-supplicant/Description
+ WPA Supplicant
+endef
+
+define Package/wpa-supplicant/config
+ source "$(SOURCE)/Config.in"
+endef
+
+define Package/wpa-supplicant-mini
+ $(Package/wpa-supplicant)
+ TITLE:=WPA Supplicant (minimal version)
+ DEPENDS:=$(if $(CONFIG_WPA_SUPPLICANT_OPENSSL),+libopenssl)
+ VARIANT:=supplicant-mini
+endef
+
+define Package/wpa-supplicant-mini/Description
+ WPA Supplicant (minimal version)
+endef
+
+define Package/wpa-cli
+ SECTION:=net
+ CATEGORY:=Network
+ DEPENDS:=wpa-supplicant
+ TITLE:=WPA Supplicant command line interface
+endef
+
+define Package/wpa-cli/Description
+ WPA Supplicant control utility
+endef
+
+
ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
- $(warning $(wildcard $(PKG_BUILD_DIR)/.config_*) != $(subst .configured_,.config_,$(STAMP_CONFIGURED)))
define Build/Configure/rebuild
- $(FIND) $(PKG_BUILD_DIR) -name \*.o | $(XARGS) rm -f
+ $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
+ rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
rm -f $(PKG_BUILD_DIR)/.config_*
touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
endef
@@ -92,7 +189,8 @@ endif
define Build/Configure
$(Build/Configure/rebuild)
- $(CP) ./files/$(BUILD_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config
+ $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config
+ $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
endef
TARGET_CPPFLAGS := \
@@ -108,30 +206,108 @@ ifdef CONFIG_PACKAGE_kmod-mac80211
TARGET_LDFLAGS += -lm -lnl-tiny
endif
-define Build/Compile
+define Build/RunMake
CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
- $(MAKE) -C $(PKG_BUILD_DIR)/hostapd \
+ $(MAKE) -C $(PKG_BUILD_DIR)/$(1) \
$(TARGET_CONFIGURE_OPTS) \
$(DRIVER_MAKEOPTS) \
LIBS="$(TARGET_LDFLAGS)" \
- hostapd hostapd_cli
+ $(2)
endef
-define Package/hostapd/install
+define Build/Compile/wpad
+ echo ` \
+ $(call Build/RunMake,hostapd,MULTICALL=1 dump_cflags); \
+ $(call Build/RunMake,wpa_supplicant,dump_cflags) | sed -e 's,$(TARGET_CFLAGS),,' \
+ ` > $(PKG_BUILD_DIR)/.cflags
+ $(call Build/RunMake,hostapd, \
+ CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
+ MULTICALL=1 \
+ hostapd_cli hostapd_multi.a \
+ )
+ $(call Build/RunMake,wpa_supplicant, \
+ CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
+ MULTICALL=1 \
+ wpa_cli wpa_supplicant_multi.a \
+ )
+ $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
+ $(TARGET_CFLAGS) \
+ ./files/multicall.c \
+ $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
+ $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
+ $(TARGET_LDFLAGS)
+endef
+
+define Build/Compile/hostapd
+ $(call Build/RunMake,hostapd, \
+ hostapd hostapd_cli \
+ )
+endef
+
+define Build/Compile/supplicant
+ $(call Build/RunMake,wpa_supplicant, \
+ wpa_cli wpa_supplicant \
+ )
+endef
+
+define Build/Compile
+ $(Build/Compile/$(LOCAL_TYPE))
+endef
+
+define Install/hostapd
$(INSTALL_DIR) $(1)/etc/hotplug.d/net
$(INSTALL_DATA) ./files/hostapd.hotplug $(1)/etc/hotplug.d/net/
$(INSTALL_DIR) $(1)/lib/wifi
$(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
$(INSTALL_DIR) $(1)/usr/sbin
+endef
+
+define Install/supplicant
+ $(INSTALL_DIR) $(1)/lib/wifi
+ $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
+ $(INSTALL_DIR) $(1)/usr/sbin
+endef
+
+define Package/hostapd/install
+ $(call Install/hostapd,$(1))
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
endef
Package/hostapd-mini/install = $(Package/hostapd/install)
-define Package/hostapd-utils/install
+ifneq ($(LOCAL_TYPE),supplicant)
+ define Package/hostapd-utils/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
+ endef
+endif
+
+define Package/wpad/install
+ $(call Install/hostapd,$(1))
+ $(call Install/supplicant,$(1))
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
+ ln -sf wpad $(1)/usr/sbin/hostapd
+ ln -sf wpad $(1)/usr/sbin/wpa_supplicant
+endef
+Package/wpad-mini/install = $(Package/wpad/install)
+
+define Package/wpa-supplicant/install
+ $(call Install/supplicant,$(1))
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
endef
+Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
+
+ifneq ($(LOCAL_VARIANT),hostapd)
+ define Package/wpa-cli/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
+ endef
+endif
$(eval $(call BuildPackage,hostapd))
$(eval $(call BuildPackage,hostapd-mini))
+$(eval $(call BuildPackage,wpad))
+$(eval $(call BuildPackage,wpad-mini))
+$(eval $(call BuildPackage,wpa-supplicant))
+$(eval $(call BuildPackage,wpa-supplicant-mini))
+$(eval $(call BuildPackage,wpa-cli))
$(eval $(call BuildPackage,hostapd-utils))
diff --git a/package/hostapd/files/full.config b/package/hostapd/files/hostapd-full.config
index 07c924fe90..07c924fe90 100644
--- a/package/hostapd/files/full.config
+++ b/package/hostapd/files/hostapd-full.config
diff --git a/package/hostapd/files/mini.config b/package/hostapd/files/hostapd-mini.config
index 1720dddbf8..1720dddbf8 100644
--- a/package/hostapd/files/mini.config
+++ b/package/hostapd/files/hostapd-mini.config
diff --git a/package/hostapd/files/multicall.c b/package/hostapd/files/multicall.c
new file mode 100644
index 0000000000..c8e814bb5c
--- /dev/null
+++ b/package/hostapd/files/multicall.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+
+extern int hostapd_main(int argc, char **argv);
+extern int wpa_supplicant_main(int argc, char **argv);
+
+int main(int argc, char **argv)
+{
+ bool restart = false;
+ const char *prog = argv[0];
+
+restart:
+ if (strstr(argv[0], "hostapd"))
+ return hostapd_main(argc, argv);
+ else if (strstr(argv[0], "wpa_supplicant"))
+ return wpa_supplicant_main(argc, argv);
+
+ if (!restart && argc > 1) {
+ argv++;
+ argc--;
+ restart = true;
+ goto restart;
+ }
+
+ fprintf(stderr, "Invalid command.\nUsage: %s wpa_supplicant|hostapd [<arguments>]\n", prog);
+ return 255;
+}
diff --git a/package/wpa_supplicant/config b/package/hostapd/files/wpa_supplicant-full.config
index 3ca1cfa655..5e7fd27d1b 100644
--- a/package/wpa_supplicant/config
+++ b/package/hostapd/files/wpa_supplicant-full.config
@@ -50,20 +50,17 @@ CONFIG_DRIVER_HOSTAP=y
#CFLAGS += -I../../include/wireless
# Driver interface for madwifi driver
-CONFIG_DRIVER_MADWIFI=y
+# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
+#CONFIG_DRIVER_MADWIFI=y
# Set include directory to the madwifi source tree
#CFLAGS += -I../../madwifi
-# Driver interface for Prism54 driver
-# (Note: Prism54 is not yet supported, i.e., this will not work as-is and is
-# for developers only)
-#CONFIG_DRIVER_PRISM54=y
-
# Driver interface for ndiswrapper
+# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
#CONFIG_DRIVER_NDISWRAPPER=y
# Driver interface for Atmel driver
-#CONFIG_DRIVER_ATMEL=y
+# CONFIG_DRIVER_ATMEL=y
# Driver interface for old Broadcom driver
# Please note that the newer Broadcom driver ("hybrid Linux driver") supports
@@ -74,6 +71,7 @@ CONFIG_DRIVER_MADWIFI=y
#CFLAGS += -I/opt/WRT54GS/release/src/include
# Driver interface for Intel ipw2100/2200 driver
+# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
#CONFIG_DRIVER_IPW=y
# Driver interface for Ralink driver
@@ -83,12 +81,14 @@ CONFIG_DRIVER_MADWIFI=y
CONFIG_DRIVER_WEXT=y
# Driver interface for Linux drivers using the nl80211 kernel interface
-#CONFIG_DRIVER_NL80211=y
+CONFIG_DRIVER_NL80211=y
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
#CONFIG_DRIVER_BSD=y
#CFLAGS += -I/usr/local/include
#LIBS += -L/usr/local/lib
+#LIBS_p += -L/usr/local/lib
+#LIBS_c += -L/usr/local/lib
# Driver interface for Windows NDIS
#CONFIG_DRIVER_NDIS=y
@@ -109,12 +109,20 @@ CONFIG_DRIVER_WEXT=y
# Driver interface for development testing
#CONFIG_DRIVER_TEST=y
+# Include client MLME (management frame processing) for test driver
+# This can be used to test MLME operations in hostapd with the test interface.
+# space.
+#CONFIG_CLIENT_MLME=y
+
# Driver interface for wired Ethernet drivers
CONFIG_DRIVER_WIRED=y
# Driver interface for the Broadcom RoboSwitch family
#CONFIG_DRIVER_ROBOSWITCH=y
+# Driver interface for no driver (e.g., WPS ER only)
+#CONFIG_DRIVER_NONE=y
+
# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
# included)
CONFIG_IEEE8021X_EAPOL=y
@@ -145,7 +153,7 @@ CONFIG_EAP_TTLS=y
CONFIG_EAP_GTC=y
# EAP-OTP
-#CONFIG_EAP_OTP=y
+CONFIG_EAP_OTP=y
# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
#CONFIG_EAP_SIM=y
@@ -192,7 +200,7 @@ CONFIG_PKCS12=y
# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
# engine.
-#CONFIG_SMARTCARD=y
+CONFIG_SMARTCARD=y
# PC/SC interface for smartcards (USIM, GSM SIM)
# Enable this if EAP-SIM or EAP-AKA is included
@@ -238,11 +246,6 @@ CONFIG_CTRL_IFACE=y
# wpa_passphrase). This saves about 0.5 kB in code size.
#CONFIG_NO_WPA_PASSPHRASE=y
-# Remove AES extra functions. This can be used to reduce code size by about
-# 1.5 kB by removing extra AES modes that are not needed for commonly used
-# client configurations (they are needed for some EAP types).
-#CONFIG_NO_AES_EXTRAS=y
-
# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
# This can be used if ap_scan=1 mode is never enabled.
#CONFIG_NO_SCAN_PROCESSING=y
@@ -259,7 +262,7 @@ CONFIG_BACKEND=file
# configuration can still be changed, the changes are just not going to be
# persistent over restarts. This option can be used to reduce code size by
# about 3.5 kB.
-CONFIG_NO_CONFIG_WRITE=y
+#CONFIG_NO_CONFIG_WRITE=y
# Remove support for configuration blobs to reduce code size by about 1.5 kB.
#CONFIG_NO_CONFIG_BLOBS=y
@@ -268,19 +271,19 @@ CONFIG_NO_CONFIG_WRITE=y
# main = UNIX/POSIX like main() function (default)
# main_winsvc = Windows service (read parameters from registry)
# main_none = Very basic example (development use only)
-CONFIG_MAIN=main
+#CONFIG_MAIN=main
# Select wrapper for operatins system and C library specific functions
# unix = UNIX/POSIX like systems (default)
# win32 = Windows systems
# none = Empty template
-CONFIG_OS=unix
+#CONFIG_OS=unix
# Select event loop implementation
# eloop = select() loop (default)
# eloop_win = Windows events and WaitForMultipleObject() loop
# eloop_none = Empty template
-CONFIG_ELOOP=eloop
+#CONFIG_ELOOP=eloop
# Select layer 2 packet implementation
# linux = Linux packet socket (default)
@@ -289,7 +292,7 @@ CONFIG_ELOOP=eloop
# winpcap = WinPcap with receive thread
# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
# none = Empty template
-CONFIG_L2_PACKET=linux
+#CONFIG_L2_PACKET=linux
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
CONFIG_PEERKEY=y
@@ -329,7 +332,7 @@ CONFIG_INTERNAL_LIBTOMMATH=y
# At the cost of about 4 kB of additional binary size, the internal LibTomMath
# can be configured to include faster routines for exptmod, sqr, and div to
# speed up DH and RSA calculation considerably
-#CONFIG_INTERNAL_LIBTOMMATH_FAST=y
+CONFIG_INTERNAL_LIBTOMMATH_FAST=y
# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
# This is only for Windows builds and requires WMI-related header files and
@@ -337,9 +340,17 @@ CONFIG_INTERNAL_LIBTOMMATH=y
#CONFIG_NDIS_EVENTS_INTEGRATED=y
#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
-# Add support for DBus control interface
+# Add support for old DBus control interface
+# (fi.epitest.hostap.WPASupplicant)
#CONFIG_CTRL_IFACE_DBUS=y
+# Add support for new DBus control interface
+# (fi.w1.hostap.wpa_supplicant1)
+#CONFIG_CTRL_IFACE_DBUS_NEW=y
+
+# Add introspection support for new DBus control interface
+#CONFIG_CTRL_IFACE_DBUS_INTRO=y
+
# Add support for loading EAP methods dynamically as shared libraries.
# When this option is enabled, each EAP method can be either included
# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
@@ -361,18 +372,11 @@ CONFIG_INTERNAL_LIBTOMMATH=y
# amount of memory/flash.
#CONFIG_DYNAMIC_EAP_METHODS=y
-# Include client MLME (management frame processing).
-# This can be used to move MLME processing of Linux mac80211 stack into user
-# space. Please note that this is currently only available with
-# driver_nl80211.c and only with a modified version of Linux kernel and
-# wpa_supplicant.
-#CONFIG_CLIENT_MLME=y
-
# IEEE Std 802.11r-2008 (Fast BSS Transition)
#CONFIG_IEEE80211R=y
# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
-CONFIG_DEBUG_FILE=y
+#CONFIG_DEBUG_FILE=y
# Enable privilege separation (see README 'Privilege separation' for details)
#CONFIG_PRIVSEP=y
@@ -380,3 +384,21 @@ CONFIG_DEBUG_FILE=y
# Enable mitigation against certain attacks against TKIP by delaying Michael
# MIC error reports by a random amount of time between 0 and 60 seconds
#CONFIG_DELAYED_MIC_ERROR_REPORT=y
+
+# Enable tracing code for developer debugging
+# This tracks use of memory allocations and other registrations and reports
+# incorrect use with a backtrace of call (or allocation) location.
+#CONFIG_WPA_TRACE=y
+# For BSD, comment out these.
+#LIBS += -lexecinfo
+#LIBS_p += -lexecinfo
+#LIBS_c += -lexecinfo
+
+# Use libbfd to get more details for developer debugging
+# This enables use of libbfd to get more detailed symbols for the backtraces
+# generated by CONFIG_WPA_TRACE=y.
+#CONFIG_WPA_TRACE_BFD=y
+# For BSD, comment out these.
+#LIBS += -lbfd -liberty -lz
+#LIBS_p += -lbfd -liberty -lz
+#LIBS_c += -lbfd -liberty -lz
diff --git a/package/wpa_supplicant/files/config.brcm-2.4 b/package/hostapd/files/wpa_supplicant-mini.config
index 0e58fa08c7..843b64a7d1 100644
--- a/package/wpa_supplicant/files/config.brcm-2.4
+++ b/package/hostapd/files/wpa_supplicant-mini.config
@@ -50,20 +50,17 @@ CONFIG_DRIVER_HOSTAP=y
#CFLAGS += -I../../include/wireless
# Driver interface for madwifi driver
-CONFIG_DRIVER_MADWIFI=y
+# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
+#CONFIG_DRIVER_MADWIFI=y
# Set include directory to the madwifi source tree
#CFLAGS += -I../../madwifi
-# Driver interface for Prism54 driver
-# (Note: Prism54 is not yet supported, i.e., this will not work as-is and is
-# for developers only)
-#CONFIG_DRIVER_PRISM54=y
-
# Driver interface for ndiswrapper
+# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
#CONFIG_DRIVER_NDISWRAPPER=y
# Driver interface for Atmel driver
-#CONFIG_DRIVER_ATMEL=y
+# CONFIG_DRIVER_ATMEL=y
# Driver interface for old Broadcom driver
# Please note that the newer Broadcom driver ("hybrid Linux driver") supports
@@ -74,6 +71,7 @@ CONFIG_DRIVER_MADWIFI=y
#CFLAGS += -I/opt/WRT54GS/release/src/include
# Driver interface for Intel ipw2100/2200 driver
+# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
#CONFIG_DRIVER_IPW=y
# Driver interface for Ralink driver
@@ -83,12 +81,14 @@ CONFIG_DRIVER_MADWIFI=y
CONFIG_DRIVER_WEXT=y
# Driver interface for Linux drivers using the nl80211 kernel interface
-#CONFIG_DRIVER_NL80211=y
+CONFIG_DRIVER_NL80211=y
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
#CONFIG_DRIVER_BSD=y
#CFLAGS += -I/usr/local/include
#LIBS += -L/usr/local/lib
+#LIBS_p += -L/usr/local/lib
+#LIBS_c += -L/usr/local/lib
# Driver interface for Windows NDIS
#CONFIG_DRIVER_NDIS=y
@@ -109,30 +109,38 @@ CONFIG_DRIVER_WEXT=y
# Driver interface for development testing
#CONFIG_DRIVER_TEST=y
+# Include client MLME (management frame processing) for test driver
+# This can be used to test MLME operations in hostapd with the test interface.
+# space.
+#CONFIG_CLIENT_MLME=y
+
# Driver interface for wired Ethernet drivers
CONFIG_DRIVER_WIRED=y
# Driver interface for the Broadcom RoboSwitch family
-CONFIG_DRIVER_ROBOSWITCH=y
+#CONFIG_DRIVER_ROBOSWITCH=y
+
+# Driver interface for no driver (e.g., WPS ER only)
+#CONFIG_DRIVER_NONE=y
# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
# included)
-CONFIG_IEEE8021X_EAPOL=y
+# CONFIG_IEEE8021X_EAPOL=y
# EAP-MD5
-CONFIG_EAP_MD5=y
+# CONFIG_EAP_MD5=y
# EAP-MSCHAPv2
-CONFIG_EAP_MSCHAPV2=y
+# CONFIG_EAP_MSCHAPV2=y
# EAP-TLS
-CONFIG_EAP_TLS=y
+# CONFIG_EAP_TLS=y
# EAL-PEAP
-CONFIG_EAP_PEAP=y
+# CONFIG_EAP_PEAP=y
# EAP-TTLS
-CONFIG_EAP_TTLS=y
+# CONFIG_EAP_TTLS=y
# EAP-FAST
# Note: Default OpenSSL package does not include support for all the
@@ -142,10 +150,10 @@ CONFIG_EAP_TTLS=y
#CONFIG_EAP_FAST=y
# EAP-GTC
-CONFIG_EAP_GTC=y
+# CONFIG_EAP_GTC=y
# EAP-OTP
-#CONFIG_EAP_OTP=y
+# CONFIG_EAP_OTP=y
# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
#CONFIG_EAP_SIM=y
@@ -157,7 +165,7 @@ CONFIG_EAP_GTC=y
#CONFIG_EAP_PAX=y
# LEAP
-CONFIG_EAP_LEAP=y
+# CONFIG_EAP_LEAP=y
# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
#CONFIG_EAP_AKA=y
@@ -188,11 +196,11 @@ CONFIG_EAP_LEAP=y
# PKCS#12 (PFX) support (used to read private key and certificate file from
# a file that usually has extension .p12 or .pfx)
-CONFIG_PKCS12=y
+# CONFIG_PKCS12=y
# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
# engine.
-#CONFIG_SMARTCARD=y
+# CONFIG_SMARTCARD=y
# PC/SC interface for smartcards (USIM, GSM SIM)
# Enable this if EAP-SIM or EAP-AKA is included
@@ -238,11 +246,6 @@ CONFIG_CTRL_IFACE=y
# wpa_passphrase). This saves about 0.5 kB in code size.
#CONFIG_NO_WPA_PASSPHRASE=y
-# Remove AES extra functions. This can be used to reduce code size by about
-# 1.5 kB by removing extra AES modes that are not needed for commonly used
-# client configurations (they are needed for some EAP types).
-#CONFIG_NO_AES_EXTRAS=y
-
# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
# This can be used if ap_scan=1 mode is never enabled.
#CONFIG_NO_SCAN_PROCESSING=y
@@ -259,7 +262,7 @@ CONFIG_BACKEND=file
# configuration can still be changed, the changes are just not going to be
# persistent over restarts. This option can be used to reduce code size by
# about 3.5 kB.
-CONFIG_NO_CONFIG_WRITE=y
+#CONFIG_NO_CONFIG_WRITE=y
# Remove support for configuration blobs to reduce code size by about 1.5 kB.
#CONFIG_NO_CONFIG_BLOBS=y
@@ -268,19 +271,19 @@ CONFIG_NO_CONFIG_WRITE=y
# main = UNIX/POSIX like main() function (default)
# main_winsvc = Windows service (read parameters from registry)
# main_none = Very basic example (development use only)
-CONFIG_MAIN=main
+#CONFIG_MAIN=main
# Select wrapper for operatins system and C library specific functions
# unix = UNIX/POSIX like systems (default)
# win32 = Windows systems
# none = Empty template
-CONFIG_OS=unix
+#CONFIG_OS=unix
# Select event loop implementation
# eloop = select() loop (default)
# eloop_win = Windows events and WaitForMultipleObject() loop
# eloop_none = Empty template
-CONFIG_ELOOP=eloop
+#CONFIG_ELOOP=eloop
# Select layer 2 packet implementation
# linux = Linux packet socket (default)
@@ -289,10 +292,10 @@ CONFIG_ELOOP=eloop
# winpcap = WinPcap with receive thread
# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
# none = Empty template
-CONFIG_L2_PACKET=linux
+#CONFIG_L2_PACKET=linux
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
-CONFIG_PEERKEY=y
+# CONFIG_PEERKEY=y
# IEEE 802.11w (management frame protection)
# This version is an experimental implementation based on IEEE 802.11w/D1.0
@@ -319,7 +322,7 @@ CONFIG_TLS=internal
# needed for LibTomMath. Alternatively, an integrated, minimal version of
# LibTomMath can be used. See beginning of libtommath.c for details on benefits
# and drawbacks of this option.
-CONFIG_INTERNAL_LIBTOMMATH=y
+#CONFIG_INTERNAL_LIBTOMMATH=y
#ifndef CONFIG_INTERNAL_LIBTOMMATH
#LTM_PATH=/usr/src/libtommath-0.39
#CFLAGS += -I$(LTM_PATH)
@@ -337,9 +340,17 @@ CONFIG_INTERNAL_LIBTOMMATH=y
#CONFIG_NDIS_EVENTS_INTEGRATED=y
#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
-# Add support for DBus control interface
+# Add support for old DBus control interface
+# (fi.epitest.hostap.WPASupplicant)
#CONFIG_CTRL_IFACE_DBUS=y
+# Add support for new DBus control interface
+# (fi.w1.hostap.wpa_supplicant1)
+#CONFIG_CTRL_IFACE_DBUS_NEW=y
+
+# Add introspection support for new DBus control interface
+#CONFIG_CTRL_IFACE_DBUS_INTRO=y
+
# Add support for loading EAP methods dynamically as shared libraries.
# When this option is enabled, each EAP method can be either included
# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
@@ -361,18 +372,11 @@ CONFIG_INTERNAL_LIBTOMMATH=y
# amount of memory/flash.
#CONFIG_DYNAMIC_EAP_METHODS=y
-# Include client MLME (management frame processing).
-# This can be used to move MLME processing of Linux mac80211 stack into user
-# space. Please note that this is currently only available with
-# driver_nl80211.c and only with a modified version of Linux kernel and
-# wpa_supplicant.
-#CONFIG_CLIENT_MLME=y
-
# IEEE Std 802.11r-2008 (Fast BSS Transition)
#CONFIG_IEEE80211R=y
# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
-CONFIG_DEBUG_FILE=y
+#CONFIG_DEBUG_FILE=y
# Enable privilege separation (see README 'Privilege separation' for details)
#CONFIG_PRIVSEP=y
@@ -380,3 +384,21 @@ CONFIG_DEBUG_FILE=y
# Enable mitigation against certain attacks against TKIP by delaying Michael
# MIC error reports by a random amount of time between 0 and 60 seconds
#CONFIG_DELAYED_MIC_ERROR_REPORT=y
+
+# Enable tracing code for developer debugging
+# This tracks use of memory allocations and other registrations and reports
+# incorrect use with a backtrace of call (or allocation) location.
+#CONFIG_WPA_TRACE=y
+# For BSD, comment out these.
+#LIBS += -lexecinfo
+#LIBS_p += -lexecinfo
+#LIBS_c += -lexecinfo
+
+# Use libbfd to get more details for developer debugging
+# This enables use of libbfd to get more detailed symbols for the backtraces
+# generated by CONFIG_WPA_TRACE=y.
+#CONFIG_WPA_TRACE_BFD=y
+# For BSD, comment out these.
+#LIBS += -lbfd -liberty -lz
+#LIBS_p += -lbfd -liberty -lz
+#LIBS_c += -lbfd -liberty -lz
diff --git a/package/wpa_supplicant/files/wpa_supplicant.sh b/package/hostapd/files/wpa_supplicant.sh
index ea10b386e1..8f7f503c1f 100644
--- a/package/wpa_supplicant/files/wpa_supplicant.sh
+++ b/package/hostapd/files/wpa_supplicant.sh
@@ -86,6 +86,7 @@ wpa_supplicant_setup_vif() {
config_get ssid "$vif" ssid
config_get bssid "$vif" bssid
bssid=${bssid:+"bssid=$bssid"}
+ rm -rf /var/run/wpa_supplicant-$ifname
cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
ctrl_interface=/var/run/wpa_supplicant-$ifname
network={
diff --git a/package/hostapd/patches/200-multicall.patch b/package/hostapd/patches/200-multicall.patch
new file mode 100644
index 0000000000..fbbba20e4c
--- /dev/null
+++ b/package/hostapd/patches/200-multicall.patch
@@ -0,0 +1,236 @@
+--- a/hostapd/Makefile
++++ b/hostapd/Makefile
+@@ -14,6 +14,7 @@ CFLAGS += -I../src/utils
+ # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
+
+ -include .config
++-include $(if $(MULTICALL), ../wpa_supplicant/.config)
+
+ ifndef CONFIG_OS
+ ifdef CONFIG_NATIVE_WINDOWS
+@@ -157,10 +158,14 @@ ifdef CONFIG_IEEE80211N
+ CFLAGS += -DCONFIG_IEEE80211N
+ endif
+
++ifndef MULTICALL
++CFLAGS += -DNO_SUPPLICANT
++endif
++
+ include ../src/drivers/drivers.mak
+-OBJS += $(DRV_AP_OBJS)
+-CFLAGS += $(DRV_AP_CFLAGS)
+-LDFLAGS += $(DRV_AP_LDFLAGS)
++OBJS += $(sort $(DRV_AP_OBJS) $(if $(MULTICALL),$(DRV_WPA_OBJS)))
++CFLAGS += $(DRV_AP_CFLAGS) $(if $(MULTICALL),$(DRV_WPA_CFLAGS))
++LDFLAGS += $(DRV_AP_LDFLAGS) $(if $(MULTICALL),$(DRV_WPA_LDFLAGS))
+ LIBS += $(DRV_AP_LIBS)
+
+ ifdef CONFIG_L2_PACKET
+@@ -738,6 +743,12 @@ install: all
+
+ BCHECK=../src/drivers/build.hostapd
+
++hostapd_multi.a: $(BCHECK) $(OBJS)
++ $(Q)$(CC) -c -o hostapd_multi.o -Dmain=hostapd_main $(CFLAGS) main.c
++ @$(E) " CC " $<
++ @rm -f $@
++ @$(AR) cr $@ hostapd_multi.o $(OBJS)
++
+ hostapd: $(BCHECK) $(OBJS)
+ $(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
+
+@@ -776,6 +787,12 @@ HOBJS += ../src/crypto/aes-internal.o
+ HOBJS += ../src/crypto/aes-internal-enc.o
+ endif
+
++dump_cflags:
++ @echo -n $(CFLAGS) " "
++
++dump_ldflags:
++ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
++
+ nt_password_hash: $(NOBJS)
+ $(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
+
+--- a/wpa_supplicant/Makefile
++++ b/wpa_supplicant/Makefile
+@@ -52,6 +52,7 @@ OBJS_p += ../src/utils/wpabuf.o
+ OBJS_c = wpa_cli.o ../src/common/wpa_ctrl.o
+
+ -include .config
++-include $(if $(MULTICALL),../hostapd/.config)
+
+ ifndef CONFIG_OS
+ ifdef CONFIG_NATIVE_WINDOWS
+@@ -579,6 +580,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
+ CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
+ LIBS += -ldl -rdynamic
+ endif
++else
++ ifdef MULTICALL
++ OBJS += ../src/eap_common/eap_common.o
++ endif
+ endif
+
+ ifdef CONFIG_AP
+@@ -631,6 +636,12 @@ CFLAGS += -DEAP_SERVER_WSC
+ OBJS += ../src/ap/wps_hostapd.o
+ OBJS += ../src/eap_server/eap_wsc.o
+ endif
++else
++ ifdef MULTICALL
++ OBJS += ../src/eap_server/eap.o
++ OBJS += ../src/eap_server/eap_identity.o
++ OBJS += ../src/eap_server/eap_methods.o
++ endif
+ endif
+
+ ifdef NEED_RSN_AUTHENTICATOR
+@@ -1260,6 +1271,12 @@ BCHECK=../src/drivers/build.wpa_supplica
+ wpa_priv: $(BCHECK) $(OBJS_priv)
+ $(LDO) $(LDFLAGS) -o wpa_priv $(OBJS_priv) $(LIBS)
+
++wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
++ $(Q)$(CC) -c -o wpa_supplicant_multi.o -Dmain=wpa_supplicant_main $(CFLAGS) main.c
++ @$(E) " CC " $<
++ @rm -f $@
++ @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
++
+ wpa_supplicant: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
+ $(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
+
+@@ -1319,6 +1336,12 @@ endif
+ $(Q)$(CC) -c -o $@ $(CFLAGS) $<
+ @$(E) " CC " $<
+
++dump_cflags:
++ @echo -n $(CFLAGS) " "
++
++dump_ldflags:
++ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
++
+ wpa_supplicant.exe: wpa_supplicant
+ mv -f $< $@
+ wpa_cli.exe: wpa_cli
+--- a/src/drivers/driver.h
++++ b/src/drivers/driver.h
+@@ -2384,8 +2384,8 @@ union wpa_event_data {
+ * Driver wrapper code should call this function whenever an event is received
+ * from the driver.
+ */
+-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
+- union wpa_event_data *data);
++extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
++ union wpa_event_data *data);
+
+
+ /*
+--- a/src/ap/drv_callbacks.c
++++ b/src/ap/drv_callbacks.c
+@@ -337,8 +337,8 @@ static void hostapd_event_eapol_rx(struc
+ }
+
+
+-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
+- union wpa_event_data *data)
++void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
++ union wpa_event_data *data)
+ {
+ struct hostapd_data *hapd = ctx;
+
+@@ -415,5 +415,6 @@ void wpa_supplicant_event(void *ctx, enu
+ break;
+ }
+ }
+-
+ #endif /* HOSTAPD */
++
++
+--- a/wpa_supplicant/wpa_priv.c
++++ b/wpa_supplicant/wpa_priv.c
+@@ -825,8 +825,8 @@ static void wpa_priv_send_ft_response(st
+ }
+
+
+-void wpa_supplicant_event(void *ctx, wpa_event_type event,
+- union wpa_event_data *data)
++static void supplicant_event(void *ctx, wpa_event_type event,
++ union wpa_event_data *data)
+ {
+ struct wpa_priv_interface *iface = ctx;
+
+@@ -968,6 +968,7 @@ int main(int argc, char *argv[])
+ if (os_program_init())
+ return -1;
+
++ wpa_supplicant_event = supplicant_event;
+ wpa_priv_fd_workaround();
+
+ for (;;) {
+--- a/wpa_supplicant/events.c
++++ b/wpa_supplicant/events.c
+@@ -1425,8 +1425,8 @@ static void wpa_supplicant_event_ibss_rs
+ #endif /* CONFIG_IBSS_RSN */
+
+
+-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
+- union wpa_event_data *data)
++void supplicant_event(void *ctx, enum wpa_event_type event,
++ union wpa_event_data *data)
+ {
+ struct wpa_supplicant *wpa_s = ctx;
+
+--- a/wpa_supplicant/wpa_supplicant.c
++++ b/wpa_supplicant/wpa_supplicant.c
+@@ -2215,6 +2215,9 @@ struct wpa_supplicant * wpa_supplicant_g
+ return NULL;
+ }
+
++extern void supplicant_event(void *ctx, enum wpa_event_type event,
++ union wpa_event_data *data);
++
+
+ /**
+ * wpa_supplicant_init - Initialize %wpa_supplicant
+@@ -2233,6 +2236,7 @@ struct wpa_global * wpa_supplicant_init(
+ if (params == NULL)
+ return NULL;
+
++ wpa_supplicant_event = supplicant_event;
+ wpa_debug_open_file(params->wpa_debug_file_path);
+ if (params->wpa_debug_syslog)
+ wpa_debug_open_syslog();
+--- a/hostapd/main.c
++++ b/hostapd/main.c
+@@ -478,6 +478,9 @@ static void usage(void)
+ exit(1);
+ }
+
++void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
++ union wpa_event_data *data);
++
+
+ int main(int argc, char *argv[])
+ {
+@@ -489,6 +492,7 @@ int main(int argc, char *argv[])
+ if (os_program_init())
+ return -1;
+
++ wpa_supplicant_event = hostapd_wpa_event;
+ for (;;) {
+ c = getopt(argc, argv, "BdhKP:tv");
+ if (c < 0)
+--- a/src/drivers/drivers.c
++++ b/src/drivers/drivers.c
+@@ -13,7 +13,11 @@
+ */
+
+ #include "includes.h"
++#include "common.h"
++#include "driver.h"
+
++void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
++ union wpa_event_data *data);
+
+ #ifdef CONFIG_DRIVER_WEXT
+ extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
diff --git a/package/wpa_supplicant/patches/100-timestamp_check.patch b/package/hostapd/patches/300-timestamp_check.patch
index 98fdbbc1be..fef63e30a4 100644
--- a/package/wpa_supplicant/patches/100-timestamp_check.patch
+++ b/package/hostapd/patches/300-timestamp_check.patch
@@ -1,6 +1,6 @@
--- a/src/tls/x509v3.c
+++ b/src/tls/x509v3.c
-@@ -1591,8 +1591,11 @@ int x509_certificate_chain_validate(stru
+@@ -1832,8 +1832,11 @@ int x509_certificate_chain_validate(stru
if (chain_trusted)
continue;
diff --git a/package/hostapd/patches/310-scan_ssid.patch b/package/hostapd/patches/310-scan_ssid.patch
new file mode 100644
index 0000000000..5a7e10f6b7
--- /dev/null
+++ b/package/hostapd/patches/310-scan_ssid.patch
@@ -0,0 +1,37 @@
+--- a/wpa_supplicant/scan.c
++++ b/wpa_supplicant/scan.c
+@@ -215,6 +215,7 @@ static void wpa_supplicant_scan(void *el
+ enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO;
+ #endif /* CONFIG_WPS */
+ struct wpa_driver_scan_params params;
++ int scan_ssid_all = 1;
+ size_t max_ssids;
+
+ if (wpa_s->disconnected && !wpa_s->scan_req) {
+@@ -275,6 +276,16 @@ static void wpa_supplicant_scan(void *el
+ wpa_s->wpa_state == WPA_INACTIVE)
+ wpa_supplicant_set_state(wpa_s, WPA_SCANNING);
+
++ /* check if all configured ssids should be scanned directly */
++ ssid = wpa_s->conf->ssid;
++ while (ssid) {
++ if (!ssid->scan_ssid) {
++ scan_ssid_all = 0;
++ break;
++ }
++ ssid = ssid->next;
++ }
++
+ /* Find the starting point from which to continue scanning */
+ ssid = wpa_s->conf->ssid;
+ if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) {
+@@ -336,6 +347,9 @@ static void wpa_supplicant_scan(void *el
+ int_array_sort_unique(params.freqs);
+ }
+
++ if (scan_ssid_all && !ssid)
++ ssid = wpa_s->conf->ssid;
++
+ if (ssid) {
+ wpa_s->prev_scan_ssid = ssid;
+ if (max_ssids > 1) {
diff --git a/package/hostapd/patches/320-rescan_immediately.patch b/package/hostapd/patches/320-rescan_immediately.patch
new file mode 100644
index 0000000000..a4020bc1dd
--- /dev/null
+++ b/package/hostapd/patches/320-rescan_immediately.patch
@@ -0,0 +1,11 @@
+--- a/wpa_supplicant/events.c
++++ b/wpa_supplicant/events.c
+@@ -843,7 +843,7 @@ static void wpa_supplicant_event_scan_re
+ wpa_printf(MSG_DEBUG, "Setup a new network");
+ wpa_supplicant_associate(wpa_s, NULL, ssid);
+ } else
+- wpa_supplicant_req_new_scan(wpa_s, 5);
++ wpa_supplicant_req_new_scan(wpa_s, 0);
+ }
+ }
+ #endif /* CONFIG_NO_SCAN_PROCESSING */
diff --git a/package/hostapd/patches/330-madwifi_merge.patch b/package/hostapd/patches/330-madwifi_merge.patch
new file mode 100644
index 0000000000..e3a89d1be6
--- /dev/null
+++ b/package/hostapd/patches/330-madwifi_merge.patch
@@ -0,0 +1,767 @@
+--- a/src/drivers/driver_madwifi.c
++++ b/src/drivers/driver_madwifi.c
+@@ -71,7 +71,6 @@
+
+ #define WPA_KEY_RSC_LEN 8
+
+-#ifdef HOSTAPD
+
+ #include "priv_netlink.h"
+ #include "netlink.h"
+@@ -82,17 +81,22 @@
+ struct madwifi_driver_data {
+ struct hostapd_data *hapd; /* back pointer */
+
+- char iface[IFNAMSIZ + 1];
++ void *wext; /* private data for driver_wext */
++ void *ctx;
++ char ifname[IFNAMSIZ + 1];
++ int ioctl_sock; /* socket for ioctl() use */
++
++#ifdef HOSTAPD
+ int ifindex;
+ struct l2_packet_data *sock_xmit; /* raw packet xmit socket */
+ struct l2_packet_data *sock_recv; /* raw packet recv socket */
+- int ioctl_sock; /* socket for ioctl() use */
+ struct netlink_data *netlink;
+ int we_version;
+ u8 acct_mac[ETH_ALEN];
+ struct hostap_sta_driver_data acct_data;
+
+ struct l2_packet_data *sock_raw; /* raw 802.11 management frames */
++#endif
+ };
+
+ static int madwifi_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
+@@ -105,7 +109,7 @@ set80211priv(struct madwifi_driver_data
+ int do_inline = len < IFNAMSIZ;
+
+ memset(&iwr, 0, sizeof(iwr));
+- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
+ #ifdef IEEE80211_IOCTL_FILTERFRAME
+ /* FILTERFRAME must be NOT inline, regardless of size. */
+ if (op == IEEE80211_IOCTL_FILTERFRAME)
+@@ -206,7 +210,7 @@ set80211param(struct madwifi_driver_data
+ struct iwreq iwr;
+
+ memset(&iwr, 0, sizeof(iwr));
+- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
+ iwr.u.mode = op;
+ memcpy(iwr.u.name+sizeof(__u32), &arg, sizeof(arg));
+
+@@ -233,6 +237,7 @@ ether_sprintf(const u8 *addr)
+ }
+ #endif /* CONFIG_NO_STDOUT_DEBUG */
+
++#ifdef HOSTAPD
+ /*
+ * Configure WPA parameters.
+ */
+@@ -395,7 +400,7 @@ madwifi_sta_set_flags(void *priv, const
+ return madwifi_set_sta_authorized(priv, addr, 0);
+ return 0;
+ }
+-
++#endif /* HOSTAPD */
+ static int
+ madwifi_del_key(void *priv, const u8 *addr, int key_idx)
+ {
+@@ -407,28 +412,20 @@ madwifi_del_key(void *priv, const u8 *ad
+ __func__, ether_sprintf(addr), key_idx);
+
+ memset(&wk, 0, sizeof(wk));
++ wk.idk_keyix = key_idx;
+ if (addr != NULL) {
+ memcpy(wk.idk_macaddr, addr, IEEE80211_ADDR_LEN);
+- wk.idk_keyix = (u8) IEEE80211_KEYIX_NONE;
+- } else {
+- wk.idk_keyix = key_idx;
+- }
+-
+- ret = set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk));
+- if (ret < 0) {
+- wpa_printf(MSG_DEBUG, "%s: Failed to delete key (addr %s"
+- " key_idx %d)", __func__, ether_sprintf(addr),
+- key_idx);
+ }
+
+- return ret;
++ set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk));
++ return 0;
+ }
+
+ static int
+-wpa_driver_madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg,
+- const u8 *addr, int key_idx, int set_tx,
+- const u8 *seq, size_t seq_len,
+- const u8 *key, size_t key_len)
++madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg,
++ const u8 *addr, int key_idx, int set_tx,
++ const u8 *seq, size_t seq_len,
++ const u8 *key, size_t key_len)
+ {
+ struct madwifi_driver_data *drv = priv;
+ struct ieee80211req_key wk;
+@@ -462,10 +459,14 @@ wpa_driver_madwifi_set_key(const char *i
+ memset(&wk, 0, sizeof(wk));
+ wk.ik_type = cipher;
+ wk.ik_flags = IEEE80211_KEY_RECV | IEEE80211_KEY_XMIT;
++
+ if (addr == NULL) {
+ memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
+ wk.ik_keyix = key_idx;
+ wk.ik_flags |= IEEE80211_KEY_DEFAULT;
++ } else if (!memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN)) {
++ wk.ik_flags |= IEEE80211_KEY_GROUP;
++ memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
+ } else {
+ memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
+ wk.ik_keyix = IEEE80211_KEYIX_NONE;
+@@ -485,6 +486,7 @@ wpa_driver_madwifi_set_key(const char *i
+ }
+
+
++#ifdef HOSTAPD
+ static int
+ madwifi_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx,
+ u8 *seq)
+@@ -591,7 +593,7 @@ madwifi_read_sta_driver_data(void *priv,
+
+ memset(data, 0, sizeof(*data));
+ snprintf(buf, sizeof(buf), "/proc/net/madwifi/%s/" MACSTR,
+- drv->iface, MAC2STR(addr));
++ drv->ifname, MAC2STR(addr));
+
+ f = fopen(buf, "r");
+ if (!f) {
+@@ -757,7 +759,7 @@ static int madwifi_receive_probe_req(str
+ if (ret)
+ return ret;
+
+- drv->sock_raw = l2_packet_init(drv->iface, NULL, ETH_P_80211_RAW,
++ drv->sock_raw = l2_packet_init(drv->ifname, NULL, ETH_P_80211_RAW,
+ madwifi_raw_receive, drv, 1);
+ if (drv->sock_raw == NULL)
+ return -1;
+@@ -1017,7 +1019,7 @@ madwifi_get_we_version(struct madwifi_dr
+ return -1;
+
+ memset(&iwr, 0, sizeof(iwr));
+- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
+ iwr.u.data.pointer = (caddr_t) range;
+ iwr.u.data.length = buflen;
+
+@@ -1134,17 +1136,17 @@ madwifi_init(struct hostapd_data *hapd,
+ perror("socket[PF_INET,SOCK_DGRAM]");
+ goto bad;
+ }
+- memcpy(drv->iface, params->ifname, sizeof(drv->iface));
++ memcpy(drv->ifname, params->ifname, sizeof(drv->ifname));
+
+ memset(&ifr, 0, sizeof(ifr));
+- os_strlcpy(ifr.ifr_name, drv->iface, sizeof(ifr.ifr_name));
++ os_strlcpy(ifr.ifr_name, drv->ifname, sizeof(ifr.ifr_name));
+ if (ioctl(drv->ioctl_sock, SIOCGIFINDEX, &ifr) != 0) {
+ perror("ioctl(SIOCGIFINDEX)");
+ goto bad;
+ }
+ drv->ifindex = ifr.ifr_ifindex;
+
+- drv->sock_xmit = l2_packet_init(drv->iface, NULL, ETH_P_EAPOL,
++ drv->sock_xmit = l2_packet_init(drv->ifname, NULL, ETH_P_EAPOL,
+ handle_read, drv, 1);
+ if (drv->sock_xmit == NULL)
+ goto bad;
+@@ -1158,7 +1160,7 @@ madwifi_init(struct hostapd_data *hapd,
+ 1);
+ if (drv->sock_recv == NULL)
+ goto bad;
+- } else if (linux_br_get(brname, drv->iface) == 0) {
++ } else if (linux_br_get(brname, drv->ifname) == 0) {
+ wpa_printf(MSG_DEBUG, "Interface in bridge %s; configure for "
+ "EAPOL receive", brname);
+ drv->sock_recv = l2_packet_init(brname, NULL, ETH_P_EAPOL,
+@@ -1169,7 +1171,7 @@ madwifi_init(struct hostapd_data *hapd,
+ drv->sock_recv = drv->sock_xmit;
+
+ memset(&iwr, 0, sizeof(iwr));
+- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
+
+ iwr.u.mode = IW_MODE_MASTER;
+
+@@ -1179,7 +1181,7 @@ madwifi_init(struct hostapd_data *hapd,
+ goto bad;
+ }
+
+- madwifi_set_privacy(drv->iface, drv, 0); /* default to no privacy */
++ madwifi_set_privacy(drv->ifname, drv, 0); /* default to no privacy */
+
+ madwifi_receive_probe_req(drv);
+
+@@ -1204,7 +1206,7 @@ madwifi_deinit(void *priv)
+ struct madwifi_driver_data *drv = priv;
+
+ netlink_deinit(drv->netlink);
+- (void) linux_set_iface_flags(drv->ioctl_sock, drv->iface, 0);
++ (void) linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 0);
+ if (drv->ioctl_sock >= 0)
+ close(drv->ioctl_sock);
+ if (drv->sock_recv != NULL && drv->sock_recv != drv->sock_xmit)
+@@ -1223,7 +1225,7 @@ madwifi_set_ssid(const char *ifname, voi
+ struct iwreq iwr;
+
+ memset(&iwr, 0, sizeof(iwr));
+- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
+ iwr.u.essid.flags = 1; /* SSID active */
+ iwr.u.essid.pointer = (caddr_t) buf;
+ iwr.u.essid.length = len + 1;
+@@ -1244,7 +1246,7 @@ madwifi_get_ssid(const char *ifname, voi
+ int ret = 0;
+
+ memset(&iwr, 0, sizeof(iwr));
+- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
+ iwr.u.essid.pointer = (caddr_t) buf;
+ iwr.u.essid.length = len;
+
+@@ -1271,137 +1273,16 @@ madwifi_commit(void *priv)
+ return 0;
+ }
+
+-#else /* HOSTAPD */
++#endif /* HOSTAPD */
+
+-struct wpa_driver_madwifi_data {
+- void *wext; /* private data for driver_wext */
+- void *ctx;
+- char ifname[IFNAMSIZ + 1];
+- int sock;
+-};
++#if !defined(NO_SUPPLICANT)
+
+ static int wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg);
+ static int wpa_driver_madwifi_set_probe_req_ie(void *priv, const u8 *ies,
+ size_t ies_len);
+
+-
+-static int
+-set80211priv(struct wpa_driver_madwifi_data *drv, int op, void *data, int len,
+- int show_err)
+-{
+- struct iwreq iwr;
+-
+- os_memset(&iwr, 0, sizeof(iwr));
+- os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
+- if (len < IFNAMSIZ &&
+- op != IEEE80211_IOCTL_SET_APPIEBUF) {
+- /*
+- * Argument data fits inline; put it there.
+- */
+- os_memcpy(iwr.u.name, data, len);
+- } else {
+- /*
+- * Argument data too big for inline transfer; setup a
+- * parameter block instead; the kernel will transfer
+- * the data for the driver.
+- */
+- iwr.u.data.pointer = data;
+- iwr.u.data.length = len;
+- }
+-
+- if (ioctl(drv->sock, op, &iwr) < 0) {
+- if (show_err) {
+-#ifdef MADWIFI_NG
+- int first = IEEE80211_IOCTL_SETPARAM;
+- int last = IEEE80211_IOCTL_KICKMAC;
+- static const char *opnames[] = {
+- "ioctl[IEEE80211_IOCTL_SETPARAM]",
+- "ioctl[IEEE80211_IOCTL_GETPARAM]",
+- "ioctl[IEEE80211_IOCTL_SETMODE]",
+- "ioctl[IEEE80211_IOCTL_GETMODE]",
+- "ioctl[IEEE80211_IOCTL_SETWMMPARAMS]",
+- "ioctl[IEEE80211_IOCTL_GETWMMPARAMS]",
+- "ioctl[IEEE80211_IOCTL_SETCHANLIST]",
+- "ioctl[IEEE80211_IOCTL_GETCHANLIST]",
+- "ioctl[IEEE80211_IOCTL_CHANSWITCH]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_SET_APPIEBUF]",
+- "ioctl[IEEE80211_IOCTL_GETSCANRESULTS]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_GETCHANINFO]",
+- "ioctl[IEEE80211_IOCTL_SETOPTIE]",
+- "ioctl[IEEE80211_IOCTL_GETOPTIE]",
+- "ioctl[IEEE80211_IOCTL_SETMLME]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_SETKEY]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_DELKEY]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_ADDMAC]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_DELMAC]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_WDSMAC]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_WDSDELMAC]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_KICKMAC]",
+- };
+-#else /* MADWIFI_NG */
+- int first = IEEE80211_IOCTL_SETPARAM;
+- int last = IEEE80211_IOCTL_CHANLIST;
+- static const char *opnames[] = {
+- "ioctl[IEEE80211_IOCTL_SETPARAM]",
+- "ioctl[IEEE80211_IOCTL_GETPARAM]",
+- "ioctl[IEEE80211_IOCTL_SETKEY]",
+- "ioctl[IEEE80211_IOCTL_GETKEY]",
+- "ioctl[IEEE80211_IOCTL_DELKEY]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_SETMLME]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_SETOPTIE]",
+- "ioctl[IEEE80211_IOCTL_GETOPTIE]",
+- "ioctl[IEEE80211_IOCTL_ADDMAC]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_DELMAC]",
+- NULL,
+- "ioctl[IEEE80211_IOCTL_CHANLIST]",
+- };
+-#endif /* MADWIFI_NG */
+- int idx = op - first;
+- if (first <= op && op <= last &&
+- idx < (int) (sizeof(opnames) / sizeof(opnames[0]))
+- && opnames[idx])
+- perror(opnames[idx]);
+- else
+- perror("ioctl[unknown???]");
+- }
+- return -1;
+- }
+- return 0;
+-}
+-
+ static int
+-set80211param(struct wpa_driver_madwifi_data *drv, int op, int arg,
+- int show_err)
+-{
+- struct iwreq iwr;
+-
+- os_memset(&iwr, 0, sizeof(iwr));
+- os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
+- iwr.u.mode = op;
+- os_memcpy(iwr.u.name+sizeof(u32), &arg, sizeof(arg));
+-
+- if (ioctl(drv->sock, IEEE80211_IOCTL_SETPARAM, &iwr) < 0) {
+- if (show_err)
+- perror("ioctl[IEEE80211_IOCTL_SETPARAM]");
+- return -1;
+- }
+- return 0;
+-}
+-
+-static int
+-wpa_driver_madwifi_set_wpa_ie(struct wpa_driver_madwifi_data *drv,
++wpa_driver_madwifi_set_wpa_ie(struct madwifi_driver_data *drv,
+ const u8 *wpa_ie, size_t wpa_ie_len)
+ {
+ struct iwreq iwr;
+@@ -1412,7 +1293,7 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa
+ iwr.u.data.pointer = (void *) wpa_ie;
+ iwr.u.data.length = wpa_ie_len;
+
+- if (ioctl(drv->sock, IEEE80211_IOCTL_SETOPTIE, &iwr) < 0) {
++ if (ioctl(drv->ioctl_sock, IEEE80211_IOCTL_SETOPTIE, &iwr) < 0) {
+ perror("ioctl[IEEE80211_IOCTL_SETOPTIE]");
+ return -1;
+ }
+@@ -1420,156 +1301,51 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa
+ }
+
+ static int
+-wpa_driver_madwifi_del_key(struct wpa_driver_madwifi_data *drv, int key_idx,
+- const u8 *addr)
+-{
+- struct ieee80211req_del_key wk;
+-
+- wpa_printf(MSG_DEBUG, "%s: keyidx=%d", __FUNCTION__, key_idx);
+- os_memset(&wk, 0, sizeof(wk));
+- wk.idk_keyix = key_idx;
+- if (addr != NULL)
+- os_memcpy(wk.idk_macaddr, addr, IEEE80211_ADDR_LEN);
+-
+- return set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk), 1);
+-}
+-
+-static int
+-wpa_driver_madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg,
+- const u8 *addr, int key_idx, int set_tx,
+- const u8 *seq, size_t seq_len,
+- const u8 *key, size_t key_len)
+-{
+- struct wpa_driver_madwifi_data *drv = priv;
+- struct ieee80211req_key wk;
+- char *alg_name;
+- u_int8_t cipher;
+-
+- if (alg == WPA_ALG_NONE)
+- return wpa_driver_madwifi_del_key(drv, key_idx, addr);
+-
+- switch (alg) {
+- case WPA_ALG_WEP:
+- if (addr == NULL || os_memcmp(addr, "\xff\xff\xff\xff\xff\xff",
+- ETH_ALEN) == 0) {
+- /*
+- * madwifi did not seem to like static WEP key
+- * configuration with IEEE80211_IOCTL_SETKEY, so use
+- * Linux wireless extensions ioctl for this.
+- */
+- return wpa_driver_wext_set_key(ifname, drv->wext, alg,
+- addr, key_idx, set_tx,
+- seq, seq_len,
+- key, key_len);
+- }
+- alg_name = "WEP";
+- cipher = IEEE80211_CIPHER_WEP;
+- break;
+- case WPA_ALG_TKIP:
+- alg_name = "TKIP";
+- cipher = IEEE80211_CIPHER_TKIP;
+- break;
+- case WPA_ALG_CCMP:
+- alg_name = "CCMP";
+- cipher = IEEE80211_CIPHER_AES_CCM;
+- break;
+- default:
+- wpa_printf(MSG_DEBUG, "%s: unknown/unsupported algorithm %d",
+- __FUNCTION__, alg);
+- return -1;
+- }
+-
+- wpa_printf(MSG_DEBUG, "%s: alg=%s key_idx=%d set_tx=%d seq_len=%lu "
+- "key_len=%lu", __FUNCTION__, alg_name, key_idx, set_tx,
+- (unsigned long) seq_len, (unsigned long) key_len);
+-
+- if (seq_len > sizeof(u_int64_t)) {
+- wpa_printf(MSG_DEBUG, "%s: seq_len %lu too big",
+- __FUNCTION__, (unsigned long) seq_len);
+- return -2;
+- }
+- if (key_len > sizeof(wk.ik_keydata)) {
+- wpa_printf(MSG_DEBUG, "%s: key length %lu too big",
+- __FUNCTION__, (unsigned long) key_len);
+- return -3;
+- }
+-
+- os_memset(&wk, 0, sizeof(wk));
+- wk.ik_type = cipher;
+- wk.ik_flags = IEEE80211_KEY_RECV;
+- if (addr == NULL ||
+- os_memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) == 0)
+- wk.ik_flags |= IEEE80211_KEY_GROUP;
+- if (set_tx) {
+- wk.ik_flags |= IEEE80211_KEY_XMIT | IEEE80211_KEY_DEFAULT;
+- os_memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
+- } else
+- os_memset(wk.ik_macaddr, 0, IEEE80211_ADDR_LEN);
+- wk.ik_keyix = key_idx;
+- wk.ik_keylen = key_len;
+-#ifdef WORDS_BIGENDIAN
+- {
+- size_t i;
+- u8 tmp[WPA_KEY_RSC_LEN];
+- os_memset(tmp, 0, sizeof(tmp));
+- for (i = 0; i < seq_len; i++)
+- tmp[WPA_KEY_RSC_LEN - i - 1] = seq[i];
+- os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN);
+- }
+-#else /* WORDS_BIGENDIAN */
+- os_memcpy(&wk.ik_keyrsc, seq, seq_len);
+-#endif /* WORDS_BIGENDIAN */
+- os_memcpy(wk.ik_keydata, key, key_len);
+-
+- return set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk), 1);
+-}
+-
+-static int
+ wpa_driver_madwifi_set_countermeasures(void *priv, int enabled)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+ wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled);
+- return set80211param(drv, IEEE80211_PARAM_COUNTERMEASURES, enabled, 1);
++ return set80211param(drv, IEEE80211_PARAM_COUNTERMEASURES, enabled);
+ }
+
+ static int
+ wpa_driver_madwifi_deauthenticate(void *priv, const u8 *addr, int reason_code)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+ struct ieee80211req_mlme mlme;
+
+ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
+ mlme.im_op = IEEE80211_MLME_DEAUTH;
+ mlme.im_reason = reason_code;
+ os_memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN);
+- return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme), 1);
++ return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme));
+ }
+
+ static int
+ wpa_driver_madwifi_disassociate(void *priv, const u8 *addr, int reason_code)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+ struct ieee80211req_mlme mlme;
+
+ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
+ mlme.im_op = IEEE80211_MLME_DISASSOC;
+ mlme.im_reason = reason_code;
+ os_memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN);
+- return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme), 1);
++ return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme));
+ }
+
+ static int
+ wpa_driver_madwifi_associate(void *priv,
+ struct wpa_driver_associate_params *params)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+ struct ieee80211req_mlme mlme;
+ int ret = 0, privacy = 1;
+
+ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
+
+ if (set80211param(drv, IEEE80211_PARAM_DROPUNENCRYPTED,
+- params->drop_unencrypted, 1) < 0)
++ params->drop_unencrypted) < 0)
+ ret = -1;
+ if (wpa_driver_madwifi_set_auth_alg(drv, params->auth_alg) < 0)
+ ret = -1;
+@@ -1592,12 +1368,12 @@ wpa_driver_madwifi_associate(void *priv,
+ params->wpa_ie_len == 0)
+ privacy = 0;
+
+- if (set80211param(drv, IEEE80211_PARAM_PRIVACY, privacy, 1) < 0)
++ if (set80211param(drv, IEEE80211_PARAM_PRIVACY, privacy) < 0)
+ ret = -1;
+
+ if (params->wpa_ie_len &&
+ set80211param(drv, IEEE80211_PARAM_WPA,
+- params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1, 1) < 0)
++ params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0)
+ ret = -1;
+
+ if (params->bssid == NULL) {
+@@ -1605,14 +1381,14 @@ wpa_driver_madwifi_associate(void *priv,
+ * roaming */
+ /* FIX: this does not seem to work; would probably need to
+ * change something in the driver */
+- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0, 1) < 0)
++ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0) < 0)
+ ret = -1;
+
+ if (wpa_driver_wext_set_ssid(drv->wext, params->ssid,
+ params->ssid_len) < 0)
+ ret = -1;
+ } else {
+- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2, 1) < 0)
++ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2) < 0)
+ ret = -1;
+ if (wpa_driver_wext_set_ssid(drv->wext, params->ssid,
+ params->ssid_len) < 0)
+@@ -1621,7 +1397,7 @@ wpa_driver_madwifi_associate(void *priv,
+ mlme.im_op = IEEE80211_MLME_ASSOC;
+ os_memcpy(mlme.im_macaddr, params->bssid, IEEE80211_ADDR_LEN);
+ if (set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme,
+- sizeof(mlme), 1) < 0) {
++ sizeof(mlme)) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: SETMLME[ASSOC] failed",
+ __func__);
+ ret = -1;
+@@ -1634,7 +1410,7 @@ wpa_driver_madwifi_associate(void *priv,
+ static int
+ wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+ int authmode;
+
+ if ((auth_alg & WPA_AUTH_ALG_OPEN) &&
+@@ -1645,13 +1421,13 @@ wpa_driver_madwifi_set_auth_alg(void *pr
+ else
+ authmode = IEEE80211_AUTH_OPEN;
+
+- return set80211param(drv, IEEE80211_PARAM_AUTHMODE, authmode, 1);
++ return set80211param(drv, IEEE80211_PARAM_AUTHMODE, authmode);
+ }
+
+ static int
+ wpa_driver_madwifi_scan(void *priv, struct wpa_driver_scan_params *params)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+ struct iwreq iwr;
+ int ret = 0;
+ const u8 *ssid = params->ssids[0].ssid;
+@@ -1669,7 +1445,7 @@ wpa_driver_madwifi_scan(void *priv, stru
+ if (wpa_driver_wext_set_ssid(drv->wext, ssid, ssid_len) < 0)
+ ret = -1;
+
+- if (ioctl(drv->sock, SIOCSIWSCAN, &iwr) < 0) {
++ if (ioctl(drv->ioctl_sock, SIOCSIWSCAN, &iwr) < 0) {
+ perror("ioctl[SIOCSIWSCAN]");
+ ret = -1;
+ }
+@@ -1691,14 +1467,14 @@ wpa_driver_madwifi_scan(void *priv, stru
+
+ static int wpa_driver_madwifi_get_bssid(void *priv, u8 *bssid)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+ return wpa_driver_wext_get_bssid(drv->wext, bssid);
+ }
+
+
+ static int wpa_driver_madwifi_get_ssid(void *priv, u8 *ssid)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+ return wpa_driver_wext_get_ssid(drv->wext, ssid);
+ }
+
+@@ -1706,14 +1482,14 @@ static int wpa_driver_madwifi_get_ssid(v
+ static struct wpa_scan_results *
+ wpa_driver_madwifi_get_scan_results(void *priv)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+ return wpa_driver_wext_get_scan_results(drv->wext);
+ }
+
+
+ static int wpa_driver_madwifi_set_operstate(void *priv, int state)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+ return wpa_driver_wext_set_operstate(drv->wext, state);
+ }
+
+@@ -1734,7 +1510,7 @@ static int wpa_driver_madwifi_set_probe_
+
+ ret = set80211priv(priv, IEEE80211_IOCTL_SET_APPIEBUF, probe_req_ie,
+ sizeof(struct ieee80211req_getset_appiebuf) +
+- ies_len, 1);
++ ies_len);
+
+ os_free(probe_req_ie);
+
+@@ -1744,7 +1520,7 @@ static int wpa_driver_madwifi_set_probe_
+
+ static void * wpa_driver_madwifi_init(void *ctx, const char *ifname)
+ {
+- struct wpa_driver_madwifi_data *drv;
++ struct madwifi_driver_data *drv;
+
+ drv = os_zalloc(sizeof(*drv));
+ if (drv == NULL)
+@@ -1755,17 +1531,17 @@ static void * wpa_driver_madwifi_init(vo
+
+ drv->ctx = ctx;
+ os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));
+- drv->sock = socket(PF_INET, SOCK_DGRAM, 0);
+- if (drv->sock < 0)
++ drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
++ if (drv->ioctl_sock < 0)
+ goto fail2;
+
+- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2, 1) < 0) {
++ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: failed to set wpa_supplicant-based "
+ "roaming", __FUNCTION__);
+ goto fail3;
+ }
+
+- if (set80211param(drv, IEEE80211_PARAM_WPA, 3, 1) < 0) {
++ if (set80211param(drv, IEEE80211_PARAM_WPA, 3) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: failed to enable WPA support",
+ __FUNCTION__);
+ goto fail3;
+@@ -1774,7 +1550,7 @@ static void * wpa_driver_madwifi_init(vo
+ return drv;
+
+ fail3:
+- close(drv->sock);
++ close(drv->ioctl_sock);
+ fail2:
+ wpa_driver_wext_deinit(drv->wext);
+ fail:
+@@ -1785,38 +1561,37 @@ fail:
+
+ static void wpa_driver_madwifi_deinit(void *priv)
+ {
+- struct wpa_driver_madwifi_data *drv = priv;
++ struct madwifi_driver_data *drv = priv;
+
+ if (wpa_driver_madwifi_set_wpa_ie(drv, NULL, 0) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: failed to clear WPA IE",
+ __FUNCTION__);
+ }
+- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0, 1) < 0) {
++ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: failed to enable driver-based "
+ "roaming", __FUNCTION__);
+ }
+- if (set80211param(drv, IEEE80211_PARAM_PRIVACY, 0, 1) < 0) {
++ if (set80211param(drv, IEEE80211_PARAM_PRIVACY, 0) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: failed to disable forced Privacy "
+ "flag", __FUNCTION__);
+ }
+- if (set80211param(drv, IEEE80211_PARAM_WPA, 0, 1) < 0) {
++ if (set80211param(drv, IEEE80211_PARAM_WPA, 0) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: failed to disable WPA",
+ __FUNCTION__);
+ }
+
+ wpa_driver_wext_deinit(drv->wext);
+
+- close(drv->sock);
++ close(drv->ioctl_sock);
+ os_free(drv);
+ }
+
+-#endif /* HOSTAPD */
+-
++#endif
+
+ const struct wpa_driver_ops wpa_driver_madwifi_ops = {
+ .name = "madwifi",
+ .desc = "MADWIFI 802.11 support (Atheros, etc.)",
+- .set_key = wpa_driver_madwifi_set_key,
++ .set_key = madwifi_set_key,
+ #ifdef HOSTAPD
+ .hapd_init = madwifi_init,
+ .hapd_deinit = madwifi_deinit,
+@@ -1836,7 +1611,8 @@ const struct wpa_driver_ops wpa_driver_m
+ .sta_clear_stats = madwifi_sta_clear_stats,
+ .commit = madwifi_commit,
+ .set_ap_wps_ie = madwifi_set_ap_wps_ie,
+-#else /* HOSTAPD */
++#endif /* HOSTAPD */
++#if !defined(NO_SUPPLICANT)
+ .get_bssid = wpa_driver_madwifi_get_bssid,
+ .get_ssid = wpa_driver_madwifi_get_ssid,
+ .init = wpa_driver_madwifi_init,
+@@ -1848,5 +1624,5 @@ const struct wpa_driver_ops wpa_driver_m
+ .disassociate = wpa_driver_madwifi_disassociate,
+ .associate = wpa_driver_madwifi_associate,
+ .set_operstate = wpa_driver_madwifi_set_operstate,
+-#endif /* HOSTAPD */
++#endif
+ };
diff --git a/package/wpa_supplicant/Makefile b/package/wpa_supplicant/Makefile
deleted file mode 100644
index 39c66e72b9..0000000000
--- a/package/wpa_supplicant/Makefile
+++ /dev/null
@@ -1,94 +0,0 @@
-#
-# Copyright (C) 2008-2009 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=wpa_supplicant
-PKG_VERSION:=0.6.9
-PKG_RELEASE:=2
-PKG_MD5SUM:=0efb8fcedf0a8acf6f423dfdb0658fdd
-
-PKG_SOURCE_URL:=http://hostap.epitest.fi/releases
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-
-PKG_BUILD_DEPENDS:= \
- PACKAGE_kmod-madwifi:madwifi \
-
-PKG_CONFIG_DEPENDS:= \
- CONFIG_PACKAGE_kmod-madwifi \
- CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/wpa-supplicant
- SECTION:=net
- CATEGORY:=Network
- TITLE:=WPA Supplicant
- DEPENDS:=$(if $(CONFIG_WPA_SUPPLICANT_OPENSSL),+libopenssl)
- URL:=http://hostap.epitest.fi/wpa_supplicant/
-endef
-
-define Package/wpa-supplicant/Description
- WPA Supplicant
-endef
-
-define Package/wpa-supplicant/config
- source "$(SOURCE)/Config.in"
-endef
-
-define Package/wpa-cli
- SECTION:=net
- CATEGORY:=Network
- DEPENDS:=wpa-supplicant
- TITLE:=WPA Supplicant command line interface
-endef
-
-define Package/wpa-cli/Description
- WPA Supplicant control utility
-endef
-
-CONFIG=$(firstword $(wildcard ./files/config.$(BOARD) ./files/config.$(ARCH) ./config))
-TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/madwifi $(if $(CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK),-DNO_TIMESTAMP_CHECK)
-
-define Build/Configure
- cp $(CONFIG) $(PKG_BUILD_DIR)/wpa_supplicant/.config
- [ -f $(STAMP_CONFIGURED) ] || $(MAKE) -C $(PKG_BUILD_DIR)/wpa_supplicant clean
- rm -f $(PKG_BUILD_DIR)/.configured*
- $(if $(CONFIG_PACKAGE_kmod-madwifi),,$(SED) 's,^CONFIG_DRIVER_MADWIFI,#CONFIG_DRIVER_MADWIFI,g' $(PKG_BUILD_DIR)/wpa_supplicant/.config)
- $(if $(CONFIG_PACKAGE_kmod-hostap),,$(SED) 's,^CONFIG_DRIVER_HOSTAP,#CONFIG_DRIVER_HOSTAP,g' $(PKG_BUILD_DIR)/wpa_supplicant/.config)
- $(if $(CONFIG_WPA_SUPPLICANT_OPENSSL),$(SED) 's|^CONFIG_TLS.*|CONFIG_TLS=openssl|g' $(PKG_BUILD_DIR)/wpa_supplicant/.config)
-endef
-
-define Build/Compile
- rm -rf $(PKG_INSTALL_DIR)
- mkdir -p $(PKG_INSTALL_DIR)
- CFLAGS="$(TARGET_CFLAGS)" \
- $(MAKE) -C $(PKG_BUILD_DIR)/wpa_supplicant \
- CC="$(TARGET_CC)" \
- KERNEL=$(LINUX_DIR) \
- CPPFLAGS="$(TARGET_CPPFLAGS)" \
- LDFLAGS="$(TARGET_LDFLAGS)" \
- all
-endef
-
-define Package/wpa-supplicant/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(CP) \
- $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant \
- $(PKG_BUILD_DIR)/wpa_supplicant/wpa_passphrase \
- $(1)/usr/sbin/
- $(INSTALL_DIR) $(1)/lib/wifi
- $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
-endef
-
-define Package/wpa-cli/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,wpa-supplicant))
-$(eval $(call BuildPackage,wpa-cli))
diff --git a/package/wpa_supplicant/files/config.brcm47xx b/package/wpa_supplicant/files/config.brcm47xx
deleted file mode 120000
index c3fbf345ca..0000000000
--- a/package/wpa_supplicant/files/config.brcm47xx
+++ /dev/null
@@ -1 +0,0 @@
-config.brcm-2.4 \ No newline at end of file
diff --git a/package/wpa_supplicant/files/config.brcm63xx b/package/wpa_supplicant/files/config.brcm63xx
deleted file mode 120000
index c3fbf345ca..0000000000
--- a/package/wpa_supplicant/files/config.brcm63xx
+++ /dev/null
@@ -1 +0,0 @@
-config.brcm-2.4 \ No newline at end of file
diff --git a/package/wpa_supplicant/patches/110-roaming.patch b/package/wpa_supplicant/patches/110-roaming.patch
deleted file mode 100644
index 077c2e56b3..0000000000
--- a/package/wpa_supplicant/patches/110-roaming.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-This patch decreases the timeouts for assoc/auth to more realistic values. Improves roaming speed
---- a/wpa_supplicant/events.c
-+++ b/wpa_supplicant/events.c
-@@ -854,7 +854,7 @@ static void wpa_supplicant_event_assoc(s
- wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
- } else if (!ft_completed) {
- /* Timeout for receiving the first EAPOL packet */
-- wpa_supplicant_req_auth_timeout(wpa_s, 10, 0);
-+ wpa_supplicant_req_auth_timeout(wpa_s, 3, 0);
- }
- wpa_supplicant_cancel_scan(wpa_s);
-
---- a/wpa_supplicant/scan.c
-+++ b/wpa_supplicant/scan.c
-@@ -189,6 +189,7 @@ static void wpa_supplicant_scan(void *el
- }
- #endif /* CONFIG_WPS */
-
-+ wpa_drv_flush_pmkid(wpa_s);
- if (wpa_s->use_client_mlme) {
- ieee80211_sta_set_probe_req_ie(wpa_s, extra_ie, extra_ie_len);
- ret = ieee80211_sta_req_scan(wpa_s, ssid ? ssid->ssid : NULL,
-@@ -203,7 +204,7 @@ static void wpa_supplicant_scan(void *el
-
- if (ret) {
- wpa_printf(MSG_WARNING, "Failed to initiate AP scan.");
-- wpa_supplicant_req_scan(wpa_s, 10, 0);
-+ wpa_supplicant_req_scan(wpa_s, 3, 0);
- } else
- wpa_s->scan_runs++;
- }
---- a/wpa_supplicant/wpa_supplicant.c
-+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -1160,10 +1160,10 @@ void wpa_supplicant_associate(struct wpa
-
- if (assoc_failed) {
- /* give IBSS a bit more time */
-- timeout = ssid->mode ? 10 : 5;
-+ timeout = ssid->mode ? 5 : 2;
- } else if (wpa_s->conf->ap_scan == 1) {
- /* give IBSS a bit more time */
-- timeout = ssid->mode ? 20 : 10;
-+ timeout = ssid->mode ? 7 : 3;
- }
- wpa_supplicant_req_auth_timeout(wpa_s, timeout, 0);
- }
diff --git a/package/wpa_supplicant/patches/120-ssid_scan.patch b/package/wpa_supplicant/patches/120-ssid_scan.patch
deleted file mode 100644
index 6beaed449c..0000000000
--- a/package/wpa_supplicant/patches/120-ssid_scan.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-Don't do broadcast SSID scans, if all configured SSIDs use scan_ssid=1. Improves background scanning in supplicant-managed roaming.
-
---- a/wpa_supplicant/scan.c
-+++ b/wpa_supplicant/scan.c
-@@ -73,6 +73,7 @@ static void wpa_supplicant_scan(void *el
- struct wpabuf *wps_ie = NULL;
- const u8 *extra_ie = NULL;
- size_t extra_ie_len = 0;
-+ int scan_ssid_all = 1;
- int wps = 0;
- #ifdef CONFIG_WPS
- enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO;
-@@ -82,6 +83,17 @@ static void wpa_supplicant_scan(void *el
- return;
-
- enabled = 0;
-+
-+ /* check if all configured ssids should be scanned directly */
-+ ssid = wpa_s->conf->ssid;
-+ while (ssid) {
-+ if (!ssid->scan_ssid) {
-+ scan_ssid_all = 0;
-+ break;
-+ }
-+ ssid = ssid->next;
-+ }
-+
- ssid = wpa_s->conf->ssid;
- while (ssid) {
- if (!ssid->disabled) {
-@@ -154,6 +166,10 @@ static void wpa_supplicant_scan(void *el
- return;
- }
-
-+ if (scan_ssid_all && !ssid) {
-+ ssid = wpa_s->conf->ssid;
-+ }
-+
- wpa_printf(MSG_DEBUG, "Starting AP scan (%s SSID)",
- ssid ? "specific": "broadcast");
- if (ssid) {
diff --git a/package/wpa_supplicant/patches/130-scanning.patch b/package/wpa_supplicant/patches/130-scanning.patch
deleted file mode 100644
index aad4450f7d..0000000000
--- a/package/wpa_supplicant/patches/130-scanning.patch
+++ /dev/null
@@ -1,175 +0,0 @@
-Add a scan result cache to improve roaming speed if the driver gave us a background scan before losing the connection.
-
---- a/wpa_supplicant/config.h
-+++ b/wpa_supplicant/config.h
-@@ -97,6 +97,12 @@ struct wpa_config {
- int ap_scan;
-
- /**
-+ * scan_cache - controls the time in seconds after the last scan results
-+ * before a new scan may be initiated
-+ */
-+ int scan_cache;
-+
-+ /**
- * ctrl_interface - Parameters for the control interface
- *
- * If this is specified, %wpa_supplicant will open a control interface
---- a/wpa_supplicant/config_file.c
-+++ b/wpa_supplicant/config_file.c
-@@ -306,6 +306,13 @@ static int wpa_config_parse_int(const st
- return 0;
- }
-
-+static int wpa_config_process_scan_cache(struct wpa_config *config, char *pos)
-+{
-+ config->scan_cache = atoi(pos);
-+ wpa_printf(MSG_DEBUG, "scan_cache=%d", config->scan_cache);
-+ return 0;
-+}
-+
-
- static int wpa_config_parse_str(const struct global_parse_data *data,
- struct wpa_config *config, int line,
-@@ -433,6 +440,7 @@ static const struct global_parse_data gl
- #endif /* CONFIG_CTRL_IFACE */
- { INT_RANGE(eapol_version, 1, 2) },
- { INT(ap_scan) },
-+ { INT(scan_cache) },
- { INT(fast_reauth) },
- #ifdef EAP_TLS_OPENSSL
- { STR(opensc_engine_path) },
-@@ -835,6 +843,8 @@ static void wpa_config_write_global(FILE
- fprintf(f, "eapol_version=%d\n", config->eapol_version);
- if (config->ap_scan != DEFAULT_AP_SCAN)
- fprintf(f, "ap_scan=%d\n", config->ap_scan);
-+ if (config->scan_cache != 0)
-+ fprintf(f, "scan_cache=%d\n", config->scan_cache);
- if (config->fast_reauth != DEFAULT_FAST_REAUTH)
- fprintf(f, "fast_reauth=%d\n", config->fast_reauth);
- #ifdef EAP_TLS_OPENSSL
---- a/wpa_supplicant/events.c
-+++ b/wpa_supplicant/events.c
-@@ -541,7 +541,7 @@ wpa_supplicant_select_bss_non_wpa(struct
- "BSSID mismatch");
- continue;
- }
--
-+
- if (!(ssid->key_mgmt & WPA_KEY_MGMT_NONE) &&
- !(ssid->key_mgmt & WPA_KEY_MGMT_WPS) &&
- !(ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA))
-@@ -551,7 +551,7 @@ wpa_supplicant_select_bss_non_wpa(struct
- continue;
- }
-
-- if ((ssid->key_mgmt &
-+ if ((ssid->key_mgmt &
- (WPA_KEY_MGMT_IEEE8021X | WPA_KEY_MGMT_PSK |
- WPA_KEY_MGMT_FT_IEEE8021X | WPA_KEY_MGMT_FT_PSK |
- WPA_KEY_MGMT_IEEE8021X_SHA256 |
-@@ -640,6 +640,9 @@ static void wpa_supplicant_event_scan_re
- wpa_s->disconnected)
- return;
-
-+ if (wpa_s->wpa_state > WPA_ASSOCIATED)
-+ goto done;
-+
- while (selected == NULL) {
- for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
- selected = wpa_supplicant_select_bss(
-@@ -652,6 +655,7 @@ static void wpa_supplicant_event_scan_re
- wpa_printf(MSG_DEBUG, "No APs found - clear blacklist "
- "and try again");
- wpa_blacklist_clear(wpa_s);
-+ memset(&wpa_s->last_scan_results, 0, sizeof(wpa_s->last_scan_results));
- wpa_s->blacklist_cleared++;
- } else if (selected == NULL) {
- break;
-@@ -687,10 +691,12 @@ static void wpa_supplicant_event_scan_re
- rsn_preauth_scan_results(wpa_s->wpa, wpa_s->scan_res);
- } else {
- wpa_printf(MSG_DEBUG, "No suitable AP found.");
-- timeout = 5;
-+ timeout = 0;
- goto req_scan;
- }
-
-+done:
-+ os_get_time(&wpa_s->last_scan_results);
- return;
-
- req_scan:
-@@ -894,6 +900,9 @@ static void wpa_supplicant_event_disasso
- }
- if (wpa_s->wpa_state >= WPA_ASSOCIATED)
- wpa_supplicant_req_scan(wpa_s, 0, 100000);
-+ else if (wpa_s->wpa_state == WPA_ASSOCIATING)
-+ wpa_supplicant_req_auth_timeout(wpa_s, 0, 100000);
-+
- bssid = wpa_s->bssid;
- if (is_zero_ether_addr(bssid))
- bssid = wpa_s->pending_bssid;
---- a/wpa_supplicant/wpa_supplicant_i.h
-+++ b/wpa_supplicant/wpa_supplicant_i.h
-@@ -350,6 +350,7 @@ struct wpa_supplicant {
- struct wpa_client_mlme mlme;
- int use_client_mlme;
- int driver_4way_handshake;
-+ struct os_time last_scan_results;
-
- int pending_mic_error_report;
- int pending_mic_error_pairwise;
-@@ -405,6 +406,7 @@ int wpa_supplicant_scard_init(struct wpa
-
- /* scan.c */
- void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
-+int wpa_supplicant_may_scan(struct wpa_supplicant *wpa_s);
- void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
-
- /* events.c */
---- a/wpa_supplicant/scan.c
-+++ b/wpa_supplicant/scan.c
-@@ -40,6 +40,18 @@ static void wpa_supplicant_gen_assoc_eve
- wpa_supplicant_event(wpa_s, EVENT_ASSOC, &data);
- }
-
-+int wpa_supplicant_may_scan(struct wpa_supplicant *wpa_s)
-+{
-+ struct os_time time;
-+
-+ if (wpa_s->conf->scan_cache > 0) {
-+ os_get_time(&time);
-+ time.sec -= wpa_s->conf->scan_cache;
-+ if (os_time_before(&time, &wpa_s->last_scan_results))
-+ return 0;
-+ }
-+ return 1;
-+}
-
- #ifdef CONFIG_WPS
- static int wpas_wps_in_use(struct wpa_config *conf,
-@@ -183,8 +195,9 @@ static void wpa_supplicant_scan(void *el
- wps = wpas_wps_in_use(wpa_s->conf, &req_type);
- #endif /* CONFIG_WPS */
-
-- if (wpa_s->scan_res_tried == 0 && wpa_s->conf->ap_scan == 1 &&
-- !wpa_s->use_client_mlme && wps != 2) {
-+ if (!wpa_supplicant_may_scan(wpa_s) ||
-+ (wpa_s->scan_res_tried == 0 && wpa_s->conf->ap_scan == 1 &&
-+ !wpa_s->use_client_mlme && wps != 2)) {
- wpa_s->scan_res_tried++;
- wpa_s->scan_req = scan_req;
- wpa_printf(MSG_DEBUG, "Trying to get current scan results "
---- a/wpa_supplicant/wpa_supplicant.c
-+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -1491,6 +1491,9 @@ void wpa_supplicant_rx_eapol(void *ctx,
- {
- struct wpa_supplicant *wpa_s = ctx;
-
-+ if (wpa_s->wpa_state < WPA_ASSOCIATING)
-+ return;
-+
- wpa_printf(MSG_DEBUG, "RX EAPOL from " MACSTR, MAC2STR(src_addr));
- wpa_hexdump(MSG_MSGDUMP, "RX EAPOL", buf, len);
-
diff --git a/package/wpa_supplicant/patches/140-quality.patch b/package/wpa_supplicant/patches/140-quality.patch
deleted file mode 100644
index edb0b2693b..0000000000
--- a/package/wpa_supplicant/patches/140-quality.patch
+++ /dev/null
@@ -1,33 +0,0 @@
---- a/wpa_supplicant/wpa_supplicant.c
-+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -1248,7 +1248,7 @@ static int wpa_supplicant_get_scan_resul
- {
- #define SCAN_AP_LIMIT 128
- struct wpa_scan_result *results;
-- int num, i;
-+ int num, i, j;
- struct wpa_scan_results *res;
-
- results = os_malloc(SCAN_AP_LIMIT * sizeof(struct wpa_scan_result));
-@@ -1345,6 +1345,21 @@ static int wpa_supplicant_get_scan_resul
- res->res[res->num++] = r;
- }
-
-+ /* sort scan results by quality */
-+ for(i = 0; i < num - 1; i++) {
-+ for(j = i + 1; j < num; j++) {
-+ struct wpa_scan_result tmp;
-+
-+ if (results[i].qual > results[j].qual)
-+ continue;
-+
-+ os_memcpy(&tmp, &results[i], sizeof(tmp));
-+ os_memcpy(&results[i], &results[j], sizeof(tmp));
-+ os_memcpy(&results[j], &tmp, sizeof(tmp));
-+ }
-+ }
-+
-+
- os_free(results);
- wpa_s->scan_res = res;
-
diff --git a/package/wpa_supplicant/patches/150-Remove-PS3-gelic-legacy-wpa-support.patch b/package/wpa_supplicant/patches/150-Remove-PS3-gelic-legacy-wpa-support.patch
deleted file mode 100644
index 94559f1b32..0000000000
--- a/package/wpa_supplicant/patches/150-Remove-PS3-gelic-legacy-wpa-support.patch
+++ /dev/null
@@ -1,251 +0,0 @@
-From 67441c596f016f69c230eaa31ecb2272c6cbf4bf Mon Sep 17 00:00:00 2001
-From: Hamish Guthrie <hamish.guthrie@sonycom.com>
-Date: Wed, 6 Jan 2010 10:00:22 +0100
-Subject: [PATCH] Remove PS3 gelic legacy wpa support
-
-The ps3 wireless driver now supports wireless extensions. There is dedicated support code in wpa_supplicant for the old gelic wireless driver. The current gelic driver retains the old API with CONFIG_GELIC_WIRELESS_OLD_PSK_INTERFACE, which is being removed from the driver.
-
-Signed-off-by: Hamish Guthrie <hamish.guthrie@sonycom.com>
----
- src/drivers/driver_ps3.c | 186 ----------------------------------------------
- src/drivers/drivers.c | 6 --
- wpa_supplicant/Makefile | 6 --
- 3 files changed, 0 insertions(+), 198 deletions(-)
- delete mode 100644 src/drivers/driver_ps3.c
-
-diff --git a/src/drivers/driver_ps3.c b/src/drivers/driver_ps3.c
-deleted file mode 100644
-index fde3425..0000000
---- a/src/drivers/driver_ps3.c
-+++ /dev/null
-@@ -1,186 +0,0 @@
--/*
-- * WPA Supplicant - PS3 Linux wireless extension driver interface
-- * Copyright 2007, 2008 Sony Corporation
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License version 2 as
-- * published by the Free Software Foundation.
-- *
-- * Alternatively, this software may be distributed under the terms of BSD
-- * license.
-- *
-- * See README and COPYING for more details.
-- */
--
--#include "includes.h"
--#include <sys/ioctl.h>
--#include "wireless_copy.h"
--#include "common.h"
--#include "wpa_common.h"
--#include "driver.h"
--#include "eloop.h"
--#include "driver_wext.h"
--#include "ieee802_11_defs.h"
--
--static int wpa_driver_ps3_set_wpa_key(struct wpa_driver_wext_data *drv,
-- struct wpa_driver_associate_params *params)
--{
-- int ret, i;
-- struct iwreq iwr;
-- char *buf, *str;
--
-- if (!params->psk && !params->passphrase) {
-- wpa_printf(MSG_INFO, "%s:no PSK error", __func__);
-- return -EINVAL;
-- }
--
-- os_memset(&iwr, 0, sizeof(iwr));
-- if (params->psk) {
-- /* includes null */
-- iwr.u.data.length = PMK_LEN * 2 + 1;
-- buf = os_malloc(iwr.u.data.length);
-- if (!buf)
-- return -ENOMEM;
-- str = buf;
-- for (i = 0; i < PMK_LEN; i++) {
-- str += snprintf(str, iwr.u.data.length - (str - buf),
-- "%02x", params->psk[i]);
-- }
-- } else if (params->passphrase) {
-- /* including quotations and null */
-- iwr.u.data.length = strlen(params->passphrase) + 3;
-- buf = os_malloc(iwr.u.data.length);
-- if (!buf)
-- return -ENOMEM;
-- buf[0] = '"';
-- os_memcpy(buf + 1, params->passphrase, iwr.u.data.length - 3);
-- buf[iwr.u.data.length - 2] = '"';
-- buf[iwr.u.data.length - 1] = '\0';
-- } else
-- return -EINVAL;
-- iwr.u.data.pointer = (caddr_t) buf;
-- os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
-- ret = ioctl(drv->ioctl_sock, SIOCIWFIRSTPRIV, &iwr);
-- os_free(buf);
--
-- return ret;
--}
--
--static int wpa_driver_ps3_set_wep_keys(struct wpa_driver_wext_data *drv,
-- struct wpa_driver_associate_params *params)
--{
-- int ret, i;
-- struct iwreq iwr;
--
-- for (i = 0; i < 4; i++) {
-- os_memset(&iwr, 0, sizeof(iwr));
-- os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
-- iwr.u.encoding.flags = i + 1;
-- if (params->wep_key_len[i]) {
-- iwr.u.encoding.pointer = (caddr_t) params->wep_key[i];
-- iwr.u.encoding.length = params->wep_key_len[i];
-- } else
-- iwr.u.encoding.flags = IW_ENCODE_NOKEY |
-- IW_ENCODE_DISABLED;
--
-- if (ioctl(drv->ioctl_sock, SIOCSIWENCODE, &iwr) < 0) {
-- perror("ioctl[SIOCSIWENCODE]");
-- ret = -1;
-- }
-- }
-- return ret;
--}
--
--static int wpa_driver_ps3_associate(void *priv,
-- struct wpa_driver_associate_params *params)
--{
-- struct wpa_driver_wext_data *drv = priv;
-- int ret, value;
--
-- wpa_printf(MSG_DEBUG, "%s: <-", __func__);
--
-- /* clear BSSID */
-- if (!params->bssid &&
-- wpa_driver_wext_set_bssid(drv, NULL) < 0)
-- ret = -1;
--
-- if (wpa_driver_wext_set_mode(drv, params->mode) < 0)
-- ret = -1;
--
-- if (params->wpa_ie == NULL || params->wpa_ie_len == 0)
-- value = IW_AUTH_WPA_VERSION_DISABLED;
-- else if (params->wpa_ie[0] == WLAN_EID_RSN)
-- value = IW_AUTH_WPA_VERSION_WPA2;
-- else
-- value = IW_AUTH_WPA_VERSION_WPA;
-- if (wpa_driver_wext_set_auth_param(drv,
-- IW_AUTH_WPA_VERSION, value) < 0)
-- ret = -1;
-- value = wpa_driver_wext_cipher2wext(params->pairwise_suite);
-- if (wpa_driver_wext_set_auth_param(drv,
-- IW_AUTH_CIPHER_PAIRWISE, value) < 0)
-- ret = -1;
-- value = wpa_driver_wext_cipher2wext(params->group_suite);
-- if (wpa_driver_wext_set_auth_param(drv,
-- IW_AUTH_CIPHER_GROUP, value) < 0)
-- ret = -1;
-- value = wpa_driver_wext_keymgmt2wext(params->key_mgmt_suite);
-- if (wpa_driver_wext_set_auth_param(drv, IW_AUTH_KEY_MGMT, value) < 0)
-- ret = -1;
--
-- /* set selected BSSID */
-- if (params->bssid &&
-- wpa_driver_wext_set_bssid(drv, params->bssid) < 0)
-- ret = -1;
--
-- switch (params->group_suite) {
-- case CIPHER_NONE:
-- ret = 0;
-- break;
-- case CIPHER_WEP40:
-- case CIPHER_WEP104:
-- ret = wpa_driver_ps3_set_wep_keys(drv, params);
-- break;
-- case CIPHER_TKIP:
-- case CIPHER_CCMP:
-- ret = wpa_driver_ps3_set_wpa_key(drv, params);
-- break;
-- }
--
-- /* start to associate */
-- ret = wpa_driver_wext_set_ssid(drv, params->ssid, params->ssid_len);
--
-- wpa_printf(MSG_DEBUG, "%s: ->", __func__);
--
-- return ret;
--}
--
--static int wpa_driver_ps3_get_capa(void *priv, struct wpa_driver_capa *capa)
--{
-- int ret;
-- wpa_printf(MSG_DEBUG, "%s:<-", __func__);
--
-- ret = wpa_driver_wext_get_capa(priv, capa);
-- if (ret) {
-- wpa_printf(MSG_INFO, "%s: base wext returns error %d",
-- __func__, ret);
-- return ret;
-- }
-- /* PS3 hypervisor does association and 4way handshake by itself */
-- capa->flags |= WPA_DRIVER_FLAGS_4WAY_HANDSHAKE;
-- wpa_printf(MSG_DEBUG, "%s:->", __func__);
-- return 0;
--}
--
--const struct wpa_driver_ops wpa_driver_ps3_ops = {
-- .name = "ps3",
-- .desc = "PLAYSTATION3 Linux wireless extension driver",
-- .get_bssid = wpa_driver_wext_get_bssid,
-- .get_ssid = wpa_driver_wext_get_ssid,
-- .scan = wpa_driver_wext_scan,
-- .get_scan_results2 = wpa_driver_wext_get_scan_results,
-- .associate = wpa_driver_ps3_associate, /* PS3 */
-- .init = wpa_driver_wext_init,
-- .deinit = wpa_driver_wext_deinit,
-- .get_capa = wpa_driver_ps3_get_capa, /* PS3 */
--};
-diff --git a/src/drivers/drivers.c b/src/drivers/drivers.c
-index d278797..7e7d720 100644
---- a/src/drivers/drivers.c
-+++ b/src/drivers/drivers.c
-@@ -64,9 +64,6 @@ extern struct wpa_driver_ops wpa_driver_ralink_ops; /* driver_ralink.c */
- #ifdef CONFIG_DRIVER_OSX
- extern struct wpa_driver_ops wpa_driver_osx_ops; /* driver_osx.m */
- #endif /* CONFIG_DRIVER_OSX */
--#ifdef CONFIG_DRIVER_PS3
--extern struct wpa_driver_ops wpa_driver_ps3_ops; /* driver_ps3.c */
--#endif /* CONFIG_DRIVER_PS3 */
- #ifdef CONFIG_DRIVER_IPHONE
- extern struct wpa_driver_ops wpa_driver_iphone_ops; /* driver_iphone.m */
- #endif /* CONFIG_DRIVER_IPHONE */
-@@ -126,9 +123,6 @@ struct wpa_driver_ops *wpa_supplicant_drivers[] =
- #ifdef CONFIG_DRIVER_OSX
- &wpa_driver_osx_ops,
- #endif /* CONFIG_DRIVER_OSX */
--#ifdef CONFIG_DRIVER_PS3
-- &wpa_driver_ps3_ops,
--#endif /* CONFIG_DRIVER_PS3 */
- #ifdef CONFIG_DRIVER_IPHONE
- &wpa_driver_iphone_ops,
- #endif /* CONFIG_DRIVER_IPHONE */
-diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
-index 45d6ada..f131e92 100644
---- a/wpa_supplicant/Makefile
-+++ b/wpa_supplicant/Makefile
-@@ -226,12 +226,6 @@ LDFLAGS += -framework CoreFoundation
- LDFLAGS += -F/System/Library/PrivateFrameworks -framework Apple80211
- endif
-
--ifdef CONFIG_DRIVER_PS3
--CFLAGS += -DCONFIG_DRIVER_PS3 -m64
--OBJS_d += ../src/drivers/driver_ps3.o
--LDFLAGS += -m64
--endif
--
- ifdef CONFIG_DRIVER_IPHONE
- CFLAGS += -DCONFIG_DRIVER_IPHONE
- OBJS_d += ../src/drivers/driver_iphone.o
---
-1.6.2.4
-