From: nbd Date: Wed, 30 Mar 2011 12:37:36 +0000 (+0000) Subject: backport mac80211, hostapd, iw, crda from trunk as of r26369 X-Git-Url: http://207.154.207.93/?a=commitdiff_plain;h=f90d7885605f132a9961f2281c217b235864ee56;p=10.03%2Fopenwrt.git backport mac80211, hostapd, iw, crda from trunk as of r26369 git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@26370 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/package/crda/Makefile b/package/crda/Makefile index b479090c4..95a184c21 100644 --- a/package/crda/Makefile +++ b/package/crda/Makefile @@ -9,19 +9,18 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=crda -PKG_RELEASE:=2 -PKG_VERSION:=1.1.0 +PKG_RELEASE:=1 +PKG_VERSION:=1.1.1 PKG_SOURCE_URL:=http://wireless.kernel.org/download/crda PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_MD5SUM:=6004584d2e39e899f7642b141dd72028 +PKG_MD5SUM:=5fc77af68b3e21736b8ef2f8b061c810 PKG_BUILD_DEPENDS:=mac80211 PKG_REGULATORY_NAME:=regulatory -PKG_REGULATORY_VERSION:=2010.11.17 -PKG_REGULATORY_SOURCE_URL:=http://mirror2.openwrt.org/sources -#PKG_REGULATORY_SOURCE_URL:=http://wireless.kernel.org/download/wireless-regdb/regulatory.bins +PKG_REGULATORY_VERSION:=2010.11.24 +PKG_REGULATORY_SOURCE_URL:=http://wireless.kernel.org/download/wireless-regdb/regulatory.bins PKG_REGULATORY_SOURCE:=$(PKG_REGULATORY_VERSION)-$(PKG_REGULATORY_NAME).bin -PKG_REGULATORY_MD5SUM:=4a497f045d93a8d5b135f4d2816faa83 +PKG_REGULATORY_MD5SUM:=001b69bba19486439031377e09229f9c include $(INCLUDE_DIR)/package.mk @@ -29,7 +28,7 @@ define Package/crda SECTION:=net CATEGORY:=Network TITLE:=Central Regulatory Domain Agent (CRDA) - DEPENDS:=@LINUX_2_6 +hotplug2 +libnl-tiny + DEPENDS:=+libnl-tiny URL:=http://wireless.kernel.org/en/developers/Regulatory/CRDA endef diff --git a/package/hostapd/Config.in b/package/hostapd/Config.in index a74cbae96..a88f977c1 100644 --- a/package/hostapd/Config.in +++ b/package/hostapd/Config.in @@ -25,3 +25,12 @@ config WPA_RFKILL_SUPPORT bool "Add rfkill support" depends PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mini || PACKAGE_wpad || PACKAGE_wpad-mini default n + + +config DRIVER_WEXT_SUPPORT + bool + default n + +config DRIVER_11N_SUPPORT + bool + default n diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index 6f3c639e6..b232b311b 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -8,15 +8,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_VERSION:=20100705 -PKG_RELEASE:=2 -PKG_REV:=2f1ce78bf78cecd7021385b04a4f55f22e76ab97 +PKG_VERSION:=20110221 +PKG_RELEASE:=1 +PKG_REV:=cd9fc7869aa1e3935c028d4032d15c75e9946410 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git PKG_SOURCE_SUBDIR:=hostapd-$(PKG_VERSION) PKG_SOURCE_VERSION:=$(PKG_REV) PKG_SOURCE_PROTO:=git +PKG_MIRROR_MD5SUM:=f5f1462884d6e6808413e185b19ea3e3 PKG_BUILD_DEPENDS:= \ PACKAGE_kmod-madwifi:madwifi \ @@ -25,13 +26,14 @@ PKG_BUILD_DEPENDS:= \ PKG_CONFIG_DEPENDS:= \ CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \ CONFIG_PACKAGE_kmod-ath9k \ - CONFIG_PACKAGE_kmod-rt2800-lib \ CONFIG_PACKAGE_kmod-mac80211 \ CONFIG_PACKAGE_kmod-madwifi \ CONFIG_PACKAGE_hostapd \ CONFIG_PACKAGE_hostapd-mini \ CONFIG_PACKAGE_kmod-hostap \ - CONFIG_WPA_RFKILL_SUPPORT + CONFIG_WPA_RFKILL_SUPPORT \ + CONFIG_DRIVER_WEXT_SUPPORT \ + CONFIG_DRIVER_11N_SUPPORT LOCAL_TYPE=$(strip \ $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \ @@ -52,11 +54,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSI include $(INCLUDE_DIR)/package.mk -ifneq ($(CONFIG_PACKAGE_kmod-rt2800-lib),) - HOSTAPD_IEEE80211N:=y -endif - -ifneq ($(CONFIG_PACKAGE_kmod-ath9k),) +ifneq ($(CONFIG_DRIVER_11N_SUPPORT),) HOSTAPD_IEEE80211N:=y endif @@ -66,6 +64,7 @@ DRIVER_MAKEOPTS= \ CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \ CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \ CONFIG_IEEE80211W=$(CONFIG_PACKAGE_kmod-ath9k) \ + CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \ $(if $(CONFIG_WPA_RFKILL_SUPPORT),NEED_RFKILL=y) ifneq ($(LOCAL_TYPE),hostapd) @@ -223,6 +222,9 @@ TARGET_CPPFLAGS := \ -DCONFIG_LIBNL20 \ -D_GNU_SOURCE +TARGET_CFLAGS += -ffunction-sections -fdata-sections +TARGET_LDFLAGS += -Wl,--gc-sections + ifdef CONFIG_PACKAGE_kmod-mac80211 TARGET_LDFLAGS += -lm -lnl-tiny endif diff --git a/package/hostapd/files/hostapd-full.config b/package/hostapd/files/hostapd-full.config index cf7993c34..33de7e0df 100644 --- a/package/hostapd/files/hostapd-full.config +++ b/package/hostapd/files/hostapd-full.config @@ -158,3 +158,5 @@ CONFIG_INTERNAL_AES=y NEED_AES_DEC=y CONFIG_WPS=y +CONFIG_FULL_DYNAMIC_VLAN=y + diff --git a/package/hostapd/files/hostapd.sh b/package/hostapd/files/hostapd.sh index 98c3f61e5..5b69ecd62 100644 --- a/package/hostapd/files/hostapd.sh +++ b/package/hostapd/files/hostapd.sh @@ -9,6 +9,9 @@ hostapd_set_bss_options() { config_get device "$vif" device config_get hwmode "$device" hwmode + config_get phy "$device" phy + + append "$var" "ctrl_interface=/var/run/hostapd-$phy" "$N" if [ "$ap_isolate" -gt 0 ]; then append "$var" "ap_isolate=$ap_isolate" "$N" @@ -127,32 +130,56 @@ hostapd_set_bss_options() { config_get iapp_interface "$vif" iapp_interface config_get_bool wps_pbc "$vif" wps_pushbutton 0 - [ -n "$wps_possible" -a "$wps_pbc" -gt 0 ] && { + config_get_bool wps_label "$vif" wps_label 0 + + config_get config_methods "$vif" wps_config + [ "$wps_pbc" -gt 0 ] && append config_methods push_button + + [ -n "$wps_possible" -a -n "$config_methods" ] && { + config_get device_type "$vif" wps_device_type "6-0050F204-1" + config_get device_name "$vif" wps_device_name "OpenWrt AP" + config_get manufacturer "$vif" wps_manufacturer "openwrt.org" + append "$var" "eap_server=1" "$N" append "$var" "wps_state=2" "$N" append "$var" "ap_setup_locked=1" "$N" - append "$var" "config_methods=push_button" "$N" + append "$var" "device_type=$device_type" "$N" + append "$var" "device_name=$device_name" "$N" + append "$var" "manufacturer=$manufacturer" "$N" + append "$var" "config_methods=$config_methods" "$N" } append "$var" "ssid=$ssid" "$N" [ -n "$bridge" ] && append "$var" "bridge=$bridge" "$N" [ -n "$ieee80211d" ] && append "$var" "ieee80211d=$ieee80211d" "$N" - [ -n "$iapp_interface" ] && append "$var" $(uci_get_state network "$iapp_interface" ifname "$iapp_interface") "$N" - - [ "$wpa" -ge "2" ] && config_get ieee80211w "$vif" ieee80211w - case "$ieee80211w" in - [012]) - append "$var" "ieee80211w=$ieee80211w" "$N" - [ "$ieee80211w" -gt "0" ] && { - config_get ieee80211w_max_timeout "$vif" ieee80211w_max_timeout - config_get ieee80211w_retry_timeout "$vif" ieee80211w_retry_timeout - [ -n "$ieee80211w_max_timeout" ] && \ - append "$var" "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" - [ -n "$ieee80211w_retry_timeout" ] && \ - append "$var" "assoc_sa_query_retry_timeout=$ieee80211w_retry_timeout" "$N" - } - ;; - esac + [ -n "$iapp_interface" ] && append "$var" iapp_interface=$(uci_get_state network "$iapp_interface" ifname "$iapp_interface") "$N" + + if [ "$wpa" -ge "2" ] + then + # RSN -> allow preauthentication + config_get rsn_preauth "$vif" rsn_preauth + if [ -n "$bridge" -a "$rsn_preauth" = 1 ] + then + append "$var" "rsn_preauth=1" "$N" + append "$var" "rsn_preauth_interfaces=$bridge" "$N" + fi + + # RSN -> allow management frame protection + config_get ieee80211w "$vif" ieee80211w + case "$ieee80211w" in + [012]) + append "$var" "ieee80211w=$ieee80211w" "$N" + [ "$ieee80211w" -gt "0" ] && { + config_get ieee80211w_max_timeout "$vif" ieee80211w_max_timeout + config_get ieee80211w_retry_timeout "$vif" ieee80211w_retry_timeout + [ -n "$ieee80211w_max_timeout" ] && \ + append "$var" "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" + [ -n "$ieee80211w_retry_timeout" ] && \ + append "$var" "assoc_sa_query_retry_timeout=$ieee80211w_retry_timeout" "$N" + } + ;; + esac + fi } hostapd_setup_vif() { @@ -172,7 +199,6 @@ hostapd_setup_vif() { [ "$channel" = auto ] && channel= [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device" cat > /var/run/hostapd-$ifname.conf <ioctl_sock, drv->iface, 0); - madwifi_set_privacy(drv, 0); /* default to no privacy */ - - madwifi_receive_probe_req(drv); -@@ -1268,8 +1266,7 @@ madwifi_set_countermeasures(void *priv, - static int - madwifi_commit(void *priv) - { -- struct madwifi_driver_data *drv = priv; -- return linux_set_iface_flags(drv->ioctl_sock, drv->iface, 1); -+ return 0; - } - - #else /* HOSTAPD */ diff --git a/package/hostapd/patches/110-countrycode.patch b/package/hostapd/patches/110-countrycode.patch deleted file mode 100644 index 11cf06e84..000000000 --- a/package/hostapd/patches/110-countrycode.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -660,7 +660,6 @@ static int setup_interface(struct hostap - country[3] = '\0'; - if (hostapd_set_country(hapd, country) < 0) { - wpa_printf(MSG_ERROR, "Failed to set country code"); -- return -1; - } - } - diff --git a/package/hostapd/patches/120-compile_fix.patch b/package/hostapd/patches/120-compile_fix.patch deleted file mode 100644 index 89480c184..000000000 --- a/package/hostapd/patches/120-compile_fix.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - #include - #include "nl80211_copy.h" ---- a/src/drivers/driver_madwifi.c -+++ b/src/drivers/driver_madwifi.c -@@ -69,6 +69,7 @@ - #define MADWIFI_NG - #endif /* IEEE80211_IOCTL_SETWMMPARAMS */ - -+#define WPA_KEY_RSC_LEN 8 - - #ifdef HOSTAPD - -@@ -1506,7 +1507,6 @@ wpa_driver_madwifi_set_key(const char *i - wk.ik_keyix = key_idx; - wk.ik_keylen = key_len; - #ifdef WORDS_BIGENDIAN --#define WPA_KEY_RSC_LEN 8 - { - size_t i; - u8 tmp[WPA_KEY_RSC_LEN]; diff --git a/package/hostapd/patches/130-scan_wait.patch b/package/hostapd/patches/130-scan_wait.patch deleted file mode 100644 index 1f249533f..000000000 --- a/package/hostapd/patches/130-scan_wait.patch +++ /dev/null @@ -1,148 +0,0 @@ ---- a/src/ap/hostapd.h -+++ b/src/ap/hostapd.h -@@ -245,6 +245,7 @@ struct hostapd_iface { - int (*for_each_interface)(struct hapd_interfaces *interfaces, - int (*cb)(struct hostapd_iface *iface, - void *ctx), void *ctx); -+ int (*init_complete)(struct hostapd_iface *iface); - }; - - /* hostapd.c */ ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -755,6 +755,9 @@ int hostapd_setup_interface_complete(str - wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", - iface->bss[0]->conf->iface); - -+ if (iface->init_complete) -+ iface->init_complete(iface); -+ - return 0; - } - ---- a/hostapd/main.c -+++ b/hostapd/main.c -@@ -35,6 +35,8 @@ - extern int wpa_debug_level; - extern int wpa_debug_show_keys; - extern int wpa_debug_timestamp; -+static int daemonize = 0; -+static char *pid_file = NULL; - - - struct hapd_interfaces { -@@ -162,6 +164,15 @@ static void hostapd_logger_cb(void *ctx, - } - #endif /* CONFIG_NO_HOSTAPD_LOGGER */ - -+static int hostapd_init_complete(struct hostapd_iface *iface) -+{ -+ if (daemonize && os_daemonize(pid_file)) { -+ perror("daemon"); -+ return -1; -+ } -+ daemonize = 0; -+} -+ - - /** - * hostapd_init - Allocate and initialize per-interface data -@@ -183,6 +194,7 @@ static struct hostapd_iface * hostapd_in - if (hapd_iface == NULL) - goto fail; - -+ hapd_iface->init_complete = hostapd_init_complete; - hapd_iface->reload_config = hostapd_reload_config; - hapd_iface->config_read_cb = hostapd_config_read; - hapd_iface->config_fname = os_strdup(config_file); -@@ -391,7 +403,7 @@ static int hostapd_global_init(struct ha - } - - --static void hostapd_global_deinit(const char *pid_file) -+static void hostapd_global_deinit(void) - { - #ifdef EAP_SERVER_TNC - tncs_global_deinit(); -@@ -409,8 +421,7 @@ static void hostapd_global_deinit(const - } - - --static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize, -- const char *pid_file) -+static int hostapd_global_run(struct hapd_interfaces *iface) - { - #ifdef EAP_SERVER_TNC - int tnc = 0; -@@ -431,11 +442,6 @@ static int hostapd_global_run(struct hap - } - #endif /* EAP_SERVER_TNC */ - -- if (daemonize && os_daemonize(pid_file)) { -- perror("daemon"); -- return -1; -- } -- - eloop_run(); - - return 0; -@@ -479,8 +485,7 @@ int main(int argc, char *argv[]) - struct hapd_interfaces interfaces; - int ret = 1; - size_t i; -- int c, debug = 0, daemonize = 0; -- char *pid_file = NULL; -+ int c, debug = 0; - - if (os_program_init()) - return -1; -@@ -545,7 +550,7 @@ int main(int argc, char *argv[]) - goto out; - } - -- if (hostapd_global_run(&interfaces, daemonize, pid_file)) -+ if (hostapd_global_run(&interfaces)) - goto out; - - ret = 0; -@@ -556,7 +561,7 @@ int main(int argc, char *argv[]) - hostapd_interface_deinit_free(interfaces.iface[i]); - os_free(interfaces.iface); - -- hostapd_global_deinit(pid_file); -+ hostapd_global_deinit(); - os_free(pid_file); - - os_program_deinit(); ---- a/hostapd/config_file.c -+++ b/hostapd/config_file.c -@@ -1857,6 +1857,8 @@ struct hostapd_config * hostapd_config_r - } - #endif /* CONFIG_IEEE80211W */ - #ifdef CONFIG_IEEE80211N -+ } else if (os_strcmp(buf, "noscan") == 0) { -+ conf->noscan = atoi(pos); - } else if (os_strcmp(buf, "ieee80211n") == 0) { - conf->ieee80211n = atoi(pos); - } else if (os_strcmp(buf, "ht_capab") == 0) { ---- a/src/ap/ap_config.h -+++ b/src/ap/ap_config.h -@@ -369,6 +369,7 @@ struct hostapd_config { - - int ht_op_mode_fixed; - u16 ht_capab; -+ int noscan; - int ieee80211n; - int secondary_channel; - }; ---- a/src/ap/hw_features.c -+++ b/src/ap/hw_features.c -@@ -460,7 +460,7 @@ static int ieee80211n_check_40mhz(struct - { - struct wpa_driver_scan_params params; - -- if (!iface->conf->secondary_channel) -+ if (!iface->conf->secondary_channel || iface->conf->noscan) - return 0; /* HT40 not used */ - - wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling " diff --git a/package/hostapd/patches/200-multicall.patch b/package/hostapd/patches/200-multicall.patch deleted file mode 100644 index a35b5c8d3..000000000 --- a/package/hostapd/patches/200-multicall.patch +++ /dev/null @@ -1,236 +0,0 @@ ---- 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 -@@ -739,6 +744,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) - -@@ -777,6 +788,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 -@@ -581,6 +582,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 -@@ -635,6 +640,12 @@ CFLAGS += -DEAP_SERVER_WSC - OBJS += ../src/ap/wps_hostapd.o - OBJS += ../src/eap_server/eap_server_wsc.o - endif -+else -+ ifdef MULTICALL -+ OBJS += ../src/eap_server/eap_server.o -+ OBJS += ../src/eap_server/eap_server_identity.o -+ OBJS += ../src/eap_server/eap_server_methods.o -+ endif - endif - - ifdef NEED_RSN_AUTHENTICATOR -@@ -1270,6 +1281,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) - -@@ -1329,6 +1346,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 -@@ -2465,8 +2465,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 -@@ -375,8 +375,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; - -@@ -453,5 +453,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 -@@ -1582,8 +1582,8 @@ static void ft_rx_action(struct wpa_supp - #endif /* CONFIG_IEEE80211R */ - - --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; - u16 reason_code = 0; ---- a/wpa_supplicant/wpa_supplicant.c -+++ b/wpa_supplicant/wpa_supplicant.c -@@ -2228,6 +2228,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 -@@ -2246,6 +2249,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 -@@ -479,6 +479,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[]) - { -@@ -490,6 +493,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/hostapd/patches/300-scan_ssid.patch b/package/hostapd/patches/300-scan_ssid.patch new file mode 100644 index 000000000..47528f8b6 --- /dev/null +++ b/package/hostapd/patches/300-scan_ssid.patch @@ -0,0 +1,37 @@ +--- a/wpa_supplicant/scan.c ++++ b/wpa_supplicant/scan.c +@@ -251,6 +251,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; + enum wpa_states prev_state; + +@@ -307,6 +308,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) { +@@ -370,6 +381,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/300-timestamp_check.patch b/package/hostapd/patches/300-timestamp_check.patch deleted file mode 100644 index 70ac63597..000000000 --- a/package/hostapd/patches/300-timestamp_check.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/src/tls/x509v3.c -+++ b/src/tls/x509v3.c -@@ -1854,8 +1854,11 @@ int x509_certificate_chain_validate(stru - if (chain_trusted) - continue; - -- if ((unsigned long) now.sec < -+ if ( -+#ifndef NO_TIMESTAMP_CHECK -+ (unsigned long) now.sec < - (unsigned long) cert->not_before || -+#endif - (unsigned long) now.sec > - (unsigned long) cert->not_after) { - wpa_printf(MSG_INFO, "X509: Certificate not valid " diff --git a/package/hostapd/patches/310-madwifi_merge.patch b/package/hostapd/patches/310-madwifi_merge.patch new file mode 100644 index 000000000..f0888f073 --- /dev/null +++ b/package/hostapd/patches/310-madwifi_merge.patch @@ -0,0 +1,782 @@ +--- 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; +@@ -466,6 +463,9 @@ wpa_driver_madwifi_set_key(const char *i + 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 +485,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 +592,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 +758,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 +1018,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 +1135,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 +1159,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 +1170,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; + +@@ -1180,7 +1181,7 @@ madwifi_init(struct hostapd_data *hapd, + } + + /* mark down during setup */ +- linux_set_iface_flags(drv->ioctl_sock, drv->iface, 0); ++ linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 0); + madwifi_set_privacy(drv, 0); /* default to no privacy */ + + madwifi_receive_probe_req(drv); +@@ -1206,7 +1207,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) +@@ -1225,7 +1226,7 @@ madwifi_set_ssid(void *priv, const u8 *b + 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; +@@ -1246,7 +1247,7 @@ madwifi_get_ssid(void *priv, u8 *buf, in + 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,140 +1272,19 @@ static int + madwifi_commit(void *priv) + { + struct madwifi_driver_data *drv = priv; +- return linux_set_iface_flags(drv->ioctl_sock, drv->iface, 1); ++ return linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1); + } + +-#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; +@@ -1415,7 +1295,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; + } +@@ -1423,157 +1303,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 +- if (seq) { +- 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 */ +- if (seq) +- 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; +@@ -1596,12 +1370,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) { +@@ -1609,14 +1383,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) +@@ -1625,7 +1399,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; +@@ -1638,7 +1412,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) && +@@ -1649,13 +1423,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; +@@ -1673,7 +1447,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; + } +@@ -1695,14 +1469,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); + } + +@@ -1710,14 +1484,16 @@ 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; ++ if (!drv->wext) ++ return 0; + return wpa_driver_wext_set_operstate(drv->wext, state); + } + +@@ -1738,7 +1514,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); + +@@ -1748,7 +1524,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) +@@ -1759,17 +1535,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; +@@ -1778,7 +1554,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: +@@ -1789,38 +1565,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, +@@ -1840,7 +1615,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, +@@ -1852,5 +1628,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 + }; +--- a/src/drivers/drivers.mak ++++ b/src/drivers/drivers.mak +@@ -144,8 +144,8 @@ DRV_WPA_OBJS += ../src/drivers/driver_ro + endif + + ifdef CONFIG_WIRELESS_EXTENSION +-DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION +-DRV_WPA_OBJS += ../src/drivers/driver_wext.o ++DRV_CFLAGS += -DCONFIG_WIRELESS_EXTENSION ++DRV_OBJS += ../src/drivers/driver_wext.o + NEED_RFKILL=y + endif + diff --git a/package/hostapd/patches/310-scan_ssid.patch b/package/hostapd/patches/310-scan_ssid.patch deleted file mode 100644 index 884459ce6..000000000 --- a/package/hostapd/patches/310-scan_ssid.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/wpa_supplicant/scan.c -+++ b/wpa_supplicant/scan.c -@@ -248,6 +248,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; - enum wpa_states prev_state; - -@@ -316,6 +317,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) { -@@ -379,6 +390,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-nl80211_multicall_fixes.patch b/package/hostapd/patches/320-nl80211_multicall_fixes.patch new file mode 100644 index 000000000..9bd736970 --- /dev/null +++ b/package/hostapd/patches/320-nl80211_multicall_fixes.patch @@ -0,0 +1,102 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -1468,7 +1468,6 @@ nla_put_failure: + } + + +-#ifndef HOSTAPD + struct wiphy_info_data { + int max_scan_ssids; + int ap_supported; +@@ -1613,7 +1612,6 @@ static int wpa_driver_nl80211_capa(struc + + return 0; + } +-#endif /* HOSTAPD */ + + + static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv) +@@ -1825,6 +1823,7 @@ static void * wpa_driver_nl80211_init(vo + drv->monitor_ifidx = -1; + drv->monitor_sock = -1; + drv->ioctl_sock = -1; ++ drv->nlmode = NL80211_IFTYPE_STATION; + + if (wpa_driver_nl80211_init_nl(drv)) { + os_free(drv); +@@ -1988,32 +1987,32 @@ wpa_driver_nl80211_finish_drv_init(struc + drv->ifindex = if_nametoindex(bss->ifname); + drv->first_bss.ifindex = drv->ifindex; + +-#ifndef HOSTAPD +- if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) { +- wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to " +- "use managed mode"); +- } +- +- if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { +- if (rfkill_is_blocked(drv->rfkill)) { +- wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " +- "interface '%s' due to rfkill", +- bss->ifname); +- drv->if_disabled = 1; +- send_rfkill_event = 1; +- } else { +- wpa_printf(MSG_ERROR, "nl80211: Could not set " +- "interface '%s' UP", bss->ifname); +- return -1; ++ if (drv->nlmode == NL80211_IFTYPE_STATION) { ++ if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) { ++ wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to " ++ "use managed mode"); ++ } ++ ++ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { ++ if (rfkill_is_blocked(drv->rfkill)) { ++ wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " ++ "interface '%s' due to rfkill", ++ bss->ifname); ++ drv->if_disabled = 1; ++ send_rfkill_event = 1; ++ } else { ++ wpa_printf(MSG_ERROR, "nl80211: Could not set " ++ "interface '%s' UP", bss->ifname); ++ return -1; ++ } + } +- } + +- if (wpa_driver_nl80211_capa(drv)) +- return -1; ++ if (wpa_driver_nl80211_capa(drv)) ++ return -1; + +- netlink_send_oper_ifla(drv->netlink, drv->ifindex, +- 1, IF_OPER_DORMANT); +-#endif /* HOSTAPD */ ++ netlink_send_oper_ifla(drv->netlink, drv->ifindex, ++ 1, IF_OPER_DORMANT); ++ } + + if (linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, drv->addr)) + return -1; +@@ -3738,7 +3737,8 @@ static void nl80211_remove_iface(struct + + #ifdef HOSTAPD + /* stop listening for EAPOL on this interface */ +- del_ifidx(drv, ifidx); ++ if (drv->nlmode == NL80211_IFTYPE_AP) ++ del_ifidx(drv, ifidx); + #endif /* HOSTAPD */ + + msg = nlmsg_alloc(); +@@ -3811,7 +3811,8 @@ static int nl80211_create_iface_once(str + + #ifdef HOSTAPD + /* start listening for EAPOL on this interface */ +- add_ifidx(drv, ifidx); ++ if (drv->nlmode == NL80211_IFTYPE_AP) ++ add_ifidx(drv, ifidx); + #endif /* HOSTAPD */ + + if (addr && iftype != NL80211_IFTYPE_MONITOR && diff --git a/package/hostapd/patches/320-rescan_immediately.patch b/package/hostapd/patches/320-rescan_immediately.patch deleted file mode 100644 index 19183040a..000000000 --- a/package/hostapd/patches/320-rescan_immediately.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/wpa_supplicant/events.c -+++ b/wpa_supplicant/events.c -@@ -963,7 +963,7 @@ static void wpa_supplicant_event_scan_re - wpa_printf(MSG_DEBUG, "Setup a new network"); - wpa_supplicant_associate(wpa_s, NULL, ssid); - } else { -- int timeout_sec = 5; -+ int timeout_sec = 0; - int timeout_usec = 0; - wpa_supplicant_req_new_scan(wpa_s, timeout_sec, - timeout_usec); diff --git a/package/hostapd/patches/330-madwifi_merge.patch b/package/hostapd/patches/330-madwifi_merge.patch deleted file mode 100644 index cddffe4b9..000000000 --- a/package/hostapd/patches/330-madwifi_merge.patch +++ /dev/null @@ -1,760 +0,0 @@ ---- 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; -@@ -1016,7 +1018,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; - -@@ -1133,17 +1135,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; -@@ -1157,7 +1159,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, -@@ -1168,7 +1170,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; - -@@ -1203,7 +1205,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) -@@ -1222,7 +1224,7 @@ madwifi_set_ssid(void *priv, const u8 *b - 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; -@@ -1243,7 +1245,7 @@ madwifi_get_ssid(void *priv, u8 *buf, in - 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; - -@@ -1270,137 +1272,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; -@@ -1411,7 +1292,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; - } -@@ -1419,156 +1300,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; -@@ -1591,12 +1367,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) { -@@ -1604,14 +1380,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) -@@ -1620,7 +1396,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; -@@ -1633,7 +1409,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) && -@@ -1644,13 +1420,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; -@@ -1668,7 +1444,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; - } -@@ -1690,14 +1466,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); - } - -@@ -1705,14 +1481,16 @@ 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; -+ if (!drv->wext) -+ return 0; - return wpa_driver_wext_set_operstate(drv->wext, state); - } - -@@ -1733,7 +1511,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); - -@@ -1743,7 +1521,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) -@@ -1754,17 +1532,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; -@@ -1773,7 +1551,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: -@@ -1784,38 +1562,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, -@@ -1835,7 +1612,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, -@@ -1847,5 +1625,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/hostapd/patches/330-multicall_bridge_fix.patch b/package/hostapd/patches/330-multicall_bridge_fix.patch new file mode 100644 index 000000000..96456ea72 --- /dev/null +++ b/package/hostapd/patches/330-multicall_bridge_fix.patch @@ -0,0 +1,45 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -464,6 +464,10 @@ static void wpa_driver_nl80211_event_rtm + return; + } + ++ if (ifi->ifi_family == AF_BRIDGE && ++ drv->nlmode != NL80211_IFTYPE_AP) ++ return; ++ + wpa_printf(MSG_DEBUG, "RTM_NEWLINK: operstate=%d ifi_flags=0x%x " + "(%s%s%s%s)", + drv->operstate, ifi->ifi_flags, +@@ -535,6 +539,10 @@ static void wpa_driver_nl80211_event_rtm + attrlen = len; + attr = (struct rtattr *) buf; + ++ if (ifi->ifi_family == AF_BRIDGE && ++ drv->nlmode != NL80211_IFTYPE_AP) ++ return; ++ + rta_len = RTA_ALIGN(sizeof(struct rtattr)); + while (RTA_OK(attr, attrlen)) { + if (attr->rta_type == IFLA_IFNAME) { +@@ -1610,6 +1618,11 @@ static int wpa_driver_nl80211_capa(struc + drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CAPABLE; + drv->capa.max_remain_on_chan = info.max_remain_on_chan; + ++#ifdef HOSTAPD ++ drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int); ++ drv->if_indices = drv->default_if_indices; ++#endif ++ + return 0; + } + +@@ -5602,8 +5615,6 @@ static void *i802_init(struct hostapd_da + br_ifindex = 0; + } + +- drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int); +- drv->if_indices = drv->default_if_indices; + for (i = 0; i < params->num_bridge; i++) { + if (params->bridge[i]) { + ifindex = if_nametoindex(params->bridge[i]); diff --git a/package/hostapd/patches/340-madwifi_key_fixes.patch b/package/hostapd/patches/340-madwifi_key_fixes.patch new file mode 100644 index 000000000..ab4d0575e --- /dev/null +++ b/package/hostapd/patches/340-madwifi_key_fixes.patch @@ -0,0 +1,69 @@ +--- a/src/drivers/driver_madwifi.c ++++ b/src/drivers/driver_madwifi.c +@@ -439,7 +439,11 @@ madwifi_set_key(const char *ifname, void + __func__, alg, ether_sprintf(addr), key_idx); + + if (alg == WPA_ALG_WEP) ++ { + cipher = IEEE80211_CIPHER_WEP; ++ if ((!addr || !memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN)) && drv->wext) ++ return wpa_driver_wext_set_key(ifname, drv->wext, alg, addr, key_idx, set_tx, seq, seq_len, key, key_len); ++ } + else if (alg == WPA_ALG_TKIP) + cipher = IEEE80211_CIPHER_TKIP; + else if (alg == WPA_ALG_CCMP) +@@ -458,20 +462,45 @@ madwifi_set_key(const char *ifname, void + + memset(&wk, 0, sizeof(wk)); + wk.ik_type = cipher; +- wk.ik_flags = IEEE80211_KEY_RECV | IEEE80211_KEY_XMIT; +- if (addr == NULL || is_broadcast_ether_addr(addr)) { +- memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN); ++ wk.ik_flags = IEEE80211_KEY_RECV; ++ if (set_tx) ++ wk.ik_flags |= IEEE80211_KEY_XMIT; ++ if (addr == NULL) { ++ os_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; ++ os_memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN); ++ /* ++ * Deduce whether group/global or unicast key by checking ++ * the address (yech). Note also that we can only mark global ++ * keys default; doing this for a unicast key is an error. ++ */ ++ if (os_memcmp(addr, "\xff\xff\xff\xff\xff\xff", ++ IEEE80211_ADDR_LEN) == 0) { ++ wk.ik_flags |= IEEE80211_KEY_GROUP; ++ wk.ik_keyix = key_idx; ++ } else { ++ wk.ik_keyix = key_idx == 0 ? IEEE80211_KEYIX_NONE : ++ key_idx; ++ } + } ++ if (wk.ik_keyix != IEEE80211_KEYIX_NONE && set_tx) ++ wk.ik_flags |= IEEE80211_KEY_DEFAULT; + wk.ik_keylen = key_len; + memcpy(wk.ik_keydata, key, key_len); ++#ifdef WORDS_BIGENDIAN ++#define WPA_KEY_RSC_LEN 8 ++ { ++ 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 */ + + ret = set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk)); + if (ret < 0) { diff --git a/package/hostapd/patches/340-roboswitch_fix.patch b/package/hostapd/patches/340-roboswitch_fix.patch deleted file mode 100644 index 50dca64f1..000000000 --- a/package/hostapd/patches/340-roboswitch_fix.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/src/drivers/driver_roboswitch.c -+++ b/src/drivers/driver_roboswitch.c -@@ -14,10 +14,10 @@ - - #include "includes.h" - #include --#include - #include - #include - #include -+#include - - #include "common.h" - #include "driver.h" diff --git a/package/hostapd/patches/350-hostap_multicall_fix.patch b/package/hostapd/patches/350-hostap_multicall_fix.patch new file mode 100644 index 000000000..a4b6cc665 --- /dev/null +++ b/package/hostapd/patches/350-hostap_multicall_fix.patch @@ -0,0 +1,554 @@ +--- a/src/drivers/driver_hostap.c ++++ b/src/drivers/driver_hostap.c +@@ -22,9 +22,6 @@ + #include "eloop.h" + #include "driver_hostap.h" + +- +-#ifdef HOSTAPD +- + #include + #include + +@@ -42,10 +39,16 @@ + static const u8 rfc1042_header[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; + + struct hostap_driver_data { ++ void *wext; /* private data for driver_wext */ ++ void *ctx; ++ char ifname[IFNAMSIZ + 1]; ++ int sock; ++ int current_mode; /* infra/adhoc */ ++ ++#ifdef HOSTAPD + struct hostapd_data *hapd; + + char iface[IFNAMSIZ + 1]; +- int sock; /* raw packet socket for driver access */ + int ioctl_sock; /* socket for ioctl() use */ + struct netlink_data *netlink; + +@@ -55,9 +58,11 @@ struct hostap_driver_data { + size_t generic_ie_len; + u8 *wps_ie; + size_t wps_ie_len; ++#endif + }; + + ++#ifdef HOSTAPD + static int hostapd_ioctl(void *priv, struct prism2_hostapd_param *param, + int len); + static int hostap_set_iface_flags(void *priv, int dev_up); +@@ -399,65 +404,6 @@ static int hostapd_ioctl(void *priv, str + } + + +-static int wpa_driver_hostap_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 hostap_driver_data *drv = priv; +- struct prism2_hostapd_param *param; +- u8 *buf; +- size_t blen; +- int ret = 0; +- +- blen = sizeof(*param) + key_len; +- buf = os_zalloc(blen); +- if (buf == NULL) +- return -1; +- +- param = (struct prism2_hostapd_param *) buf; +- param->cmd = PRISM2_SET_ENCRYPTION; +- if (addr == NULL) +- memset(param->sta_addr, 0xff, ETH_ALEN); +- else +- memcpy(param->sta_addr, addr, ETH_ALEN); +- switch (alg) { +- case WPA_ALG_NONE: +- os_strlcpy((char *) param->u.crypt.alg, "NONE", +- HOSTAP_CRYPT_ALG_NAME_LEN); +- break; +- case WPA_ALG_WEP: +- os_strlcpy((char *) param->u.crypt.alg, "WEP", +- HOSTAP_CRYPT_ALG_NAME_LEN); +- break; +- case WPA_ALG_TKIP: +- os_strlcpy((char *) param->u.crypt.alg, "TKIP", +- HOSTAP_CRYPT_ALG_NAME_LEN); +- break; +- case WPA_ALG_CCMP: +- os_strlcpy((char *) param->u.crypt.alg, "CCMP", +- HOSTAP_CRYPT_ALG_NAME_LEN); +- break; +- default: +- os_free(buf); +- return -1; +- } +- param->u.crypt.flags = set_tx ? HOSTAP_CRYPT_FLAG_SET_TX_KEY : 0; +- param->u.crypt.idx = key_idx; +- param->u.crypt.key_len = key_len; +- memcpy((u8 *) (param + 1), key, key_len); +- +- if (hostapd_ioctl(drv, param, blen)) { +- printf("Failed to set encryption.\n"); +- ret = -1; +- } +- free(buf); +- +- return ret; +-} +- +- + static int hostap_get_seqnum(const char *ifname, void *priv, const u8 *addr, + int idx, u8 *seq) + { +@@ -1125,21 +1071,9 @@ static struct hostapd_hw_modes * hostap_ + return mode; + } + +-#else /* HOSTAPD */ +- +-struct wpa_driver_hostap_data { +- void *wext; /* private data for driver_wext */ +- void *ctx; +- char ifname[IFNAMSIZ + 1]; +- int sock; +- int current_mode; /* infra/adhoc */ +-}; +- +- +-static int wpa_driver_hostap_set_auth_alg(void *priv, int auth_alg); +- ++#endif /* HOSTAPD */ + +-static int hostapd_ioctl(struct wpa_driver_hostap_data *drv, ++static int wpa_hostapd_ioctl(struct hostap_driver_data *drv, + struct prism2_hostapd_param *param, + int len, int show_err) + { +@@ -1161,7 +1095,12 @@ static int hostapd_ioctl(struct wpa_driv + } + + +-static int wpa_driver_hostap_set_wpa_ie(struct wpa_driver_hostap_data *drv, ++#if !defined(NO_SUPPLICANT) ++ ++static int wpa_driver_hostap_set_auth_alg(void *priv, int auth_alg); ++ ++ ++static int wpa_driver_hostap_set_wpa_ie(struct hostap_driver_data *drv, + const u8 *wpa_ie, size_t wpa_ie_len) + { + struct prism2_hostapd_param *param; +@@ -1177,7 +1116,7 @@ static int wpa_driver_hostap_set_wpa_ie( + param->cmd = PRISM2_HOSTAPD_SET_GENERIC_ELEMENT; + param->u.generic_elem.len = wpa_ie_len; + os_memcpy(param->u.generic_elem.data, wpa_ie, wpa_ie_len); +- res = hostapd_ioctl(drv, param, blen, 1); ++ res = wpa_hostapd_ioctl(drv, param, blen, 1); + + os_free(param); + +@@ -1185,7 +1124,7 @@ static int wpa_driver_hostap_set_wpa_ie( + } + + +-static int prism2param(struct wpa_driver_hostap_data *drv, int param, ++static int prism2param(struct hostap_driver_data *drv, int param, + int value) + { + struct iwreq iwr; +@@ -1207,7 +1146,7 @@ static int prism2param(struct wpa_driver + + static int wpa_driver_hostap_set_wpa(void *priv, int enabled) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + int ret = 0; + + wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled); +@@ -1223,125 +1162,15 @@ static int wpa_driver_hostap_set_wpa(voi + } + + +-static void show_set_key_error(struct prism2_hostapd_param *param) +-{ +- switch (param->u.crypt.err) { +- case HOSTAP_CRYPT_ERR_UNKNOWN_ALG: +- wpa_printf(MSG_INFO, "Unknown algorithm '%s'.", +- param->u.crypt.alg); +- wpa_printf(MSG_INFO, "You may need to load kernel module to " +- "register that algorithm."); +- wpa_printf(MSG_INFO, "E.g., 'modprobe hostap_crypt_wep' for " +- "WEP."); +- break; +- case HOSTAP_CRYPT_ERR_UNKNOWN_ADDR: +- wpa_printf(MSG_INFO, "Unknown address " MACSTR ".", +- MAC2STR(param->sta_addr)); +- break; +- case HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED: +- wpa_printf(MSG_INFO, "Crypt algorithm initialization failed."); +- break; +- case HOSTAP_CRYPT_ERR_KEY_SET_FAILED: +- wpa_printf(MSG_INFO, "Key setting failed."); +- break; +- case HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED: +- wpa_printf(MSG_INFO, "TX key index setting failed."); +- break; +- case HOSTAP_CRYPT_ERR_CARD_CONF_FAILED: +- wpa_printf(MSG_INFO, "Card configuration failed."); +- break; +- } +-} +- +- +-static int wpa_driver_hostap_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_hostap_data *drv = priv; +- struct prism2_hostapd_param *param; +- u8 *buf; +- size_t blen; +- int ret = 0; +- char *alg_name; +- +- switch (alg) { +- case WPA_ALG_NONE: +- alg_name = "none"; +- break; +- case WPA_ALG_WEP: +- alg_name = "WEP"; +- break; +- case WPA_ALG_TKIP: +- alg_name = "TKIP"; +- break; +- case WPA_ALG_CCMP: +- alg_name = "CCMP"; +- break; +- default: +- 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 > 8) +- return -2; +- +- blen = sizeof(*param) + key_len; +- buf = os_zalloc(blen); +- if (buf == NULL) +- return -1; +- +- param = (struct prism2_hostapd_param *) buf; +- param->cmd = PRISM2_SET_ENCRYPTION; +- /* TODO: In theory, STA in client mode can use five keys; four default +- * keys for receiving (with keyidx 0..3) and one individual key for +- * both transmitting and receiving (keyidx 0) _unicast_ packets. Now, +- * keyidx 0 is reserved for this unicast use and default keys can only +- * use keyidx 1..3 (i.e., default key with keyidx 0 is not supported). +- * This should be fine for more or less all cases, but for completeness +- * sake, the driver could be enhanced to support the missing key. */ +-#if 0 +- if (addr == NULL) +- os_memset(param->sta_addr, 0xff, ETH_ALEN); +- else +- os_memcpy(param->sta_addr, addr, ETH_ALEN); +-#else +- os_memset(param->sta_addr, 0xff, ETH_ALEN); +-#endif +- os_strlcpy((char *) param->u.crypt.alg, alg_name, +- HOSTAP_CRYPT_ALG_NAME_LEN); +- param->u.crypt.flags = set_tx ? HOSTAP_CRYPT_FLAG_SET_TX_KEY : 0; +- param->u.crypt.idx = key_idx; +- if (seq) +- os_memcpy(param->u.crypt.seq, seq, seq_len); +- param->u.crypt.key_len = key_len; +- os_memcpy((u8 *) (param + 1), key, key_len); +- +- if (hostapd_ioctl(drv, param, blen, 1)) { +- wpa_printf(MSG_WARNING, "Failed to set encryption."); +- show_set_key_error(param); +- ret = -1; +- } +- os_free(buf); +- +- return ret; +-} +- +- + static int wpa_driver_hostap_set_countermeasures(void *priv, int enabled) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled); + return prism2param(drv, PRISM2_PARAM_TKIP_COUNTERMEASURES, enabled); + } + + +-static int wpa_driver_hostap_reset(struct wpa_driver_hostap_data *drv, ++static int wpa_driver_hostap_reset(struct hostap_driver_data *drv, + int type) + { + struct iwreq iwr; +@@ -1362,7 +1191,7 @@ static int wpa_driver_hostap_reset(struc + } + + +-static int wpa_driver_hostap_mlme(struct wpa_driver_hostap_data *drv, ++static int wpa_driver_hostap_mlme(struct hostap_driver_data *drv, + const u8 *addr, int cmd, int reason_code) + { + struct prism2_hostapd_param param; +@@ -1377,7 +1206,7 @@ static int wpa_driver_hostap_mlme(struct + os_memcpy(param.sta_addr, addr, ETH_ALEN); + param.u.mlme.cmd = cmd; + param.u.mlme.reason_code = reason_code; +- ret = hostapd_ioctl(drv, ¶m, sizeof(param), 1); ++ ret = wpa_hostapd_ioctl(drv, ¶m, sizeof(param), 1); + if (ret == 0) { + os_sleep(0, 100000); + ret = wpa_driver_hostap_reset(drv, 2); +@@ -1389,7 +1218,7 @@ static int wpa_driver_hostap_mlme(struct + static int wpa_driver_hostap_deauthenticate(void *priv, const u8 *addr, + int reason_code) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + wpa_printf(MSG_DEBUG, "%s", __FUNCTION__); + return wpa_driver_hostap_mlme(drv, addr, MLME_STA_DEAUTH, + reason_code); +@@ -1399,7 +1228,7 @@ static int wpa_driver_hostap_deauthentic + static int wpa_driver_hostap_disassociate(void *priv, const u8 *addr, + int reason_code) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + wpa_printf(MSG_DEBUG, "%s", __FUNCTION__); + return wpa_driver_hostap_mlme(drv, addr, MLME_STA_DISASSOC, + reason_code); +@@ -1410,7 +1239,7 @@ static int + wpa_driver_hostap_associate(void *priv, + struct wpa_driver_associate_params *params) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + int ret = 0; + int allow_unencrypted_eapol; + +@@ -1474,7 +1303,7 @@ wpa_driver_hostap_associate(void *priv, + static int wpa_driver_hostap_scan(void *priv, + struct wpa_driver_scan_params *params) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + struct prism2_hostapd_param param; + int ret; + const u8 *ssid = params->ssids[0].ssid; +@@ -1495,7 +1324,7 @@ static int wpa_driver_hostap_scan(void * + param.cmd = PRISM2_HOSTAPD_SCAN_REQ; + param.u.scan_req.ssid_len = ssid_len; + os_memcpy(param.u.scan_req.ssid, ssid, ssid_len); +- ret = hostapd_ioctl(drv, ¶m, sizeof(param), 1); ++ ret = wpa_hostapd_ioctl(drv, ¶m, sizeof(param), 1); + + /* Not all drivers generate "scan completed" wireless event, so try to + * read results after a timeout. */ +@@ -1510,7 +1339,7 @@ static int wpa_driver_hostap_scan(void * + + static int wpa_driver_hostap_set_auth_alg(void *priv, int auth_alg) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + int algs = 0; + + if (auth_alg & WPA_AUTH_ALG_OPEN) +@@ -1528,35 +1357,35 @@ static int wpa_driver_hostap_set_auth_al + + static int wpa_driver_hostap_get_bssid(void *priv, u8 *bssid) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + return wpa_driver_wext_get_bssid(drv->wext, bssid); + } + + + static int wpa_driver_hostap_get_ssid(void *priv, u8 *ssid) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + return wpa_driver_wext_get_ssid(drv->wext, ssid); + } + + + static struct wpa_scan_results * wpa_driver_hostap_get_scan_results(void *priv) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + return wpa_driver_wext_get_scan_results(drv->wext); + } + + + static int wpa_driver_hostap_set_operstate(void *priv, int state) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + return wpa_driver_wext_set_operstate(drv->wext, state); + } + + + static void * wpa_driver_hostap_init(void *ctx, const char *ifname) + { +- struct wpa_driver_hostap_data *drv; ++ struct hostap_driver_data *drv; + + drv = os_zalloc(sizeof(*drv)); + if (drv == NULL) +@@ -1596,14 +1425,120 @@ static void * wpa_driver_hostap_init(voi + + static void wpa_driver_hostap_deinit(void *priv) + { +- struct wpa_driver_hostap_data *drv = priv; ++ struct hostap_driver_data *drv = priv; + wpa_driver_hostap_set_wpa(drv, 0); + wpa_driver_wext_deinit(drv->wext); + close(drv->sock); + os_free(drv); + } + +-#endif /* HOSTAPD */ ++#endif ++ ++ ++static void show_set_key_error(struct prism2_hostapd_param *param) ++{ ++ switch (param->u.crypt.err) { ++ case HOSTAP_CRYPT_ERR_UNKNOWN_ALG: ++ wpa_printf(MSG_INFO, "Unknown algorithm '%s'.", ++ param->u.crypt.alg); ++ wpa_printf(MSG_INFO, "You may need to load kernel module to " ++ "register that algorithm."); ++ wpa_printf(MSG_INFO, "E.g., 'modprobe hostap_crypt_wep' for " ++ "WEP."); ++ break; ++ case HOSTAP_CRYPT_ERR_UNKNOWN_ADDR: ++ wpa_printf(MSG_INFO, "Unknown address " MACSTR ".", ++ MAC2STR(param->sta_addr)); ++ break; ++ case HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED: ++ wpa_printf(MSG_INFO, "Crypt algorithm initialization failed."); ++ break; ++ case HOSTAP_CRYPT_ERR_KEY_SET_FAILED: ++ wpa_printf(MSG_INFO, "Key setting failed."); ++ break; ++ case HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED: ++ wpa_printf(MSG_INFO, "TX key index setting failed."); ++ break; ++ case HOSTAP_CRYPT_ERR_CARD_CONF_FAILED: ++ wpa_printf(MSG_INFO, "Card configuration failed."); ++ break; ++ } ++} ++ ++ ++static int wpa_driver_hostap_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 hostap_driver_data *drv = priv; ++ struct prism2_hostapd_param *param; ++ u8 *buf; ++ size_t blen; ++ int ret = 0; ++ char *alg_name; ++ ++ switch (alg) { ++ case WPA_ALG_NONE: ++ alg_name = "none"; ++ break; ++ case WPA_ALG_WEP: ++ alg_name = "WEP"; ++ break; ++ case WPA_ALG_TKIP: ++ alg_name = "TKIP"; ++ break; ++ case WPA_ALG_CCMP: ++ alg_name = "CCMP"; ++ break; ++ default: ++ 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 > 8) ++ return -2; ++ ++ blen = sizeof(*param) + key_len; ++ buf = os_zalloc(blen); ++ if (buf == NULL) ++ return -1; ++ ++ param = (struct prism2_hostapd_param *) buf; ++ param->cmd = PRISM2_SET_ENCRYPTION; ++ /* TODO: In theory, STA in client mode can use five keys; four default ++ * keys for receiving (with keyidx 0..3) and one individual key for ++ * both transmitting and receiving (keyidx 0) _unicast_ packets. Now, ++ * keyidx 0 is reserved for this unicast use and default keys can only ++ * use keyidx 1..3 (i.e., default key with keyidx 0 is not supported). ++ * This should be fine for more or less all cases, but for completeness ++ * sake, the driver could be enhanced to support the missing key. */ ++ if (addr == NULL) ++ os_memset(param->sta_addr, 0xff, ETH_ALEN); ++ else ++ os_memcpy(param->sta_addr, addr, ETH_ALEN); ++ os_strlcpy((char *) param->u.crypt.alg, alg_name, ++ HOSTAP_CRYPT_ALG_NAME_LEN); ++ param->u.crypt.flags = set_tx ? HOSTAP_CRYPT_FLAG_SET_TX_KEY : 0; ++ param->u.crypt.idx = key_idx; ++ if (seq) ++ os_memcpy(param->u.crypt.seq, seq, seq_len); ++ param->u.crypt.key_len = key_len; ++ os_memcpy((u8 *) (param + 1), key, key_len); ++ ++ if (wpa_hostapd_ioctl(drv, param, blen, 1)) { ++ wpa_printf(MSG_WARNING, "Failed to set encryption."); ++ show_set_key_error(param); ++ ret = -1; ++ } ++ os_free(buf); ++ ++ return ret; ++} + + + const struct wpa_driver_ops wpa_driver_hostap_ops = { +@@ -1631,7 +1566,8 @@ const struct wpa_driver_ops wpa_driver_h + .sta_clear_stats = hostap_sta_clear_stats, + .get_hw_feature_data = hostap_get_hw_feature_data, + .set_ap_wps_ie = hostap_set_ap_wps_ie, +-#else /* HOSTAPD */ ++#endif /* HOSTAPD */ ++#if !defined(NO_SUPPLICANT) + .get_bssid = wpa_driver_hostap_get_bssid, + .get_ssid = wpa_driver_hostap_get_ssid, + .set_countermeasures = wpa_driver_hostap_set_countermeasures, +@@ -1643,5 +1579,5 @@ const struct wpa_driver_ops wpa_driver_h + .init = wpa_driver_hostap_init, + .deinit = wpa_driver_hostap_deinit, + .set_operstate = wpa_driver_hostap_set_operstate, +-#endif /* HOSTAPD */ ++#endif + }; diff --git a/package/hostapd/patches/350-wds_fix.patch b/package/hostapd/patches/350-wds_fix.patch deleted file mode 100644 index 3a3ee000a..000000000 --- a/package/hostapd/patches/350-wds_fix.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -4652,9 +4652,11 @@ static int i802_set_wds_sta(void *priv, - wpa_printf(MSG_DEBUG, "nl80211: Set WDS STA addr=" MACSTR - " aid=%d val=%d name=%s", MAC2STR(addr), aid, val, name); - if (val) { -- if (nl80211_create_iface(drv, name, NL80211_IFTYPE_AP_VLAN, -+ if (!if_nametoindex(name)) { -+ if (nl80211_create_iface(drv, name, NL80211_IFTYPE_AP_VLAN, - NULL, 1) < 0) -- return -1; -+ return -1; -+ } - linux_set_iface_flags(drv->ioctl_sock, name, 1); - return i802_set_sta_vlan(priv, addr, name, 0); - } else { ---- a/src/ap/ieee802_11.c -+++ b/src/ap/ieee802_11.c -@@ -1627,6 +1627,9 @@ static void handle_assoc_cb(struct hosta - "Could not add STA to kernel driver"); - } - -+ if (sta->flags & WLAN_STA_WDS) -+ hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 1); -+ - if (sta->eapol_sm == NULL) { - /* - * This STA does not use RADIUS server for EAP authentication, diff --git a/package/hostapd/patches/360-wds_bridge.patch b/package/hostapd/patches/360-wds_bridge.patch deleted file mode 100644 index 4cc60de06..000000000 --- a/package/hostapd/patches/360-wds_bridge.patch +++ /dev/null @@ -1,75 +0,0 @@ ---- a/src/ap/ap_config.h -+++ b/src/ap/ap_config.h -@@ -148,6 +148,7 @@ struct hostapd_wmm_ac_params { - struct hostapd_bss_config { - char iface[IFNAMSIZ + 1]; - char bridge[IFNAMSIZ + 1]; -+ char wds_bridge[IFNAMSIZ + 1]; - - enum hostapd_logger_level logger_syslog_level, logger_stdout_level; - ---- a/hostapd/config_file.c -+++ b/hostapd/config_file.c -@@ -1193,6 +1193,8 @@ struct hostapd_config * hostapd_config_r - sizeof(conf->bss[0].iface)); - } else if (os_strcmp(buf, "bridge") == 0) { - os_strlcpy(bss->bridge, pos, sizeof(bss->bridge)); -+ } else if (os_strcmp(buf, "wds_bridge") == 0) { -+ os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge)); - } else if (os_strcmp(buf, "driver") == 0) { - int j; - /* clear to get error below if setting is invalid */ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -4642,7 +4642,8 @@ static int i802_set_sta_vlan(void *priv, - } - - --static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val) -+static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val, -+ const char *bridge_ifname) - { - struct i802_bss *bss = priv; - struct wpa_driver_nl80211_data *drv = bss->drv; -@@ -4656,6 +4657,10 @@ static int i802_set_wds_sta(void *priv, - if (nl80211_create_iface(drv, name, NL80211_IFTYPE_AP_VLAN, - NULL, 1) < 0) - return -1; -+ if (bridge_ifname) { -+ if (linux_br_add_if(drv->ioctl_sock, bridge_ifname, name) < 0) -+ return -1; -+ } - } - linux_set_iface_flags(drv->ioctl_sock, name, 1); - return i802_set_sta_vlan(priv, addr, name, 0); ---- a/src/ap/ap_drv_ops.c -+++ b/src/ap/ap_drv_ops.c -@@ -265,9 +265,15 @@ static int hostapd_vlan_if_remove(struct - static int hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr, - int aid, int val) - { -+ const char *bridge = NULL; -+ - if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL) - return 0; -- return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val); -+ if (hapd->conf->wds_bridge[0]) -+ bridge = hapd->conf->wds_bridge; -+ else if (hapd->conf->bridge[0]) -+ bridge = hapd->conf->bridge; -+ return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val, bridge); - } - - ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -1622,7 +1622,8 @@ struct wpa_driver_ops { - * @val: 1 = bind to 4-address WDS; 0 = unbind - * Returns: 0 on success, -1 on failure - */ -- int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val); -+ int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val, -+ const char *bridge_ifname); - - /** - * send_action - Transmit an Action frame diff --git a/package/hostapd/patches/370-basic_rates.patch b/package/hostapd/patches/370-basic_rates.patch deleted file mode 100644 index 6c3fafe83..000000000 --- a/package/hostapd/patches/370-basic_rates.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -716,6 +716,16 @@ int hostapd_setup_interface_complete(str - } - } - -+ if (iface->current_mode) { -+ if (hostapd_prepare_rates(hapd, iface->current_mode)) { -+ wpa_printf(MSG_ERROR, "Failed to prepare rates table."); -+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_WARNING, -+ "Failed to prepare rates table."); -+ return -1; -+ } -+ } -+ - if (hapd->iconf->rts_threshold > -1 && - hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) { - wpa_printf(MSG_ERROR, "Could not set RTS threshold for " ---- a/src/ap/hw_features.c -+++ b/src/ap/hw_features.c -@@ -101,8 +101,8 @@ int hostapd_get_hw_features(struct hosta - } - - --static int hostapd_prepare_rates(struct hostapd_data *hapd, -- struct hostapd_hw_modes *mode) -+int hostapd_prepare_rates(struct hostapd_data *hapd, -+ struct hostapd_hw_modes *mode) - { - int i, num_basic_rates = 0; - int basic_rates_a[] = { 60, 120, 240, -1 }; -@@ -668,14 +668,6 @@ int hostapd_select_hw_mode(struct hostap - return -1; - } - -- if (hostapd_prepare_rates(iface->bss[0], iface->current_mode)) { -- wpa_printf(MSG_ERROR, "Failed to prepare rates table."); -- hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211, -- HOSTAPD_LEVEL_WARNING, -- "Failed to prepare rates table."); -- return -1; -- } -- - return 0; - } - ---- a/src/ap/hw_features.h -+++ b/src/ap/hw_features.h -@@ -25,6 +25,8 @@ const char * hostapd_hw_mode_txt(int mod - int hostapd_hw_get_freq(struct hostapd_data *hapd, int chan); - int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq); - int hostapd_check_ht_capab(struct hostapd_iface *iface); -+int hostapd_prepare_rates(struct hostapd_data *hapd, -+ struct hostapd_hw_modes *mode); - #else /* NEED_AP_MLME */ - static inline void - hostapd_free_hw_features(struct hostapd_hw_modes *hw_features, -@@ -56,6 +58,11 @@ static inline int hostapd_check_ht_capab - { - return 0; - } -+static inline int hostapd_prepare_rates(struct hostapd_data *hapd, -+ struct hostapd_hw_modes *mode) -+{ -+ return 0; -+} - - #endif /* NEED_AP_MLME */ - diff --git a/package/hostapd/patches/380-ap_isolate.patch b/package/hostapd/patches/380-ap_isolate.patch deleted file mode 100644 index 12fbdc86b..000000000 --- a/package/hostapd/patches/380-ap_isolate.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- a/hostapd/config_file.c -+++ b/hostapd/config_file.c -@@ -1266,6 +1266,8 @@ struct hostapd_config * hostapd_config_r - } - } else if (os_strcmp(buf, "wds_sta") == 0) { - bss->wds_sta = atoi(pos); -+ } else if (os_strcmp(buf, "ap_isolate") == 0) { -+ bss->isolate = atoi(pos); - } else if (os_strcmp(buf, "ap_max_inactivity") == 0) { - bss->ap_max_inactivity = atoi(pos); - } else if (os_strcmp(buf, "country_code") == 0) { ---- a/src/ap/ap_config.h -+++ b/src/ap/ap_config.h -@@ -199,6 +199,7 @@ struct hostapd_bss_config { - struct mac_acl_entry *deny_mac; - int num_deny_mac; - int wds_sta; -+ int isolate; - - int auth_algs; /* bitfield of allowed IEEE 802.11 authentication - * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */ ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -1626,6 +1626,14 @@ struct wpa_driver_ops { - const char *bridge_ifname); - - /** -+ * set_ap_isolate - Enable/disable AP isolation -+ * @priv: private driver interface data -+ * @val: 1 = enabled; 0 = disabled -+ * Returns: 0 on success, -1 on failure -+ */ -+ int (*set_ap_isolate)(void *priv, int val); -+ -+ /** - * send_action - Transmit an Action frame - * @priv: Private driver interface data - * @freq: Frequency (in MHz) of the channel ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -4339,6 +4339,29 @@ static int i802_set_rate_sets(void *priv - return -ENOBUFS; - } - -+static int i802_set_ap_isolate(void *priv, int val) -+{ -+ struct i802_bss *bss = priv; -+ struct wpa_driver_nl80211_data *drv = bss->drv; -+ struct nl_msg *msg; -+ int i; -+ -+ msg = nlmsg_alloc(); -+ if (!msg) -+ return -ENOMEM; -+ -+ genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0, -+ NL80211_CMD_SET_BSS, 0); -+ -+ NLA_PUT_U8(msg, NL80211_ATTR_AP_ISOLATE, !!val); -+ -+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname)); -+ -+ return send_and_recv_msgs(drv, msg, NULL, NULL); -+ nla_put_failure: -+ return -ENOBUFS; -+} -+ - #endif /* HOSTAPD */ - - -@@ -5448,6 +5471,7 @@ const struct wpa_driver_ops wpa_driver_n - .set_tx_queue_params = i802_set_tx_queue_params, - .set_sta_vlan = i802_set_sta_vlan, - .set_wds_sta = i802_set_wds_sta, -+ .set_ap_isolate = i802_set_ap_isolate, - #endif /* HOSTAPD */ - .set_freq = i802_set_freq, - .send_action = wpa_driver_nl80211_send_action, ---- a/src/ap/ap_drv_ops.c -+++ b/src/ap/ap_drv_ops.c -@@ -180,6 +180,14 @@ static int hostapd_set_radius_acl_expire - } - - -+static int hostapd_set_ap_isolate(struct hostapd_data *hapd, int value) -+{ -+ if (hapd->driver == NULL || hapd->driver->set_ap_isolate == NULL) -+ return 0; -+ hapd->driver->set_ap_isolate(hapd->drv_priv, value); -+} -+ -+ - static int hostapd_set_bss_params(struct hostapd_data *hapd, - int use_protection) - { -@@ -229,6 +237,12 @@ static int hostapd_set_bss_params(struct - "driver"); - ret = -1; - } -+ if (hostapd_set_ap_isolate(hapd, hapd->conf->isolate) && -+ !hapd->conf->isolate) { -+ wpa_printf(MSG_ERROR, "Could not enable AP isolation in " -+ "kernel driver"); -+ ret = -1; -+ } - - return ret; - } diff --git a/package/hostapd/patches/390-nl80211_fixes.patch b/package/hostapd/patches/390-nl80211_fixes.patch deleted file mode 100644 index 20c603252..000000000 --- a/package/hostapd/patches/390-nl80211_fixes.patch +++ /dev/null @@ -1,124 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -1135,7 +1135,6 @@ nla_put_failure: - } - - --#ifndef HOSTAPD - struct wiphy_info_data { - int max_scan_ssids; - int ap_supported; -@@ -1247,7 +1246,6 @@ static int wpa_driver_nl80211_capa(struc - - return 0; - } --#endif /* HOSTAPD */ - - - static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv, -@@ -1411,6 +1409,7 @@ static void * wpa_driver_nl80211_init(vo - drv->monitor_ifidx = -1; - drv->monitor_sock = -1; - drv->ioctl_sock = -1; -+ drv->nlmode = NL80211_IFTYPE_STATION; - - if (wpa_driver_nl80211_init_nl(drv, ctx)) { - os_free(drv); -@@ -1530,32 +1529,32 @@ wpa_driver_nl80211_finish_drv_init(struc - drv->ifindex = if_nametoindex(bss->ifname); - drv->first_bss.ifindex = drv->ifindex; - --#ifndef HOSTAPD -- if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) { -- wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to " -- "use managed mode"); -- } -+ if (drv->nlmode == NL80211_IFTYPE_STATION) { -+ if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) { -+ wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to " -+ "use managed mode"); -+ } - -- if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { -- if (rfkill_is_blocked(drv->rfkill)) { -- wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " -- "interface '%s' due to rfkill", -- bss->ifname); -- drv->if_disabled = 1; -- send_rfkill_event = 1; -- } else { -- wpa_printf(MSG_ERROR, "nl80211: Could not set " -- "interface '%s' UP", bss->ifname); -- return -1; -+ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { -+ if (rfkill_is_blocked(drv->rfkill)) { -+ wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " -+ "interface '%s' due to rfkill", -+ bss->ifname); -+ drv->if_disabled = 1; -+ send_rfkill_event = 1; -+ } else { -+ wpa_printf(MSG_ERROR, "nl80211: Could not set " -+ "interface '%s' UP", bss->ifname); -+ return -1; -+ } - } -- } - -- if (wpa_driver_nl80211_capa(drv)) -- return -1; -+ if (wpa_driver_nl80211_capa(drv)) -+ return -1; - -- netlink_send_oper_ifla(drv->netlink, drv->ifindex, -- 1, IF_OPER_DORMANT); --#endif /* HOSTAPD */ -+ netlink_send_oper_ifla(drv->netlink, drv->ifindex, -+ 1, IF_OPER_DORMANT); -+ } - - if (nl80211_register_action_frames(drv) < 0) { - wpa_printf(MSG_DEBUG, "nl80211: Failed to register Action " -@@ -2219,13 +2218,9 @@ static int wpa_driver_nl80211_set_key(co - */ - if (ret || !set_tx || alg == WPA_ALG_NONE) - return ret; --#ifdef HOSTAPD -- if (addr) -- return ret; --#else /* HOSTAPD */ -+ - if (drv->nlmode == NL80211_IFTYPE_AP && addr) - return ret; --#endif /* HOSTAPD */ - - msg = nlmsg_alloc(); - if (!msg) -@@ -3066,7 +3061,8 @@ static void nl80211_remove_iface(struct - - #ifdef HOSTAPD - /* stop listening for EAPOL on this interface */ -- del_ifidx(drv, ifidx); -+ if (drv->nlmode == NL80211_IFTYPE_AP) -+ del_ifidx(drv, ifidx); - #endif /* HOSTAPD */ - - msg = nlmsg_alloc(); -@@ -3139,7 +3135,8 @@ static int nl80211_create_iface_once(str - - #ifdef HOSTAPD - /* start listening for EAPOL on this interface */ -- add_ifidx(drv, ifidx); -+ if (drv->nlmode == NL80211_IFTYPE_AP) -+ add_ifidx(drv, ifidx); - #endif /* HOSTAPD */ - - if (addr && iftype != NL80211_IFTYPE_MONITOR && -@@ -4842,6 +4839,7 @@ static void *i802_init(struct hostapd_da - return NULL; - - drv = bss->drv; -+ drv->nlmode = NL80211_IFTYPE_AP; - if (linux_br_get(brname, params->ifname) == 0) { - wpa_printf(MSG_DEBUG, "nl80211: Interface %s is in bridge %s", - params->ifname, brname); diff --git a/package/hostapd/patches/400-nl80211_sta_auth.patch b/package/hostapd/patches/400-nl80211_sta_auth.patch deleted file mode 100644 index 41c68c093..000000000 --- a/package/hostapd/patches/400-nl80211_sta_auth.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/wpa_supplicant/wpa_supplicant.c -+++ b/wpa_supplicant/wpa_supplicant.c -@@ -545,10 +545,16 @@ void wpa_supplicant_set_state(struct wpa - wpa_s->reassociated_connection = 1; - wpa_drv_set_operstate(wpa_s, 1); - wpa_s->after_wps = 0; -+#ifndef IEEE8021X_EAPOL -+ wpa_drv_set_supp_port(wpa_s, 1); -+#endif - } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || - state == WPA_ASSOCIATED) { - wpa_s->new_connection = 1; - wpa_drv_set_operstate(wpa_s, 0); -+#ifndef IEEE8021X_EAPOL -+ wpa_drv_set_supp_port(wpa_s, 0); -+#endif - } - wpa_s->wpa_state = state; - diff --git a/package/hostapd/patches/410-no_rfkill.patch b/package/hostapd/patches/410-no_rfkill.patch deleted file mode 100644 index f7e8bc057..000000000 --- a/package/hostapd/patches/410-no_rfkill.patch +++ /dev/null @@ -1,263 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -75,7 +75,9 @@ struct wpa_driver_nl80211_data { - int ifindex; - int if_removed; - int if_disabled; -+#ifdef CONFIG_RFKILL - struct rfkill_data *rfkill; -+#endif - struct wpa_driver_capa capa; - int has_capability; - -@@ -1361,7 +1363,7 @@ err1: - return -1; - } - -- -+#ifdef CONFIG_RFKILL - static void wpa_driver_nl80211_rfkill_blocked(void *ctx) - { - wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked"); -@@ -1383,6 +1385,7 @@ static void wpa_driver_nl80211_rfkill_un - } - /* rtnetlink ifup handler will report interface as enabled */ - } -+#endif /* CONFIG_RFKILL */ - - - /** -@@ -1396,7 +1399,9 @@ static void * wpa_driver_nl80211_init(vo - { - struct wpa_driver_nl80211_data *drv; - struct netlink_config *cfg; -+#ifdef CONFIG_RFKILL - struct rfkill_config *rcfg; -+#endif - struct i802_bss *bss; - - drv = os_zalloc(sizeof(*drv)); -@@ -1434,6 +1439,7 @@ static void * wpa_driver_nl80211_init(vo - goto failed; - } - -+#ifdef CONFIG_RFKILL - rcfg = os_zalloc(sizeof(*rcfg)); - if (rcfg == NULL) - goto failed; -@@ -1446,6 +1452,7 @@ static void * wpa_driver_nl80211_init(vo - wpa_printf(MSG_DEBUG, "nl80211: RFKILL status not available"); - os_free(rcfg); - } -+#endif /* CONFIG_RFKILL */ - - if (wpa_driver_nl80211_finish_drv_init(drv)) - goto failed; -@@ -1453,7 +1460,9 @@ static void * wpa_driver_nl80211_init(vo - return bss; - - failed: -+#ifdef CONFIG_RFKILL - rfkill_deinit(drv->rfkill); -+#endif - netlink_deinit(drv->netlink); - if (drv->ioctl_sock >= 0) - close(drv->ioctl_sock); -@@ -1514,10 +1523,12 @@ static int nl80211_register_action_frame - } - - -+#ifdef CONFIG_RFKILL - static void wpa_driver_nl80211_send_rfkill(void *eloop_ctx, void *timeout_ctx) - { - wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL); - } -+#endif /* CONFIG_RFKILL */ - - - static int -@@ -1536,13 +1547,16 @@ wpa_driver_nl80211_finish_drv_init(struc - } - - if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { -+#ifdef CONFIG_RFKILL - if (rfkill_is_blocked(drv->rfkill)) { - wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " - "interface '%s' due to rfkill", - bss->ifname); - drv->if_disabled = 1; - send_rfkill_event = 1; -- } else { -+ } else -+#endif -+ { - wpa_printf(MSG_ERROR, "nl80211: Could not set " - "interface '%s' UP", bss->ifname); - return -1; -@@ -1567,8 +1581,10 @@ wpa_driver_nl80211_finish_drv_init(struc - } - - if (send_rfkill_event) { -+#ifdef CONFIG_RFKILL - eloop_register_timeout(0, 0, wpa_driver_nl80211_send_rfkill, - drv, drv->ctx); -+#endif - } - - return 0; -@@ -1647,7 +1663,9 @@ static void wpa_driver_nl80211_deinit(vo - - netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP); - netlink_deinit(drv->netlink); -+#ifdef CONFIG_RFKILL - rfkill_deinit(drv->rfkill); -+#endif - - eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx); - ---- a/src/drivers/driver_wext.c -+++ b/src/drivers/driver_wext.c -@@ -700,7 +700,7 @@ static void wpa_driver_wext_event_rtm_de - } - } - -- -+#ifdef CONFIG_RFKILL - static void wpa_driver_wext_rfkill_blocked(void *ctx) - { - wpa_printf(MSG_DEBUG, "WEXT: RFKILL blocked"); -@@ -722,7 +722,7 @@ static void wpa_driver_wext_rfkill_unblo - } - /* rtnetlink ifup handler will report interface as enabled */ - } -- -+#endif /* CONFIG_RFKILL */ - - /** - * wpa_driver_wext_init - Initialize WE driver interface -@@ -735,7 +735,9 @@ void * wpa_driver_wext_init(void *ctx, c - { - struct wpa_driver_wext_data *drv; - struct netlink_config *cfg; -+#ifdef CONFIG_RFKILL - struct rfkill_config *rcfg; -+#endif - char path[128]; - struct stat buf; - -@@ -769,6 +771,7 @@ void * wpa_driver_wext_init(void *ctx, c - goto err2; - } - -+#ifdef CONFIG_RFKILL - rcfg = os_zalloc(sizeof(*rcfg)); - if (rcfg == NULL) - goto err3; -@@ -781,6 +784,7 @@ void * wpa_driver_wext_init(void *ctx, c - wpa_printf(MSG_DEBUG, "WEXT: RFKILL status not available"); - os_free(rcfg); - } -+#endif /* CONFIG_RFKILL */ - - drv->mlme_sock = -1; - -@@ -792,7 +796,9 @@ void * wpa_driver_wext_init(void *ctx, c - return drv; - - err3: -+#ifdef CONFIG_RFKILL - rfkill_deinit(drv->rfkill); -+#endif - netlink_deinit(drv->netlink); - err2: - close(drv->ioctl_sock); -@@ -802,10 +808,12 @@ err1: - } - - -+#ifdef CONFIG_RFKILL - static void wpa_driver_wext_send_rfkill(void *eloop_ctx, void *timeout_ctx) - { - wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL); - } -+#endif /* CONFIG_RFKILL */ - - - static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv) -@@ -813,13 +821,16 @@ static int wpa_driver_wext_finish_drv_in - int send_rfkill_event = 0; - - if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1) < 0) { -+#ifdef CONFIG_RFKILL - if (rfkill_is_blocked(drv->rfkill)) { - wpa_printf(MSG_DEBUG, "WEXT: Could not yet enable " - "interface '%s' due to rfkill", - drv->ifname); - drv->if_disabled = 1; - send_rfkill_event = 1; -- } else { -+ } else -+#endif -+ { - wpa_printf(MSG_ERROR, "WEXT: Could not set " - "interface '%s' UP", drv->ifname); - return -1; -@@ -867,8 +878,10 @@ static int wpa_driver_wext_finish_drv_in - 1, IF_OPER_DORMANT); - - if (send_rfkill_event) { -+#ifdef CONFIG_RFKILL - eloop_register_timeout(0, 0, wpa_driver_wext_send_rfkill, - drv, drv->ctx); -+#endif - } - - return 0; -@@ -898,7 +911,9 @@ void wpa_driver_wext_deinit(void *priv) - - netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP); - netlink_deinit(drv->netlink); -+#ifdef CONFIG_RFKILL - rfkill_deinit(drv->rfkill); -+#endif - - if (drv->mlme_sock >= 0) - eloop_unregister_read_sock(drv->mlme_sock); ---- a/src/drivers/drivers.mak -+++ b/src/drivers/drivers.mak -@@ -31,7 +31,6 @@ NEED_SME=y - NEED_AP_MLME=y - NEED_NETLINK=y - NEED_LINUX_IOCTL=y --NEED_RFKILL=y - DRV_LIBS += -lnl - - ifdef CONFIG_LIBNL20 -@@ -78,7 +77,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT - CONFIG_WIRELESS_EXTENSION=y - NEED_NETLINK=y - NEED_LINUX_IOCTL=y --NEED_RFKILL=y - endif - - ifdef CONFIG_DRIVER_HERMES -@@ -166,6 +164,7 @@ endif - - ifdef NEED_RFKILL - DRV_OBJS += ../src/drivers/rfkill.o -+DRV_WPA_CFLAGS += -DCONFIG_RFKILL - endif - - ---- a/src/drivers/driver_wext.h -+++ b/src/drivers/driver_wext.h -@@ -27,7 +27,9 @@ struct wpa_driver_wext_data { - int ifindex2; - int if_removed; - int if_disabled; -+#ifdef CONFIG_RFKILL - struct rfkill_data *rfkill; -+#endif - u8 *assoc_req_ies; - size_t assoc_req_ies_len; - u8 *assoc_resp_ies; diff --git a/package/hostapd/patches/420-stbc_fix_backport.patch b/package/hostapd/patches/420-stbc_fix_backport.patch deleted file mode 100644 index 89998d9fc..000000000 --- a/package/hostapd/patches/420-stbc_fix_backport.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Helmut Schaa -Date: Sat, 28 Aug 2010 09:25:44 +0000 (+0300) -Subject: hostapd: enable STBC only for STBC capable STAs -X-Git-Url: http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff_plain;h=36af1c7d31bdc5ba4dacacbf32d3c7585665ae2b - -hostapd: enable STBC only for STBC capable STAs - -hostapd simply used its own STBC configuration in the STA's HT caps. This -resulted in TX STBC being used for STAs not supporting RX STBC, which in -turn resulted in the STA not receiving anything. - -Fix this by handling the STBC flags in the same way mac80211 does. Mask -out RX STBC if we don't support TX STBC and vice versa. - -Tested only with the nl80211 driver and a STBC incapable STA. - -Signed-off-by: Helmut Schaa ---- - ---- a/src/ap/ieee802_11_ht.c -+++ b/src/ap/ieee802_11_ht.c -@@ -256,7 +256,15 @@ void hostapd_get_ht_capab(struct hostapd - cap &= hapd->iconf->ht_capab; - cap |= (hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED); - -- /* FIXME: Rx STBC needs to be handled specially */ -- cap |= (hapd->iconf->ht_capab & HT_CAP_INFO_RX_STBC_MASK); -+ /* -+ * STBC needs to be handled specially -+ * if we don't support RX STBC, mask out TX STBC in the STA's HT caps -+ * if we don't support TX STBC, mask out RX STBC in the STA's HT caps -+ */ -+ if (!(hapd->iconf->ht_capab & HT_CAP_INFO_RX_STBC_MASK)) -+ cap &= ~HT_CAP_INFO_TX_STBC; -+ if (!(hapd->iconf->ht_capab & HT_CAP_INFO_TX_STBC)) -+ cap &= ~HT_CAP_INFO_RX_STBC_MASK; -+ - neg_ht_cap->ht_capabilities_info = host_to_le16(cap); - } diff --git a/package/hostapd/patches/430-supplicant_bridge_fix.patch b/package/hostapd/patches/430-supplicant_bridge_fix.patch deleted file mode 100644 index feddf6fed..000000000 --- a/package/hostapd/patches/430-supplicant_bridge_fix.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -410,6 +410,10 @@ static void wpa_driver_nl80211_event_rtm - return; - } - -+ if (ifi->ifi_family == AF_BRIDGE && -+ drv->nlmode != NL80211_IFTYPE_AP) -+ return; -+ - wpa_printf(MSG_DEBUG, "RTM_NEWLINK: operstate=%d ifi_flags=0x%x " - "(%s%s%s%s)", - drv->operstate, ifi->ifi_flags, -@@ -481,6 +485,10 @@ static void wpa_driver_nl80211_event_rtm - attrlen = len; - attr = (struct rtattr *) buf; - -+ if (ifi->ifi_family == AF_BRIDGE && -+ drv->nlmode != NL80211_IFTYPE_AP) -+ return; -+ - rta_len = RTA_ALIGN(sizeof(struct rtattr)); - while (RTA_OK(attr, attrlen)) { - if (attr->rta_type == IFLA_IFNAME) { -@@ -1347,6 +1355,11 @@ static int wpa_driver_nl80211_init_nl(st - eloop_register_read_sock(nl_socket_get_fd(drv->nl_handle_event), - wpa_driver_nl80211_event_receive, drv, ctx); - -+#ifdef HOSTAPD -+ drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int); -+ drv->if_indices = drv->default_if_indices; -+#endif -+ - return 0; - - err4: -@@ -4867,8 +4880,6 @@ static void *i802_init(struct hostapd_da - br_ifindex = 0; - } - -- drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int); -- drv->if_indices = drv->default_if_indices; - for (i = 0; i < params->num_bridge; i++) { - if (params->bridge[i]) { - ifindex = if_nametoindex(params->bridge[i]); diff --git a/package/hostapd/patches/440-mbss_reload_fix.patch b/package/hostapd/patches/440-mbss_reload_fix.patch deleted file mode 100644 index ed513b1f1..000000000 --- a/package/hostapd/patches/440-mbss_reload_fix.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -42,37 +42,8 @@ static int hostapd_setup_encryption(char - - extern int wpa_debug_level; - -- --int hostapd_reload_config(struct hostapd_iface *iface) -+static int hostapd_reload_bss(struct hostapd_data *hapd) - { -- struct hostapd_data *hapd = iface->bss[0]; -- struct hostapd_config *newconf, *oldconf; -- size_t j; -- -- if (iface->config_read_cb == NULL) -- return -1; -- newconf = iface->config_read_cb(iface->config_fname); -- if (newconf == NULL) -- return -1; -- -- /* -- * Deauthenticate all stations since the new configuration may not -- * allow them to use the BSS anymore. -- */ -- for (j = 0; j < iface->num_bss; j++) -- hostapd_flush_old_stations(iface->bss[j]); -- --#ifndef CONFIG_NO_RADIUS -- /* TODO: update dynamic data based on changed configuration -- * items (e.g., open/close sockets, etc.) */ -- radius_client_flush(hapd->radius, 0); --#endif /* CONFIG_NO_RADIUS */ -- -- oldconf = hapd->iconf; -- hapd->iconf = newconf; -- hapd->conf = &newconf->bss[0]; -- iface->conf = newconf; -- - if (hostapd_setup_wpa_psk(hapd->conf)) { - wpa_printf(MSG_ERROR, "Failed to re-configure WPA PSK " - "after reloading configuration"); -@@ -110,10 +81,46 @@ int hostapd_reload_config(struct hostapd - wpa_printf(MSG_ERROR, "Could not set SSID for kernel driver"); - /* try to continue */ - } -+ wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface); -+} -+ -+int hostapd_reload_config(struct hostapd_iface *iface) -+{ -+ struct hostapd_data *hapd = iface->bss[0]; -+ struct hostapd_config *newconf, *oldconf; -+ size_t j; -+ -+ if (iface->config_read_cb == NULL) -+ return -1; -+ newconf = iface->config_read_cb(iface->config_fname); -+ if (newconf == NULL) -+ return -1; -+ -+ /* -+ * Deauthenticate all stations since the new configuration may not -+ * allow them to use the BSS anymore. -+ */ -+ for (j = 0; j < iface->num_bss; j++) -+ hostapd_flush_old_stations(iface->bss[j]); -+ -+#ifndef CONFIG_NO_RADIUS -+ /* TODO: update dynamic data based on changed configuration -+ * items (e.g., open/close sockets, etc.) */ -+ radius_client_flush(hapd->radius, 0); -+#endif /* CONFIG_NO_RADIUS */ -+ -+ oldconf = hapd->iconf; -+ iface->conf = newconf; -+ -+ for (j = 0; j < iface->num_bss; j++) { -+ hapd = iface->bss[j]; -+ hapd->iconf = newconf; -+ hapd->conf = &newconf->bss[j]; -+ hostapd_reload_bss(hapd); -+ } - - hostapd_config_free(oldconf); - -- wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface); - - return 0; - } diff --git a/package/hostapd/patches/450-reload_settings.patch b/package/hostapd/patches/450-reload_settings.patch deleted file mode 100644 index 5f226124c..000000000 --- a/package/hostapd/patches/450-reload_settings.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -112,6 +112,10 @@ int hostapd_reload_config(struct hostapd - oldconf = hapd->iconf; - iface->conf = newconf; - -+ iface->freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel); -+ if (iface->current_mode) -+ hostapd_prepare_rates(hapd, iface->current_mode); -+ - for (j = 0; j < iface->num_bss; j++) { - hapd = iface->bss[j]; - hapd->iconf = newconf; diff --git a/package/hostapd/patches/451-nl80211_del_beacon_bss.patch b/package/hostapd/patches/451-nl80211_del_beacon_bss.patch deleted file mode 100644 index b23acc6f0..000000000 --- a/package/hostapd/patches/451-nl80211_del_beacon_bss.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -1604,23 +1604,41 @@ wpa_driver_nl80211_finish_drv_init(struc - } - - --static int wpa_driver_nl80211_del_beacon(struct wpa_driver_nl80211_data *drv) -+static int wpa_driver_nl80211_del_bss_beacon(struct i802_bss *bss) - { -+ struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; - -+ bss->beacon_set = 0; -+ - msg = nlmsg_alloc(); - if (!msg) - return -ENOMEM; - - genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, - 0, NL80211_CMD_DEL_BEACON, 0); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex); -+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex); - - return send_and_recv_msgs(drv, msg, NULL, NULL); - nla_put_failure: -+ nlmsg_free(msg); - return -ENOBUFS; - } - -+static int wpa_driver_nl80211_del_beacon(struct wpa_driver_nl80211_data *drv) -+{ -+ struct i802_bss *bss; -+ -+ for (bss = &drv->first_bss; bss; bss = bss->next) -+ wpa_driver_nl80211_del_bss_beacon(bss); -+} -+ -+static int wpa_driver_nl80211_stop_ap(void *priv) -+{ -+ struct i802_bss *bss = priv; -+ -+ wpa_driver_nl80211_del_beacon(bss->drv); -+} - - /** - * wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface -@@ -5512,4 +5530,5 @@ const struct wpa_driver_ops wpa_driver_n - .send_ft_action = nl80211_send_ft_action, - .signal_monitor = nl80211_signal_monitor, - .send_frame = nl80211_send_frame, -+ .stop_ap = wpa_driver_nl80211_stop_ap, - }; ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -1774,6 +1774,8 @@ struct wpa_driver_ops { - */ - int (*send_frame)(void *priv, const u8 *data, size_t data_len, - int encrypt); -+ -+ int (*stop_ap)(void *priv); - }; - - diff --git a/package/hostapd/patches/452-ctrl_iface_reload.patch b/package/hostapd/patches/452-ctrl_iface_reload.patch deleted file mode 100644 index e07ab6d44..000000000 --- a/package/hostapd/patches/452-ctrl_iface_reload.patch +++ /dev/null @@ -1,96 +0,0 @@ ---- a/hostapd/ctrl_iface.c -+++ b/hostapd/ctrl_iface.c -@@ -35,6 +35,7 @@ - #include "ap/wps_hostapd.h" - #include "ap/ctrl_iface_ap.h" - #include "ctrl_iface.h" -+#include "config_file.h" - - - struct wpa_ctrl_dst { -@@ -45,6 +46,7 @@ struct wpa_ctrl_dst { - int errors; - }; - -+static char *reload_opts = NULL; - - static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level, - const char *buf, size_t len); -@@ -315,6 +317,66 @@ static int hostapd_ctrl_iface_wps_oob(st - #endif /* CONFIG_WPS_OOB */ - #endif /* CONFIG_WPS */ - -+static int hostapd_ctrl_iface_set_down(struct hostapd_data *hapd) -+{ -+ if (hapd->driver->stop_ap) -+ hapd->driver->stop_ap(hapd->drv_priv); -+ return 0; -+} -+ -+static char *get_option(char *opt, char *str) -+{ -+ int len = strlen(str); -+ -+ if (!strncmp(opt, str, len)) -+ return opt + len; -+ else -+ return NULL; -+} -+ -+static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname) -+{ -+ struct hostapd_config *conf; -+ char *opt, *val; -+ -+ conf = hostapd_config_read(fname); -+ if (!conf) -+ return NULL; -+ -+ for (opt = strtok(reload_opts, " "); -+ opt; -+ opt = strtok(NULL, " ")) { -+ -+ if ((val = get_option(opt, "channel="))) -+ conf->channel = atoi(val); -+ else if ((val = get_option(opt, "ht_capab="))) -+ conf->ht_capab = atoi(val); -+ else if ((val = get_option(opt, "ht_capab_mask="))) -+ conf->ht_capab &= atoi(val); -+ else if ((val = get_option(opt, "sec_chan="))) -+ conf->secondary_channel = atoi(val); -+ else if ((val = get_option(opt, "hwmode="))) -+ conf->hw_mode = atoi(val); -+ else if ((val = get_option(opt, "ieee80211n="))) -+ conf->ieee80211n = atoi(val); -+ else -+ break; -+ } -+ -+ return conf; -+} -+ -+static int hostapd_ctrl_iface_reload(struct hostapd_data *hapd, char *txt) -+{ -+ struct hostapd_iface *iface = hapd->iface; -+ -+ iface->config_read_cb = hostapd_ctrl_iface_config_read; -+ reload_opts = txt; -+ -+ hostapd_reload_config(iface); -+ -+ iface->config_read_cb = hostapd_config_read; -+} - - static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx, - void *sock_ctx) -@@ -379,6 +441,10 @@ static void hostapd_ctrl_iface_receive(i - reply_len += res; - } - #endif /* CONFIG_NO_RADIUS */ -+ } else if (os_strcmp(buf, "DOWN") == 0) { -+ hostapd_ctrl_iface_set_down(hapd); -+ } else if (os_strncmp(buf, "RELOAD ", 7) == 0) { -+ hostapd_ctrl_iface_reload(hapd, buf + 7); - } else if (os_strcmp(buf, "STA-FIRST") == 0) { - reply_len = hostapd_ctrl_iface_sta_first(hapd, reply, - reply_size); diff --git a/package/hostapd/patches/453-ap_sta_support.patch b/package/hostapd/patches/453-ap_sta_support.patch deleted file mode 100644 index 930981dd3..000000000 --- a/package/hostapd/patches/453-ap_sta_support.patch +++ /dev/null @@ -1,211 +0,0 @@ ---- a/wpa_supplicant/wpa_supplicant_i.h -+++ b/wpa_supplicant/wpa_supplicant_i.h -@@ -98,6 +98,8 @@ struct wpa_interface { - * receiving of EAPOL frames from an additional interface. - */ - const char *bridge_ifname; -+ -+ const char *hostapd_ctrl; - }; - - /** -@@ -316,6 +318,8 @@ struct wpa_supplicant { - #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ - char bridge_ifname[16]; - -+ struct wpa_ctrl *hostapd; -+ - char *confname; - struct wpa_config *conf; - int countermeasures; ---- a/wpa_supplicant/Makefile -+++ b/wpa_supplicant/Makefile -@@ -51,6 +51,11 @@ OBJS_p += ../src/utils/wpa_debug.o - OBJS_p += ../src/utils/wpabuf.o - OBJS_c = wpa_cli.o ../src/common/wpa_ctrl.o - -+ifdef MULTICALL -+OBJS += ../src/common/wpa_ctrl.o -+CFLAGS += -DMULTICALL -+endif -+ - -include .config - -include $(if $(MULTICALL),../hostapd/.config) - ---- a/wpa_supplicant/wpa_supplicant.c -+++ b/wpa_supplicant/wpa_supplicant.c -@@ -120,6 +120,55 @@ extern int wpa_debug_show_keys; - extern int wpa_debug_timestamp; - extern struct wpa_driver_ops *wpa_drivers[]; - -+#ifdef MULTICALL -+static int hostapd_stop(struct wpa_supplicant *wpa_s) -+{ -+ const char *cmd = "DOWN"; -+ char buf[256]; -+ int len = sizeof(buf); -+ -+ if (wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL) < 0) { -+ wpa_printf(MSG_ERROR, "\nFailed to stop hostapd AP interfaces\n"); -+ return -1; -+ } -+ return 0; -+} -+ -+static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) -+{ -+ char *cmd = NULL; -+ char buf[256]; -+ int len = sizeof(buf); -+ int channel, hw_mode; -+ int ret; -+ -+ if (!bss) -+ return; -+ -+ if (bss->freq < 4000) { -+ hw_mode = HOSTAPD_MODE_IEEE80211G; -+ channel = (bss->freq - 2407) / 5; -+ } else { -+ hw_mode = HOSTAPD_MODE_IEEE80211A; -+ channel = (bss->freq - 5000) / 5; -+ } -+ -+ if (asprintf(&cmd, "RELOAD channel=%d sec_chan=0 hw_mode=%d ieee80211n=%d", -+ channel, hw_mode, !!bss->ht_capab) < 0) { -+ return -1; -+ } -+ -+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL); -+ free(cmd); -+ -+ if (ret < 0) { -+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n"); -+ return -1; -+ } -+ return 0; -+} -+#endif -+ - /* Configure default/group WEP keys for static WEP */ - int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) - { -@@ -548,8 +597,16 @@ void wpa_supplicant_set_state(struct wpa - #ifndef IEEE8021X_EAPOL - wpa_drv_set_supp_port(wpa_s, 1); - #endif -+#ifdef MULTICALL -+ if (wpa_s->hostapd) -+ hostapd_reload(wpa_s, wpa_s->current_bss); -+#endif - } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || - state == WPA_ASSOCIATED) { -+#ifdef MULTICALL -+ if (wpa_s->hostapd) -+ hostapd_stop(wpa_s); -+#endif - wpa_s->new_connection = 1; - wpa_drv_set_operstate(wpa_s, 0); - #ifndef IEEE8021X_EAPOL -@@ -1957,6 +2014,21 @@ static int wpa_supplicant_init_iface(str - os_strlcpy(wpa_s->bridge_ifname, iface->bridge_ifname, - sizeof(wpa_s->bridge_ifname)); - } -+#ifdef MULTICALL -+ if (iface->hostapd_ctrl) { -+ char *cmd = "DOWN"; -+ char buf[256]; -+ int len = sizeof(buf); -+ -+ wpa_s->hostapd = wpa_ctrl_open(iface->hostapd_ctrl); -+ if (!wpa_s->hostapd) { -+ wpa_printf(MSG_ERROR, "\nFailed to connect to hostapd\n"); -+ return -1; -+ } -+ if (hostapd_stop(wpa_s) < 0) -+ return -1; -+ } -+#endif - - /* RSNA Supplicant Key Management - INITIALIZE */ - eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); ---- a/wpa_supplicant/bss.c -+++ b/wpa_supplicant/bss.c -@@ -17,6 +17,7 @@ - #include "utils/common.h" - #include "utils/eloop.h" - #include "common/ieee802_11_defs.h" -+#include "common/ieee802_11_common.h" - #include "drivers/driver.h" - #include "wpa_supplicant_i.h" - #include "config.h" -@@ -89,6 +90,8 @@ struct wpa_bss * wpa_bss_get(struct wpa_ - - static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src) - { -+ struct ieee80211_ht_capabilities *capab; -+ struct ieee802_11_elems elems; - os_time_t usec; - - dst->flags = src->flags; -@@ -101,6 +104,12 @@ static void wpa_bss_copy_res(struct wpa_ - dst->level = src->level; - dst->tsf = src->tsf; - -+ memset(&elems, 0, sizeof(elems)); -+ ieee802_11_parse_elems((u8 *) (src + 1), src->ie_len, &elems, 0); -+ capab = (struct ieee80211_ht_capabilities *) elems.ht_capabilities; -+ if (capab) -+ dst->ht_capab = le_to_host16(capab->ht_capabilities_info); -+ - os_get_time(&dst->last_update); - dst->last_update.sec -= src->age / 1000; - usec = (src->age % 1000) * 1000; ---- a/wpa_supplicant/bss.h -+++ b/wpa_supplicant/bss.h -@@ -56,6 +56,7 @@ struct wpa_bss { - unsigned int flags; - u8 bssid[ETH_ALEN]; - u8 ssid[32]; -+ u16 ht_capab; - size_t ssid_len; - int freq; - u16 beacon_int; ---- a/wpa_supplicant/main.c -+++ b/wpa_supplicant/main.c -@@ -31,7 +31,7 @@ static void usage(void) - "usage:\n" - " wpa_supplicant [-BddhKLqqstuvW] [-P] " - "[-g] \\\n" -- " -i -c [-C] [-D] " -+ " -i -c [-C] [-D] [-H]" - "[-p] \\\n" - " [-b] [-f] \\\n" - " [-o] [-O] \\\n" -@@ -67,6 +67,7 @@ static void usage(void) - #endif /* CONFIG_DEBUG_SYSLOG */ - printf(" -t = include timestamp in debug messages\n" - " -h = show this help text\n" -+ " -H = connect to a hostapd instance to manage state changes\n" - " -L = show license (GPL and BSD)\n" - " -o = override driver parameter for new interfaces\n" - " -O = override ctrl_interface parameter for new interfaces\n" -@@ -143,7 +144,7 @@ int main(int argc, char *argv[]) - wpa_supplicant_fd_workaround(); - - for (;;) { -- c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNo:O:p:P:qstuvW"); -+ c = getopt(argc, argv, "b:Bc:C:D:df:g:hH:i:KLNo:O:p:P:qstuvW"); - if (c < 0) - break; - switch (c) { -@@ -184,6 +185,9 @@ int main(int argc, char *argv[]) - usage(); - exitcode = 0; - goto out; -+ case 'H': -+ iface->hostapd_ctrl = optarg; -+ break; - case 'i': - iface->ifname = optarg; - break; diff --git a/package/hostapd/patches/460-oper_state_fix.patch b/package/hostapd/patches/460-oper_state_fix.patch deleted file mode 100644 index 5a685a23e..000000000 --- a/package/hostapd/patches/460-oper_state_fix.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Jouni Malinen -Date: Tue, 26 Oct 2010 13:30:28 +0000 (+0300) -Subject: hostapd: Set operstate UP when initializing AP mode -X-Git-Url: http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff_plain;h=e11f5a2cbc333113a3a1cc1aeea7f698c3936ca3 - -hostapd: Set operstate UP when initializing AP mode - -This is needed to avoid problems with other applications setting and -leaving the interface to IF_OPER_DORMANT state. In AP mode, the interface -is ready immediately after the keys are set, so we better make sure the -DORMANT state does not prevent normal operations after that. ---- - ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -622,6 +622,9 @@ static int hostapd_setup_bss(struct host - - ieee802_11_set_beacon(hapd); - -+ if (hapd->driver && hapd->driver->set_operstate) -+ hapd->driver->set_operstate(hapd->drv_priv, 1); -+ - return 0; - } - diff --git a/package/hostapd/patches/500-scan_wait.patch b/package/hostapd/patches/500-scan_wait.patch new file mode 100644 index 000000000..14dccc326 --- /dev/null +++ b/package/hostapd/patches/500-scan_wait.patch @@ -0,0 +1,148 @@ +--- a/src/ap/hostapd.h ++++ b/src/ap/hostapd.h +@@ -228,6 +228,7 @@ struct hostapd_iface { + int (*for_each_interface)(struct hapd_interfaces *interfaces, + int (*cb)(struct hostapd_iface *iface, + void *ctx), void *ctx); ++ int (*init_complete)(struct hostapd_iface *iface); + }; + + /* hostapd.c */ +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -790,6 +790,9 @@ int hostapd_setup_interface_complete(str + wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", + iface->bss[0]->conf->iface); + ++ if (iface->init_complete) ++ iface->init_complete(iface); ++ + return 0; + } + +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -35,6 +35,8 @@ + extern int wpa_debug_level; + extern int wpa_debug_show_keys; + extern int wpa_debug_timestamp; ++static int daemonize = 0; ++static char *pid_file = NULL; + + + struct hapd_interfaces { +@@ -162,6 +164,15 @@ static void hostapd_logger_cb(void *ctx, + } + #endif /* CONFIG_NO_HOSTAPD_LOGGER */ + ++static int hostapd_init_complete(struct hostapd_iface *iface) ++{ ++ if (daemonize && os_daemonize(pid_file)) { ++ perror("daemon"); ++ return -1; ++ } ++ daemonize = 0; ++} ++ + + /** + * hostapd_init - Allocate and initialize per-interface data +@@ -183,6 +194,7 @@ static struct hostapd_iface * hostapd_in + if (hapd_iface == NULL) + goto fail; + ++ hapd_iface->init_complete = hostapd_init_complete; + hapd_iface->reload_config = hostapd_reload_config; + hapd_iface->config_read_cb = hostapd_config_read; + hapd_iface->config_fname = os_strdup(config_file); +@@ -391,7 +403,7 @@ static int hostapd_global_init(struct ha + } + + +-static void hostapd_global_deinit(const char *pid_file) ++static void hostapd_global_deinit(void) + { + #ifdef EAP_SERVER_TNC + tncs_global_deinit(); +@@ -409,8 +421,7 @@ static void hostapd_global_deinit(const + } + + +-static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize, +- const char *pid_file) ++static int hostapd_global_run(struct hapd_interfaces *iface) + { + #ifdef EAP_SERVER_TNC + int tnc = 0; +@@ -431,11 +442,6 @@ static int hostapd_global_run(struct hap + } + #endif /* EAP_SERVER_TNC */ + +- if (daemonize && os_daemonize(pid_file)) { +- perror("daemon"); +- return -1; +- } +- + eloop_run(); + + return 0; +@@ -491,8 +497,7 @@ int main(int argc, char *argv[]) + struct hapd_interfaces interfaces; + int ret = 1; + size_t i; +- int c, debug = 0, daemonize = 0; +- char *pid_file = NULL; ++ int c, debug = 0; + const char *log_file = NULL; + + if (os_program_init()) +@@ -566,7 +571,7 @@ int main(int argc, char *argv[]) + goto out; + } + +- if (hostapd_global_run(&interfaces, daemonize, pid_file)) ++ if (hostapd_global_run(&interfaces)) + goto out; + + ret = 0; +@@ -577,7 +582,7 @@ int main(int argc, char *argv[]) + hostapd_interface_deinit_free(interfaces.iface[i]); + os_free(interfaces.iface); + +- hostapd_global_deinit(pid_file); ++ hostapd_global_deinit(); + os_free(pid_file); + + if (log_file) +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -1891,6 +1891,8 @@ struct hostapd_config * hostapd_config_r + } + #endif /* CONFIG_IEEE80211W */ + #ifdef CONFIG_IEEE80211N ++ } else if (os_strcmp(buf, "noscan") == 0) { ++ conf->noscan = atoi(pos); + } else if (os_strcmp(buf, "ieee80211n") == 0) { + conf->ieee80211n = atoi(pos); + } else if (os_strcmp(buf, "ht_capab") == 0) { +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -389,6 +389,7 @@ struct hostapd_config { + + int ht_op_mode_fixed; + u16 ht_capab; ++ int noscan; + int ieee80211n; + int secondary_channel; + int require_ht; +--- a/src/ap/hw_features.c ++++ b/src/ap/hw_features.c +@@ -463,7 +463,7 @@ static int ieee80211n_check_40mhz(struct + { + struct wpa_driver_scan_params params; + +- if (!iface->conf->secondary_channel) ++ if (!iface->conf->secondary_channel || iface->conf->noscan) + return 0; /* HT40 not used */ + + wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling " diff --git a/package/hostapd/patches/510-multicall.patch b/package/hostapd/patches/510-multicall.patch new file mode 100644 index 000000000..e705792cd --- /dev/null +++ b/package/hostapd/patches/510-multicall.patch @@ -0,0 +1,246 @@ +--- 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 +@@ -159,10 +160,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 +@@ -780,6 +785,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) + $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) + @$(E) " LD " $@ +@@ -820,6 +831,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) + $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n) + @$(E) " LD " $@ +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -53,6 +53,7 @@ OBJS_c = wpa_cli.o ../src/common/wpa_ctr + OBJS_c += ../src/utils/wpa_debug.o + + -include .config ++-include $(if $(MULTICALL),../hostapd/.config) + + ifndef CONFIG_OS + ifdef CONFIG_NATIVE_WINDOWS +@@ -634,6 +635,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 +@@ -642,9 +647,11 @@ NEED_EAP_COMMON=y + NEED_RSN_AUTHENTICATOR=y + CFLAGS += -DCONFIG_AP + OBJS += ap.o ++ifndef MULTICALL + CFLAGS += -DCONFIG_NO_RADIUS + CFLAGS += -DCONFIG_NO_ACCOUNTING + CFLAGS += -DCONFIG_NO_VLAN ++endif + OBJS += ../src/ap/hostapd.o + OBJS += ../src/ap/wpa_auth_glue.o + OBJS += ../src/ap/utils.o +@@ -688,10 +695,18 @@ CFLAGS += -DEAP_SERVER_WSC + OBJS += ../src/ap/wps_hostapd.o + OBJS += ../src/eap_server/eap_server_wsc.o + endif ++else ++ ifdef MULTICALL ++ OBJS += ../src/eap_server/eap_server.o ++ OBJS += ../src/eap_server/eap_server_identity.o ++ OBJS += ../src/eap_server/eap_server_methods.o ++ endif + endif + + ifdef NEED_RSN_AUTHENTICATOR ++ifndef MULTICALL + CFLAGS += -DCONFIG_NO_RADIUS ++endif + NEED_AES_WRAP=y + OBJS += ../src/ap/wpa_auth.o + OBJS += ../src/ap/wpa_auth_ie.o +@@ -1352,6 +1367,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) + $(Q)$(LDO) $(LDFLAGS) -o wpa_priv $(OBJS_priv) $(LIBS) + @$(E) " LD " $@ + ++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) + $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) + @$(E) " LD " $@ +@@ -1412,6 +1433,12 @@ eap_ikev2.so: ../src/eap_peer/eap_ikev2. + $(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 +@@ -3169,8 +3169,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 +@@ -443,8 +443,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; + +--- 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 +@@ -1718,8 +1718,8 @@ static void wpa_supplicant_event_unprot_ + } + + +-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; + u16 reason_code = 0; +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -2313,6 +2313,9 @@ static void wpa_supplicant_deinit_iface( + wpa_drv_deinit(wpa_s); + } + ++extern void supplicant_event(void *ctx, enum wpa_event_type event, ++ union wpa_event_data *data); ++ + + /** + * wpa_supplicant_add_iface - Add a new network interface +@@ -2496,6 +2499,7 @@ struct wpa_global * wpa_supplicant_init( + wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); + #endif /* CONFIG_NO_WPA_MSG */ + ++ 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 +@@ -491,6 +491,9 @@ static const char * hostapd_msg_ifname_c + return NULL; + } + ++void hostapd_wpa_event(void *ctx, enum wpa_event_type event, ++ union wpa_event_data *data); ++ + + int main(int argc, char *argv[]) + { +@@ -503,6 +506,7 @@ int main(int argc, char *argv[]) + if (os_program_init()) + return -1; + ++ wpa_supplicant_event = hostapd_wpa_event; + for (;;) { + c = getopt(argc, argv, "Bdf:hKP: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/hostapd/patches/520-timestamp_check.patch b/package/hostapd/patches/520-timestamp_check.patch new file mode 100644 index 000000000..70ac63597 --- /dev/null +++ b/package/hostapd/patches/520-timestamp_check.patch @@ -0,0 +1,15 @@ +--- a/src/tls/x509v3.c ++++ b/src/tls/x509v3.c +@@ -1854,8 +1854,11 @@ int x509_certificate_chain_validate(stru + if (chain_trusted) + continue; + +- if ((unsigned long) now.sec < ++ if ( ++#ifndef NO_TIMESTAMP_CHECK ++ (unsigned long) now.sec < + (unsigned long) cert->not_before || ++#endif + (unsigned long) now.sec > + (unsigned long) cert->not_after) { + wpa_printf(MSG_INFO, "X509: Certificate not valid " diff --git a/package/hostapd/patches/530-rescan_immediately.patch b/package/hostapd/patches/530-rescan_immediately.patch new file mode 100644 index 000000000..b6efbb8d0 --- /dev/null +++ b/package/hostapd/patches/530-rescan_immediately.patch @@ -0,0 +1,11 @@ +--- a/wpa_supplicant/events.c ++++ b/wpa_supplicant/events.c +@@ -953,7 +953,7 @@ static int _wpa_supplicant_event_scan_re + wpa_dbg(wpa_s, MSG_DEBUG, "Setup a new network"); + wpa_supplicant_associate(wpa_s, NULL, ssid); + } else { +- int timeout_sec = 5; ++ int timeout_sec = 0; + int timeout_usec = 0; + #ifdef CONFIG_P2P + if (wpa_s->p2p_in_provisioning) { diff --git a/package/hostapd/patches/540-optional_rfkill.patch b/package/hostapd/patches/540-optional_rfkill.patch new file mode 100644 index 000000000..dd460835c --- /dev/null +++ b/package/hostapd/patches/540-optional_rfkill.patch @@ -0,0 +1,281 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -129,7 +129,9 @@ struct wpa_driver_nl80211_data { + int ifindex; + int if_removed; + int if_disabled; ++#ifdef CONFIG_RFKILL + struct rfkill_data *rfkill; ++#endif + struct wpa_driver_capa capa; + int has_capability; + +@@ -1750,7 +1752,7 @@ err1: + return -1; + } + +- ++#ifdef CONFIG_RFKILL + static void wpa_driver_nl80211_rfkill_blocked(void *ctx) + { + wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked"); +@@ -1772,6 +1774,7 @@ static void wpa_driver_nl80211_rfkill_un + } + /* rtnetlink ifup handler will report interface as enabled */ + } ++#endif /* CONFIG_RFKILL */ + + + static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv) +@@ -1820,7 +1823,9 @@ static void * wpa_driver_nl80211_init(vo + { + struct wpa_driver_nl80211_data *drv; + struct netlink_config *cfg; ++#ifdef CONFIG_RFKILL + struct rfkill_config *rcfg; ++#endif + struct i802_bss *bss; + + drv = os_zalloc(sizeof(*drv)); +@@ -1863,6 +1868,7 @@ static void * wpa_driver_nl80211_init(vo + goto failed; + } + ++#ifdef CONFIG_RFKILL + rcfg = os_zalloc(sizeof(*rcfg)); + if (rcfg == NULL) + goto failed; +@@ -1875,6 +1881,7 @@ static void * wpa_driver_nl80211_init(vo + wpa_printf(MSG_DEBUG, "nl80211: RFKILL status not available"); + os_free(rcfg); + } ++#endif /* CONFIG_RFKILL */ + + if (wpa_driver_nl80211_finish_drv_init(drv)) + goto failed; +@@ -1882,7 +1889,9 @@ static void * wpa_driver_nl80211_init(vo + return bss; + + failed: ++#ifdef CONFIG_RFKILL + rfkill_deinit(drv->rfkill); ++#endif + netlink_deinit(drv->netlink); + if (drv->ioctl_sock >= 0) + close(drv->ioctl_sock); +@@ -1985,10 +1994,12 @@ static int nl80211_register_action_frame + } + + ++#ifdef CONFIG_RFKILL + static void wpa_driver_nl80211_send_rfkill(void *eloop_ctx, void *timeout_ctx) + { + wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL); + } ++#endif /* CONFIG_RFKILL */ + + + static int +@@ -2007,13 +2018,16 @@ wpa_driver_nl80211_finish_drv_init(struc + } + + if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { ++#ifdef CONFIG_RFKILL + if (rfkill_is_blocked(drv->rfkill)) { + wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " + "interface '%s' due to rfkill", + bss->ifname); + drv->if_disabled = 1; + send_rfkill_event = 1; +- } else { ++ } else ++#endif ++ { + wpa_printf(MSG_ERROR, "nl80211: Could not set " + "interface '%s' UP", bss->ifname); + return -1; +@@ -2041,8 +2055,10 @@ wpa_driver_nl80211_finish_drv_init(struc + } + + if (send_rfkill_event) { ++#ifdef CONFIG_RFKILL + eloop_register_timeout(0, 0, wpa_driver_nl80211_send_rfkill, + drv, drv->ctx); ++#endif + } + + return 0; +@@ -2123,7 +2139,9 @@ static void wpa_driver_nl80211_deinit(vo + + netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP); + netlink_deinit(drv->netlink); ++#ifdef CONFIG_RFKILL + rfkill_deinit(drv->rfkill); ++#endif + + eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx); + +@@ -5672,7 +5690,9 @@ static void *i802_init(struct hostapd_da + + failed: + nl80211_remove_monitor_interface(drv); ++#ifdef CONFIG_RFKILL + rfkill_deinit(drv->rfkill); ++#endif + netlink_deinit(drv->netlink); + if (drv->ioctl_sock >= 0) + close(drv->ioctl_sock); +--- a/src/drivers/driver_wext.c ++++ b/src/drivers/driver_wext.c +@@ -702,7 +702,7 @@ static void wpa_driver_wext_event_rtm_de + } + } + +- ++#ifdef CONFIG_RFKILL + static void wpa_driver_wext_rfkill_blocked(void *ctx) + { + wpa_printf(MSG_DEBUG, "WEXT: RFKILL blocked"); +@@ -724,7 +724,7 @@ static void wpa_driver_wext_rfkill_unblo + } + /* rtnetlink ifup handler will report interface as enabled */ + } +- ++#endif /* CONFIG_RFKILL */ + + static void wext_get_phy_name(struct wpa_driver_wext_data *drv) + { +@@ -770,7 +770,9 @@ void * wpa_driver_wext_init(void *ctx, c + { + struct wpa_driver_wext_data *drv; + struct netlink_config *cfg; ++#ifdef CONFIG_RFKILL + struct rfkill_config *rcfg; ++#endif + char path[128]; + struct stat buf; + +@@ -805,6 +807,7 @@ void * wpa_driver_wext_init(void *ctx, c + goto err2; + } + ++#ifdef CONFIG_RFKILL + rcfg = os_zalloc(sizeof(*rcfg)); + if (rcfg == NULL) + goto err3; +@@ -817,6 +820,7 @@ void * wpa_driver_wext_init(void *ctx, c + wpa_printf(MSG_DEBUG, "WEXT: RFKILL status not available"); + os_free(rcfg); + } ++#endif /* CONFIG_RFKILL */ + + drv->mlme_sock = -1; + +@@ -828,7 +832,9 @@ void * wpa_driver_wext_init(void *ctx, c + return drv; + + err3: ++#ifdef CONFIG_RFKILL + rfkill_deinit(drv->rfkill); ++#endif + netlink_deinit(drv->netlink); + err2: + close(drv->ioctl_sock); +@@ -838,10 +844,12 @@ err1: + } + + ++#ifdef CONFIG_RFKILL + static void wpa_driver_wext_send_rfkill(void *eloop_ctx, void *timeout_ctx) + { + wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL); + } ++#endif /* CONFIG_RFKILL */ + + + static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv) +@@ -849,13 +857,16 @@ static int wpa_driver_wext_finish_drv_in + int send_rfkill_event = 0; + + if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1) < 0) { ++#ifdef CONFIG_RFKILL + if (rfkill_is_blocked(drv->rfkill)) { + wpa_printf(MSG_DEBUG, "WEXT: Could not yet enable " + "interface '%s' due to rfkill", + drv->ifname); + drv->if_disabled = 1; + send_rfkill_event = 1; +- } else { ++ } else ++#endif ++ { + wpa_printf(MSG_ERROR, "WEXT: Could not set " + "interface '%s' UP", drv->ifname); + return -1; +@@ -903,8 +914,10 @@ static int wpa_driver_wext_finish_drv_in + 1, IF_OPER_DORMANT); + + if (send_rfkill_event) { ++#ifdef CONFIG_RFKILL + eloop_register_timeout(0, 0, wpa_driver_wext_send_rfkill, + drv, drv->ctx); ++#endif + } + + return 0; +@@ -934,7 +947,9 @@ void wpa_driver_wext_deinit(void *priv) + + netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP); + netlink_deinit(drv->netlink); ++#ifdef CONFIG_RFKILL + rfkill_deinit(drv->rfkill); ++#endif + + if (drv->mlme_sock >= 0) + eloop_unregister_read_sock(drv->mlme_sock); +--- a/src/drivers/drivers.mak ++++ b/src/drivers/drivers.mak +@@ -43,7 +43,6 @@ NEED_SME=y + NEED_AP_MLME=y + NEED_NETLINK=y + NEED_LINUX_IOCTL=y +-NEED_RFKILL=y + ifdef CONFIG_LIBNL_TINY + DRV_LIBS += -lnl-tiny + else +@@ -94,7 +93,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT + CONFIG_WIRELESS_EXTENSION=y + NEED_NETLINK=y + NEED_LINUX_IOCTL=y +-NEED_RFKILL=y + endif + + ifdef CONFIG_DRIVER_RALINK +@@ -146,7 +144,6 @@ endif + ifdef CONFIG_WIRELESS_EXTENSION + DRV_CFLAGS += -DCONFIG_WIRELESS_EXTENSION + DRV_OBJS += ../src/drivers/driver_wext.o +-NEED_RFKILL=y + endif + + ifdef NEED_NETLINK +@@ -159,6 +156,7 @@ endif + + ifdef NEED_RFKILL + DRV_OBJS += ../src/drivers/rfkill.o ++DRV_WPA_CFLAGS += -DCONFIG_RFKILL + endif + + +--- a/src/drivers/driver_wext.h ++++ b/src/drivers/driver_wext.h +@@ -28,7 +28,9 @@ struct wpa_driver_wext_data { + int ifindex2; + int if_removed; + int if_disabled; ++#ifdef CONFIG_RFKILL + struct rfkill_data *rfkill; ++#endif + u8 *assoc_req_ies; + size_t assoc_req_ies_len; + u8 *assoc_resp_ies; diff --git a/package/hostapd/patches/550-reload_freq_change.patch b/package/hostapd/patches/550-reload_freq_change.patch new file mode 100644 index 000000000..ce9c1bf01 --- /dev/null +++ b/package/hostapd/patches/550-reload_freq_change.patch @@ -0,0 +1,13 @@ +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -120,6 +120,10 @@ int hostapd_reload_config(struct hostapd + oldconf = hapd->iconf; + iface->conf = newconf; + ++ iface->freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel); ++ if (iface->current_mode) ++ hostapd_prepare_rates(hapd, iface->current_mode); ++ + for (j = 0; j < iface->num_bss; j++) { + hapd = iface->bss[j]; + hapd->iconf = newconf; diff --git a/package/hostapd/patches/551-nl80211_del_beacon_bss.patch b/package/hostapd/patches/551-nl80211_del_beacon_bss.patch new file mode 100644 index 000000000..bd71a7baf --- /dev/null +++ b/package/hostapd/patches/551-nl80211_del_beacon_bss.patch @@ -0,0 +1,63 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -2065,23 +2065,41 @@ wpa_driver_nl80211_finish_drv_init(struc + } + + +-static int wpa_driver_nl80211_del_beacon(struct wpa_driver_nl80211_data *drv) ++static int wpa_driver_nl80211_del_bss_beacon(struct i802_bss *bss) + { ++ struct wpa_driver_nl80211_data *drv = bss->drv; + struct nl_msg *msg; + ++ bss->beacon_set = 0; ++ + msg = nlmsg_alloc(); + if (!msg) + return -ENOMEM; + + genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, + 0, NL80211_CMD_DEL_BEACON, 0); +- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex); ++ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex); + + return send_and_recv_msgs(drv, msg, NULL, NULL); + nla_put_failure: ++ nlmsg_free(msg); + return -ENOBUFS; + } + ++static int wpa_driver_nl80211_del_beacon(struct wpa_driver_nl80211_data *drv) ++{ ++ struct i802_bss *bss; ++ ++ for (bss = &drv->first_bss; bss; bss = bss->next) ++ wpa_driver_nl80211_del_bss_beacon(bss); ++} ++ ++static int wpa_driver_nl80211_stop_ap(void *priv) ++{ ++ struct i802_bss *bss = priv; ++ ++ wpa_driver_nl80211_del_beacon(bss->drv); ++} + + /** + * wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface +@@ -6529,4 +6547,5 @@ const struct wpa_driver_ops wpa_driver_n + .set_intra_bss = nl80211_set_intra_bss, + .set_param = nl80211_set_param, + .get_radio_name = nl80211_get_radio_name, ++ .stop_ap = wpa_driver_nl80211_stop_ap, + }; +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -2217,6 +2217,8 @@ struct wpa_driver_ops { + const u8 *buf, size_t len); + + int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer); ++ ++ int (*stop_ap)(void *priv); + }; + + diff --git a/package/hostapd/patches/552-ctrl_iface_reload.patch b/package/hostapd/patches/552-ctrl_iface_reload.patch new file mode 100644 index 000000000..a780f7dca --- /dev/null +++ b/package/hostapd/patches/552-ctrl_iface_reload.patch @@ -0,0 +1,96 @@ +--- a/hostapd/ctrl_iface.c ++++ b/hostapd/ctrl_iface.c +@@ -39,6 +39,7 @@ + #include "wps/wps_defs.h" + #include "wps/wps.h" + #include "ctrl_iface.h" ++#include "config_file.h" + + + struct wpa_ctrl_dst { +@@ -49,6 +50,7 @@ struct wpa_ctrl_dst { + int errors; + }; + ++static char *reload_opts = NULL; + + static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level, + const char *buf, size_t len); +@@ -323,6 +325,66 @@ static int hostapd_ctrl_iface_disassocia + return 0; + } + ++static int hostapd_ctrl_iface_set_down(struct hostapd_data *hapd) ++{ ++ if (hapd->driver->stop_ap) ++ hapd->driver->stop_ap(hapd->drv_priv); ++ return 0; ++} ++ ++static char *get_option(char *opt, char *str) ++{ ++ int len = strlen(str); ++ ++ if (!strncmp(opt, str, len)) ++ return opt + len; ++ else ++ return NULL; ++} ++ ++static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname) ++{ ++ struct hostapd_config *conf; ++ char *opt, *val; ++ ++ conf = hostapd_config_read(fname); ++ if (!conf) ++ return NULL; ++ ++ for (opt = strtok(reload_opts, " "); ++ opt; ++ opt = strtok(NULL, " ")) { ++ ++ if ((val = get_option(opt, "channel="))) ++ conf->channel = atoi(val); ++ else if ((val = get_option(opt, "ht_capab="))) ++ conf->ht_capab = atoi(val); ++ else if ((val = get_option(opt, "ht_capab_mask="))) ++ conf->ht_capab &= atoi(val); ++ else if ((val = get_option(opt, "sec_chan="))) ++ conf->secondary_channel = atoi(val); ++ else if ((val = get_option(opt, "hwmode="))) ++ conf->hw_mode = atoi(val); ++ else if ((val = get_option(opt, "ieee80211n="))) ++ conf->ieee80211n = atoi(val); ++ else ++ break; ++ } ++ ++ return conf; ++} ++ ++static int hostapd_ctrl_iface_reload(struct hostapd_data *hapd, char *txt) ++{ ++ struct hostapd_iface *iface = hapd->iface; ++ ++ iface->config_read_cb = hostapd_ctrl_iface_config_read; ++ reload_opts = txt; ++ ++ hostapd_reload_config(iface); ++ ++ iface->config_read_cb = hostapd_config_read; ++} + + #ifdef CONFIG_IEEE80211W + #ifdef NEED_AP_MLME +@@ -822,6 +884,10 @@ static void hostapd_ctrl_iface_receive(i + reply_len += res; + } + #endif /* CONFIG_NO_RADIUS */ ++ } else if (os_strcmp(buf, "DOWN") == 0) { ++ hostapd_ctrl_iface_set_down(hapd); ++ } else if (os_strncmp(buf, "RELOAD ", 7) == 0) { ++ hostapd_ctrl_iface_reload(hapd, buf + 7); + } else if (os_strcmp(buf, "STA-FIRST") == 0) { + reply_len = hostapd_ctrl_iface_sta_first(hapd, reply, + reply_size); diff --git a/package/hostapd/patches/553-ap_sta_support.patch b/package/hostapd/patches/553-ap_sta_support.patch new file mode 100644 index 000000000..d94808e87 --- /dev/null +++ b/package/hostapd/patches/553-ap_sta_support.patch @@ -0,0 +1,211 @@ +--- a/wpa_supplicant/wpa_supplicant_i.h ++++ b/wpa_supplicant/wpa_supplicant_i.h +@@ -99,6 +99,8 @@ struct wpa_interface { + * receiving of EAPOL frames from an additional interface. + */ + const char *bridge_ifname; ++ ++ const char *hostapd_ctrl; + }; + + /** +@@ -337,6 +339,8 @@ struct wpa_supplicant { + #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ + char bridge_ifname[16]; + ++ struct wpa_ctrl *hostapd; ++ + char *confname; + struct wpa_config *conf; + int countermeasures; +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -52,6 +52,11 @@ OBJS_p += ../src/utils/wpabuf.o + OBJS_c = wpa_cli.o ../src/common/wpa_ctrl.o + OBJS_c += ../src/utils/wpa_debug.o + ++ifdef MULTICALL ++OBJS += ../src/common/wpa_ctrl.o ++CFLAGS += -DMULTICALL ++endif ++ + -include .config + -include $(if $(MULTICALL),../hostapd/.config) + +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -122,6 +122,55 @@ extern int wpa_debug_show_keys; + extern int wpa_debug_timestamp; + extern struct wpa_driver_ops *wpa_drivers[]; + ++#ifdef MULTICALL ++static int hostapd_stop(struct wpa_supplicant *wpa_s) ++{ ++ const char *cmd = "DOWN"; ++ char buf[256]; ++ int len = sizeof(buf); ++ ++ if (wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL) < 0) { ++ wpa_printf(MSG_ERROR, "\nFailed to stop hostapd AP interfaces\n"); ++ return -1; ++ } ++ return 0; ++} ++ ++static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) ++{ ++ char *cmd = NULL; ++ char buf[256]; ++ int len = sizeof(buf); ++ int channel, hw_mode; ++ int ret; ++ ++ if (!bss) ++ return; ++ ++ if (bss->freq < 4000) { ++ hw_mode = HOSTAPD_MODE_IEEE80211G; ++ channel = (bss->freq - 2407) / 5; ++ } else { ++ hw_mode = HOSTAPD_MODE_IEEE80211A; ++ channel = (bss->freq - 5000) / 5; ++ } ++ ++ if (asprintf(&cmd, "RELOAD channel=%d sec_chan=0 hw_mode=%d ieee80211n=%d", ++ channel, hw_mode, !!bss->ht_capab) < 0) { ++ return -1; ++ } ++ ++ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL); ++ free(cmd); ++ ++ if (ret < 0) { ++ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n"); ++ return -1; ++ } ++ return 0; ++} ++#endif ++ + /* Configure default/group WEP keys for static WEP */ + int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) + { +@@ -597,8 +646,16 @@ void wpa_supplicant_set_state(struct wpa + #ifdef CONFIG_P2P + wpas_p2p_completed(wpa_s); + #endif /* CONFIG_P2P */ ++#ifdef MULTICALL ++ if (wpa_s->hostapd) ++ hostapd_reload(wpa_s, wpa_s->current_bss); ++#endif + } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || + state == WPA_ASSOCIATED) { ++#ifdef MULTICALL ++ if (wpa_s->hostapd) ++ hostapd_stop(wpa_s); ++#endif + wpa_s->new_connection = 1; + wpa_drv_set_operstate(wpa_s, 0); + #ifndef IEEE8021X_EAPOL +@@ -2148,6 +2205,21 @@ static int wpa_supplicant_init_iface(str + os_strlcpy(wpa_s->bridge_ifname, iface->bridge_ifname, + sizeof(wpa_s->bridge_ifname)); + } ++#ifdef MULTICALL ++ if (iface->hostapd_ctrl) { ++ char *cmd = "DOWN"; ++ char buf[256]; ++ int len = sizeof(buf); ++ ++ wpa_s->hostapd = wpa_ctrl_open(iface->hostapd_ctrl); ++ if (!wpa_s->hostapd) { ++ wpa_printf(MSG_ERROR, "\nFailed to connect to hostapd\n"); ++ return -1; ++ } ++ if (hostapd_stop(wpa_s) < 0) ++ return -1; ++ } ++#endif + + /* RSNA Supplicant Key Management - INITIALIZE */ + eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); +--- a/wpa_supplicant/bss.c ++++ b/wpa_supplicant/bss.c +@@ -17,6 +17,7 @@ + #include "utils/common.h" + #include "utils/eloop.h" + #include "common/ieee802_11_defs.h" ++#include "common/ieee802_11_common.h" + #include "drivers/driver.h" + #include "wpa_supplicant_i.h" + #include "config.h" +@@ -70,6 +71,8 @@ struct wpa_bss * wpa_bss_get(struct wpa_ + + static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src) + { ++ struct ieee80211_ht_capabilities *capab; ++ struct ieee802_11_elems elems; + os_time_t usec; + + dst->flags = src->flags; +@@ -82,6 +85,12 @@ static void wpa_bss_copy_res(struct wpa_ + dst->level = src->level; + dst->tsf = src->tsf; + ++ memset(&elems, 0, sizeof(elems)); ++ ieee802_11_parse_elems((u8 *) (src + 1), src->ie_len, &elems, 0); ++ capab = (struct ieee80211_ht_capabilities *) elems.ht_capabilities; ++ if (capab) ++ dst->ht_capab = le_to_host16(capab->ht_capabilities_info); ++ + os_get_time(&dst->last_update); + dst->last_update.sec -= src->age / 1000; + usec = (src->age % 1000) * 1000; +--- a/wpa_supplicant/bss.h ++++ b/wpa_supplicant/bss.h +@@ -56,6 +56,7 @@ struct wpa_bss { + unsigned int flags; + u8 bssid[ETH_ALEN]; + u8 ssid[32]; ++ u16 ht_capab; + size_t ssid_len; + int freq; + u16 beacon_int; +--- a/wpa_supplicant/main.c ++++ b/wpa_supplicant/main.c +@@ -31,7 +31,7 @@ static void usage(void) + "usage:\n" + " wpa_supplicant [-BddhKLqqstuvW] [-P] " + "[-g] \\\n" +- " -i -c [-C] [-D] " ++ " -i -c [-C] [-D] [-H]" + "[-p] \\\n" + " [-b] [-f] \\\n" + " [-o] [-O] \\\n" +@@ -67,6 +67,7 @@ static void usage(void) + #endif /* CONFIG_DEBUG_SYSLOG */ + printf(" -t = include timestamp in debug messages\n" + " -h = show this help text\n" ++ " -H = connect to a hostapd instance to manage state changes\n" + " -L = show license (GPL and BSD)\n" + " -o = override driver parameter for new interfaces\n" + " -O = override ctrl_interface parameter for new interfaces\n" +@@ -143,7 +144,7 @@ int main(int argc, char *argv[]) + wpa_supplicant_fd_workaround(); + + for (;;) { +- c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNo:O:p:P:qstuvW"); ++ c = getopt(argc, argv, "b:Bc:C:D:df:g:hH:i:KLNo:O:p:P:qstuvW"); + if (c < 0) + break; + switch (c) { +@@ -184,6 +185,9 @@ int main(int argc, char *argv[]) + usage(); + exitcode = 0; + goto out; ++ case 'H': ++ iface->hostapd_ctrl = optarg; ++ break; + case 'i': + iface->ifname = optarg; + break; diff --git a/package/hostapd/patches/560-disable_ctrl_iface_mib.patch b/package/hostapd/patches/560-disable_ctrl_iface_mib.patch new file mode 100644 index 000000000..f186235cb --- /dev/null +++ b/package/hostapd/patches/560-disable_ctrl_iface_mib.patch @@ -0,0 +1,161 @@ +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -119,6 +119,9 @@ endif + ifdef CONFIG_NO_CTRL_IFACE + CFLAGS += -DCONFIG_NO_CTRL_IFACE + else ++ifdef CONFIG_CTRL_IFACE_MIB ++CFLAGS += -DCONFIG_CTRL_IFACE_MIB ++endif + OBJS += ctrl_iface.o + OBJS += ../src/ap/ctrl_iface_ap.o + endif +--- a/hostapd/ctrl_iface.c ++++ b/hostapd/ctrl_iface.c +@@ -855,6 +855,7 @@ static void hostapd_ctrl_iface_receive(i + } else if (os_strncmp(buf, "RELOG", 5) == 0) { + if (wpa_debug_reopen_file() < 0) + reply_len = -1; ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "MIB") == 0) { + reply_len = ieee802_11_get_mib(hapd, reply, reply_size); + if (reply_len >= 0) { +@@ -884,10 +885,12 @@ static void hostapd_ctrl_iface_receive(i + reply_len += res; + } + #endif /* CONFIG_NO_RADIUS */ ++#endif + } else if (os_strcmp(buf, "DOWN") == 0) { + hostapd_ctrl_iface_set_down(hapd); + } else if (os_strncmp(buf, "RELOAD ", 7) == 0) { + hostapd_ctrl_iface_reload(hapd, buf + 7); ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "STA-FIRST") == 0) { + reply_len = hostapd_ctrl_iface_sta_first(hapd, reply, + reply_size); +@@ -897,6 +900,7 @@ static void hostapd_ctrl_iface_receive(i + } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { + reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, + reply_size); ++#endif + } else if (os_strcmp(buf, "ATTACH") == 0) { + if (hostapd_ctrl_iface_attach(hapd, &from, fromlen)) + reply_len = -1; +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -675,6 +675,9 @@ ifdef CONFIG_IEEE80211N + OBJS += ../src/ap/ieee802_11_ht.o + endif + ifdef CONFIG_CTRL_IFACE ++ifdef CONFIG_CTRL_IFACE_MIB ++CFLAGS += -DCONFIG_CTRL_IFACE_MIB ++endif + OBJS += ../src/ap/ctrl_iface_ap.o + endif + +--- a/wpa_supplicant/ctrl_iface.c ++++ b/wpa_supplicant/ctrl_iface.c +@@ -2885,6 +2885,7 @@ char * wpa_supplicant_ctrl_iface_process + reply_len = -1; + } else if (os_strncmp(buf, "NOTE ", 5) == 0) { + wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "MIB") == 0) { + reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); + if (reply_len >= 0) { +@@ -2896,6 +2897,7 @@ char * wpa_supplicant_ctrl_iface_process + else + reply_len += res; + } ++#endif + } else if (os_strncmp(buf, "STATUS", 6) == 0) { + reply_len = wpa_supplicant_ctrl_iface_status( + wpa_s, buf + 6, reply, reply_size); +@@ -3189,6 +3191,7 @@ char * wpa_supplicant_ctrl_iface_process + reply_len = wpa_supplicant_ctrl_iface_bss( + wpa_s, buf + 4, reply, reply_size); + #ifdef CONFIG_AP ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "STA-FIRST") == 0) { + reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); + } else if (os_strncmp(buf, "STA ", 4) == 0) { +@@ -3197,6 +3200,7 @@ char * wpa_supplicant_ctrl_iface_process + } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { + reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, + reply_size); ++#endif + #endif /* CONFIG_AP */ + } else if (os_strcmp(buf, "SUSPEND") == 0) { + wpas_notify_suspend(wpa_s->global); +--- a/src/ap/ctrl_iface_ap.c ++++ b/src/ap/ctrl_iface_ap.c +@@ -24,6 +24,7 @@ + #include "p2p_hostapd.h" + #include "ctrl_iface_ap.h" + ++#ifdef CONFIG_CTRL_IFACE_MIB + + static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd, + struct sta_info *sta, +@@ -106,3 +107,5 @@ int hostapd_ctrl_iface_sta_next(struct h + } + return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); + } ++ ++#endif +--- a/src/ap/ieee802_1x.c ++++ b/src/ap/ieee802_1x.c +@@ -1866,6 +1866,7 @@ static const char * bool_txt(Boolean boo + return bool ? "TRUE" : "FALSE"; + } + ++#ifdef CONFIG_CTRL_IFACE_MIB + + int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) + { +@@ -2017,6 +2018,7 @@ int ieee802_1x_get_mib_sta(struct hostap + return len; + } + ++#endif + + static void ieee802_1x_finished(struct hostapd_data *hapd, + struct sta_info *sta, int success) +--- a/src/ap/wpa_auth.c ++++ b/src/ap/wpa_auth.c +@@ -2470,6 +2470,7 @@ static int wpa_cipher_bits(int cipher) + } + } + ++#ifdef CONFIG_CTRL_IFACE_MIB + + #define RSN_SUITE "%02x-%02x-%02x-%d" + #define RSN_SUITE_ARG(s) \ +@@ -2633,7 +2634,7 @@ int wpa_get_mib_sta(struct wpa_state_mac + + return len; + } +- ++#endif + + void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth) + { +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -1913,6 +1913,8 @@ static u32 wpa_cipher_suite(struct wpa_s + } + + ++#ifdef CONFIG_CTRL_IFACE_MIB ++ + #define RSN_SUITE "%02x-%02x-%02x-%d" + #define RSN_SUITE_ARG(s) \ + ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff +@@ -1992,6 +1994,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch + + return (int) len; + } ++#endif + #endif /* CONFIG_CTRL_IFACE */ + + diff --git a/package/hostapd/patches/600-terminate_on_setup_failure.patch b/package/hostapd/patches/600-terminate_on_setup_failure.patch index 9385413e5..63d3ec501 100644 --- a/package/hostapd/patches/600-terminate_on_setup_failure.patch +++ b/package/hostapd/patches/600-terminate_on_setup_failure.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -706,11 +706,8 @@ int hostapd_setup_interface_complete(str +@@ -717,11 +717,8 @@ int hostapd_setup_interface_complete(str size_t j; u8 *prev_addr; @@ -14,7 +14,7 @@ wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (hapd->iconf->channel) { -@@ -726,7 +723,7 @@ int hostapd_setup_interface_complete(str +@@ -737,7 +734,7 @@ int hostapd_setup_interface_complete(str hapd->iconf->secondary_channel)) { wpa_printf(MSG_ERROR, "Could not set channel for " "kernel driver"); @@ -23,16 +23,16 @@ } } -@@ -736,7 +733,7 @@ int hostapd_setup_interface_complete(str +@@ -748,7 +745,7 @@ int hostapd_setup_interface_complete(str hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, - HOSTAPD_LEVEL_WARNING, - "Failed to prepare rates table."); + HOSTAPD_LEVEL_WARNING, + "Failed to prepare rates table."); - return -1; + goto error; } } -@@ -744,14 +741,14 @@ int hostapd_setup_interface_complete(str +@@ -756,14 +753,14 @@ int hostapd_setup_interface_complete(str hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) { wpa_printf(MSG_ERROR, "Could not set RTS threshold for " "kernel driver"); @@ -49,7 +49,7 @@ } prev_addr = hapd->own_addr; -@@ -761,7 +758,7 @@ int hostapd_setup_interface_complete(str +@@ -773,7 +770,7 @@ int hostapd_setup_interface_complete(str if (j) os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN); if (hostapd_setup_bss(hapd, j == 0)) @@ -58,7 +58,7 @@ if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0) prev_addr = hapd->own_addr; } -@@ -773,7 +770,7 @@ int hostapd_setup_interface_complete(str +@@ -785,7 +782,7 @@ int hostapd_setup_interface_complete(str if (hostapd_driver_commit(hapd) < 0) { wpa_printf(MSG_ERROR, "%s: Failed to commit driver " "configuration", __func__); @@ -66,8 +66,8 @@ + goto error; } - wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", -@@ -783,6 +780,11 @@ int hostapd_setup_interface_complete(str + if (hapd->setup_complete_cb) +@@ -798,6 +795,11 @@ int hostapd_setup_interface_complete(str iface->init_complete(iface); return 0; diff --git a/package/hostapd/patches/700-random_pool_add_kernel.patch b/package/hostapd/patches/700-random_pool_add_kernel.patch new file mode 100644 index 000000000..1edaff9e7 --- /dev/null +++ b/package/hostapd/patches/700-random_pool_add_kernel.patch @@ -0,0 +1,120 @@ +--- a/src/crypto/random.c ++++ b/src/crypto/random.c +@@ -47,6 +47,8 @@ + #define EXTRACT_LEN 16 + #define MIN_READY_MARK 2 + ++#ifndef CONFIG_NO_RANDOM_POOL ++ + static u32 pool[POOL_WORDS]; + static unsigned int input_rotate = 0; + static unsigned int pool_pos = 0; +@@ -120,7 +122,7 @@ static void random_extract(u8 *out) + } + + +-void random_add_randomness(const void *buf, size_t len) ++static void random_pool_add_randomness(const void *buf, size_t len) + { + struct os_time t; + static unsigned int count = 0; +@@ -260,3 +262,22 @@ void random_mark_pool_ready(void) + wpa_printf(MSG_DEBUG, "random: Mark internal entropy pool to be " + "ready (count=%u/%u)", own_pool_ready, MIN_READY_MARK); + } ++ ++#endif /* CONFIG_NO_RANDOM_POOL */ ++ ++ ++void random_add_randomness(const void *buf, size_t len) ++{ ++#ifdef __linux__ ++ int fd; ++ ++ fd = open("/dev/random", O_RDWR); ++ if (fd >= 0) { ++ write(fd, buf, len); ++ close(fd); ++ } ++#endif ++#ifndef CONFIG_NO_RANDOM_POOL ++ random_pool_add_randomness(buf, len); ++#endif ++} +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -698,11 +698,11 @@ endif + ifdef CONFIG_NO_RANDOM_POOL + CFLAGS += -DCONFIG_NO_RANDOM_POOL + else +-OBJS += ../src/crypto/random.o +-HOBJS += ../src/crypto/random.o + HOBJS += $(SHA1OBJS) + HOBJS += ../src/crypto/md5.o + endif ++OBJS += ../src/crypto/random.o ++HOBJS += ../src/crypto/random.o + + ifdef CONFIG_RADIUS_SERVER + CFLAGS += -DRADIUS_SERVER +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -1101,9 +1101,8 @@ endif + + ifdef CONFIG_NO_RANDOM_POOL + CFLAGS += -DCONFIG_NO_RANDOM_POOL +-else +-OBJS += ../src/crypto/random.o + endif ++OBJS += ../src/crypto/random.o + + ifdef CONFIG_CTRL_IFACE + ifeq ($(CONFIG_CTRL_IFACE), y) +--- a/wpa_supplicant/Android.mk ++++ b/wpa_supplicant/Android.mk +@@ -1102,9 +1102,8 @@ endif + + ifdef CONFIG_NO_RANDOM_POOL + L_CFLAGS += -DCONFIG_NO_RANDOM_POOL +-else +-OBJS += src/crypto/random.c + endif ++OBJS += src/crypto/random.c + + ifdef CONFIG_CTRL_IFACE + ifeq ($(CONFIG_CTRL_IFACE), y) +--- a/hostapd/Android.mk ++++ b/hostapd/Android.mk +@@ -717,11 +717,11 @@ endif + ifdef CONFIG_NO_RANDOM_POOL + L_CFLAGS += -DCONFIG_NO_RANDOM_POOL + else +-OBJS += src/crypto/random.c +-HOBJS += src/crypto/random.c + HOBJS += $(SHA1OBJS) + HOBJS += src/crypto/md5.c + endif ++OBJS += src/crypto/random.c ++HOBJS += src/crypto/random.c + + ifdef CONFIG_RADIUS_SERVER + L_CFLAGS += -DRADIUS_SERVER +--- a/src/crypto/random.h ++++ b/src/crypto/random.h +@@ -16,15 +16,14 @@ + #define RANDOM_H + + #ifdef CONFIG_NO_RANDOM_POOL +-#define random_add_randomness(b, l) do { } while (0) + #define random_get_bytes(b, l) os_get_random((b), (l)) + #define random_pool_ready() 1 + #define random_mark_pool_ready() do { } while (0) + #else /* CONFIG_NO_RANDOM_POOL */ +-void random_add_randomness(const void *buf, size_t len); + int random_get_bytes(void *buf, size_t len); + int random_pool_ready(void); + void random_mark_pool_ready(void); + #endif /* CONFIG_NO_RANDOM_POOL */ ++void random_add_randomness(const void *buf, size_t len); + + #endif /* RANDOM_H */ diff --git a/package/hostapd/patches/710-bring_down_interface.patch b/package/hostapd/patches/710-bring_down_interface.patch new file mode 100644 index 000000000..bfd5ef626 --- /dev/null +++ b/package/hostapd/patches/710-bring_down_interface.patch @@ -0,0 +1,21 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -4883,9 +4883,6 @@ static int wpa_driver_nl80211_set_mode(v + /* Try to set the mode again while the interface is + * down */ + ret = nl80211_set_mode(drv, drv->ifindex, nlmode); +- if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, +- 1)) +- ret = -1; + if (!ret) + break; + } else +@@ -4898,6 +4895,8 @@ static int wpa_driver_nl80211_set_mode(v + wpa_printf(MSG_DEBUG, "nl80211: Mode change succeeded while " + "interface is down"); + drv->nlmode = nlmode; ++ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) ++ ret = -1; + } + + done: diff --git a/package/hostapd/patches/720-fix_wps_pin_crash.patch b/package/hostapd/patches/720-fix_wps_pin_crash.patch new file mode 100644 index 000000000..e1a3184d6 --- /dev/null +++ b/package/hostapd/patches/720-fix_wps_pin_crash.patch @@ -0,0 +1,12 @@ +--- a/hostapd/ctrl_iface.c ++++ b/hostapd/ctrl_iface.c +@@ -514,6 +514,9 @@ static int hostapd_ctrl_iface_wps_ap_pin + char *pos; + const char *pin_txt; + ++ if (!hapd->wps) ++ return -1; ++ + pos = os_strchr(txt, ' '); + if (pos) + *pos++ = '\0'; diff --git a/package/hostapd/patches/730-nl80211_enable_qosdata.patch b/package/hostapd/patches/730-nl80211_enable_qosdata.patch new file mode 100644 index 000000000..08bebe1a6 --- /dev/null +++ b/package/hostapd/patches/730-nl80211_enable_qosdata.patch @@ -0,0 +1,195 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -4263,7 +4263,7 @@ static const u8 rfc1042_header[6] = { 0x + + static int wpa_driver_nl80211_hapd_send_eapol( + void *priv, const u8 *addr, const u8 *data, +- size_t data_len, int encrypt, const u8 *own_addr) ++ size_t data_len, int encrypt, const u8 *own_addr, u32 flags) + { + struct i802_bss *bss = priv; + struct wpa_driver_nl80211_data *drv = bss->drv; +@@ -4271,11 +4271,7 @@ static int wpa_driver_nl80211_hapd_send_ + size_t len; + u8 *pos; + int res; +-#if 0 /* FIX */ +- int qos = sta->flags & WPA_STA_WMM; +-#else +- int qos = 0; +-#endif ++ int qos = flags & WPA_STA_WMM; + + len = sizeof(*hdr) + (qos ? 2 : 0) + sizeof(rfc1042_header) + 2 + + data_len; +@@ -4291,26 +4287,22 @@ static int wpa_driver_nl80211_hapd_send_ + hdr->frame_control |= host_to_le16(WLAN_FC_FROMDS); + if (encrypt) + hdr->frame_control |= host_to_le16(WLAN_FC_ISWEP); +-#if 0 /* To be enabled if qos determination is added above */ + if (qos) { + hdr->frame_control |= + host_to_le16(WLAN_FC_STYPE_QOS_DATA << 4); + } +-#endif + + memcpy(hdr->IEEE80211_DA_FROMDS, addr, ETH_ALEN); + memcpy(hdr->IEEE80211_BSSID_FROMDS, own_addr, ETH_ALEN); + memcpy(hdr->IEEE80211_SA_FROMDS, own_addr, ETH_ALEN); + pos = (u8 *) (hdr + 1); + +-#if 0 /* To be enabled if qos determination is added above */ + if (qos) { + /* add an empty QoS header if needed */ + pos[0] = 0; + pos[1] = 0; + pos += 2; + } +-#endif + + memcpy(pos, rfc1042_header, sizeof(rfc1042_header)); + pos += sizeof(rfc1042_header); +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -1396,7 +1396,7 @@ struct wpa_driver_ops { + */ + int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data, + size_t data_len, int encrypt, +- const u8 *own_addr); ++ const u8 *own_addr, u32 flags); + + /** + * sta_deauth - Deauthenticate a station (AP only) +--- a/src/drivers/driver_madwifi.c ++++ b/src/drivers/driver_madwifi.c +@@ -1097,7 +1097,7 @@ madwifi_wireless_event_init(struct madwi + + static int + madwifi_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len, +- int encrypt, const u8 *own_addr) ++ int encrypt, const u8 *own_addr, u32 flags) + { + struct madwifi_driver_data *drv = priv; + unsigned char buf[3000]; +--- a/src/drivers/driver_test.c ++++ b/src/drivers/driver_test.c +@@ -175,7 +175,7 @@ test_driver_get_cli(struct wpa_driver_te + + static int test_driver_send_eapol(void *priv, const u8 *addr, const u8 *data, + size_t data_len, int encrypt, +- const u8 *own_addr) ++ const u8 *own_addr, u32 flags) + { + struct test_driver_bss *dbss = priv; + struct wpa_driver_test_data *drv = dbss->drv; +--- a/src/drivers/driver_hostap.c ++++ b/src/drivers/driver_hostap.c +@@ -294,7 +294,8 @@ static int hostap_send_mlme(void *priv, + + + static int hostap_send_eapol(void *priv, const u8 *addr, const u8 *data, +- size_t data_len, int encrypt, const u8 *own_addr) ++ size_t data_len, int encrypt, const u8 *own_addr, ++ u32 flags) + { + struct hostap_driver_data *drv = priv; + struct ieee80211_hdr *hdr; +--- a/src/drivers/driver_atheros.c ++++ b/src/drivers/driver_atheros.c +@@ -1132,7 +1132,7 @@ atheros_wireless_event_init(struct ather + + static int + atheros_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len, +- int encrypt, const u8 *own_addr) ++ int encrypt, const u8 *own_addr, u32 flags) + { + struct atheros_driver_data *drv = priv; + unsigned char buf[3000]; +--- a/src/drivers/driver_bsd.c ++++ b/src/drivers/driver_bsd.c +@@ -516,7 +516,7 @@ no_ie: + + static int + bsd_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len, +- int encrypt, const u8 *own_addr) ++ int encrypt, const u8 *own_addr, u32 flags) + { + struct bsd_driver_data *drv = priv; + +--- a/src/ap/ap_drv_ops.h ++++ b/src/ap/ap_drv_ops.h +@@ -135,13 +135,14 @@ static inline int hostapd_drv_sta_remove + + static inline int hostapd_drv_hapd_send_eapol(struct hostapd_data *hapd, + const u8 *addr, const u8 *data, +- size_t data_len, int encrypt) ++ size_t data_len, int encrypt, ++ u32 flags) + { + if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL) + return 0; + return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data, + data_len, encrypt, +- hapd->own_addr); ++ hapd->own_addr, flags); + } + + static inline int hostapd_drv_read_sta_data( +--- a/src/ap/ieee802_1x.c ++++ b/src/ap/ieee802_1x.c +@@ -73,7 +73,7 @@ static void ieee802_1x_send(struct hosta + rsn_preauth_send(hapd, sta, buf, len); + } else { + hostapd_drv_hapd_send_eapol(hapd, sta->addr, buf, len, +- encrypt); ++ encrypt, sta->flags); + } + + os_free(buf); +--- a/src/ap/wpa_auth_glue.c ++++ b/src/ap/wpa_auth_glue.c +@@ -243,8 +243,15 @@ static int hostapd_wpa_auth_send_eapol(v + int encrypt) + { + struct hostapd_data *hapd = ctx; ++ struct sta_info *sta; ++ u32 flags = 0; ++ ++ sta = ap_get_sta(hapd, addr); ++ if (sta) ++ flags = sta->flags; ++ + return hostapd_drv_hapd_send_eapol(hapd, addr, data, data_len, +- encrypt); ++ encrypt, flags); + } + + +--- a/wpa_supplicant/driver_i.h ++++ b/wpa_supplicant/driver_i.h +@@ -351,12 +351,12 @@ static inline int wpa_drv_sta_remove(str + static inline int wpa_drv_hapd_send_eapol(struct wpa_supplicant *wpa_s, + const u8 *addr, const u8 *data, + size_t data_len, int encrypt, +- const u8 *own_addr) ++ const u8 *own_addr, u32 flags) + { + if (wpa_s->driver->hapd_send_eapol) + return wpa_s->driver->hapd_send_eapol(wpa_s->drv_priv, addr, + data, data_len, encrypt, +- own_addr); ++ own_addr, flags); + return -1; + } + +--- a/src/drivers/driver_wired.c ++++ b/src/drivers/driver_wired.c +@@ -314,7 +314,7 @@ static int wired_init_sockets(struct wpa + + static int wired_send_eapol(void *priv, const u8 *addr, + const u8 *data, size_t data_len, int encrypt, +- const u8 *own_addr) ++ const u8 *own_addr, u32 flags) + { + struct wpa_driver_wired_data *drv = priv; + struct ieee8023_hdr *hdr; diff --git a/package/iw/Makefile b/package/iw/Makefile index d1d60c1c6..625e17921 100644 --- a/package/iw/Makefile +++ b/package/iw/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iw -PKG_VERSION:=0.9.21 +PKG_VERSION:=0.9.22 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://wireless.kernel.org/download/iw/ -PKG_MD5SUM:=726db5f1fd6bc316434414770513ef81 +PKG_MD5SUM:=561c2602c5ce7c65a590118286c0892a PKG_BUILD_DEPENDS:=mac80211 include $(INCLUDE_DIR)/package.mk diff --git a/package/iw/patches/001-nl80211_sync.patch b/package/iw/patches/001-nl80211_sync.patch index 3f01fbf0d..a385897b7 100644 --- a/package/iw/patches/001-nl80211_sync.patch +++ b/package/iw/patches/001-nl80211_sync.patch @@ -1,221 +1,81 @@ --- a/nl80211.h +++ b/nl80211.h -@@ -295,7 +295,9 @@ - * auth and assoc steps. For this, you need to specify the SSID in a - * %NL80211_ATTR_SSID attribute, and can optionally specify the association - * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC, -- * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_CONTROL_PORT. -+ * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, -+ * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and -+ * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. - * It is also sent as an event, with the BSSID and response IEs when the - * connection is established or failed to be established. This can be - * determined by the STATUS_CODE attribute. -@@ -313,8 +315,8 @@ - * channel for the specified amount of time. This can be used to do - * off-channel operations like transmit a Public Action frame and wait for - * a response while being associated to an AP on another channel. -- * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify which -- * radio is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the -+ * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus -+ * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the - * frequency for the operation and %NL80211_ATTR_WIPHY_CHANNEL_TYPE may be - * optionally used to specify additional channel parameters. - * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds -@@ -385,6 +387,8 @@ - * of any other interfaces, and other interfaces will again take - * precedence when they are used. +@@ -148,6 +148,10 @@ + * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to + * destination %NL80211_ATTR_MAC on the interface identified by + * %NL80211_ATTR_IFINDEX. ++ * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by ++ * %NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP. ++ * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by ++ * %NL80211_ATTR_MAC. + * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the + * the interface identified by %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC +@@ -612,7 +616,7 @@ enum nl80211_commands { + * consisting of a nested array. * -+ * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. -+ * - * @NL80211_CMD_MAX: highest used command number - * @__NL80211_CMD_AFTER_LAST: internal use - */ -@@ -487,6 +491,7 @@ enum nl80211_commands { - NL80211_CMD_NOTIFY_CQM, - - NL80211_CMD_SET_CHANNEL, -+ NL80211_CMD_SET_WDS_PEER, - - /* add new commands above here */ - -@@ -686,6 +691,15 @@ enum nl80211_commands { - * request, the driver will assume that the port is unauthorized until - * authorized by user space. Otherwise, port is marked authorized by - * default in station mode. -+ * @NL80211_ATTR_CONTROL_PORT_ETHERTYPE: A 16-bit value indicating the -+ * ethertype that will be used for key negotiation. It can be -+ * specified with the associate and connect commands. If it is not -+ * specified, the value defaults to 0x888E (PAE, 802.1X). This -+ * attribute is also used as a flag in the wiphy information to -+ * indicate that protocols other than PAE are supported. -+ * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with -+ * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom -+ * ethertype frames used for key negotiation must not be encrypted. + * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). +- * @NL80211_ATTR_PLINK_ACTION: action to perform on the mesh peer link. ++ * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link. + * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. + * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path + * info given for %NL80211_CMD_GET_MPATH, nested attribute described at +@@ -879,7 +883,9 @@ enum nl80211_commands { + * See &enum nl80211_key_default_types. * - * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. - * We recommend using nested, driver-specific attributes within this. -@@ -787,6 +801,33 @@ enum nl80211_commands { - * This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING - * for non-automatic settings. + * @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters. These cannot be +- * changed once the mesh is active. ++ * changed once the mesh is active. ++ * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute ++ * containing attributes from &enum nl80211_meshconf_params. * -+ * @NL80211_ATTR_SUPPORT_IBSS_RSN: The device supports IBSS RSN, which mostly -+ * means support for per-station GTKs. -+ * -+ * @NL80211_ATTR_WIPHY_ANTENNA_TX: Bitmap of allowed antennas for transmitting. -+ * This can be used to mask out antennas which are not attached or should -+ * not be used for transmitting. If an antenna is not selected in this -+ * bitmap the hardware is not allowed to transmit on this antenna. -+ * -+ * Each bit represents one antenna, starting with antenna 1 at the first -+ * bit. Depending on which antennas are selected in the bitmap, 802.11n -+ * drivers can derive which chainmasks to use (if all antennas belonging to -+ * a particular chain are disabled this chain should be disabled) and if -+ * a chain has diversity antennas wether diversity should be used or not. -+ * HT capabilities (STBC, TX Beamforming, Antenna selection) can be -+ * derived from the available chains after applying the antenna mask. -+ * Non-802.11n drivers can derive wether to use diversity or not. -+ * Drivers may reject configurations or RX/TX mask combinations they cannot -+ * support by returning -EINVAL. -+ * -+ * @NL80211_ATTR_WIPHY_ANTENNA_RX: Bitmap of allowed antennas for receiving. -+ * This can be used to mask out antennas which are not attached or should -+ * not be used for receiving. If an antenna is not selected in this bitmap -+ * the hardware should not be configured to receive on this antenna. -+ * For a more detailed descripton see @NL80211_ATTR_WIPHY_ANTENNA_TX. -+ * -+ * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS -+ * * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use - */ -@@ -951,6 +992,16 @@ enum nl80211_attrs { - NL80211_ATTR_RX_FRAME_TYPES, - NL80211_ATTR_FRAME_TYPE, - -+ NL80211_ATTR_CONTROL_PORT_ETHERTYPE, -+ NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, -+ -+ NL80211_ATTR_SUPPORT_IBSS_RSN, -+ -+ NL80211_ATTR_WIPHY_ANTENNA_TX, -+ NL80211_ATTR_WIPHY_ANTENNA_RX, -+ -+ NL80211_ATTR_MCAST_RATE, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, -@@ -1006,6 +1057,8 @@ enum nl80211_attrs { - * @NL80211_IFTYPE_WDS: wireless distribution interface - * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames - * @NL80211_IFTYPE_MESH_POINT: mesh point -+ * @NL80211_IFTYPE_P2P_CLIENT: P2P client -+ * @NL80211_IFTYPE_P2P_GO: P2P group owner - * @NL80211_IFTYPE_MAX: highest interface type number currently defined - * @NUM_NL80211_IFTYPES: number of defined interface types - * -@@ -1022,6 +1075,8 @@ enum nl80211_iftype { - NL80211_IFTYPE_WDS, - NL80211_IFTYPE_MONITOR, - NL80211_IFTYPE_MESH_POINT, -+ NL80211_IFTYPE_P2P_CLIENT, -+ NL80211_IFTYPE_P2P_GO, - - /* keep last */ - NUM_NL80211_IFTYPES, -@@ -1111,6 +1166,8 @@ enum nl80211_rate_info { - * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station) - * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this - * station) -+ * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station) -+ * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station) +@@ -1225,8 +1231,6 @@ enum nl80211_rate_info { + * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) + * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station) + * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) +- * @__NL80211_STA_INFO_AFTER_LAST: internal +- * @NL80211_STA_INFO_MAX: highest possible station info attribute + * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) + * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute + * containing info as possible, see &enum nl80211_sta_info_txrate. +@@ -1236,6 +1240,13 @@ enum nl80211_rate_info { + * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station) + * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station) + * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm) ++ * @NL80211_STA_INFO_LLID: the station's mesh LLID ++ * @NL80211_STA_INFO_PLID: the station's mesh PLID ++ * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station ++ * @NL80211_STA_INFO_RX_BITRATE: last unicast rx rate, nested attribute ++ * containing info as possible, see &enum nl80211_sta_info_txrate. ++ * @__NL80211_STA_INFO_AFTER_LAST: internal ++ * @NL80211_STA_INFO_MAX: highest possible station info attribute */ enum nl80211_sta_info { __NL80211_STA_INFO_INVALID, -@@ -1124,6 +1181,8 @@ enum nl80211_sta_info { - NL80211_STA_INFO_TX_BITRATE, - NL80211_STA_INFO_RX_PACKETS, - NL80211_STA_INFO_TX_PACKETS, -+ NL80211_STA_INFO_TX_RETRIES, -+ NL80211_STA_INFO_TX_FAILED, +@@ -1252,6 +1263,7 @@ enum nl80211_sta_info { + NL80211_STA_INFO_TX_RETRIES, + NL80211_STA_INFO_TX_FAILED, + NL80211_STA_INFO_SIGNAL_AVG, ++ NL80211_STA_INFO_RX_BITRATE, /* keep last */ __NL80211_STA_INFO_AFTER_LAST, -@@ -1277,7 +1336,11 @@ enum nl80211_bitrate_attr { - * wireless core it thinks its knows the regulatory domain we should be in. - * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an - * 802.11 country information element with regulatory information it -- * thinks we should consider. -+ * thinks we should consider. cfg80211 only processes the country -+ * code from the IE, and relies on the regulatory domain information -+ * structure pased by userspace (CRDA) from our wireless-regdb. -+ * If a channel is enabled but the country code indicates it should -+ * be disabled we disable the channel and re-enable it upon disassociation. - */ - enum nl80211_reg_initiator { - NL80211_REGDOM_SET_BY_CORE, -@@ -1382,6 +1445,17 @@ enum nl80211_reg_rule_flags { - * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved - * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel - * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm) -+ * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used -+ * @NL80211_SURVEY_INFO_CHANNEL_TIME: amount of time (in ms) that the radio -+ * spent on this channel -+ * @NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY: amount of the time the primary -+ * channel was sensed busy (either due to activity or energy detect) -+ * @NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: amount of time the extension -+ * channel was sensed busy -+ * @NL80211_SURVEY_INFO_CHANNEL_TIME_RX: amount of time the radio spent -+ * receiving data -+ * @NL80211_SURVEY_INFO_CHANNEL_TIME_TX: amount of time the radio spent -+ * transmitting data - * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number - * currently defined - * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use -@@ -1390,6 +1464,12 @@ enum nl80211_survey_info { - __NL80211_SURVEY_INFO_INVALID, - NL80211_SURVEY_INFO_FREQUENCY, - NL80211_SURVEY_INFO_NOISE, -+ NL80211_SURVEY_INFO_IN_USE, -+ NL80211_SURVEY_INFO_CHANNEL_TIME, -+ NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY, -+ NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY, -+ NL80211_SURVEY_INFO_CHANNEL_TIME_RX, -+ NL80211_SURVEY_INFO_CHANNEL_TIME_TX, - - /* keep last */ - __NL80211_SURVEY_INFO_AFTER_LAST, -@@ -1636,11 +1716,14 @@ enum nl80211_auth_type { - * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key - * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key - * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS) -+ * @NUM_NL80211_KEYTYPES: number of defined key types - */ - enum nl80211_key_type { - NL80211_KEYTYPE_GROUP, - NL80211_KEYTYPE_PAIRWISE, - NL80211_KEYTYPE_PEERKEY, -+ -+ NUM_NL80211_KEYTYPES - }; - - /** -@@ -1671,6 +1754,9 @@ enum nl80211_wpa_versions { - * CCMP keys, each six bytes in little endian - * @NL80211_KEY_DEFAULT: flag indicating default key - * @NL80211_KEY_DEFAULT_MGMT: flag indicating default management key -+ * @NL80211_KEY_TYPE: the key type from enum nl80211_key_type, if not -+ * specified the default depends on whether a MAC address was -+ * given with the command using the key or not (u32) - * @__NL80211_KEY_AFTER_LAST: internal - * @NL80211_KEY_MAX: highest key attribute +@@ -1626,7 +1638,7 @@ enum nl80211_mntr_flags { + * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) + * that it takes for an HWMP information element to propagate across the mesh + * +- * @NL80211_MESHCONF_ROOTMODE: whether root mode is enabled or not ++ * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not + * + * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a + * source mesh point for path selection elements. +@@ -1678,6 +1690,7 @@ enum nl80211_meshconf_params { + * element that vendors will use to identify the path selection methods and + * metrics in use. + * ++ * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number + * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use */ -@@ -1682,6 +1768,7 @@ enum nl80211_key_attributes { - NL80211_KEY_SEQ, - NL80211_KEY_DEFAULT, - NL80211_KEY_DEFAULT_MGMT, -+ NL80211_KEY_TYPE, - - /* keep last */ - __NL80211_KEY_AFTER_LAST, + enum nl80211_mesh_setup_params { diff --git a/package/iw/patches/100-rx_rate.patch b/package/iw/patches/100-rx_rate.patch new file mode 100644 index 000000000..e3df6ca09 --- /dev/null +++ b/package/iw/patches/100-rx_rate.patch @@ -0,0 +1,97 @@ +--- a/station.c ++++ b/station.c +@@ -29,13 +29,43 @@ enum plink_actions { + PLINK_ACTION_BLOCK, + }; + ++static void print_sta_bitrate(struct nlattr *nla, const char *name) ++{ ++ struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1]; ++ ++ static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = { ++ [NL80211_RATE_INFO_BITRATE] = { .type = NLA_U16 }, ++ [NL80211_RATE_INFO_MCS] = { .type = NLA_U8 }, ++ [NL80211_RATE_INFO_40_MHZ_WIDTH] = { .type = NLA_FLAG }, ++ [NL80211_RATE_INFO_SHORT_GI] = { .type = NLA_FLAG }, ++ }; ++ ++ if (!nla) ++ return; ++ ++ if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX, nla, rate_policy)) { ++ fprintf(stderr, "failed to parse nested rate attributes!\n"); ++ } else { ++ printf("\n\t%s:\t", name); ++ if (rinfo[NL80211_RATE_INFO_BITRATE]) { ++ int rate = nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]); ++ printf("%d.%d MBit/s", rate / 10, rate % 10); ++ } ++ ++ if (rinfo[NL80211_RATE_INFO_MCS]) ++ printf(" MCS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_MCS])); ++ if (rinfo[NL80211_RATE_INFO_40_MHZ_WIDTH]) ++ printf(" 40Mhz"); ++ if (rinfo[NL80211_RATE_INFO_SHORT_GI]) ++ printf(" short GI"); ++ } ++} + + static int print_sta_handler(struct nl_msg *msg, void *arg) + { + struct nlattr *tb[NL80211_ATTR_MAX + 1]; + struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); + struct nlattr *sinfo[NL80211_STA_INFO_MAX + 1]; +- struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1]; + char mac_addr[20], state_name[10], dev[20]; + static struct nla_policy stats_policy[NL80211_STA_INFO_MAX + 1] = { + [NL80211_STA_INFO_INACTIVE_TIME] = { .type = NLA_U32 }, +@@ -45,6 +75,7 @@ static int print_sta_handler(struct nl_m + [NL80211_STA_INFO_TX_PACKETS] = { .type = NLA_U32 }, + [NL80211_STA_INFO_SIGNAL] = { .type = NLA_U8 }, + [NL80211_STA_INFO_TX_BITRATE] = { .type = NLA_NESTED }, ++ [NL80211_STA_INFO_RX_BITRATE] = { .type = NLA_NESTED }, + [NL80211_STA_INFO_LLID] = { .type = NLA_U16 }, + [NL80211_STA_INFO_PLID] = { .type = NLA_U16 }, + [NL80211_STA_INFO_PLINK_STATE] = { .type = NLA_U8 }, +@@ -52,13 +83,6 @@ static int print_sta_handler(struct nl_m + [NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32 }, + }; + +- static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = { +- [NL80211_RATE_INFO_BITRATE] = { .type = NLA_U16 }, +- [NL80211_RATE_INFO_MCS] = { .type = NLA_U8 }, +- [NL80211_RATE_INFO_40_MHZ_WIDTH] = { .type = NLA_FLAG }, +- [NL80211_RATE_INFO_SHORT_GI] = { .type = NLA_FLAG }, +- }; +- + nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), + genlmsg_attrlen(gnlh, 0), NULL); + +@@ -111,25 +135,8 @@ static int print_sta_handler(struct nl_m + printf("\n\tsignal avg:\t%d dBm", + (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG])); + +- if (sinfo[NL80211_STA_INFO_TX_BITRATE]) { +- if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX, +- sinfo[NL80211_STA_INFO_TX_BITRATE], rate_policy)) { +- fprintf(stderr, "failed to parse nested rate attributes!\n"); +- } else { +- printf("\n\ttx bitrate:\t"); +- if (rinfo[NL80211_RATE_INFO_BITRATE]) { +- int rate = nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]); +- printf("%d.%d MBit/s", rate / 10, rate % 10); +- } +- +- if (rinfo[NL80211_RATE_INFO_MCS]) +- printf(" MCS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_MCS])); +- if (rinfo[NL80211_RATE_INFO_40_MHZ_WIDTH]) +- printf(" 40Mhz"); +- if (rinfo[NL80211_RATE_INFO_SHORT_GI]) +- printf(" short GI"); +- } +- } ++ print_sta_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], "tx bitrate"); ++ print_sta_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE], "rx bitrate"); + + if (sinfo[NL80211_STA_INFO_LLID]) + printf("\n\tmesh llid:\t%d", diff --git a/package/iw/patches/100-survey_freq_in_use.patch b/package/iw/patches/100-survey_freq_in_use.patch deleted file mode 100644 index 3933ae379..000000000 --- a/package/iw/patches/100-survey_freq_in_use.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/survey.c -+++ b/survey.c -@@ -44,8 +44,9 @@ static int print_survey_handler(struct n - } - - if (sinfo[NL80211_SURVEY_INFO_FREQUENCY]) -- printf("\tfrequency:\t%u MHz\n", -- nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY])); -+ printf("\tfrequency:\t%u MHz%s\n", -+ nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]), -+ sinfo[NL80211_SURVEY_INFO_IN_USE] ? " [in use]" : ""); - if (sinfo[NL80211_SURVEY_INFO_NOISE]) - printf("\tnoise:\t\t%d dBm\n", - (int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_NOISE])); diff --git a/package/iw/patches/110-survey_phy_stats.patch b/package/iw/patches/110-survey_phy_stats.patch deleted file mode 100644 index cdd5c2e48..000000000 --- a/package/iw/patches/110-survey_phy_stats.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/survey.c -+++ b/survey.c -@@ -44,12 +44,27 @@ static int print_survey_handler(struct n - } - - if (sinfo[NL80211_SURVEY_INFO_FREQUENCY]) -- printf("\tfrequency:\t%u MHz%s\n", -+ printf("\tfrequency:\t\t\t%u MHz%s\n", - nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]), - sinfo[NL80211_SURVEY_INFO_IN_USE] ? " [in use]" : ""); - if (sinfo[NL80211_SURVEY_INFO_NOISE]) -- printf("\tnoise:\t\t%d dBm\n", -+ printf("\tnoise:\t\t\t\t%d dBm\n", - (int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_NOISE])); -+ if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME]) -+ printf("\tchannel active time:\t\t%lld ms\n", -+ (int64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME])); -+ if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY]) -+ printf("\tchannel busy time:\t\t%lld ms\n", -+ (int64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY])); -+ if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY]) -+ printf("\textension channel busy time:\t%lld ms\n", -+ (int64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY])); -+ if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX]) -+ printf("\tchannel receive time:\t\t%lld ms\n", -+ (int64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX])); -+ if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_TX]) -+ printf("\tchannel transmit time:\t\t%lld ms\n", -+ (int64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_TX])); - return NL_SKIP; - } - diff --git a/package/iw/patches/120-ibss_mcast_rate.patch b/package/iw/patches/120-ibss_mcast_rate.patch deleted file mode 100644 index acbd3e89a..000000000 --- a/package/iw/patches/120-ibss_mcast_rate.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/ibss.c -+++ b/ibss.c -@@ -83,6 +83,20 @@ static int join_ibss(struct nl80211_stat - argc--; - } - -+ /* multicast rate */ -+ if (argc > 1 && strcmp(argv[0], "mcast-rate") == 0) { -+ argv++; -+ argc--; -+ -+ rate = strtod(argv[0], &end); -+ if (*end != '\0') -+ return 1; -+ -+ NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, (int) rate * 10); -+ argv++; -+ argc--; -+ } -+ - if (!argc) - return 0; - -@@ -109,7 +123,7 @@ COMMAND(ibss, leave, NULL, - "Leave the current IBSS cell."); - COMMAND(ibss, join, - " [fixed-freq] [] " -- "[basic-rates ] [key d:0:abcde]", -+ "[basic-rates ] [mcast-rate ] [key d:0:abcde]", - NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss, - "Join the IBSS cell with the given SSID, if it doesn't exist create\n" - "it on the given frequency. When fixed frequency is requested, don't\n" diff --git a/package/kernel/modules/wireless.mk b/package/kernel/modules/wireless.mk index 41a05ff59..ff0cdc514 100644 --- a/package/kernel/modules/wireless.mk +++ b/package/kernel/modules/wireless.mk @@ -43,7 +43,7 @@ $(eval $(call KernelPackage,lib80211)) define KernelPackage/net-airo SUBMENU:=$(WIRELESS_MENU) TITLE:=Cisco Aironet driver - DEPENDS:=@PCI_SUPPORT + DEPENDS:=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT KCONFIG:=CONFIG_AIRO FILES:=$(LINUX_DIR)/drivers/net/wireless/airo.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,airo) @@ -59,7 +59,7 @@ $(eval $(call KernelPackage,net-airo)) define KernelPackage/net-hermes SUBMENU:=$(WIRELESS_MENU) TITLE:=Hermes 802.11b chipset support - DEPENDS:=@LINUX_2_6 @PCI_SUPPORT||PCMCIA_SUPPORT + DEPENDS:=@LINUX_2_6 @PCI_SUPPORT||PCMCIA_SUPPORT +@DRIVER_WEXT_SUPPORT KCONFIG:=CONFIG_HERMES \ CONFIG_HERMES_CACHE_FW_ON_INIT=n FILES:= \ @@ -125,7 +125,7 @@ $(eval $(call KernelPackage,net-hermes-pcmcia)) define KernelPackage/net-prism54 SUBMENU:=$(WIRELESS_MENU) TITLE:=Intersil Prism54 support - DEPENDS:=@PCI_SUPPORT + DEPENDS:=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT KCONFIG:=CONFIG_PRISM54 FILES:=$(LINUX_DIR)/drivers/net/wireless/prism54/prism54.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,60,prism54) diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 5e49c810b..ea07fff7a 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -10,17 +10,26 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=2011-02-25 +PKG_VERSION:=2011-03-24 PKG_RELEASE:=1 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources -PKG_MD5SUM:=c0242cc152a157902ff60fe05d1773b2 +PKG_MD5SUM:=f5713fb3ab59bdd3d0ce931b813ef960 PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 +PKG_DRIVERS = \ + ath5k libertas-usb libertas-sd p54-common p54-pci p54-usb p54-spi \ + rt2x00-lib rt2x00-pci rt2x00-usb rt2x00-soc rt2800-lib rt2400-pci \ + rt2500-pci rt2500-usb rt61-pci rt73-usb rt2800-pci rt2800-usb \ + rtl8180 rtl8187 zd1211rw mac80211-hwsim carl9170 b43 b43legacy \ + ath9k-common ath9k ath9k-htc ath net-libipw net-ipw2100 net-ipw2200 \ + mwl8k net-hermes net-hermes-pci net-hermes-plx net-hermes-pcmcia + PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_kmod-mac80211 \ + $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \ CONFIG_PACKAGE_MAC80211_DEBUGFS \ CONFIG_PACKAGE_ATH_DEBUG \ CONFIG_ATH_USER_REGD \ @@ -274,7 +283,7 @@ endef define KernelPackage/rt2800-lib $(call KernelPackage/rt2x00/Default) - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +USB_SUPPORT:kmod-rt2x00-usb +TARGET_ramips:kmod-rt2x00-soc + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +USB_SUPPORT:kmod-rt2x00-usb +TARGET_ramips:kmod-rt2x00-soc +@DRIVER_11N_SUPPORT TITLE+= (rt2800 LIB) FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800lib.ko AUTOLOAD:=$(call AutoLoad,27,rt2800lib) @@ -427,16 +436,25 @@ define KernelPackage/ath5k/description Atheros 5xxx chipset. endef -define KernelPackage/ath9k +define KernelPackage/ath9k-common $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 802.11n wireless cards support + TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc) URL:=http://linuxwireless.org/en/users/Drivers/ath9k - DEPENDS+= @PCI_SUPPORT +kmod-ath + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko + AUTOLOAD:=$(call AutoLoad,27,ath9k_hw ath9k_common) +endef + +define KernelPackage/ath9k + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11n PCI wireless cards support + URL:=http://linuxwireless.org/en/users/Drivers/ath9k + DEPENDS+= @PCI_SUPPORT +kmod-ath9k-common + FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko - AUTOLOAD:=$(call AutoLoad,27,ath9k_hw ath9k_common ath9k) + AUTOLOAD:=$(call AutoLoad,28,ath9k) endef define KernelPackage/ath9k/description @@ -444,10 +462,50 @@ This module adds support for wireless adapters based on Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets. endef +AR7010FW:=ar7010.fw +AR7010_1_1_FW:=ar7010_1_1.fw +AR9271FW:=ar9271.fw + +define Download/ar9271 + FILE:=$(AR9271FW) + URL:=http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=blob_plain;f=ar9271.fw;h=d0ee74a1c8dccb7cc21f5be90f1d4048fa9dbf9e;hb=HEAD;? + MD5SUM:=2e6f5045ec4c5a42bb93ced242bad0ba +endef +$(eval $(call Download,ar9271)) + +define Download/ar7010 + FILE:=$(AR7010FW) + URL:=http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=blob_plain;f=ar7010.fw;h=840005d0f0c81838c581b8cd5d76c8dd3843731c;hb=HEAD;? + MD5SUM:=59823b82b1f72bed9b044e8cc78ad65c +endef +$(eval $(call Download,ar7010)) + +define Download/ar7010_1_1 + FILE:=$(AR7010_1_1_FW) + URL:=http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=blob_plain;f=ar7010_1_1.fw;h=684d4cd1a8cac4f58305589e31f9d856d03a8ef0;hb=HEAD;? + MD5SUM:=544fcbe5a93cfa53c7e6d3ded2b05347 +endef +$(eval $(call Download,ar7010_1_1)) + +define KernelPackage/ath9k-htc + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11n USB device support + URL:=http://linuxwireless.org/en/users/Drivers/ath9k + DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko + AUTOLOAD:=$(call AutoLoad,28,ath9k_htc) +endef + +define KernelPackage/ath9k-htc/description +This module adds support for wireless adapters based on +Atheros USB AR9271 and AR7010 family of chipsets. +endef + define KernelPackage/carl9170 $(call KernelPackage/mac80211/Default) TITLE:=Driver for Atheros AR9170 USB sticks - DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core + DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +@DRIVER_11N_SUPPORT FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko AUTOLOAD:=$(call AutoLoad,60,carl9170) endef @@ -499,7 +557,7 @@ endef define KernelPackage/libertas-sd $(call KernelPackage/mac80211/Default) - DEPENDS+= +kmod-mac80211 +kmod-lib80211 + DEPENDS+= +kmod-mac80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT TITLE:=Marvell 88W8686 Wireless Driver FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \ @@ -579,7 +637,7 @@ endef define KernelPackage/net-hermes $(call KernelPackage/mac80211/Default) TITLE:=Hermes 802.11b chipset support - DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 + DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco.ko AUTOLOAD:=$(call AutoLoad,50,orinoco) endef @@ -910,12 +968,13 @@ MAKE_OPTS:= \ CONFIG_ATH5K_PCI=$(if $(CONFIG_TARGET_atheros),,y) \ CONFIG_ATH5K_AHB=$(if $(CONFIG_TARGET_atheros),y) \ CONFIG_ATH9K=$(if $(CONFIG_PACKAGE_kmod-ath9k),m) \ - CONFIG_ATH9K_HW=$(if $(CONFIG_PACKAGE_kmod-ath9k),m) \ - CONFIG_ATH9K_COMMON=$(if $(CONFIG_PACKAGE_kmod-ath9k),m) \ + CONFIG_ATH9K_HTC=$(if $(CONFIG_PACKAGE_kmod-ath9k-htc),m) \ + CONFIG_ATH9K_HW=$(if $(CONFIG_PACKAGE_kmod-ath9k-common),m) \ + CONFIG_ATH9K_COMMON=$(if $(CONFIG_PACKAGE_kmod-ath9k-common),m) \ CONFIG_ATH9K_DEBUGFS=$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),y) \ CONFIG_CARL9170=$(if $(CONFIG_PACKAGE_kmod-carl9170),m) \ CONFIG_CARL9170_DEBUGFS=$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),y) \ - CONFIG_ZD1211RW=$(if $(CONFIG_PACKAGE_kmod-zd1211rw),m) \ + CONFIG_COMPAT_ZD1211RW=$(if $(CONFIG_PACKAGE_kmod-zd1211rw),m) \ CONFIG_P54_COMMON=$(if $(CONFIG_PACKAGE_kmod-p54-common),m) \ CONFIG_P54_PCI=$(if $(CONFIG_PACKAGE_kmod-p54-pci),m) \ CONFIG_P54_USB=$(if $(CONFIG_PACKAGE_kmod-p54-usb),m) \ @@ -987,7 +1046,6 @@ MAKE_OPTS:= \ CONFIG_AR9170_USB=$(if $(CONFIG_PACKAGE_kmod-ar9170),m) \ CONFIG_AR9170_LEDS=$(CONFIG_LEDS_TRIGGERS) \ CONFIG_IWM= \ - CONFIG_ATH9K_HTC= \ CONFIG_MAC80211_RC_MINSTREL_HT=y \ MADWIFI= \ OLD_IWL= \ @@ -1101,6 +1159,15 @@ define KernelPackage/ar9170/install $(INSTALL_DATA) $(DL_DIR)/$(AR9170FW) $(1)/lib/firmware/ endef +define KernelPackage/ath9k-htc/install + $(INSTALL_DIR) $(1)/lib/firmware + $(INSTALL_DATA) \ + $(DL_DIR)/$(AR9271FW) \ + $(DL_DIR)/$(AR7010FW) \ + $(DL_DIR)/$(AR7010_1_1_FW) \ + $(1)/lib/firmware/ +endef + define KernelPackage/net-ipw2100/install $(INSTALL_DIR) $(1)/lib/firmware $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware @@ -1184,7 +1251,9 @@ $(eval $(call KernelPackage,rtl8180)) $(eval $(call KernelPackage,rtl8187)) $(eval $(call KernelPackage,zd1211rw)) $(eval $(call KernelPackage,mac80211-hwsim)) +$(eval $(call KernelPackage,ath9k-common)) $(eval $(call KernelPackage,ath9k)) +$(eval $(call KernelPackage,ath9k-htc)) $(eval $(call KernelPackage,ath)) $(eval $(call KernelPackage,carl9170)) $(eval $(call KernelPackage,b43)) diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 2f4abd085..d395db11d 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -6,10 +6,15 @@ mac80211_hostapd_setup_base() { local ifname="$2" cfgfile="/var/run/hostapd-$phy.conf" + macfile="/var/run/hostapd-$phy.maclist" + [ -e "$macfile" ] && rm -f "$macfile" + config_get device "$vif" device config_get country "$device" country config_get hwmode "$device" hwmode config_get channel "$device" channel + config_get beacon_int "$device" beacon_int + config_get basic_rate_list "$device" basic_rate config_get_bool noscan "$device" noscan [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device" [ "$channel" = auto ] && channel= @@ -30,7 +35,35 @@ mac80211_hostapd_setup_base() { [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" } } - cat > "$cfgfile" <> $macfile + done + } + + local br brval brstr + [ -n "$basic_rate_list" ] && { + for br in $basic_rate_list; do + brval="$(($br / 100))" + [ -n "$brstr" ] && brstr="$brstr " + brstr="$brstr$brval" + done + } + + cat >> "$cfgfile" <