From 327d4d9f67f3d0d6a98393568989696963a899bf Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 9 Nov 2010 01:36:36 +0000 Subject: hostapd: update to 20101109, reorganize patches SVN-Revision: 23932 --- package/hostapd/Makefile | 6 +- package/hostapd/patches/001-nl80211_sync.patch | 21 - .../hostapd/patches/100-madwifi_compile_fix.patch | 18 + package/hostapd/patches/100-madwifi_fix.patch | 21 - package/hostapd/patches/110-countrycode.patch | 10 - .../patches/110-roboswitch_compile_fix.patch | 14 + package/hostapd/patches/120-compile_fix.patch | 28 - package/hostapd/patches/130-scan_wait.patch | 148 ---- package/hostapd/patches/200-multicall.patch | 236 ------- package/hostapd/patches/300-scan_ssid.patch | 37 + package/hostapd/patches/300-timestamp_check.patch | 15 - package/hostapd/patches/310-madwifi_merge.patch | 773 +++++++++++++++++++++ package/hostapd/patches/310-scan_ssid.patch | 37 - .../hostapd/patches/320-rescan_immediately.patch | 11 - package/hostapd/patches/320-wds_fix.patch | 28 + package/hostapd/patches/330-madwifi_merge.patch | 760 -------------------- package/hostapd/patches/330-wds_bridge_fix.patch | 75 ++ package/hostapd/patches/340-basic_rates_fix.patch | 70 ++ package/hostapd/patches/340-roboswitch_fix.patch | 14 - .../hostapd/patches/350-ap_isolate_support.patch | 108 +++ package/hostapd/patches/350-wds_fix.patch | 28 - .../patches/360-nl80211_multicall_fixes.patch | 124 ++++ package/hostapd/patches/360-wds_bridge.patch | 75 -- package/hostapd/patches/370-basic_rates.patch | 70 -- .../hostapd/patches/370-non_eapol_port_fix.patch | 22 + package/hostapd/patches/380-ap_isolate.patch | 108 --- .../hostapd/patches/380-multicall_bridge_fix.patch | 45 ++ package/hostapd/patches/390-mbss_reload_fix.patch | 89 +++ package/hostapd/patches/390-nl80211_fixes.patch | 124 ---- package/hostapd/patches/400-nl80211_sta_auth.patch | 19 - package/hostapd/patches/410-no_rfkill.patch | 263 ------- .../hostapd/patches/420-stbc_fix_backport.patch | 41 -- .../patches/430-supplicant_bridge_fix.patch | 45 -- package/hostapd/patches/440-mbss_reload_fix.patch | 89 --- package/hostapd/patches/450-reload_settings.patch | 13 - .../patches/451-nl80211_del_beacon_bss.patch | 63 -- .../hostapd/patches/452-ctrl_iface_reload.patch | 96 --- package/hostapd/patches/453-ap_sta_support.patch | 211 ------ package/hostapd/patches/460-oper_state_fix.patch | 25 - package/hostapd/patches/500-scan_wait.patch | 148 ++++ package/hostapd/patches/510-multicall.patch | 236 +++++++ package/hostapd/patches/520-timestamp_check.patch | 15 + .../hostapd/patches/530-rescan_immediately.patch | 11 + package/hostapd/patches/540-optional_rfkill.patch | 263 +++++++ .../hostapd/patches/550-reload_freq_change.patch | 13 + .../patches/551-nl80211_del_beacon_bss.patch | 63 ++ .../hostapd/patches/552-ctrl_iface_reload.patch | 96 +++ package/hostapd/patches/553-ap_sta_support.patch | 211 ++++++ 48 files changed, 2462 insertions(+), 2574 deletions(-) delete mode 100644 package/hostapd/patches/001-nl80211_sync.patch create mode 100644 package/hostapd/patches/100-madwifi_compile_fix.patch delete mode 100644 package/hostapd/patches/100-madwifi_fix.patch delete mode 100644 package/hostapd/patches/110-countrycode.patch create mode 100644 package/hostapd/patches/110-roboswitch_compile_fix.patch delete mode 100644 package/hostapd/patches/120-compile_fix.patch delete mode 100644 package/hostapd/patches/130-scan_wait.patch delete mode 100644 package/hostapd/patches/200-multicall.patch create mode 100644 package/hostapd/patches/300-scan_ssid.patch delete mode 100644 package/hostapd/patches/300-timestamp_check.patch create mode 100644 package/hostapd/patches/310-madwifi_merge.patch delete mode 100644 package/hostapd/patches/310-scan_ssid.patch delete mode 100644 package/hostapd/patches/320-rescan_immediately.patch create mode 100644 package/hostapd/patches/320-wds_fix.patch delete mode 100644 package/hostapd/patches/330-madwifi_merge.patch create mode 100644 package/hostapd/patches/330-wds_bridge_fix.patch create mode 100644 package/hostapd/patches/340-basic_rates_fix.patch delete mode 100644 package/hostapd/patches/340-roboswitch_fix.patch create mode 100644 package/hostapd/patches/350-ap_isolate_support.patch delete mode 100644 package/hostapd/patches/350-wds_fix.patch create mode 100644 package/hostapd/patches/360-nl80211_multicall_fixes.patch delete mode 100644 package/hostapd/patches/360-wds_bridge.patch delete mode 100644 package/hostapd/patches/370-basic_rates.patch create mode 100644 package/hostapd/patches/370-non_eapol_port_fix.patch delete mode 100644 package/hostapd/patches/380-ap_isolate.patch create mode 100644 package/hostapd/patches/380-multicall_bridge_fix.patch create mode 100644 package/hostapd/patches/390-mbss_reload_fix.patch delete mode 100644 package/hostapd/patches/390-nl80211_fixes.patch delete mode 100644 package/hostapd/patches/400-nl80211_sta_auth.patch delete mode 100644 package/hostapd/patches/410-no_rfkill.patch delete mode 100644 package/hostapd/patches/420-stbc_fix_backport.patch delete mode 100644 package/hostapd/patches/430-supplicant_bridge_fix.patch delete mode 100644 package/hostapd/patches/440-mbss_reload_fix.patch delete mode 100644 package/hostapd/patches/450-reload_settings.patch delete mode 100644 package/hostapd/patches/451-nl80211_del_beacon_bss.patch delete mode 100644 package/hostapd/patches/452-ctrl_iface_reload.patch delete mode 100644 package/hostapd/patches/453-ap_sta_support.patch delete mode 100644 package/hostapd/patches/460-oper_state_fix.patch create mode 100644 package/hostapd/patches/500-scan_wait.patch create mode 100644 package/hostapd/patches/510-multicall.patch create mode 100644 package/hostapd/patches/520-timestamp_check.patch create mode 100644 package/hostapd/patches/530-rescan_immediately.patch create mode 100644 package/hostapd/patches/540-optional_rfkill.patch create mode 100644 package/hostapd/patches/550-reload_freq_change.patch create mode 100644 package/hostapd/patches/551-nl80211_del_beacon_bss.patch create mode 100644 package/hostapd/patches/552-ctrl_iface_reload.patch create mode 100644 package/hostapd/patches/553-ap_sta_support.patch (limited to 'package/hostapd') diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index 6f3c639e69..52cf94448c 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_VERSION:=20100705 -PKG_RELEASE:=2 -PKG_REV:=2f1ce78bf78cecd7021385b04a4f55f22e76ab97 +PKG_VERSION:=20101109 +PKG_RELEASE:=1 +PKG_REV:=8672562b04a6f51cba5dad19b27a296caa17f0c0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git diff --git a/package/hostapd/patches/001-nl80211_sync.patch b/package/hostapd/patches/001-nl80211_sync.patch deleted file mode 100644 index a9310c7044..0000000000 --- a/package/hostapd/patches/001-nl80211_sync.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/src/drivers/nl80211_copy.h -+++ b/src/drivers/nl80211_copy.h -@@ -709,6 +709,9 @@ enum nl80211_commands { - * NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE, - * NL80211_CMD_DISASSOCIATE. - * -+ * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations -+ * connected to this BSS. -+ * - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use - */ -@@ -864,6 +867,8 @@ enum nl80211_attrs { - - NL80211_ATTR_LOCAL_STATE_CHANGE, - -+ NL80211_ATTR_AP_ISOLATE, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, diff --git a/package/hostapd/patches/100-madwifi_compile_fix.patch b/package/hostapd/patches/100-madwifi_compile_fix.patch new file mode 100644 index 0000000000..54e33f107e --- /dev/null +++ b/package/hostapd/patches/100-madwifi_compile_fix.patch @@ -0,0 +1,18 @@ +--- 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 + +@@ -1510,7 +1511,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/100-madwifi_fix.patch b/package/hostapd/patches/100-madwifi_fix.patch deleted file mode 100644 index 736b295031..0000000000 --- a/package/hostapd/patches/100-madwifi_fix.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/src/drivers/driver_madwifi.c -+++ b/src/drivers/driver_madwifi.c -@@ -1177,8 +1177,6 @@ madwifi_init(struct hostapd_data *hapd, - goto bad; - } - -- /* mark down during setup */ -- linux_set_iface_flags(drv->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 11cf06e847..0000000000 --- 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/110-roboswitch_compile_fix.patch b/package/hostapd/patches/110-roboswitch_compile_fix.patch new file mode 100644 index 0000000000..50dca64f1a --- /dev/null +++ b/package/hostapd/patches/110-roboswitch_compile_fix.patch @@ -0,0 +1,14 @@ +--- 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/120-compile_fix.patch b/package/hostapd/patches/120-compile_fix.patch deleted file mode 100644 index 89480c1849..0000000000 --- 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 1f249533f0..0000000000 --- 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 a35b5c8d35..0000000000 --- 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 0000000000..296690fb0d --- /dev/null +++ b/package/hostapd/patches/300-scan_ssid.patch @@ -0,0 +1,37 @@ +--- a/wpa_supplicant/scan.c ++++ b/wpa_supplicant/scan.c +@@ -250,6 +250,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; + +@@ -306,6 +307,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) { +@@ -369,6 +380,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 70ac63597c..0000000000 --- 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 0000000000..4fb92c532c --- /dev/null +++ b/package/hostapd/patches/310-madwifi_merge.patch @@ -0,0 +1,773 @@ +--- a/src/drivers/driver_madwifi.c ++++ b/src/drivers/driver_madwifi.c +@@ -71,7 +71,6 @@ + + #define WPA_KEY_RSC_LEN 8 + +-#ifdef HOSTAPD + + #include "priv_netlink.h" + #include "netlink.h" +@@ -82,17 +81,22 @@ + struct madwifi_driver_data { + struct hostapd_data *hapd; /* back pointer */ + +- char iface[IFNAMSIZ + 1]; ++ void *wext; /* private data for driver_wext */ ++ void *ctx; ++ char ifname[IFNAMSIZ + 1]; ++ int ioctl_sock; /* socket for ioctl() use */ ++ ++#ifdef HOSTAPD + int ifindex; + struct l2_packet_data *sock_xmit; /* raw packet xmit socket */ + struct l2_packet_data *sock_recv; /* raw packet recv socket */ +- int ioctl_sock; /* socket for ioctl() use */ + struct netlink_data *netlink; + int we_version; + u8 acct_mac[ETH_ALEN]; + struct hostap_sta_driver_data acct_data; + + struct l2_packet_data *sock_raw; /* raw 802.11 management frames */ ++#endif + }; + + static int madwifi_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, +@@ -105,7 +109,7 @@ set80211priv(struct madwifi_driver_data + int do_inline = len < IFNAMSIZ; + + memset(&iwr, 0, sizeof(iwr)); +- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); ++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); + #ifdef IEEE80211_IOCTL_FILTERFRAME + /* FILTERFRAME must be NOT inline, regardless of size. */ + if (op == IEEE80211_IOCTL_FILTERFRAME) +@@ -206,7 +210,7 @@ set80211param(struct madwifi_driver_data + struct iwreq iwr; + + memset(&iwr, 0, sizeof(iwr)); +- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); ++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); + iwr.u.mode = op; + memcpy(iwr.u.name+sizeof(__u32), &arg, sizeof(arg)); + +@@ -233,6 +237,7 @@ ether_sprintf(const u8 *addr) + } + #endif /* CONFIG_NO_STDOUT_DEBUG */ + ++#ifdef HOSTAPD + /* + * Configure WPA parameters. + */ +@@ -395,7 +400,7 @@ madwifi_sta_set_flags(void *priv, const + return madwifi_set_sta_authorized(priv, addr, 0); + return 0; + } +- ++#endif /* HOSTAPD */ + static int + madwifi_del_key(void *priv, const u8 *addr, int key_idx) + { +@@ -407,28 +412,20 @@ madwifi_del_key(void *priv, const u8 *ad + __func__, ether_sprintf(addr), key_idx); + + memset(&wk, 0, sizeof(wk)); ++ wk.idk_keyix = key_idx; + if (addr != NULL) { + memcpy(wk.idk_macaddr, addr, IEEE80211_ADDR_LEN); +- wk.idk_keyix = (u8) IEEE80211_KEYIX_NONE; +- } else { +- wk.idk_keyix = key_idx; +- } +- +- ret = set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk)); +- if (ret < 0) { +- wpa_printf(MSG_DEBUG, "%s: Failed to delete key (addr %s" +- " key_idx %d)", __func__, ether_sprintf(addr), +- key_idx); + } + +- return ret; ++ set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk)); ++ return 0; + } + + static int +-wpa_driver_madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg, +- const u8 *addr, int key_idx, int set_tx, +- const u8 *seq, size_t seq_len, +- const u8 *key, size_t key_len) ++madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg, ++ const u8 *addr, int key_idx, int set_tx, ++ const u8 *seq, size_t seq_len, ++ const u8 *key, size_t key_len) + { + struct madwifi_driver_data *drv = priv; + struct ieee80211req_key wk; +@@ -462,10 +459,14 @@ wpa_driver_madwifi_set_key(const char *i + memset(&wk, 0, sizeof(wk)); + wk.ik_type = cipher; + wk.ik_flags = IEEE80211_KEY_RECV | IEEE80211_KEY_XMIT; ++ + if (addr == NULL) { + memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN); + wk.ik_keyix = key_idx; + wk.ik_flags |= IEEE80211_KEY_DEFAULT; ++ } else if (!memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN)) { ++ wk.ik_flags |= IEEE80211_KEY_GROUP; ++ memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN); + } else { + memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN); + wk.ik_keyix = IEEE80211_KEYIX_NONE; +@@ -485,6 +486,7 @@ wpa_driver_madwifi_set_key(const char *i + } + + ++#ifdef HOSTAPD + static int + madwifi_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx, + u8 *seq) +@@ -591,7 +593,7 @@ madwifi_read_sta_driver_data(void *priv, + + memset(data, 0, sizeof(*data)); + snprintf(buf, sizeof(buf), "/proc/net/madwifi/%s/" MACSTR, +- drv->iface, MAC2STR(addr)); ++ drv->ifname, MAC2STR(addr)); + + f = fopen(buf, "r"); + if (!f) { +@@ -757,7 +759,7 @@ static int madwifi_receive_probe_req(str + if (ret) + return ret; + +- drv->sock_raw = l2_packet_init(drv->iface, NULL, ETH_P_80211_RAW, ++ drv->sock_raw = l2_packet_init(drv->ifname, NULL, ETH_P_80211_RAW, + madwifi_raw_receive, drv, 1); + if (drv->sock_raw == NULL) + return -1; +@@ -1017,7 +1019,7 @@ madwifi_get_we_version(struct madwifi_dr + return -1; + + memset(&iwr, 0, sizeof(iwr)); +- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); ++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); + iwr.u.data.pointer = (caddr_t) range; + iwr.u.data.length = buflen; + +@@ -1134,17 +1136,17 @@ madwifi_init(struct hostapd_data *hapd, + perror("socket[PF_INET,SOCK_DGRAM]"); + goto bad; + } +- memcpy(drv->iface, params->ifname, sizeof(drv->iface)); ++ memcpy(drv->ifname, params->ifname, sizeof(drv->ifname)); + + memset(&ifr, 0, sizeof(ifr)); +- os_strlcpy(ifr.ifr_name, drv->iface, sizeof(ifr.ifr_name)); ++ os_strlcpy(ifr.ifr_name, drv->ifname, sizeof(ifr.ifr_name)); + if (ioctl(drv->ioctl_sock, SIOCGIFINDEX, &ifr) != 0) { + perror("ioctl(SIOCGIFINDEX)"); + goto bad; + } + drv->ifindex = ifr.ifr_ifindex; + +- drv->sock_xmit = l2_packet_init(drv->iface, NULL, ETH_P_EAPOL, ++ drv->sock_xmit = l2_packet_init(drv->ifname, NULL, ETH_P_EAPOL, + handle_read, drv, 1); + if (drv->sock_xmit == NULL) + goto bad; +@@ -1158,7 +1160,7 @@ madwifi_init(struct hostapd_data *hapd, + 1); + if (drv->sock_recv == NULL) + goto bad; +- } else if (linux_br_get(brname, drv->iface) == 0) { ++ } else if (linux_br_get(brname, drv->ifname) == 0) { + wpa_printf(MSG_DEBUG, "Interface in bridge %s; configure for " + "EAPOL receive", brname); + drv->sock_recv = l2_packet_init(brname, NULL, ETH_P_EAPOL, +@@ -1169,7 +1171,7 @@ madwifi_init(struct hostapd_data *hapd, + drv->sock_recv = drv->sock_xmit; + + memset(&iwr, 0, sizeof(iwr)); +- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); ++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); + + iwr.u.mode = IW_MODE_MASTER; + +@@ -1180,7 +1182,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 +1208,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 +1227,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 +1248,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 +1273,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 +1296,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,156 +1304,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; +@@ -1595,12 +1371,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) { +@@ -1608,14 +1384,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) +@@ -1624,7 +1400,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; +@@ -1637,7 +1413,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) && +@@ -1648,13 +1424,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; +@@ -1672,7 +1448,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; + } +@@ -1694,14 +1470,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); + } + +@@ -1709,14 +1485,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); + } + +@@ -1737,7 +1515,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); + +@@ -1747,7 +1525,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) +@@ -1758,17 +1536,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; +@@ -1777,7 +1555,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: +@@ -1788,38 +1566,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, +@@ -1839,7 +1616,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, +@@ -1851,5 +1629,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/310-scan_ssid.patch b/package/hostapd/patches/310-scan_ssid.patch deleted file mode 100644 index 884459ce66..0000000000 --- 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-rescan_immediately.patch b/package/hostapd/patches/320-rescan_immediately.patch deleted file mode 100644 index 19183040a9..0000000000 --- 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/320-wds_fix.patch b/package/hostapd/patches/320-wds_fix.patch new file mode 100644 index 0000000000..984af95bd0 --- /dev/null +++ b/package/hostapd/patches/320-wds_fix.patch @@ -0,0 +1,28 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -4987,9 +4987,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 +@@ -1659,6 +1659,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/330-madwifi_merge.patch b/package/hostapd/patches/330-madwifi_merge.patch deleted file mode 100644 index cddffe4b91..0000000000 --- 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-wds_bridge_fix.patch b/package/hostapd/patches/330-wds_bridge_fix.patch new file mode 100644 index 0000000000..2f080b7a8f --- /dev/null +++ b/package/hostapd/patches/330-wds_bridge_fix.patch @@ -0,0 +1,75 @@ +--- 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 +@@ -1208,6 +1208,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 +@@ -4977,7 +4977,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; +@@ -4991,6 +4992,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 +@@ -366,9 +366,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 +@@ -1700,7 +1700,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/340-basic_rates_fix.patch b/package/hostapd/patches/340-basic_rates_fix.patch new file mode 100644 index 0000000000..bacf958afb --- /dev/null +++ b/package/hostapd/patches/340-basic_rates_fix.patch @@ -0,0 +1,70 @@ +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -728,6 +728,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/340-roboswitch_fix.patch b/package/hostapd/patches/340-roboswitch_fix.patch deleted file mode 100644 index 50dca64f1a..0000000000 --- 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-ap_isolate_support.patch b/package/hostapd/patches/350-ap_isolate_support.patch new file mode 100644 index 0000000000..2f2b837112 --- /dev/null +++ b/package/hostapd/patches/350-ap_isolate_support.patch @@ -0,0 +1,108 @@ +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -1281,6 +1281,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 +@@ -1704,6 +1704,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 +@@ -4661,6 +4661,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 */ + + +@@ -5840,6 +5863,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 +@@ -281,6 +281,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) + { +@@ -330,6 +338,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/350-wds_fix.patch b/package/hostapd/patches/350-wds_fix.patch deleted file mode 100644 index 3a3ee000ae..0000000000 --- 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-nl80211_multicall_fixes.patch b/package/hostapd/patches/360-nl80211_multicall_fixes.patch new file mode 100644 index 0000000000..bc57ab1e41 --- /dev/null +++ b/package/hostapd/patches/360-nl80211_multicall_fixes.patch @@ -0,0 +1,124 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -1380,7 +1380,6 @@ nla_put_failure: + } + + +-#ifndef HOSTAPD + struct wiphy_info_data { + int max_scan_ssids; + int ap_supported; +@@ -1493,7 +1492,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) +@@ -1667,6 +1665,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); +@@ -1823,32 +1822,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 " +@@ -2511,13 +2510,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) +@@ -3368,7 +3363,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(); +@@ -3441,7 +3437,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 && +@@ -5177,6 +5174,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/360-wds_bridge.patch b/package/hostapd/patches/360-wds_bridge.patch deleted file mode 100644 index 4cc60de063..0000000000 --- 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 6c3fafe837..0000000000 --- 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/370-non_eapol_port_fix.patch b/package/hostapd/patches/370-non_eapol_port_fix.patch new file mode 100644 index 0000000000..56e5b3381c --- /dev/null +++ b/package/hostapd/patches/370-non_eapol_port_fix.patch @@ -0,0 +1,22 @@ +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -550,6 +550,9 @@ void wpa_supplicant_set_state(struct wpa + wpa_s->new_connection = 0; + wpa_s->reassociated_connection = 1; + wpa_drv_set_operstate(wpa_s, 1); ++#ifndef IEEE8021X_EAPOL ++ wpa_drv_set_supp_port(wpa_s, 1); ++#endif + wpa_s->after_wps = 0; + #ifdef CONFIG_P2P + wpas_p2p_completed(wpa_s); +@@ -558,6 +561,9 @@ void wpa_supplicant_set_state(struct wpa + 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/380-ap_isolate.patch b/package/hostapd/patches/380-ap_isolate.patch deleted file mode 100644 index 12fbdc86b7..0000000000 --- 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/380-multicall_bridge_fix.patch b/package/hostapd/patches/380-multicall_bridge_fix.patch new file mode 100644 index 0000000000..eb5d696f45 --- /dev/null +++ b/package/hostapd/patches/380-multicall_bridge_fix.patch @@ -0,0 +1,45 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -452,6 +452,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, +@@ -523,6 +527,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) { +@@ -1490,6 +1498,11 @@ static int wpa_driver_nl80211_capa(struc + drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CAPABLE; + drv->capa.max_remain_on_chan = 5000; + ++#ifdef HOSTAPD ++ drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int); ++ drv->if_indices = drv->default_if_indices; ++#endif ++ + return 0; + } + +@@ -5184,8 +5197,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/390-mbss_reload_fix.patch b/package/hostapd/patches/390-mbss_reload_fix.patch new file mode 100644 index 0000000000..e27bcb5a7e --- /dev/null +++ b/package/hostapd/patches/390-mbss_reload_fix.patch @@ -0,0 +1,89 @@ +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -43,37 +43,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"); +@@ -111,10 +82,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/390-nl80211_fixes.patch b/package/hostapd/patches/390-nl80211_fixes.patch deleted file mode 100644 index 20c603252c..0000000000 --- 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 41c68c0932..0000000000 --- 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 f7e8bc057c..0000000000 --- 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 e448a01fbe..0000000000 --- a/package/hostapd/patches/420-stbc_fix_backport.patch +++ /dev/null @@ -1,41 +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 ---- - -diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c -index 1b39a6a..b193ee0 100644 ---- 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_data *hapd, - 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 feddf6fed0..0000000000 --- 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 ed513b1f17..0000000000 --- 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 5f226124c3..0000000000 --- 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 b23acc6f01..0000000000 --- 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 e07ab6d440..0000000000 --- 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 930981dd38..0000000000 --- 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 5a685a23ef..0000000000 --- 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 0000000000..02675e1781 --- /dev/null +++ b/package/hostapd/patches/500-scan_wait.patch @@ -0,0 +1,148 @@ +--- a/src/ap/hostapd.h ++++ b/src/ap/hostapd.h +@@ -271,6 +271,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 +@@ -784,6 +784,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 +@@ -1882,6 +1882,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 +@@ -380,6 +380,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/510-multicall.patch b/package/hostapd/patches/510-multicall.patch new file mode 100644 index 0000000000..541e349b99 --- /dev/null +++ b/package/hostapd/patches/510-multicall.patch @@ -0,0 +1,236 @@ +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -14,6 +14,7 @@ CFLAGS += -I../src/utils + # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include + + -include .config ++-include $(if $(MULTICALL), ../wpa_supplicant/.config) + + ifndef CONFIG_OS + ifdef CONFIG_NATIVE_WINDOWS +@@ -157,10 +158,14 @@ ifdef CONFIG_IEEE80211N + CFLAGS += -DCONFIG_IEEE80211N + endif + ++ifndef MULTICALL ++CFLAGS += -DNO_SUPPLICANT ++endif ++ + include ../src/drivers/drivers.mak +-OBJS += $(DRV_AP_OBJS) +-CFLAGS += $(DRV_AP_CFLAGS) +-LDFLAGS += $(DRV_AP_LDFLAGS) ++OBJS += $(sort $(DRV_AP_OBJS) $(if $(MULTICALL),$(DRV_WPA_OBJS))) ++CFLAGS += $(DRV_AP_CFLAGS) $(if $(MULTICALL),$(DRV_WPA_CFLAGS)) ++LDFLAGS += $(DRV_AP_LDFLAGS) $(if $(MULTICALL),$(DRV_WPA_LDFLAGS)) + LIBS += $(DRV_AP_LIBS) + + ifdef CONFIG_L2_PACKET +@@ -763,6 +768,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) + +@@ -801,6 +812,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 +@@ -622,6 +623,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 +@@ -676,6 +681,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 +@@ -1317,6 +1328,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) + +@@ -1376,6 +1393,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 +@@ -2667,8 +2667,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 +@@ -420,8 +420,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; + +@@ -498,5 +498,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 +@@ -1556,8 +1556,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 +@@ -2314,6 +2314,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 +@@ -2332,6 +2335,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/520-timestamp_check.patch b/package/hostapd/patches/520-timestamp_check.patch new file mode 100644 index 0000000000..70ac63597c --- /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 0000000000..20906ce9b2 --- /dev/null +++ b/package/hostapd/patches/530-rescan_immediately.patch @@ -0,0 +1,11 @@ +--- a/wpa_supplicant/events.c ++++ b/wpa_supplicant/events.c +@@ -893,7 +893,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; + #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 0000000000..6e86ef0cf5 --- /dev/null +++ b/package/hostapd/patches/540-optional_rfkill.patch @@ -0,0 +1,263 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -115,7 +115,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; + +@@ -1630,7 +1632,7 @@ err1: + return -1; + } + +- ++#ifdef CONFIG_RFKILL + static void wpa_driver_nl80211_rfkill_blocked(void *ctx) + { + wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked"); +@@ -1652,6 +1654,7 @@ static void wpa_driver_nl80211_rfkill_un + } + /* rtnetlink ifup handler will report interface as enabled */ + } ++#endif /* CONFIG_RFKILL */ + + + /** +@@ -1665,7 +1668,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)); +@@ -1703,6 +1708,7 @@ static void * wpa_driver_nl80211_init(vo + goto failed; + } + ++#ifdef CONFIG_RFKILL + rcfg = os_zalloc(sizeof(*rcfg)); + if (rcfg == NULL) + goto failed; +@@ -1715,6 +1721,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; +@@ -1722,7 +1729,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); +@@ -1820,10 +1829,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 +@@ -1842,13 +1853,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; +@@ -1873,8 +1887,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; +@@ -1955,7 +1971,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 +@@ -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_HERMES +@@ -183,6 +181,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/550-reload_freq_change.patch b/package/hostapd/patches/550-reload_freq_change.patch new file mode 100644 index 0000000000..786eafc691 --- /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 +@@ -113,6 +113,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 0000000000..1d08b93907 --- /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 +@@ -1897,23 +1897,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 +@@ -5905,4 +5923,5 @@ const struct wpa_driver_ops wpa_driver_n + .signal_monitor = nl80211_signal_monitor, + .send_frame = nl80211_send_frame, + .set_intra_bss = nl80211_set_intra_bss, ++ .stop_ap = wpa_driver_nl80211_stop_ap, + }; +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -1915,6 +1915,8 @@ struct wpa_driver_ops { + * set_intra_bss - Enables/Disables intra BSS bridging + */ + int (*set_intra_bss)(void *priv, int enabled); ++ ++ 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 0000000000..cf65f76b12 --- /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 +@@ -38,6 +38,7 @@ + #include "wps/wps_defs.h" + #include "wps/wps.h" + #include "ctrl_iface.h" ++#include "config_file.h" + + + struct wpa_ctrl_dst { +@@ -48,6 +49,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); +@@ -318,6 +320,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 +@@ -814,6 +876,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 0000000000..765fdff9c9 --- /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 +@@ -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 +@@ -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) + { +@@ -557,8 +606,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 +@@ -2027,6 +2084,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; -- cgit v1.2.3