diff options
author | James <> | 2013-03-17 12:16:37 +0000 |
---|---|---|
committer | James <> | 2013-03-17 12:16:37 +0000 |
commit | 27b76ab0671089c47506615a796a261e993896a7 (patch) | |
tree | 61213d67e7fa87b20356b23798558e2c4212c42f /package/network/services/hostapd/patches | |
download | trunk-36060-27b76ab0671089c47506615a796a261e993896a7.tar.gz trunk-36060-27b76ab0671089c47506615a796a261e993896a7.tar.bz2 trunk-36060-27b76ab0671089c47506615a796a261e993896a7.zip |
Diffstat (limited to 'package/network/services/hostapd/patches')
61 files changed, 6494 insertions, 0 deletions
diff --git a/package/network/services/hostapd/patches/.svn/entries b/package/network/services/hostapd/patches/.svn/entries new file mode 100644 index 0000000..a3f9e44 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/entries @@ -0,0 +1,1048 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/package/network/services/hostapd/patches +svn://svn.openwrt.org/openwrt + + + +2013-03-12T00:19:25.327611Z +35973 +nbd + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +550-limit_debug_messages.patch +file + + + + +2013-03-17T12:13:18.000000Z +846aaceecb1a4441ca08cddbae9079a7 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +6683 + +400-noscan.patch +file + + + + +2013-03-17T12:13:18.000000Z +ca9feb69b8c4ae35c901adc2782d515d +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +973 + +500-random_pool_add_kernel.patch +file + + + + +2013-03-17T12:13:18.000000Z +e58c139846d64119492d5a460045c484 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +4182 + +480-terminate_on_setup_failure.patch +file + + + + +2013-03-17T12:13:18.000000Z +255021f60d278e726d769ed95bb2cf5f +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +2104 + +530-wps_single_auth_enc_type.patch +file + + + + +2013-03-17T12:13:18.000000Z +08bdf9b12055b84a08eb6e3146cf0ffb +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +838 + +602-driver_nl80211-use-new-parameters-during-ibss-join.patch +file + + + + +2013-03-17T12:13:18.000000Z +a31ce9254e7e13a58fe772f91eac0288 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +1833 + +320-madwifi_key_fixes.patch +file + + + + +2013-03-17T12:13:18.000000Z +df1de63c44720c6d7669485e7eadf206 +2012-09-13T12:38:51.674444Z +33392 +nbd + + + + + + + + + + + + + + + + + + + + + +1101 + +410-multicall.patch +file + + + + +2013-03-17T12:13:18.000000Z +6e90a6b2a2ee45abd9c47aea55ae824d +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +6765 + +452-ctrl_iface_reload.patch +file + + + + +2013-03-17T12:13:18.000000Z +4d9cd821b5304195291eb6bcb45902e9 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +2548 + +440-optional_rfkill.patch +file + + + + +2013-03-17T12:13:18.000000Z +35b9b794a8647831f9fd76f6cf925f38 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +6615 + +450-reload_freq_change.patch +file + + + + +2013-03-17T12:13:18.000000Z +a55078553ea18916cea5830eb8f1c00a +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +836 + +590-hostapd_cli_ifdef.patch +file + + + + +2013-03-17T12:13:18.000000Z +6dfbd82739a9f0637a39af5d85009d17 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +1959 + +430-rescan_immediately.patch +file + + + + +2013-03-17T12:13:18.000000Z +4f0287fbec25e7d3a1319f21a5cd77b0 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +353 + +420-timestamp_check.patch +file + + + + +2013-03-17T12:13:18.000000Z +fd1a0035891785a99b43e4c5e0862e23 +2012-03-27T10:42:47.716426Z +31080 +nbd + + + + + + + + + + + + + + + + + + + + + +319 + +560-indicate-features.patch +file + + + + +2013-03-17T12:13:18.000000Z +0d5a1285efcf6d39ef12312eb6b1bae9 +2012-09-13T12:38:51.674444Z +33392 +nbd + + + + + + + + + + + + + + + + + + + + + +1841 + +610-max_num_sta_probe.patch +file + + + + +2013-03-17T12:13:18.000000Z +c25dc1b191f25ebe24a75cb5e3aaa6b2 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +438 + +604-wpa_s-support-htmode-param.patch +file + + + + +2013-03-17T12:13:18.000000Z +566994ae8077101d8f8f3f76ec85b00e +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +3996 + +601-wpa_supplicant-add-new-config-params-to-be-used-with.patch +file + + + + +2013-03-17T12:13:18.000000Z +0310dce5e3e6786385ef952fda79372d +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +5286 + +520-fix_wps_pin_crash.patch +file + + + + +2013-03-17T12:13:18.000000Z +ea48499636810e0510d2fe1e7b1ca238 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +245 + +300-nl80211_multicall_fixes.patch +file + + + + +2013-03-17T12:13:18.000000Z +f6a65ca97e0c5b47ef00118aa19191f4 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +1927 + +310-multicall_bridge_fix.patch +file + + + + +2013-03-17T12:13:18.000000Z +bb0a7cd8ab1268c659a004905cda4eb8 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +1396 + +470-wpa_ie_cap_workaround.patch +file + + + + +2013-03-17T12:13:18.000000Z +78e4f69c0a2d027bc8c333f89a4e373a +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +1449 + +510-bring_down_interface.patch +file + + + + +2013-03-17T12:13:18.000000Z +7fe0dcf068d8b9eaf3fe0d1842bd7137 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +604 + +540-dynamic_20_40_mhz.patch +file + + + + +2013-03-17T12:13:18.000000Z +0d5434aaf008d34249440b389f4898ce +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +5739 + +453-ap_sta_support.patch +file + + + + +2013-03-17T12:13:18.000000Z +4149b0a0ce6dfbbc9ddb2ad77dcff5e3 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +6302 + +460-disable_ctrl_iface_mib.patch +file + + + + +2013-03-17T12:13:18.000000Z +b797f933fad4d561f7679ae964883443 +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +4961 + +620-scan_wait.patch +file + + + + +2013-03-17T12:13:18.000000Z +cd4bbc1ada03b6961919e176550c7f29 +2013-02-16T19:00:34.153225Z +35630 +nbd + + + + + + + + + + + + + + + + + + + + + +1453 + +570-genl_connect_debug.patch +file + + + + +2013-03-17T12:13:18.000000Z +b802be892f0fa2ba7008373674eba021 +2012-09-13T12:38:51.674444Z +33392 +nbd + + + + + + + + + + + + + + + + + + + + + +379 + +330-fix_reassoc_after_ack_failure.patch +file + + + + +2013-03-17T12:13:18.000000Z +ed653341660fe8836f000bc6e35d364a +2013-03-12T00:19:25.327611Z +35973 +nbd + + + + + + + + + + + + + + + + + + + + + +445 + +451-nl80211_del_beacon_bss.patch +file + + + + +2013-03-17T12:13:18.000000Z +94c041ac9c687e43a90315b3eb212cae +2013-03-04T17:16:38.282232Z +35887 +nbd + + + + + + + + + + + + + + + + + + + + + +1697 + diff --git a/package/network/services/hostapd/patches/.svn/text-base/300-nl80211_multicall_fixes.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/300-nl80211_multicall_fixes.patch.svn-base new file mode 100644 index 0000000..6c4f46f --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/300-nl80211_multicall_fixes.patch.svn-base @@ -0,0 +1,60 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -3129,6 +3129,7 @@ static void * wpa_driver_nl80211_init(vo + drv->monitor_sock = -1; + drv->eapol_tx_sock = -1; + drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED; ++ drv->nlmode = NL80211_IFTYPE_STATION; + + if (wpa_driver_nl80211_init_nl(drv)) { + os_free(drv); +@@ -3446,17 +3447,12 @@ static void wpa_driver_nl80211_send_rfki + wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL); + } + +- + static int +-wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv) ++wpa_driver_nl80211_finish_drv_init_sta(struct wpa_driver_nl80211_data *drv, ++ int *send_rfkill_event) + { + struct i802_bss *bss = &drv->first_bss; +- int send_rfkill_event = 0; + +- drv->ifindex = if_nametoindex(bss->ifname); +- drv->first_bss.ifindex = drv->ifindex; +- +-#ifndef HOSTAPD + /* + * Make sure the interface starts up in station mode unless this is a + * dynamically added interface (e.g., P2P) that was already configured +@@ -3475,7 +3471,7 @@ wpa_driver_nl80211_finish_drv_init(struc + "interface '%s' due to rfkill", + bss->ifname); + drv->if_disabled = 1; +- send_rfkill_event = 1; ++ *send_rfkill_event = 1; + } else { + wpa_printf(MSG_ERROR, "nl80211: Could not set " + "interface '%s' UP", bss->ifname); +@@ -3485,7 +3481,19 @@ wpa_driver_nl80211_finish_drv_init(struc + + netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, + 1, IF_OPER_DORMANT); +-#endif /* HOSTAPD */ ++} ++ ++static int ++wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv) ++{ ++ struct i802_bss *bss = &drv->first_bss; ++ int send_rfkill_event = 0; ++ ++ drv->ifindex = if_nametoindex(bss->ifname); ++ drv->first_bss.ifindex = drv->ifindex; ++ ++ if (drv->nlmode == NL80211_IFTYPE_STATION) ++ wpa_driver_nl80211_finish_drv_init_sta(drv, &send_rfkill_event); + + if (wpa_driver_nl80211_capa(drv)) + return -1; diff --git a/package/network/services/hostapd/patches/.svn/text-base/310-multicall_bridge_fix.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/310-multicall_bridge_fix.patch.svn-base new file mode 100644 index 0000000..e167ba7 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/310-multicall_bridge_fix.patch.svn-base @@ -0,0 +1,45 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -897,6 +897,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, +@@ -1004,6 +1008,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) { +@@ -3131,6 +3139,11 @@ static void * wpa_driver_nl80211_init(vo + drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED; + drv->nlmode = NL80211_IFTYPE_STATION; + ++#ifdef HOSTAPD ++ drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int); ++ drv->if_indices = drv->default_if_indices; ++#endif ++ + if (wpa_driver_nl80211_init_nl(drv)) { + os_free(drv); + return NULL; +@@ -8021,8 +8034,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/network/services/hostapd/patches/.svn/text-base/320-madwifi_key_fixes.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/320-madwifi_key_fixes.patch.svn-base new file mode 100644 index 0000000..45a7ac6 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/320-madwifi_key_fixes.patch.svn-base @@ -0,0 +1,34 @@ +--- a/src/drivers/driver_madwifi.c ++++ b/src/drivers/driver_madwifi.c +@@ -453,7 +453,9 @@ 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; ++ wk.ik_flags = IEEE80211_KEY_RECV; ++ if (set_tx) ++ wk.ik_flags |= IEEE80211_KEY_XMIT; + if (addr == NULL || is_broadcast_ether_addr(addr)) { + memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN); + wk.ik_keyix = key_idx; +@@ -465,6 +467,20 @@ wpa_driver_madwifi_set_key(const char *i + wk.ik_keylen = key_len; + memcpy(wk.ik_keydata, key, key_len); + ++#ifdef WORDS_BIGENDIAN ++#define WPA_KEY_RSC_LEN 8 ++ { ++ size_t i; ++ u8 tmp[WPA_KEY_RSC_LEN]; ++ os_memset(tmp, 0, sizeof(tmp)); ++ for (i = 0; i < seq_len; i++) ++ tmp[WPA_KEY_RSC_LEN - i - 1] = seq[i]; ++ os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN); ++ } ++#else /* WORDS_BIGENDIAN */ ++ os_memcpy(&wk.ik_keyrsc, seq, seq_len); ++#endif /* WORDS_BIGENDIAN */ ++ + ret = set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk)); + if (ret < 0) { + wpa_printf(MSG_DEBUG, "%s: Failed to set key (addr %s" diff --git a/package/network/services/hostapd/patches/.svn/text-base/330-fix_reassoc_after_ack_failure.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/330-fix_reassoc_after_ack_failure.patch.svn-base new file mode 100644 index 0000000..a91e4ae --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/330-fix_reassoc_after_ack_failure.patch.svn-base @@ -0,0 +1,11 @@ +--- a/src/ap/sta_info.c ++++ b/src/ap/sta_info.c +@@ -576,7 +576,7 @@ void ap_sta_disassociate(struct hostapd_ + { + wpa_printf(MSG_DEBUG, "%s: disassociate STA " MACSTR, + hapd->conf->iface, MAC2STR(sta->addr)); +- sta->flags &= ~WLAN_STA_ASSOC; ++ sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_ASSOC_REQ_OK); + ap_sta_set_authorized(hapd, sta, 0); + sta->timeout_next = STA_DEAUTH; + wpa_printf(MSG_DEBUG, "%s: reschedule ap_handle_timer timeout " diff --git a/package/network/services/hostapd/patches/.svn/text-base/400-noscan.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/400-noscan.patch.svn-base new file mode 100644 index 0000000..b1b25ff --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/400-noscan.patch.svn-base @@ -0,0 +1,32 @@ +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -2464,6 +2464,8 @@ static int hostapd_config_fill(struct ho + } + #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 +@@ -510,6 +510,7 @@ struct hostapd_config { + + int ht_op_mode_fixed; + u16 ht_capab; ++ int noscan; + int ieee80211n; + int secondary_channel; + int require_ht; +--- a/src/ap/hw_features.c ++++ b/src/ap/hw_features.c +@@ -494,7 +494,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/network/services/hostapd/patches/.svn/text-base/410-multicall.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/410-multicall.patch.svn-base new file mode 100644 index 0000000..4c6f8c9 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/410-multicall.patch.svn-base @@ -0,0 +1,246 @@ +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -14,6 +14,7 @@ CFLAGS += -I../src/utils + # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include + + -include .config ++-include $(if $(MULTICALL), ../wpa_supplicant/.config) + + ifndef CONFIG_OS + ifdef CONFIG_NATIVE_WINDOWS +@@ -192,10 +193,14 @@ ifdef CONFIG_IEEE80211AC + CFLAGS += -DCONFIG_IEEE80211AC + 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 +@@ -860,6 +865,12 @@ install: all + + BCHECK=../src/drivers/build.hostapd + ++hostapd_multi.a: $(BCHECK) $(OBJS) ++ $(Q)$(CC) -c -o hostapd_multi.o -Dmain=hostapd_main $(CFLAGS) main.c ++ @$(E) " CC " $< ++ @rm -f $@ ++ @$(AR) cr $@ hostapd_multi.o $(OBJS) ++ + hostapd: $(BCHECK) $(OBJS) + $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) + @$(E) " LD " $@ +@@ -898,6 +909,12 @@ HOBJS += ../src/crypto/aes-internal.o + HOBJS += ../src/crypto/aes-internal-enc.o + endif + ++dump_cflags: ++ @echo -n $(CFLAGS) " " ++ ++dump_ldflags: ++ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " " ++ + nt_password_hash: $(NOBJS) + $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n) + @$(E) " LD " $@ +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -14,6 +14,7 @@ CFLAGS += -I../src + CFLAGS += -I../src/utils + + -include .config ++-include $(if $(MULTICALL),../hostapd/.config) + + BINALL=wpa_supplicant wpa_cli + +@@ -704,6 +705,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 +@@ -712,9 +717,11 @@ NEED_EAP_COMMON=y + NEED_RSN_AUTHENTICATOR=y + CFLAGS += -DCONFIG_AP + OBJS += ap.o ++ifndef MULTICALL + CFLAGS += -DCONFIG_NO_RADIUS + CFLAGS += -DCONFIG_NO_ACCOUNTING + CFLAGS += -DCONFIG_NO_VLAN ++endif + OBJS += ../src/ap/hostapd.o + OBJS += ../src/ap/wpa_auth_glue.o + OBJS += ../src/ap/utils.o +@@ -769,10 +776,18 @@ endif + ifdef CONFIG_HS20 + OBJS += ../src/ap/hs20.o + endif ++else ++ ifdef MULTICALL ++ OBJS += ../src/eap_server/eap_server.o ++ OBJS += ../src/eap_server/eap_server_identity.o ++ OBJS += ../src/eap_server/eap_server_methods.o ++ endif + endif + + ifdef NEED_RSN_AUTHENTICATOR ++ifndef MULTICALL + CFLAGS += -DCONFIG_NO_RADIUS ++endif + NEED_AES_WRAP=y + OBJS += ../src/ap/wpa_auth.o + OBJS += ../src/ap/wpa_auth_ie.o +@@ -1521,6 +1536,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) + + $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config + ++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: $(BCHECK) $(OBJS) $(EXTRA_progs) + $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) + @$(E) " LD " $@ +@@ -1591,6 +1612,12 @@ eap_ikev2.so: ../src/eap_peer/eap_ikev2. + %@.service: %.service.arg.in + sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ + ++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 +@@ -3726,8 +3726,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 +@@ -714,8 +714,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; + #ifndef CONFIG_NO_STDOUT_DEBUG +--- a/wpa_supplicant/wpa_priv.c ++++ b/wpa_supplicant/wpa_priv.c +@@ -819,8 +819,8 @@ static void wpa_priv_send_ft_response(st + } + + +-void wpa_supplicant_event(void *ctx, enum wpa_event_type event, +- union wpa_event_data *data) ++static void supplicant_event(void *ctx, enum wpa_event_type event, ++ union wpa_event_data *data) + { + struct wpa_priv_interface *iface = ctx; + +@@ -962,6 +962,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 +@@ -2333,8 +2333,8 @@ static void wpa_supplicant_event_unprot_ + } + + +-void wpa_supplicant_event(void *ctx, enum wpa_event_type event, +- union wpa_event_data *data) ++void supplicant_event(void *ctx, enum wpa_event_type event, ++ union wpa_event_data *data) + { + struct wpa_supplicant *wpa_s = ctx; + u16 reason_code = 0; +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -2972,6 +2972,9 @@ static void wpa_supplicant_deinit_iface( + } + } + ++extern void supplicant_event(void *ctx, enum wpa_event_type event, ++ union wpa_event_data *data); ++ + + /** + * wpa_supplicant_add_iface - Add a new network interface +@@ -3164,6 +3167,7 @@ struct wpa_global * wpa_supplicant_init( + wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); + #endif /* CONFIG_NO_WPA_MSG */ + ++ wpa_supplicant_event = supplicant_event; + wpa_debug_open_file(params->wpa_debug_file_path); + if (params->wpa_debug_syslog) + wpa_debug_open_syslog(); +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -530,6 +530,9 @@ static int hostapd_get_global_ctrl_iface + return 0; + } + ++void hostapd_wpa_event(void *ctx, enum wpa_event_type event, ++ union wpa_event_data *data); ++ + + int main(int argc, char *argv[]) + { +@@ -555,6 +558,7 @@ int main(int argc, char *argv[]) + interfaces.global_iface_name = NULL; + interfaces.global_ctrl_sock = -1; + ++ wpa_supplicant_event = hostapd_wpa_event; + for (;;) { + c = getopt(argc, argv, "Bde:f:hKP:tvg:"); + if (c < 0) +--- a/src/drivers/drivers.c ++++ b/src/drivers/drivers.c +@@ -7,7 +7,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/network/services/hostapd/patches/.svn/text-base/420-timestamp_check.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/420-timestamp_check.patch.svn-base new file mode 100644 index 0000000..b2d4a05 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/420-timestamp_check.patch.svn-base @@ -0,0 +1,12 @@ +--- a/src/tls/x509v3.c ++++ b/src/tls/x509v3.c +@@ -1848,6 +1848,9 @@ int x509_certificate_chain_validate(stru + if (chain_trusted) + continue; + ++#ifdef NO_TIMESTAMP_CHECK ++ disable_time_checks = 1; ++#endif + if (!disable_time_checks && + ((unsigned long) now.sec < + (unsigned long) cert->not_before || diff --git a/package/network/services/hostapd/patches/.svn/text-base/430-rescan_immediately.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/430-rescan_immediately.patch.svn-base new file mode 100644 index 0000000..082344a --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/430-rescan_immediately.patch.svn-base @@ -0,0 +1,11 @@ +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -2416,7 +2416,7 @@ static struct wpa_supplicant * wpa_suppl + if (wpa_s == NULL) + return NULL; + wpa_s->scan_req = INITIAL_SCAN_REQ; +- wpa_s->scan_interval = 5; ++ wpa_s->scan_interval = 1; + wpa_s->new_connection = 1; + wpa_s->parent = wpa_s; + wpa_s->sched_scanning = 0; diff --git a/package/network/services/hostapd/patches/.svn/text-base/440-optional_rfkill.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/440-optional_rfkill.patch.svn-base new file mode 100644 index 0000000..8ed4d99 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/440-optional_rfkill.patch.svn-base @@ -0,0 +1,261 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -218,7 +218,9 @@ struct wpa_driver_nl80211_data { + int if_removed; + int if_disabled; + int ignore_if_down_event; ++#ifdef CONFIG_RFKILL + struct rfkill_data *rfkill; ++#endif + struct wpa_driver_capa capa; + int has_capability; + +@@ -2967,7 +2969,7 @@ static int wpa_driver_nl80211_init_nl(st + return 0; + } + +- ++#ifdef CONFIG_RFKILL + static void wpa_driver_nl80211_rfkill_blocked(void *ctx) + { + wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked"); +@@ -2990,6 +2992,7 @@ static void wpa_driver_nl80211_rfkill_un + } + /* rtnetlink ifup handler will report interface as enabled */ + } ++#endif /* CONFIG_RFKILL */ + + + static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv) +@@ -3118,7 +3121,9 @@ static void * wpa_driver_nl80211_init(vo + void *global_priv) + { + struct wpa_driver_nl80211_data *drv; ++#ifdef CONFIG_RFKILL + struct rfkill_config *rcfg; ++#endif + struct i802_bss *bss; + + if (global_priv == NULL) +@@ -3154,6 +3159,7 @@ static void * wpa_driver_nl80211_init(vo + + nl80211_get_phy_name(drv); + ++#ifdef CONFIG_RFKILL + rcfg = os_zalloc(sizeof(*rcfg)); + if (rcfg == NULL) + goto failed; +@@ -3166,6 +3172,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; +@@ -3455,10 +3462,12 @@ static void nl80211_mgmt_unsubscribe(str + } + + ++#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 + wpa_driver_nl80211_finish_drv_init_sta(struct wpa_driver_nl80211_data *drv, +@@ -3479,13 +3488,16 @@ wpa_driver_nl80211_finish_drv_init_sta(s + } + + if (linux_set_iface_flags(drv->global->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; +@@ -3516,8 +3528,10 @@ wpa_driver_nl80211_finish_drv_init(struc + return -1; + + if (send_rfkill_event) { ++#ifdef CONFIG_RFKILL + eloop_register_timeout(0, 0, wpa_driver_nl80211_send_rfkill, + drv, drv->ctx); ++#endif + } + + return 0; +@@ -3603,7 +3617,9 @@ static void wpa_driver_nl80211_deinit(st + + netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, 0, + IF_OPER_UP); ++#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 +@@ -742,7 +742,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"); +@@ -764,7 +764,7 @@ static void wpa_driver_wext_rfkill_unblo + } + /* rtnetlink ifup handler will report interface as enabled */ + } +- ++#endif /* CONFIG_RFKILL */ + + static void wext_get_phy_name(struct wpa_driver_wext_data *drv) + { +@@ -810,7 +810,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; + +@@ -845,6 +847,7 @@ void * wpa_driver_wext_init(void *ctx, c + goto err2; + } + ++#ifdef CONFIG_RFKILL + rcfg = os_zalloc(sizeof(*rcfg)); + if (rcfg == NULL) + goto err3; +@@ -857,6 +860,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; + +@@ -874,7 +878,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); +@@ -884,10 +890,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) +@@ -895,13 +903,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; +@@ -949,8 +960,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; +@@ -980,7 +993,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 +@@ -25,7 +25,6 @@ NEED_SME=y + NEED_AP_MLME=y + NEED_NETLINK=y + NEED_LINUX_IOCTL=y +-NEED_RFKILL=y + + ifdef CONFIG_LIBNL32 + DRV_LIBS += -lnl-3 +@@ -109,7 +108,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_NDIS +@@ -135,7 +133,6 @@ endif + ifdef CONFIG_WIRELESS_EXTENSION + DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION + DRV_WPA_OBJS += ../src/drivers/driver_wext.o +-NEED_RFKILL=y + endif + + ifdef NEED_NETLINK +@@ -148,6 +145,7 @@ endif + + ifdef NEED_RFKILL + DRV_OBJS += ../src/drivers/rfkill.o ++DRV_WPA_CFLAGS += -DCONFIG_RFKILL + endif + + ifdef CONFIG_VLAN_NETLINK +--- a/src/drivers/driver_wext.h ++++ b/src/drivers/driver_wext.h +@@ -22,7 +22,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/network/services/hostapd/patches/.svn/text-base/450-reload_freq_change.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/450-reload_freq_change.patch.svn-base new file mode 100644 index 0000000..bf48fe4 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/450-reload_freq_change.patch.svn-base @@ -0,0 +1,27 @@ +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -140,6 +140,24 @@ int hostapd_reload_config(struct hostapd + oldconf = hapd->iconf; + iface->conf = newconf; + ++ hostapd_select_hw_mode(iface); ++ iface->freq = hostapd_hw_get_freq(hapd, newconf->channel); ++ ++ if (hostapd_set_freq(hapd, newconf->hw_mode, iface->freq, ++ newconf->channel, ++ newconf->ieee80211n, ++ newconf->ieee80211ac, ++ newconf->secondary_channel, ++ newconf->vht_oper_chwidth, ++ newconf->vht_oper_centr_freq_seg0_idx, ++ newconf->vht_oper_centr_freq_seg1_idx)) { ++ wpa_printf(MSG_ERROR, "Could not set channel for " ++ "kernel driver"); ++ } ++ ++ if (iface->current_mode) ++ hostapd_prepare_rates(iface, iface->current_mode); ++ + for (j = 0; j < iface->num_bss; j++) { + hapd = iface->bss[j]; + hapd->iconf = newconf; diff --git a/package/network/services/hostapd/patches/.svn/text-base/451-nl80211_del_beacon_bss.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/451-nl80211_del_beacon_bss.patch.svn-base new file mode 100644 index 0000000..2eaa5dc --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/451-nl80211_del_beacon_bss.patch.svn-base @@ -0,0 +1,63 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -3538,16 +3538,18 @@ 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; + + nl80211_cmd(drv, msg, 0, NL80211_CMD_DEL_BEACON); +- 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: +@@ -3555,6 +3557,21 @@ static int wpa_driver_nl80211_del_beacon + 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); ++ ++ return 0; ++} ++ ++static int wpa_driver_nl80211_stop_ap(void *priv) ++{ ++ struct i802_bss *bss = priv; ++ return wpa_driver_nl80211_del_beacon(bss->drv); ++} + + /** + * wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface +@@ -9547,4 +9564,5 @@ const struct wpa_driver_ops wpa_driver_n + .send_tdls_mgmt = nl80211_send_tdls_mgmt, + .tdls_oper = nl80211_tdls_oper, + #endif /* CONFIG_TDLS */ ++ .stop_ap = wpa_driver_nl80211_stop_ap, + }; +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -2071,6 +2071,9 @@ struct wpa_driver_ops { + */ + int (*probe_req_report)(void *priv, int report); + ++ ++ int (*stop_ap)(void *priv); ++ + /** + * deinit_ap - Deinitialize AP mode + * @priv: Private driver interface data diff --git a/package/network/services/hostapd/patches/.svn/text-base/452-ctrl_iface_reload.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/452-ctrl_iface_reload.patch.svn-base new file mode 100644 index 0000000..85e871f --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/452-ctrl_iface_reload.patch.svn-base @@ -0,0 +1,98 @@ +--- a/hostapd/ctrl_iface.c ++++ b/hostapd/ctrl_iface.c +@@ -33,6 +33,7 @@ + #include "wps/wps.h" + #include "config_file.h" + #include "ctrl_iface.h" ++#include "config_file.h" + + + struct wpa_ctrl_dst { +@@ -43,6 +44,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); +@@ -152,6 +154,68 @@ static int hostapd_ctrl_iface_new_sta(st + 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, "hw_mode="))) ++ 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_update(struct hostapd_data *hapd, char *txt) ++{ ++ struct hostapd_config * (*config_read_cb)(const char *config_fname); ++ struct hostapd_iface *iface = hapd->iface; ++ ++ config_read_cb = iface->interfaces->config_read_cb; ++ iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read; ++ reload_opts = txt; ++ ++ hostapd_reload_config(iface); ++ ++ iface->interfaces->config_read_cb = config_read_cb; ++} + + #ifdef CONFIG_IEEE80211W + #ifdef NEED_AP_MLME +@@ -902,6 +966,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, "UPDATE ", 7) == 0) { ++ hostapd_ctrl_iface_update(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/network/services/hostapd/patches/.svn/text-base/453-ap_sta_support.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/453-ap_sta_support.patch.svn-base new file mode 100644 index 0000000..df04d3d --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/453-ap_sta_support.patch.svn-base @@ -0,0 +1,222 @@ +--- a/wpa_supplicant/wpa_supplicant_i.h ++++ b/wpa_supplicant/wpa_supplicant_i.h +@@ -96,6 +96,8 @@ struct wpa_interface { + * receiving of EAPOL frames from an additional interface. + */ + const char *bridge_ifname; ++ ++ const char *hostapd_ctrl; + }; + + /** +@@ -305,6 +307,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 +@@ -13,6 +13,10 @@ PKG_CONFIG ?= pkg-config + CFLAGS += -I../src + CFLAGS += -I../src/utils + ++ifdef MULTICALL ++CFLAGS += -DMULTICALL ++endif ++ + -include .config + -include $(if $(MULTICALL),../hostapd/.config) + +@@ -76,6 +80,10 @@ OBJS_c = wpa_cli.o ../src/common/wpa_ctr + OBJS_c += ../src/utils/wpa_debug.o + OBJS_c += ../src/utils/common.o + ++ifdef MULTICALL ++OBJS += ../src/common/wpa_ctrl.o ++endif ++ + ifndef CONFIG_OS + ifdef CONFIG_NATIVE_WINDOWS + CONFIG_OS=win32 +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -107,6 +107,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, "UPDATE 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) + { +@@ -676,8 +725,16 @@ void wpa_supplicant_set_state(struct wpa + #endif /* CONFIG_P2P */ + + sme_sched_obss_scan(wpa_s, 1); ++#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 +@@ -2778,6 +2835,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 +@@ -11,6 +11,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" +@@ -227,6 +228,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 os_time *fetch_time) + { ++ struct ieee80211_ht_capabilities *capab; ++ struct ieee802_11_elems elems; + os_time_t usec; + + dst->flags = src->flags; +@@ -239,6 +242,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); ++ + dst->last_update.sec = fetch_time->sec; + dst->last_update.usec = fetch_time->usec; + dst->last_update.sec -= src->age / 1000; +--- a/wpa_supplicant/main.c ++++ b/wpa_supplicant/main.c +@@ -25,7 +25,7 @@ static void usage(void) + "usage:\n" + " wpa_supplicant [-BddhKLqqstuvW] [-P<pid file>] " + "[-g<global ctrl>] \\\n" +- " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] " ++ " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-H<hostapd path>]" + "[-p<driver_param>] \\\n" + " [-b<br_ifname>] [-f<debug file>] [-e<entropy file>] " + "\\\n" +@@ -67,6 +67,7 @@ static void usage(void) + #endif /* CONFIG_DEBUG_LINUX_TRACING */ + 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 (BSD)\n" + " -o = override driver parameter for new interfaces\n" + " -O = override ctrl_interface parameter for new interfaces\n" +@@ -155,7 +156,7 @@ int main(int argc, char *argv[]) + + for (;;) { + c = getopt(argc, argv, +- "b:Bc:C:D:de:f:g:hi:KLNo:O:p:P:qsTtuvW"); ++ "b:Bc:C:D:de:f:g:hH:i:KLNo:O:p:P:qsTtuvW"); + if (c < 0) + break; + switch (c) { +@@ -199,6 +200,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; +--- a/wpa_supplicant/bss.h ++++ b/wpa_supplicant/bss.h +@@ -69,6 +69,8 @@ struct wpa_bss { + u8 ssid[32]; + /** Length of SSID */ + size_t ssid_len; ++ /** HT caapbilities */ ++ u16 ht_capab; + /** Frequency of the channel in MHz (e.g., 2412 = channel 1) */ + int freq; + /** Beacon interval in TUs (host byte order) */ diff --git a/package/network/services/hostapd/patches/.svn/text-base/460-disable_ctrl_iface_mib.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/460-disable_ctrl_iface_mib.patch.svn-base new file mode 100644 index 0000000..e5db6b4 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/460-disable_ctrl_iface_mib.patch.svn-base @@ -0,0 +1,168 @@ +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -136,6 +136,9 @@ endif + ifdef CONFIG_NO_CTRL_IFACE + CFLAGS += -DCONFIG_NO_CTRL_IFACE + else ++ifdef CONFIG_CTRL_IFACE_MIB ++CFLAGS += -DCONFIG_CTRL_IFACE_MIB ++endif + OBJS += ctrl_iface.o + OBJS += ../src/ap/ctrl_iface_ap.o + endif +--- a/hostapd/ctrl_iface.c ++++ b/hostapd/ctrl_iface.c +@@ -937,6 +937,7 @@ static void hostapd_ctrl_iface_receive(i + } else if (os_strncmp(buf, "RELOG", 5) == 0) { + if (wpa_debug_reopen_file() < 0) + reply_len = -1; ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "MIB") == 0) { + reply_len = ieee802_11_get_mib(hapd, reply, reply_size); + if (reply_len >= 0) { +@@ -966,10 +967,12 @@ static void hostapd_ctrl_iface_receive(i + reply_len += res; + } + #endif /* CONFIG_NO_RADIUS */ ++#endif + } else if (os_strcmp(buf, "DOWN") == 0) { + hostapd_ctrl_iface_set_down(hapd); + } else if (os_strncmp(buf, "UPDATE ", 7) == 0) { + hostapd_ctrl_iface_update(hapd, buf + 7); ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "STA-FIRST") == 0) { + reply_len = hostapd_ctrl_iface_sta_first(hapd, reply, + reply_size); +@@ -979,6 +982,7 @@ static void hostapd_ctrl_iface_receive(i + } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { + reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, + reply_size); ++#endif + } else if (os_strcmp(buf, "ATTACH") == 0) { + if (hostapd_ctrl_iface_attach(hapd, &from, fromlen)) + reply_len = -1; +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -754,6 +754,9 @@ ifdef CONFIG_WNM + OBJS += ../src/ap/wnm_ap.o + endif + ifdef CONFIG_CTRL_IFACE ++ifdef CONFIG_CTRL_IFACE_MIB ++CFLAGS += -DCONFIG_CTRL_IFACE_MIB ++endif + OBJS += ../src/ap/ctrl_iface_ap.o + endif + +--- a/wpa_supplicant/ctrl_iface.c ++++ b/wpa_supplicant/ctrl_iface.c +@@ -4933,6 +4933,7 @@ char * wpa_supplicant_ctrl_iface_process + reply_len = -1; + } else if (os_strncmp(buf, "NOTE ", 5) == 0) { + wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "MIB") == 0) { + reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); + if (reply_len >= 0) { +@@ -4944,6 +4945,7 @@ char * wpa_supplicant_ctrl_iface_process + else + reply_len += res; + } ++#endif + } else if (os_strncmp(buf, "STATUS", 6) == 0) { + reply_len = wpa_supplicant_ctrl_iface_status( + wpa_s, buf + 6, reply, reply_size); +@@ -5350,6 +5352,7 @@ char * wpa_supplicant_ctrl_iface_process + reply_len = wpa_supplicant_ctrl_iface_bss( + wpa_s, buf + 4, reply, reply_size); + #ifdef CONFIG_AP ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "STA-FIRST") == 0) { + reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); + } else if (os_strncmp(buf, "STA ", 4) == 0) { +@@ -5358,6 +5361,7 @@ char * wpa_supplicant_ctrl_iface_process + } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { + reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, + reply_size); ++#endif + } else if (os_strncmp(buf, "DEAUTHENTICATE ", 15) == 0) { + if (ap_ctrl_iface_sta_deauthenticate(wpa_s, buf + 15)) + reply_len = -1; +--- a/src/ap/ctrl_iface_ap.c ++++ b/src/ap/ctrl_iface_ap.c +@@ -20,6 +20,7 @@ + #include "ctrl_iface_ap.h" + #include "ap_drv_ops.h" + ++#ifdef CONFIG_CTRL_IFACE_MIB + + static int hostapd_get_sta_conn_time(struct sta_info *sta, + char *buf, size_t buflen) +@@ -129,6 +130,7 @@ int hostapd_ctrl_iface_sta_next(struct h + return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); + } + ++#endif + + #ifdef CONFIG_P2P_MANAGER + static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, +@@ -303,3 +305,4 @@ int hostapd_ctrl_iface_disassociate(stru + + return 0; + } ++ +--- a/src/ap/ieee802_1x.c ++++ b/src/ap/ieee802_1x.c +@@ -2048,6 +2048,7 @@ static const char * bool_txt(Boolean boo + return bool ? "TRUE" : "FALSE"; + } + ++#ifdef CONFIG_CTRL_IFACE_MIB + + int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) + { +@@ -2200,6 +2201,7 @@ int ieee802_1x_get_mib_sta(struct hostap + return len; + } + ++#endif + + static void ieee802_1x_finished(struct hostapd_data *hapd, + struct sta_info *sta, int success) +--- a/src/ap/wpa_auth.c ++++ b/src/ap/wpa_auth.c +@@ -2687,6 +2687,7 @@ static const char * wpa_bool_txt(int boo + return bool ? "TRUE" : "FALSE"; + } + ++#ifdef CONFIG_CTRL_IFACE_MIB + + #define RSN_SUITE "%02x-%02x-%02x-%d" + #define RSN_SUITE_ARG(s) \ +@@ -2831,7 +2832,7 @@ int wpa_get_mib_sta(struct wpa_state_mac + + return len; + } +- ++#endif + + void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth) + { +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -1848,6 +1848,8 @@ static u32 wpa_key_mgmt_suite(struct wpa + } + + ++#ifdef CONFIG_CTRL_IFACE_MIB ++ + #define RSN_SUITE "%02x-%02x-%02x-%d" + #define RSN_SUITE_ARG(s) \ + ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff +@@ -1931,6 +1933,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch + + return (int) len; + } ++#endif + #endif /* CONFIG_CTRL_IFACE */ + + diff --git a/package/network/services/hostapd/patches/.svn/text-base/470-wpa_ie_cap_workaround.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/470-wpa_ie_cap_workaround.patch.svn-base new file mode 100644 index 0000000..974ec3d --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/470-wpa_ie_cap_workaround.patch.svn-base @@ -0,0 +1,56 @@ +--- a/src/common/wpa_common.c ++++ b/src/common/wpa_common.c +@@ -965,6 +965,31 @@ const char * wpa_key_mgmt_txt(int key_mg + } + + ++static void wpa_fixup_wpa_ie_rsn(u8 *assoc_ie, const u8 *wpa_msg_ie, ++ size_t rsn_ie_len) ++{ ++ int pos, count; ++ ++ pos = sizeof(struct rsn_ie_hdr) + RSN_SELECTOR_LEN; ++ if (rsn_ie_len < pos + 2) ++ return; ++ ++ count = WPA_GET_LE16(wpa_msg_ie + pos); ++ pos += 2 + count * RSN_SELECTOR_LEN; ++ if (rsn_ie_len < pos + 2) ++ return; ++ ++ count = WPA_GET_LE16(wpa_msg_ie + pos); ++ pos += 2 + count * RSN_SELECTOR_LEN; ++ if (rsn_ie_len < pos + 2) ++ return; ++ ++ if (!assoc_ie[pos] && !assoc_ie[pos + 1] && ++ (wpa_msg_ie[pos] || wpa_msg_ie[pos + 1])) ++ memcpy(&assoc_ie[pos], &wpa_msg_ie[pos], 2); ++} ++ ++ + int wpa_compare_rsn_ie(int ft_initial_assoc, + const u8 *ie1, size_t ie1len, + const u8 *ie2, size_t ie2len) +@@ -972,8 +997,19 @@ int wpa_compare_rsn_ie(int ft_initial_as + if (ie1 == NULL || ie2 == NULL) + return -1; + +- if (ie1len == ie2len && os_memcmp(ie1, ie2, ie1len) == 0) +- return 0; /* identical IEs */ ++ if (ie1len == ie2len) { ++ u8 *ie_tmp; ++ ++ if (os_memcmp(ie1, ie2, ie1len) == 0) ++ return 0; /* identical IEs */ ++ ++ ie_tmp = alloca(ie1len); ++ memcpy(ie_tmp, ie1, ie1len); ++ wpa_fixup_wpa_ie_rsn(ie_tmp, ie2, ie1len); ++ ++ if (os_memcmp(ie_tmp, ie2, ie1len) == 0) ++ return 0; /* only mismatch in RSN capabilties */ ++ } + + #ifdef CONFIG_IEEE80211R + if (ft_initial_assoc) { diff --git a/package/network/services/hostapd/patches/.svn/text-base/480-terminate_on_setup_failure.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/480-terminate_on_setup_failure.patch.svn-base new file mode 100644 index 0000000..f9d7425 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/480-terminate_on_setup_failure.patch.svn-base @@ -0,0 +1,81 @@ +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -895,11 +895,8 @@ int hostapd_setup_interface_complete(str + size_t j; + u8 *prev_addr; + +- if (err) { +- wpa_printf(MSG_ERROR, "Interface initialization failed"); +- eloop_terminate(); +- return -1; +- } ++ if (err) ++ goto error; + + wpa_printf(MSG_DEBUG, "Completing interface initialization"); + if (hapd->iconf->channel) { +@@ -919,7 +916,7 @@ int hostapd_setup_interface_complete(str + hapd->iconf->vht_oper_centr_freq_seg1_idx)) { + wpa_printf(MSG_ERROR, "Could not set channel for " + "kernel driver"); +- return -1; ++ goto error; + } + } + +@@ -930,7 +927,7 @@ int hostapd_setup_interface_complete(str + hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, + HOSTAPD_LEVEL_WARNING, + "Failed to prepare rates table."); +- return -1; ++ goto error; + } + } + +@@ -938,14 +935,14 @@ int hostapd_setup_interface_complete(str + hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) { + wpa_printf(MSG_ERROR, "Could not set RTS threshold for " + "kernel driver"); +- return -1; ++ goto error; + } + + if (hapd->iconf->fragm_threshold > -1 && + hostapd_set_frag(hapd, hapd->iconf->fragm_threshold)) { + wpa_printf(MSG_ERROR, "Could not set fragmentation threshold " + "for kernel driver"); +- return -1; ++ goto error; + } + + prev_addr = hapd->own_addr; +@@ -955,7 +952,7 @@ int hostapd_setup_interface_complete(str + if (j) + os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN); + if (hostapd_setup_bss(hapd, j == 0)) +- return -1; ++ goto error; + if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0) + prev_addr = hapd->own_addr; + } +@@ -967,7 +964,7 @@ int hostapd_setup_interface_complete(str + if (hostapd_driver_commit(hapd) < 0) { + wpa_printf(MSG_ERROR, "%s: Failed to commit driver " + "configuration", __func__); +- return -1; ++ goto error; + } + + /* +@@ -988,6 +985,11 @@ int hostapd_setup_interface_complete(str + iface->bss[0]->conf->iface); + + return 0; ++ ++error: ++ wpa_printf(MSG_ERROR, "Interface initialization failed"); ++ eloop_terminate(); ++ return -1; + } + + diff --git a/package/network/services/hostapd/patches/.svn/text-base/500-random_pool_add_kernel.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/500-random_pool_add_kernel.patch.svn-base new file mode 100644 index 0000000..2280537 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/500-random_pool_add_kernel.patch.svn-base @@ -0,0 +1,176 @@ +--- a/src/crypto/random.c ++++ b/src/crypto/random.c +@@ -25,6 +25,7 @@ + #include "utils/includes.h" + #ifdef __linux__ + #include <fcntl.h> ++#include <sys/stat.h> + #endif /* __linux__ */ + + #include "utils/common.h" +@@ -33,6 +34,8 @@ + #include "sha1.h" + #include "random.h" + ++#define RANDOM_STAMPFILE "/var/run/.random_available" ++ + #define POOL_WORDS 32 + #define POOL_WORDS_MASK (POOL_WORDS - 1) + #define POOL_TAP1 26 +@@ -43,6 +46,8 @@ + #define EXTRACT_LEN 16 + #define MIN_READY_MARK 2 + ++#ifndef CONFIG_NO_RANDOM_POOL ++ + static u32 pool[POOL_WORDS]; + static unsigned int input_rotate = 0; + static unsigned int pool_pos = 0; +@@ -123,7 +128,7 @@ static void random_extract(u8 *out) + } + + +-void random_add_randomness(const void *buf, size_t len) ++static void random_pool_add_randomness(const void *buf, size_t len) + { + struct os_time t; + static unsigned int count = 0; +@@ -213,16 +218,22 @@ int random_get_bytes(void *buf, size_t l + int random_pool_ready(void) + { + #ifdef __linux__ ++ struct stat st; + int fd; + ssize_t res; + ++ if (stat(RANDOM_STAMPFILE, &st) == 0) ++ return 1; ++ + /* + * Make sure that there is reasonable entropy available before allowing + * some key derivation operations to proceed. + */ + +- if (dummy_key_avail == sizeof(dummy_key)) ++ if (dummy_key_avail == sizeof(dummy_key)) { ++ random_mark_pool_ready(); + return 1; /* Already initialized - good to continue */ ++ } + + /* + * Try to fetch some more data from the kernel high quality +@@ -257,6 +268,7 @@ int random_pool_ready(void) + if (dummy_key_avail == sizeof(dummy_key)) { + if (own_pool_ready < MIN_READY_MARK) + own_pool_ready = MIN_READY_MARK; ++ random_mark_pool_ready(); + random_write_entropy(); + return 1; + } +@@ -269,6 +281,7 @@ int random_pool_ready(void) + total_collected + 10 * own_pool_ready > MIN_COLLECT_ENTROPY) { + wpa_printf(MSG_INFO, "random: Allow operation to proceed " + "based on internal entropy"); ++ random_mark_pool_ready(); + return 1; + } + +@@ -284,10 +297,16 @@ int random_pool_ready(void) + + void random_mark_pool_ready(void) + { ++ int fd; ++ + own_pool_ready++; + wpa_printf(MSG_DEBUG, "random: Mark internal entropy pool to be " + "ready (count=%u/%u)", own_pool_ready, MIN_READY_MARK); + random_write_entropy(); ++ ++ fd = open(RANDOM_STAMPFILE, O_CREAT | O_WRONLY | O_EXCL | O_NOFOLLOW, 0600); ++ if (fd >= 0) ++ close(fd); + } + + +@@ -444,3 +463,22 @@ void random_deinit(void) + os_free(random_entropy_file); + random_entropy_file = NULL; + } ++ ++#endif /* CONFIG_NO_RANDOM_POOL */ ++ ++ ++void random_add_randomness(const void *buf, size_t len) ++{ ++#ifdef __linux__ ++ int fd; ++ ++ fd = open("/dev/random", O_RDWR); ++ if (fd >= 0) { ++ write(fd, buf, len); ++ close(fd); ++ } ++#endif ++#ifndef CONFIG_NO_RANDOM_POOL ++ random_pool_add_randomness(buf, len); ++#endif ++} +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -1222,9 +1222,8 @@ endif + + ifdef CONFIG_NO_RANDOM_POOL + CFLAGS += -DCONFIG_NO_RANDOM_POOL +-else +-OBJS += ../src/crypto/random.o + endif ++OBJS += ../src/crypto/random.o + + ifdef CONFIG_CTRL_IFACE + ifeq ($(CONFIG_CTRL_IFACE), y) +--- a/wpa_supplicant/Android.mk ++++ b/wpa_supplicant/Android.mk +@@ -1162,9 +1162,8 @@ endif + + ifdef CONFIG_NO_RANDOM_POOL + L_CFLAGS += -DCONFIG_NO_RANDOM_POOL +-else +-OBJS += src/crypto/random.c + endif ++OBJS += src/crypto/random.c + + ifdef CONFIG_CTRL_IFACE + ifeq ($(CONFIG_CTRL_IFACE), y) +--- a/hostapd/Android.mk ++++ b/hostapd/Android.mk +@@ -745,11 +745,11 @@ endif + ifdef CONFIG_NO_RANDOM_POOL + L_CFLAGS += -DCONFIG_NO_RANDOM_POOL + else +-OBJS += src/crypto/random.c +-HOBJS += src/crypto/random.c + HOBJS += $(SHA1OBJS) + HOBJS += src/crypto/md5.c + endif ++OBJS += src/crypto/random.c ++HOBJS += src/crypto/random.c + + ifdef CONFIG_RADIUS_SERVER + L_CFLAGS += -DRADIUS_SERVER +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -748,12 +748,12 @@ endif + ifdef CONFIG_NO_RANDOM_POOL + CFLAGS += -DCONFIG_NO_RANDOM_POOL + else +-OBJS += ../src/crypto/random.o +-HOBJS += ../src/crypto/random.o + HOBJS += ../src/utils/eloop.o + HOBJS += $(SHA1OBJS) + HOBJS += ../src/crypto/md5.o + endif ++OBJS += ../src/crypto/random.o ++HOBJS += ../src/crypto/random.o + + ifdef CONFIG_RADIUS_SERVER + CFLAGS += -DRADIUS_SERVER diff --git a/package/network/services/hostapd/patches/.svn/text-base/510-bring_down_interface.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/510-bring_down_interface.patch.svn-base new file mode 100644 index 0000000..1288e9e --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/510-bring_down_interface.patch.svn-base @@ -0,0 +1,19 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -7346,8 +7346,6 @@ static int wpa_driver_nl80211_set_mode(s + ret = nl80211_set_mode(drv, drv->ifindex, nlmode); + if (ret == -EACCES) + break; +- res = linux_set_iface_flags(drv->global->ioctl_sock, +- bss->ifname, 1); + if (res && !ret) + ret = -1; + else if (ret != -EBUSY) +@@ -7363,6 +7361,7 @@ static int wpa_driver_nl80211_set_mode(s + "interface is down"); + drv->nlmode = nlmode; + drv->ignore_if_down_event = 1; ++ linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1); + } + + done: diff --git a/package/network/services/hostapd/patches/.svn/text-base/520-fix_wps_pin_crash.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/520-fix_wps_pin_crash.patch.svn-base new file mode 100644 index 0000000..80d562c --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/520-fix_wps_pin_crash.patch.svn-base @@ -0,0 +1,12 @@ +--- a/hostapd/ctrl_iface.c ++++ b/hostapd/ctrl_iface.c +@@ -479,6 +479,9 @@ static int hostapd_ctrl_iface_wps_ap_pin + char *pos; + const char *pin_txt; + ++ if (!hapd->wps) ++ return -1; ++ + pos = os_strchr(txt, ' '); + if (pos) + *pos++ = '\0'; diff --git a/package/network/services/hostapd/patches/.svn/text-base/530-wps_single_auth_enc_type.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/530-wps_single_auth_enc_type.patch.svn-base new file mode 100644 index 0000000..51c7669 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/530-wps_single_auth_enc_type.patch.svn-base @@ -0,0 +1,25 @@ +--- a/src/ap/wps_hostapd.c ++++ b/src/ap/wps_hostapd.c +@@ -871,11 +871,9 @@ int hostapd_init_wps(struct hostapd_data + + if (conf->rsn_pairwise & WPA_CIPHER_CCMP) + wps->encr_types |= WPS_ENCR_AES; +- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) ++ else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) + wps->encr_types |= WPS_ENCR_TKIP; +- } +- +- if (conf->wpa & WPA_PROTO_WPA) { ++ } else if (conf->wpa & WPA_PROTO_WPA) { + if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK) + wps->auth_types |= WPS_AUTH_WPAPSK; + if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X) +@@ -883,7 +881,7 @@ int hostapd_init_wps(struct hostapd_data + + if (conf->wpa_pairwise & WPA_CIPHER_CCMP) + wps->encr_types |= WPS_ENCR_AES; +- if (conf->wpa_pairwise & WPA_CIPHER_TKIP) ++ else if (conf->wpa_pairwise & WPA_CIPHER_TKIP) + wps->encr_types |= WPS_ENCR_TKIP; + } + diff --git a/package/network/services/hostapd/patches/.svn/text-base/540-dynamic_20_40_mhz.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/540-dynamic_20_40_mhz.patch.svn-base new file mode 100644 index 0000000..ce2a339 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/540-dynamic_20_40_mhz.patch.svn-base @@ -0,0 +1,206 @@ +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -2474,6 +2474,10 @@ static int hostapd_config_fill(struct ho + "ht_capab", line); + errors++; + } ++ } else if (os_strcmp(buf, "dynamic_ht40") == 0) { ++ conf->dynamic_ht40 = atoi(pos); ++ if (conf->dynamic_ht40 == 1) ++ conf->dynamic_ht40 = 1500; + } else if (os_strcmp(buf, "require_ht") == 0) { + conf->require_ht = atoi(pos); + #endif /* CONFIG_IEEE80211N */ +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -514,6 +514,7 @@ struct hostapd_config { + int ieee80211n; + int secondary_channel; + int require_ht; ++ int dynamic_ht40; + u32 vht_capab; + int ieee80211ac; + int require_vht; +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -22,6 +22,7 @@ + #include "beacon.h" + #include "iapp.h" + #include "ieee802_1x.h" ++#include "ieee802_11.h" + #include "ieee802_11_auth.h" + #include "vlan_init.h" + #include "wpa_auth.h" +@@ -332,6 +333,7 @@ static void hostapd_cleanup_iface_pre(st + + static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) + { ++ hostapd_deinit_ht(iface); + hostapd_free_hw_features(iface->hw_features, iface->num_hw_features); + iface->hw_features = NULL; + os_free(iface->current_rates); +--- a/src/ap/hostapd.h ++++ b/src/ap/hostapd.h +@@ -265,6 +265,9 @@ struct hostapd_iface { + /* Overlapping BSS information */ + int olbc_ht; + ++ int force_20mhz; ++ struct os_time last_20mhz_trigger; ++ + u16 ht_op_mode; + void (*scan_cb)(struct hostapd_iface *iface); + }; +--- a/src/ap/ieee802_11.c ++++ b/src/ap/ieee802_11.c +@@ -1484,6 +1484,9 @@ static void handle_beacon(struct hostapd + sizeof(mgmt->u.beacon)), &elems, + 0); + ++ if (!elems.ht_capabilities) ++ hostapd_trigger_20mhz(hapd->iface); ++ + ap_list_process_beacon(hapd->iface, mgmt, &elems, fi); + } + +--- a/src/ap/ieee802_11.h ++++ b/src/ap/ieee802_11.h +@@ -81,4 +81,17 @@ int hostapd_update_time_adv(struct hosta + void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr); + u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid); + ++#ifdef CONFIG_IEEE80211N ++void hostapd_trigger_20mhz(struct hostapd_iface *iface); ++void hostapd_deinit_ht(struct hostapd_iface *iface); ++ ++#else ++static inline void hostapd_deinit_ht(struct hostapd_iface *iface) ++{ ++} ++static inline void hostapd_trigger_20mhz(struct hostapd_iface *iface) ++{ ++} ++#endif /* CONFIG_IEEE80211N */ ++ + #endif /* IEEE802_11_H */ +--- a/src/ap/ieee802_11_ht.c ++++ b/src/ap/ieee802_11_ht.c +@@ -20,9 +20,11 @@ + #include "drivers/driver.h" + #include "hostapd.h" + #include "ap_config.h" ++#include "ap_drv_ops.h" + #include "sta_info.h" + #include "beacon.h" + #include "ieee802_11.h" ++#include "utils/eloop.h" + + + u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid) +@@ -70,12 +72,15 @@ u8 * hostapd_eid_ht_operation(struct hos + + oper->control_chan = hapd->iconf->channel; + oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode); +- if (hapd->iconf->secondary_channel == 1) +- oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | +- HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; +- if (hapd->iconf->secondary_channel == -1) +- oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | +- HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; ++ ++ if (!hapd->iface->force_20mhz) { ++ if (hapd->iconf->secondary_channel == 1) ++ oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | ++ HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; ++ if (hapd->iconf->secondary_channel == -1) ++ oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | ++ HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; ++ } + + pos += sizeof(*oper); + +@@ -270,3 +275,84 @@ void hostapd_get_ht_capab(struct hostapd + + neg_ht_cap->ht_capabilities_info = host_to_le16(cap); + } ++ ++static void hostapd_set_force_20mhz(struct hostapd_iface *iface); ++ ++static void hostapd_restore_40mhz(void *eloop_data, void *user_ctx) ++{ ++ struct hostapd_iface *iface = eloop_data; ++ struct os_time time; ++ int timeout; ++ ++ if (!iface->last_20mhz_trigger.sec) ++ return; ++ ++ os_get_time(&time); ++ timeout = iface->last_20mhz_trigger.sec + iface->conf->dynamic_ht40 - ++ time.sec; ++ ++ if (timeout > 0) { ++ eloop_register_timeout(timeout, 0, hostapd_restore_40mhz, ++ iface, NULL); ++ return; ++ } ++ ++ iface->last_20mhz_trigger.sec = 0; ++ iface->last_20mhz_trigger.usec = 0; ++ ++ iface->force_20mhz = 0; ++ hostapd_set_force_20mhz(iface); ++} ++ ++static void hostapd_set_force_20mhz(struct hostapd_iface *iface) ++{ ++ int secondary_channel; ++ int i; ++ ++ ieee802_11_set_beacons(iface); ++ ++ for (i = 0; i < iface->num_bss; i++) { ++ struct hostapd_data *hapd = iface->bss[i]; ++ ++ if (iface->force_20mhz) ++ secondary_channel = 0; ++ else ++ secondary_channel = hapd->iconf->secondary_channel; ++ ++ if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq, ++ hapd->iconf->channel, ++ hapd->iconf->ieee80211n, ++ hapd->iconf->ieee80211ac, ++ secondary_channel, ++ hapd->iconf->vht_oper_chwidth, ++ hapd->iconf->vht_oper_centr_freq_seg0_idx, ++ hapd->iconf->vht_oper_centr_freq_seg1_idx)) { ++ wpa_printf(MSG_ERROR, "Could not set channel for " ++ "kernel driver"); ++ } ++ } ++} ++ ++void hostapd_deinit_ht(struct hostapd_iface *iface) ++{ ++ eloop_cancel_timeout(hostapd_restore_40mhz, iface, NULL); ++} ++ ++void hostapd_trigger_20mhz(struct hostapd_iface *iface) ++{ ++ if (!iface->conf->dynamic_ht40) ++ return; ++ ++ if (!iface->force_20mhz) { ++ iface->force_20mhz = 1; ++ hostapd_set_force_20mhz(iface); ++ } ++ ++ if (!iface->last_20mhz_trigger.sec) { ++ eloop_cancel_timeout(hostapd_restore_40mhz, iface, NULL); ++ eloop_register_timeout(iface->conf->dynamic_ht40, 0, ++ hostapd_restore_40mhz, iface, NULL); ++ } ++ ++ os_get_time(&iface->last_20mhz_trigger); ++} diff --git a/package/network/services/hostapd/patches/.svn/text-base/550-limit_debug_messages.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/550-limit_debug_messages.patch.svn-base new file mode 100644 index 0000000..659e980 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/550-limit_debug_messages.patch.svn-base @@ -0,0 +1,213 @@ +--- a/src/utils/wpa_debug.c ++++ b/src/utils/wpa_debug.c +@@ -201,7 +201,7 @@ void wpa_debug_close_linux_tracing(void) + * + * Note: New line '\n' is added to the end of the text when printing to stdout. + */ +-void wpa_printf(int level, const char *fmt, ...) ++void _wpa_printf(int level, const char *fmt, ...) + { + va_list ap; + +@@ -248,8 +248,8 @@ void wpa_printf(int level, const char *f + } + + +-static void _wpa_hexdump(int level, const char *title, const u8 *buf, +- size_t len, int show) ++void _wpa_hexdump(int level, const char *title, const u8 *buf, ++ size_t len, int show) + { + size_t i; + +@@ -375,20 +375,9 @@ static void _wpa_hexdump(int level, cons + #endif /* CONFIG_ANDROID_LOG */ + } + +-void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len) +-{ +- _wpa_hexdump(level, title, buf, len, 1); +-} +- +- +-void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len) +-{ +- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); +-} + +- +-static void _wpa_hexdump_ascii(int level, const char *title, const u8 *buf, +- size_t len, int show) ++void _wpa_hexdump_ascii(int level, const char *title, const u8 *buf, ++ size_t len, int show) + { + size_t i, llen; + const u8 *pos = buf; +@@ -495,19 +484,6 @@ static void _wpa_hexdump_ascii(int level + } + + +-void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, size_t len) +-{ +- _wpa_hexdump_ascii(level, title, buf, len, 1); +-} +- +- +-void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, +- size_t len) +-{ +- _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys); +-} +- +- + #ifdef CONFIG_DEBUG_FILE + static char *last_path = NULL; + #endif /* CONFIG_DEBUG_FILE */ +@@ -591,7 +567,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_ + } + + +-void wpa_msg(void *ctx, int level, const char *fmt, ...) ++void _wpa_msg(void *ctx, int level, const char *fmt, ...) + { + va_list ap; + char *buf; +@@ -625,7 +601,7 @@ void wpa_msg(void *ctx, int level, const + } + + +-void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) ++void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) + { + va_list ap; + char *buf; +--- a/src/utils/wpa_debug.h ++++ b/src/utils/wpa_debug.h +@@ -43,6 +43,17 @@ int wpa_debug_open_file(const char *path + int wpa_debug_reopen_file(void); + void wpa_debug_close_file(void); + ++/* internal */ ++void _wpa_hexdump(int level, const char *title, const u8 *buf, ++ size_t len, int show); ++void _wpa_hexdump_ascii(int level, const char *title, const u8 *buf, ++ size_t len, int show); ++extern int wpa_debug_show_keys; ++ ++#ifndef CONFIG_MSG_MIN_PRIORITY ++#define CONFIG_MSG_MIN_PRIORITY 0 ++#endif ++ + /** + * wpa_debug_printf_timestamp - Print timestamp for debug output + * +@@ -63,9 +74,15 @@ void wpa_debug_print_timestamp(void); + * + * Note: New line '\n' is added to the end of the text when printing to stdout. + */ +-void wpa_printf(int level, const char *fmt, ...) ++void _wpa_printf(int level, const char *fmt, ...) + PRINTF_FORMAT(2, 3); + ++#define wpa_printf(level, ...) \ ++ do { \ ++ if (level >= CONFIG_MSG_MIN_PRIORITY) \ ++ _wpa_printf(level, __VA_ARGS__); \ ++ } while(0) ++ + /** + * wpa_hexdump - conditional hex dump + * @level: priority level (MSG_*) of the message +@@ -77,7 +94,13 @@ PRINTF_FORMAT(2, 3); + * output may be directed to stdout, stderr, and/or syslog based on + * configuration. The contents of buf is printed out has hex dump. + */ +-void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len); ++static inline void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump(level, title, buf, len, 1); ++} + + static inline void wpa_hexdump_buf(int level, const char *title, + const struct wpabuf *buf) +@@ -99,7 +122,13 @@ static inline void wpa_hexdump_buf(int l + * like wpa_hexdump(), but by default, does not include secret keys (passwords, + * etc.) in debug output. + */ +-void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len); ++static inline void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); ++} + + static inline void wpa_hexdump_buf_key(int level, const char *title, + const struct wpabuf *buf) +@@ -121,8 +150,14 @@ static inline void wpa_hexdump_buf_key(i + * the hex numbers and ASCII characters (for printable range) are shown. 16 + * bytes per line will be shown. + */ +-void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, +- size_t len); ++static inline void wpa_hexdump_ascii(int level, const char *title, ++ const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump_ascii(level, title, buf, len, 1); ++} + + /** + * wpa_hexdump_ascii_key - conditional hex dump, hide keys +@@ -138,8 +173,14 @@ void wpa_hexdump_ascii(int level, const + * bytes per line will be shown. This works like wpa_hexdump_ascii(), but by + * default, does not include secret keys (passwords, etc.) in debug output. + */ +-void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, +- size_t len); ++static inline void wpa_hexdump_ascii_key(int level, const char *title, ++ const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys); ++} + + /* + * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce +@@ -172,7 +213,12 @@ void wpa_hexdump_ascii_key(int level, co + * + * Note: New line '\n' is added to the end of the text when printing to stdout. + */ +-void wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); ++void _wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); ++#define wpa_msg(ctx, level, ...) \ ++ do { \ ++ if (level >= CONFIG_MSG_MIN_PRIORITY) \ ++ _wpa_msg(ctx, level, __VA_ARGS__); \ ++ } while(0) + + /** + * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors +@@ -186,8 +232,13 @@ void wpa_msg(void *ctx, int level, const + * attached ctrl_iface monitors. In other words, it can be used for frequent + * events that do not need to be sent to syslog. + */ +-void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) ++void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) + PRINTF_FORMAT(3, 4); ++#define wpa_msg_ctrl(ctx, level, ...) \ ++ do { \ ++ if (level >= CONFIG_MSG_MIN_PRIORITY) \ ++ _wpa_msg_ctrl(ctx, level, __VA_ARGS__); \ ++ } while(0) + + typedef void (*wpa_msg_cb_func)(void *ctx, int level, const char *txt, + size_t len); diff --git a/package/network/services/hostapd/patches/.svn/text-base/560-indicate-features.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/560-indicate-features.patch.svn-base new file mode 100644 index 0000000..d01e18b --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/560-indicate-features.patch.svn-base @@ -0,0 +1,82 @@ +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -13,6 +13,7 @@ + + #include "utils/common.h" + #include "utils/eloop.h" ++#include "utils/build_features.h" + #include "crypto/random.h" + #include "crypto/tls.h" + #include "common/version.h" +@@ -560,7 +561,7 @@ int main(int argc, char *argv[]) + + wpa_supplicant_event = hostapd_wpa_event; + for (;;) { +- c = getopt(argc, argv, "Bde:f:hKP:tvg:"); ++ c = getopt(argc, argv, "Bde:f:hKP:tg:v::"); + if (c < 0) + break; + switch (c) { +@@ -592,6 +593,8 @@ int main(int argc, char *argv[]) + wpa_debug_timestamp++; + break; + case 'v': ++ if (optarg) ++ exit(!has_feature(optarg)); + show_version(); + exit(1); + break; +--- a/wpa_supplicant/main.c ++++ b/wpa_supplicant/main.c +@@ -12,6 +12,7 @@ + #endif /* __linux__ */ + + #include "common.h" ++#include "build_features.h" + #include "wpa_supplicant_i.h" + #include "driver_i.h" + +@@ -156,7 +157,7 @@ int main(int argc, char *argv[]) + + for (;;) { + c = getopt(argc, argv, +- "b:Bc:C:D:de:f:g:hH:i:KLNo:O:p:P:qsTtuvW"); ++ "b:Bc:C:D:de:f:g:hH:i:KLNo:O:p:P:qsTtuv::W"); + if (c < 0) + break; + switch (c) { +@@ -248,8 +249,12 @@ int main(int argc, char *argv[]) + break; + #endif /* CONFIG_DBUS */ + case 'v': +- printf("%s\n", wpa_supplicant_version); +- exitcode = 0; ++ if (optarg) { ++ exitcode = !has_feature(optarg); ++ } else { ++ printf("%s\n", wpa_supplicant_version); ++ exitcode = 0; ++ } + goto out; + case 'W': + params.wait_for_monitor++; +--- /dev/null ++++ b/src/utils/build_features.h +@@ -0,0 +1,17 @@ ++#ifndef BUILD_FEATURES_H ++#define BUILD_FEATURES_H ++ ++static inline int has_feature(const char *feat) ++{ ++#ifdef IEEE8021X_EAPOL ++ if (!strcmp(feat, "eap")) ++ return 1; ++#endif ++#ifdef IEEE80211N ++ if (!strcmp(feat, "11n")) ++ return 1; ++#endif ++ return 0; ++} ++ ++#endif /* BUILD_FEATURES_H */ diff --git a/package/network/services/hostapd/patches/.svn/text-base/570-genl_connect_debug.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/570-genl_connect_debug.patch.svn-base new file mode 100644 index 0000000..5f14048 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/570-genl_connect_debug.patch.svn-base @@ -0,0 +1,11 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -127,7 +127,7 @@ static struct nl_handle * nl_create_hand + } + + if (genl_connect(handle)) { +- wpa_printf(MSG_ERROR, "nl80211: Failed to connect to generic " ++ wpa_printf(MSG_DEBUG, "nl80211: Failed to connect to generic " + "netlink (%s)", dbg); + nl80211_handle_destroy(handle); + return NULL; diff --git a/package/network/services/hostapd/patches/.svn/text-base/590-hostapd_cli_ifdef.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/590-hostapd_cli_ifdef.patch.svn-base new file mode 100644 index 0000000..cbf1e48 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/590-hostapd_cli_ifdef.patch.svn-base @@ -0,0 +1,50 @@ +--- a/hostapd/hostapd_cli.c ++++ b/hostapd/hostapd_cli.c +@@ -67,7 +67,6 @@ static const char *commands_help = + #ifdef CONFIG_IEEE80211W + " sa_query <addr> send SA Query to a station\n" + #endif /* CONFIG_IEEE80211W */ +-#ifdef CONFIG_WPS + " wps_pin <uuid> <pin> [timeout] [addr] add WPS Enrollee PIN\n" + " wps_check_pin <PIN> verify PIN checksum\n" + " wps_pbc indicate button pushed to initiate PBC\n" +@@ -79,7 +78,6 @@ static const char *commands_help = + #endif /* CONFIG_WPS_NFC */ + " wps_ap_pin <cmd> [params..] enable/disable AP PIN\n" + " wps_config <SSID> <auth> <encr> <key> configure AP\n" +-#endif /* CONFIG_WPS */ + " get_config show current configuration\n" + " help show this usage help\n" + " interface [ifname] show interfaces/select interface\n" +@@ -340,7 +338,6 @@ static int hostapd_cli_cmd_sa_query(stru + #endif /* CONFIG_IEEE80211W */ + + +-#ifdef CONFIG_WPS + static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, + char *argv[]) + { +@@ -559,7 +556,6 @@ static int hostapd_cli_cmd_wps_config(st + ssid_hex, argv[1]); + return wpa_ctrl_command(ctrl, buf); + } +-#endif /* CONFIG_WPS */ + + + static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, +@@ -805,7 +801,6 @@ static struct hostapd_cli_cmd hostapd_cl + #ifdef CONFIG_IEEE80211W + { "sa_query", hostapd_cli_cmd_sa_query }, + #endif /* CONFIG_IEEE80211W */ +-#ifdef CONFIG_WPS + { "wps_pin", hostapd_cli_cmd_wps_pin }, + { "wps_check_pin", hostapd_cli_cmd_wps_check_pin }, + { "wps_pbc", hostapd_cli_cmd_wps_pbc }, +@@ -818,7 +813,6 @@ static struct hostapd_cli_cmd hostapd_cl + #endif /* CONFIG_WPS_NFC */ + { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin }, + { "wps_config", hostapd_cli_cmd_wps_config }, +-#endif /* CONFIG_WPS */ + { "disassoc_imminent", hostapd_cli_cmd_disassoc_imminent }, + { "ess_disassoc", hostapd_cli_cmd_ess_disassoc }, + { "get_config", hostapd_cli_cmd_get_config }, diff --git a/package/network/services/hostapd/patches/.svn/text-base/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch.svn-base new file mode 100644 index 0000000..977bce4 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch.svn-base @@ -0,0 +1,209 @@ +From 4bb69d15477e0f2b00e166845341dc933de47c58 Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli <ordex@autistici.org> +Date: Sun, 3 Jun 2012 18:22:56 +0200 +Subject: [PATCHv2 601/602] wpa_supplicant: add new config params to be used + with the ibss join command + +Signed-hostap: Antonio Quartulli <ordex@autistici.org> +--- + src/drivers/driver.h | 6 +++ + wpa_supplicant/config.c | 96 +++++++++++++++++++++++++++++++++++++++ + wpa_supplicant/config_ssid.h | 6 +++ + wpa_supplicant/wpa_supplicant.c | 23 +++++++--- + 4 files changed, 124 insertions(+), 7 deletions(-) + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -19,6 +19,7 @@ + + #define WPA_SUPPLICANT_DRIVER_VERSION 4 + ++#include "drivers/nl80211_copy.h" + #include "common/defs.h" + + #define HOSTAPD_CHAN_DISABLED 0x00000001 +@@ -363,6 +364,11 @@ struct wpa_driver_associate_params { + */ + int freq; + ++ int beacon_interval; ++ int fixed_freq; ++ unsigned char rates[NL80211_MAX_SUPP_RATES]; ++ int mcast_rate; ++ + /** + * bg_scan_period - Background scan period in seconds, 0 to disable + * background scan, or -1 to indicate no change to default driver +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -14,6 +14,7 @@ + #include "rsn_supp/wpa.h" + #include "eap_peer/eap.h" + #include "p2p/p2p.h" ++#include "drivers/nl80211_copy.h" + #include "config.h" + + +@@ -1369,6 +1370,97 @@ static char * wpa_config_write_p2p_clien + + #endif /* CONFIG_P2P */ + ++static int wpa_config_parse_mcast_rate(const struct parse_data *data, ++ struct wpa_ssid *ssid, int line, ++ const char *value) ++{ ++ ssid->mcast_rate = (int)(strtod(value, NULL) * 10); ++ ++ return 0; ++} ++ ++#ifndef NO_CONFIG_WRITE ++static char * wpa_config_write_mcast_rate(const struct parse_data *data, ++ struct wpa_ssid *ssid) ++{ ++ char *value; ++ int res; ++ ++ if (!ssid->mcast_rate == 0) ++ return NULL; ++ ++ value = os_malloc(6); /* longest: 300.0 */ ++ if (value == NULL) ++ return NULL; ++ res = os_snprintf(value, 5, "%.1f", (double)ssid->mcast_rate / 10); ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ return value; ++} ++#endif /* NO_CONFIG_WRITE */ ++ ++static int wpa_config_parse_rates(const struct parse_data *data, ++ struct wpa_ssid *ssid, int line, ++ const char *value) ++{ ++ int i; ++ char *pos, *r, *sptr, *end; ++ double rate; ++ ++ pos = (char *)value; ++ r = strtok_r(pos, ",", &sptr); ++ i = 0; ++ while (pos && i < NL80211_MAX_SUPP_RATES) { ++ rate = 0.0; ++ if (r) ++ rate = strtod(r, &end); ++ ssid->rates[i] = rate * 2; ++ if (*end != '\0' || rate * 2 != ssid->rates[i]) ++ return 1; ++ ++ i++; ++ r = strtok_r(NULL, ",", &sptr); ++ } ++ ++ return 0; ++} ++ ++#ifndef NO_CONFIG_WRITE ++static char * wpa_config_write_rates(const struct parse_data *data, ++ struct wpa_ssid *ssid) ++{ ++ char *value, *pos; ++ int res, i; ++ ++ if (ssid->rates[0] <= 0) ++ return NULL; ++ ++ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1); ++ if (value == NULL) ++ return NULL; ++ pos = value; ++ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) { ++ res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2); ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ pos += res; ++ } ++ res = os_snprintf(pos, 6, "%.1f", ++ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2); ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ ++ value[6 * NL80211_MAX_SUPP_RATES] = '\0'; ++ return value; ++} ++#endif /* NO_CONFIG_WRITE */ ++ + /* Helper macros for network block parser */ + + #ifdef OFFSET +@@ -1546,6 +1638,9 @@ static const struct parse_data ssid_fiel + { INT(ap_max_inactivity) }, + { INT(dtim_period) }, + { INT(beacon_int) }, ++ { INT_RANGE(fixed_freq, 0, 1) }, ++ { FUNC(rates) }, ++ { FUNC(mcast_rate) }, + }; + + #undef OFFSET +--- a/wpa_supplicant/config_ssid.h ++++ b/wpa_supplicant/config_ssid.h +@@ -11,6 +11,7 @@ + + #include "common/defs.h" + #include "eap_peer/eap_config.h" ++#include "drivers/nl80211_copy.h" + + #define MAX_SSID_LEN 32 + +@@ -571,6 +572,10 @@ struct wpa_ssid { + * dereferences since it may not be updated in all cases. + */ + void *parent_cred; ++ ++ int fixed_freq; ++ unsigned char rates[NL80211_MAX_SUPP_RATES]; ++ double mcast_rate; + }; + + #endif /* CONFIG_SSID_H */ +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -1570,15 +1570,24 @@ void wpa_supplicant_associate(struct wpa + params.ssid_len = ssid->ssid_len; + } + +- if (ssid->mode == WPAS_MODE_IBSS && ssid->bssid_set && +- wpa_s->conf->ap_scan == 2) { +- params.bssid = ssid->bssid; +- params.fixed_bssid = 1; ++ if (ssid->mode == WPAS_MODE_IBSS) { ++ if (ssid->bssid_set && wpa_s->conf->ap_scan == 2) { ++ params.bssid = ssid->bssid; ++ params.fixed_bssid = 1; ++ } ++ if (ssid->frequency > 0 && params.freq == 0) ++ /* Initial channel for IBSS */ ++ params.freq = ssid->frequency; ++ params.fixed_freq = ssid->fixed_freq; ++ params.beacon_interval = ssid->beacon_int; ++ i = 0; ++ while (i < NL80211_MAX_SUPP_RATES) { ++ params.rates[i] = ssid->rates[i]; ++ i++; ++ } ++ params.mcast_rate = ssid->mcast_rate; + } + +- if (ssid->mode == WPAS_MODE_IBSS && ssid->frequency > 0 && +- params.freq == 0) +- params.freq = ssid->frequency; /* Initial channel for IBSS */ + params.wpa_ie = wpa_ie; + params.wpa_ie_len = wpa_ie_len; + params.pairwise_suite = cipher_pairwise; diff --git a/package/network/services/hostapd/patches/.svn/text-base/602-driver_nl80211-use-new-parameters-during-ibss-join.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/602-driver_nl80211-use-new-parameters-during-ibss-join.patch.svn-base new file mode 100644 index 0000000..bf80185 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/602-driver_nl80211-use-new-parameters-during-ibss-join.patch.svn-base @@ -0,0 +1,59 @@ +From ffc4445958a3ed4064f2e1bf73fa478a61c5cf7b Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli <ordex@autistici.org> +Date: Sun, 3 Jun 2012 18:42:25 +0200 +Subject: [PATCHv2 602/602] driver_nl80211: use new parameters during ibss join + +Signed-hostap: Antonio Quartulli <ordex@autistici.org> +--- + src/drivers/driver_nl80211.c | 33 ++++++++++++++++++++++++++++++++- + 1 file changed, 32 insertions(+), 1 deletion(-) + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -6806,7 +6806,7 @@ static int wpa_driver_nl80211_ibss(struc + struct wpa_driver_associate_params *params) + { + struct nl_msg *msg; +- int ret = -1; ++ int ret = -1, i; + int count = 0; + + wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); +@@ -6839,6 +6839,37 @@ retry: + wpa_printf(MSG_DEBUG, " * freq=%d", params->freq); + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, params->freq); + ++ if (params->fixed_freq) { ++ wpa_printf(MSG_DEBUG, " * fixed_freq"); ++ NLA_PUT_FLAG(msg, NL80211_ATTR_FREQ_FIXED); ++ } ++ ++ if (params->beacon_interval > 0) { ++ wpa_printf(MSG_DEBUG, " * beacon_interval=%d", ++ params->beacon_interval); ++ NLA_PUT_U32(msg, NL80211_ATTR_BEACON_INTERVAL, ++ params->beacon_interval); ++ } ++ ++ if (params->rates[0] > 0) { ++ wpa_printf(MSG_DEBUG, " * basic_rates:"); ++ i = 0; ++ while (i < NL80211_MAX_SUPP_RATES && ++ params->rates[i] > 0) { ++ wpa_printf(MSG_DEBUG, " %.1f", ++ (double)params->rates[i] / 2); ++ i++; ++ } ++ NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, i, ++ params->rates); ++ } ++ ++ if (params->mcast_rate > 0) { ++ wpa_printf(MSG_DEBUG, " * mcast_rates=%.1f", ++ (double)params->mcast_rate / 10); ++ NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate); ++ } ++ + ret = nl80211_set_conn_keys(params, msg); + if (ret) + goto nla_put_failure; diff --git a/package/network/services/hostapd/patches/.svn/text-base/604-wpa_s-support-htmode-param.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/604-wpa_s-support-htmode-param.patch.svn-base new file mode 100644 index 0000000..00272a5 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/604-wpa_s-support-htmode-param.patch.svn-base @@ -0,0 +1,156 @@ +From b9329c5dfeed7d5c55d2117d8dfe326fc40c8fb1 Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli <ordex@autistici.org> +Date: Tue, 3 Jul 2012 00:36:24 +0200 +Subject: [PATCH] wpa_s: support htmode param + +possible values are HT20, HT40-, HT40+ and NOHT + +Signed-off-by: Antonio Quartulli <ordex@autistici.org> +--- + src/drivers/driver.h | 2 ++ + src/drivers/driver_nl80211.c | 16 ++++++++++ + wpa_supplicant/config.c | 66 +++++++++++++++++++++++++++++++++++++++ + wpa_supplicant/config_ssid.h | 2 ++ + wpa_supplicant/wpa_supplicant.c | 2 ++ + 5 files changed, 88 insertions(+) + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -368,6 +368,8 @@ struct wpa_driver_associate_params { + int fixed_freq; + unsigned char rates[NL80211_MAX_SUPP_RATES]; + int mcast_rate; ++ int ht_set; ++ unsigned int htmode; + + /** + * bg_scan_period - Background scan period in seconds, 0 to disable +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -6870,6 +6870,22 @@ retry: + NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate); + } + ++ if (params->ht_set) { ++ switch(params->htmode) { ++ case NL80211_CHAN_HT20: ++ wpa_printf(MSG_DEBUG, " * ht=HT20"); ++ break; ++ case NL80211_CHAN_HT40PLUS: ++ wpa_printf(MSG_DEBUG, " * ht=HT40+"); ++ break; ++ case NL80211_CHAN_HT40MINUS: ++ wpa_printf(MSG_DEBUG, " * ht=HT40-"); ++ break; ++ } ++ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, ++ params->htmode); ++ } ++ + ret = nl80211_set_conn_keys(params, msg); + if (ret) + goto nla_put_failure; +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -1401,6 +1401,71 @@ static char * wpa_config_write_mcast_rat + } + #endif /* NO_CONFIG_WRITE */ + ++static int wpa_config_parse_htmode(const struct parse_data *data, ++ struct wpa_ssid *ssid, int line, ++ const char *value) ++{ ++ int i; ++ static const struct { ++ const char *name; ++ unsigned int val; ++ } htmap[] = { ++ { .name = "HT20", .val = NL80211_CHAN_HT20, }, ++ { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, }, ++ { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, }, ++ { .name = "NOHT", .val = NL80211_CHAN_NO_HT, }, ++ }; ++ ssid->ht_set = 0;; ++ for (i = 0; i < 4; i++) { ++ if (strcasecmp(htmap[i].name, value) == 0) { ++ ssid->htmode = htmap[i].val; ++ ssid->ht_set = 1; ++ break; ++ } ++ } ++ ++ return 0; ++} ++ ++#ifndef NO_CONFIG_WRITE ++static char * wpa_config_write_htmode(const struct parse_data *data, ++ struct wpa_ssid *ssid) ++{ ++ char *value; ++ int res; ++ ++ value = os_malloc(6); /* longest: HT40+ */ ++ if (value == NULL) ++ return NULL; ++ ++ switch(ssid->htmode) { ++ case NL80211_CHAN_HT20: ++ res = os_snprintf(value, 4, "HT20"); ++ break; ++ case NL80211_CHAN_HT40PLUS: ++ res = os_snprintf(value, 5, "HT40+"); ++ break; ++ case NL80211_CHAN_HT40MINUS: ++ res = os_snprintf(value, 5, "HT40-"); ++ break; ++ case NL80211_CHAN_NO_HT: ++ res = os_snprintf(value, 4, "NOHT"); ++ break; ++ default: ++ os_free(value); ++ return NULL; ++ } ++ ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ ++ return value; ++} ++#endif /* NO_CONFIG_WRITE */ ++ ++ + static int wpa_config_parse_rates(const struct parse_data *data, + struct wpa_ssid *ssid, int line, + const char *value) +@@ -1641,6 +1706,7 @@ static const struct parse_data ssid_fiel + { INT_RANGE(fixed_freq, 0, 1) }, + { FUNC(rates) }, + { FUNC(mcast_rate) }, ++ { FUNC(htmode) }, + }; + + #undef OFFSET +--- a/wpa_supplicant/config_ssid.h ++++ b/wpa_supplicant/config_ssid.h +@@ -576,6 +576,8 @@ struct wpa_ssid { + int fixed_freq; + unsigned char rates[NL80211_MAX_SUPP_RATES]; + double mcast_rate; ++ int ht_set; ++ unsigned int htmode; + }; + + #endif /* CONFIG_SSID_H */ +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -1586,6 +1586,8 @@ void wpa_supplicant_associate(struct wpa + i++; + } + params.mcast_rate = ssid->mcast_rate; ++ params.ht_set = ssid->ht_set; ++ params.htmode = ssid->htmode; + } + + params.wpa_ie = wpa_ie; diff --git a/package/network/services/hostapd/patches/.svn/text-base/610-max_num_sta_probe.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/610-max_num_sta_probe.patch.svn-base new file mode 100644 index 0000000..141eb5b --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/610-max_num_sta_probe.patch.svn-base @@ -0,0 +1,13 @@ +--- a/src/ap/beacon.c ++++ b/src/ap/beacon.c +@@ -455,6 +455,10 @@ void handle_probe_req(struct hostapd_dat + return; + } + ++ if (!sta && hapd->num_sta >= hapd->conf->max_num_sta) ++ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " ignored," ++ " too many connected stations.", MAC2STR(mgmt->sa)); ++ + #ifdef CONFIG_INTERWORKING + if (elems.interworking && elems.interworking_len >= 1) { + u8 ant = elems.interworking[0] & 0x0f; diff --git a/package/network/services/hostapd/patches/.svn/text-base/620-scan_wait.patch.svn-base b/package/network/services/hostapd/patches/.svn/text-base/620-scan_wait.patch.svn-base new file mode 100644 index 0000000..d9c7f30 --- /dev/null +++ b/package/network/services/hostapd/patches/.svn/text-base/620-scan_wait.patch.svn-base @@ -0,0 +1,65 @@ +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -32,6 +32,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; + + extern struct wpa_driver_ops *wpa_drivers[]; + +@@ -146,6 +148,14 @@ static void hostapd_logger_cb(void *ctx, + } + #endif /* CONFIG_NO_HOSTAPD_LOGGER */ + ++static void hostapd_setup_complete_cb(void *ctx) ++{ ++ if (daemonize && os_daemonize(pid_file)) { ++ perror("daemon"); ++ return; ++ } ++ daemonize = 0; ++} + + /** + * hostapd_init - Allocate and initialize per-interface data +@@ -189,6 +199,7 @@ static struct hostapd_iface * hostapd_in + if (hapd == NULL) + goto fail; + hapd->msg_ctx = hapd; ++ hapd->setup_complete_cb = hostapd_setup_complete_cb; + } + + return hapd_iface; +@@ -425,8 +436,6 @@ static void hostapd_global_deinit(const + #endif /* CONFIG_NATIVE_WINDOWS */ + + eap_server_unregister_methods(); +- +- os_daemonize_terminate(pid_file); + } + + +@@ -452,11 +461,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; +@@ -540,8 +544,7 @@ int main(int argc, char *argv[]) + struct hapd_interfaces interfaces; + int ret = 1; + size_t i; +- int c, debug = 0, daemonize = 0; +- char *pid_file = NULL; ++ int c, debug = 0; + const char *log_file = NULL; + const char *entropy_file = NULL; + diff --git a/package/network/services/hostapd/patches/300-nl80211_multicall_fixes.patch b/package/network/services/hostapd/patches/300-nl80211_multicall_fixes.patch new file mode 100644 index 0000000..6c4f46f --- /dev/null +++ b/package/network/services/hostapd/patches/300-nl80211_multicall_fixes.patch @@ -0,0 +1,60 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -3129,6 +3129,7 @@ static void * wpa_driver_nl80211_init(vo + drv->monitor_sock = -1; + drv->eapol_tx_sock = -1; + drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED; ++ drv->nlmode = NL80211_IFTYPE_STATION; + + if (wpa_driver_nl80211_init_nl(drv)) { + os_free(drv); +@@ -3446,17 +3447,12 @@ static void wpa_driver_nl80211_send_rfki + wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL); + } + +- + static int +-wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv) ++wpa_driver_nl80211_finish_drv_init_sta(struct wpa_driver_nl80211_data *drv, ++ int *send_rfkill_event) + { + struct i802_bss *bss = &drv->first_bss; +- int send_rfkill_event = 0; + +- drv->ifindex = if_nametoindex(bss->ifname); +- drv->first_bss.ifindex = drv->ifindex; +- +-#ifndef HOSTAPD + /* + * Make sure the interface starts up in station mode unless this is a + * dynamically added interface (e.g., P2P) that was already configured +@@ -3475,7 +3471,7 @@ wpa_driver_nl80211_finish_drv_init(struc + "interface '%s' due to rfkill", + bss->ifname); + drv->if_disabled = 1; +- send_rfkill_event = 1; ++ *send_rfkill_event = 1; + } else { + wpa_printf(MSG_ERROR, "nl80211: Could not set " + "interface '%s' UP", bss->ifname); +@@ -3485,7 +3481,19 @@ wpa_driver_nl80211_finish_drv_init(struc + + netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, + 1, IF_OPER_DORMANT); +-#endif /* HOSTAPD */ ++} ++ ++static int ++wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv) ++{ ++ struct i802_bss *bss = &drv->first_bss; ++ int send_rfkill_event = 0; ++ ++ drv->ifindex = if_nametoindex(bss->ifname); ++ drv->first_bss.ifindex = drv->ifindex; ++ ++ if (drv->nlmode == NL80211_IFTYPE_STATION) ++ wpa_driver_nl80211_finish_drv_init_sta(drv, &send_rfkill_event); + + if (wpa_driver_nl80211_capa(drv)) + return -1; diff --git a/package/network/services/hostapd/patches/310-multicall_bridge_fix.patch b/package/network/services/hostapd/patches/310-multicall_bridge_fix.patch new file mode 100644 index 0000000..e167ba7 --- /dev/null +++ b/package/network/services/hostapd/patches/310-multicall_bridge_fix.patch @@ -0,0 +1,45 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -897,6 +897,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, +@@ -1004,6 +1008,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) { +@@ -3131,6 +3139,11 @@ static void * wpa_driver_nl80211_init(vo + drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED; + drv->nlmode = NL80211_IFTYPE_STATION; + ++#ifdef HOSTAPD ++ drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int); ++ drv->if_indices = drv->default_if_indices; ++#endif ++ + if (wpa_driver_nl80211_init_nl(drv)) { + os_free(drv); + return NULL; +@@ -8021,8 +8034,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/network/services/hostapd/patches/320-madwifi_key_fixes.patch b/package/network/services/hostapd/patches/320-madwifi_key_fixes.patch new file mode 100644 index 0000000..45a7ac6 --- /dev/null +++ b/package/network/services/hostapd/patches/320-madwifi_key_fixes.patch @@ -0,0 +1,34 @@ +--- a/src/drivers/driver_madwifi.c ++++ b/src/drivers/driver_madwifi.c +@@ -453,7 +453,9 @@ 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; ++ wk.ik_flags = IEEE80211_KEY_RECV; ++ if (set_tx) ++ wk.ik_flags |= IEEE80211_KEY_XMIT; + if (addr == NULL || is_broadcast_ether_addr(addr)) { + memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN); + wk.ik_keyix = key_idx; +@@ -465,6 +467,20 @@ wpa_driver_madwifi_set_key(const char *i + wk.ik_keylen = key_len; + memcpy(wk.ik_keydata, key, key_len); + ++#ifdef WORDS_BIGENDIAN ++#define WPA_KEY_RSC_LEN 8 ++ { ++ size_t i; ++ u8 tmp[WPA_KEY_RSC_LEN]; ++ os_memset(tmp, 0, sizeof(tmp)); ++ for (i = 0; i < seq_len; i++) ++ tmp[WPA_KEY_RSC_LEN - i - 1] = seq[i]; ++ os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN); ++ } ++#else /* WORDS_BIGENDIAN */ ++ os_memcpy(&wk.ik_keyrsc, seq, seq_len); ++#endif /* WORDS_BIGENDIAN */ ++ + ret = set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk)); + if (ret < 0) { + wpa_printf(MSG_DEBUG, "%s: Failed to set key (addr %s" diff --git a/package/network/services/hostapd/patches/330-fix_reassoc_after_ack_failure.patch b/package/network/services/hostapd/patches/330-fix_reassoc_after_ack_failure.patch new file mode 100644 index 0000000..a91e4ae --- /dev/null +++ b/package/network/services/hostapd/patches/330-fix_reassoc_after_ack_failure.patch @@ -0,0 +1,11 @@ +--- a/src/ap/sta_info.c ++++ b/src/ap/sta_info.c +@@ -576,7 +576,7 @@ void ap_sta_disassociate(struct hostapd_ + { + wpa_printf(MSG_DEBUG, "%s: disassociate STA " MACSTR, + hapd->conf->iface, MAC2STR(sta->addr)); +- sta->flags &= ~WLAN_STA_ASSOC; ++ sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_ASSOC_REQ_OK); + ap_sta_set_authorized(hapd, sta, 0); + sta->timeout_next = STA_DEAUTH; + wpa_printf(MSG_DEBUG, "%s: reschedule ap_handle_timer timeout " diff --git a/package/network/services/hostapd/patches/400-noscan.patch b/package/network/services/hostapd/patches/400-noscan.patch new file mode 100644 index 0000000..b1b25ff --- /dev/null +++ b/package/network/services/hostapd/patches/400-noscan.patch @@ -0,0 +1,32 @@ +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -2464,6 +2464,8 @@ static int hostapd_config_fill(struct ho + } + #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 +@@ -510,6 +510,7 @@ struct hostapd_config { + + int ht_op_mode_fixed; + u16 ht_capab; ++ int noscan; + int ieee80211n; + int secondary_channel; + int require_ht; +--- a/src/ap/hw_features.c ++++ b/src/ap/hw_features.c +@@ -494,7 +494,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/network/services/hostapd/patches/410-multicall.patch b/package/network/services/hostapd/patches/410-multicall.patch new file mode 100644 index 0000000..4c6f8c9 --- /dev/null +++ b/package/network/services/hostapd/patches/410-multicall.patch @@ -0,0 +1,246 @@ +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -14,6 +14,7 @@ CFLAGS += -I../src/utils + # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include + + -include .config ++-include $(if $(MULTICALL), ../wpa_supplicant/.config) + + ifndef CONFIG_OS + ifdef CONFIG_NATIVE_WINDOWS +@@ -192,10 +193,14 @@ ifdef CONFIG_IEEE80211AC + CFLAGS += -DCONFIG_IEEE80211AC + 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 +@@ -860,6 +865,12 @@ install: all + + BCHECK=../src/drivers/build.hostapd + ++hostapd_multi.a: $(BCHECK) $(OBJS) ++ $(Q)$(CC) -c -o hostapd_multi.o -Dmain=hostapd_main $(CFLAGS) main.c ++ @$(E) " CC " $< ++ @rm -f $@ ++ @$(AR) cr $@ hostapd_multi.o $(OBJS) ++ + hostapd: $(BCHECK) $(OBJS) + $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) + @$(E) " LD " $@ +@@ -898,6 +909,12 @@ HOBJS += ../src/crypto/aes-internal.o + HOBJS += ../src/crypto/aes-internal-enc.o + endif + ++dump_cflags: ++ @echo -n $(CFLAGS) " " ++ ++dump_ldflags: ++ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " " ++ + nt_password_hash: $(NOBJS) + $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n) + @$(E) " LD " $@ +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -14,6 +14,7 @@ CFLAGS += -I../src + CFLAGS += -I../src/utils + + -include .config ++-include $(if $(MULTICALL),../hostapd/.config) + + BINALL=wpa_supplicant wpa_cli + +@@ -704,6 +705,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 +@@ -712,9 +717,11 @@ NEED_EAP_COMMON=y + NEED_RSN_AUTHENTICATOR=y + CFLAGS += -DCONFIG_AP + OBJS += ap.o ++ifndef MULTICALL + CFLAGS += -DCONFIG_NO_RADIUS + CFLAGS += -DCONFIG_NO_ACCOUNTING + CFLAGS += -DCONFIG_NO_VLAN ++endif + OBJS += ../src/ap/hostapd.o + OBJS += ../src/ap/wpa_auth_glue.o + OBJS += ../src/ap/utils.o +@@ -769,10 +776,18 @@ endif + ifdef CONFIG_HS20 + OBJS += ../src/ap/hs20.o + endif ++else ++ ifdef MULTICALL ++ OBJS += ../src/eap_server/eap_server.o ++ OBJS += ../src/eap_server/eap_server_identity.o ++ OBJS += ../src/eap_server/eap_server_methods.o ++ endif + endif + + ifdef NEED_RSN_AUTHENTICATOR ++ifndef MULTICALL + CFLAGS += -DCONFIG_NO_RADIUS ++endif + NEED_AES_WRAP=y + OBJS += ../src/ap/wpa_auth.o + OBJS += ../src/ap/wpa_auth_ie.o +@@ -1521,6 +1536,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) + + $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config + ++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: $(BCHECK) $(OBJS) $(EXTRA_progs) + $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) + @$(E) " LD " $@ +@@ -1591,6 +1612,12 @@ eap_ikev2.so: ../src/eap_peer/eap_ikev2. + %@.service: %.service.arg.in + sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ + ++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 +@@ -3726,8 +3726,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 +@@ -714,8 +714,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; + #ifndef CONFIG_NO_STDOUT_DEBUG +--- a/wpa_supplicant/wpa_priv.c ++++ b/wpa_supplicant/wpa_priv.c +@@ -819,8 +819,8 @@ static void wpa_priv_send_ft_response(st + } + + +-void wpa_supplicant_event(void *ctx, enum wpa_event_type event, +- union wpa_event_data *data) ++static void supplicant_event(void *ctx, enum wpa_event_type event, ++ union wpa_event_data *data) + { + struct wpa_priv_interface *iface = ctx; + +@@ -962,6 +962,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 +@@ -2333,8 +2333,8 @@ static void wpa_supplicant_event_unprot_ + } + + +-void wpa_supplicant_event(void *ctx, enum wpa_event_type event, +- union wpa_event_data *data) ++void supplicant_event(void *ctx, enum wpa_event_type event, ++ union wpa_event_data *data) + { + struct wpa_supplicant *wpa_s = ctx; + u16 reason_code = 0; +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -2972,6 +2972,9 @@ static void wpa_supplicant_deinit_iface( + } + } + ++extern void supplicant_event(void *ctx, enum wpa_event_type event, ++ union wpa_event_data *data); ++ + + /** + * wpa_supplicant_add_iface - Add a new network interface +@@ -3164,6 +3167,7 @@ struct wpa_global * wpa_supplicant_init( + wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); + #endif /* CONFIG_NO_WPA_MSG */ + ++ wpa_supplicant_event = supplicant_event; + wpa_debug_open_file(params->wpa_debug_file_path); + if (params->wpa_debug_syslog) + wpa_debug_open_syslog(); +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -530,6 +530,9 @@ static int hostapd_get_global_ctrl_iface + return 0; + } + ++void hostapd_wpa_event(void *ctx, enum wpa_event_type event, ++ union wpa_event_data *data); ++ + + int main(int argc, char *argv[]) + { +@@ -555,6 +558,7 @@ int main(int argc, char *argv[]) + interfaces.global_iface_name = NULL; + interfaces.global_ctrl_sock = -1; + ++ wpa_supplicant_event = hostapd_wpa_event; + for (;;) { + c = getopt(argc, argv, "Bde:f:hKP:tvg:"); + if (c < 0) +--- a/src/drivers/drivers.c ++++ b/src/drivers/drivers.c +@@ -7,7 +7,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/network/services/hostapd/patches/420-timestamp_check.patch b/package/network/services/hostapd/patches/420-timestamp_check.patch new file mode 100644 index 0000000..b2d4a05 --- /dev/null +++ b/package/network/services/hostapd/patches/420-timestamp_check.patch @@ -0,0 +1,12 @@ +--- a/src/tls/x509v3.c ++++ b/src/tls/x509v3.c +@@ -1848,6 +1848,9 @@ int x509_certificate_chain_validate(stru + if (chain_trusted) + continue; + ++#ifdef NO_TIMESTAMP_CHECK ++ disable_time_checks = 1; ++#endif + if (!disable_time_checks && + ((unsigned long) now.sec < + (unsigned long) cert->not_before || diff --git a/package/network/services/hostapd/patches/430-rescan_immediately.patch b/package/network/services/hostapd/patches/430-rescan_immediately.patch new file mode 100644 index 0000000..082344a --- /dev/null +++ b/package/network/services/hostapd/patches/430-rescan_immediately.patch @@ -0,0 +1,11 @@ +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -2416,7 +2416,7 @@ static struct wpa_supplicant * wpa_suppl + if (wpa_s == NULL) + return NULL; + wpa_s->scan_req = INITIAL_SCAN_REQ; +- wpa_s->scan_interval = 5; ++ wpa_s->scan_interval = 1; + wpa_s->new_connection = 1; + wpa_s->parent = wpa_s; + wpa_s->sched_scanning = 0; diff --git a/package/network/services/hostapd/patches/440-optional_rfkill.patch b/package/network/services/hostapd/patches/440-optional_rfkill.patch new file mode 100644 index 0000000..8ed4d99 --- /dev/null +++ b/package/network/services/hostapd/patches/440-optional_rfkill.patch @@ -0,0 +1,261 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -218,7 +218,9 @@ struct wpa_driver_nl80211_data { + int if_removed; + int if_disabled; + int ignore_if_down_event; ++#ifdef CONFIG_RFKILL + struct rfkill_data *rfkill; ++#endif + struct wpa_driver_capa capa; + int has_capability; + +@@ -2967,7 +2969,7 @@ static int wpa_driver_nl80211_init_nl(st + return 0; + } + +- ++#ifdef CONFIG_RFKILL + static void wpa_driver_nl80211_rfkill_blocked(void *ctx) + { + wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked"); +@@ -2990,6 +2992,7 @@ static void wpa_driver_nl80211_rfkill_un + } + /* rtnetlink ifup handler will report interface as enabled */ + } ++#endif /* CONFIG_RFKILL */ + + + static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv) +@@ -3118,7 +3121,9 @@ static void * wpa_driver_nl80211_init(vo + void *global_priv) + { + struct wpa_driver_nl80211_data *drv; ++#ifdef CONFIG_RFKILL + struct rfkill_config *rcfg; ++#endif + struct i802_bss *bss; + + if (global_priv == NULL) +@@ -3154,6 +3159,7 @@ static void * wpa_driver_nl80211_init(vo + + nl80211_get_phy_name(drv); + ++#ifdef CONFIG_RFKILL + rcfg = os_zalloc(sizeof(*rcfg)); + if (rcfg == NULL) + goto failed; +@@ -3166,6 +3172,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; +@@ -3455,10 +3462,12 @@ static void nl80211_mgmt_unsubscribe(str + } + + ++#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 + wpa_driver_nl80211_finish_drv_init_sta(struct wpa_driver_nl80211_data *drv, +@@ -3479,13 +3488,16 @@ wpa_driver_nl80211_finish_drv_init_sta(s + } + + if (linux_set_iface_flags(drv->global->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; +@@ -3516,8 +3528,10 @@ wpa_driver_nl80211_finish_drv_init(struc + return -1; + + if (send_rfkill_event) { ++#ifdef CONFIG_RFKILL + eloop_register_timeout(0, 0, wpa_driver_nl80211_send_rfkill, + drv, drv->ctx); ++#endif + } + + return 0; +@@ -3603,7 +3617,9 @@ static void wpa_driver_nl80211_deinit(st + + netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, 0, + IF_OPER_UP); ++#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 +@@ -742,7 +742,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"); +@@ -764,7 +764,7 @@ static void wpa_driver_wext_rfkill_unblo + } + /* rtnetlink ifup handler will report interface as enabled */ + } +- ++#endif /* CONFIG_RFKILL */ + + static void wext_get_phy_name(struct wpa_driver_wext_data *drv) + { +@@ -810,7 +810,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; + +@@ -845,6 +847,7 @@ void * wpa_driver_wext_init(void *ctx, c + goto err2; + } + ++#ifdef CONFIG_RFKILL + rcfg = os_zalloc(sizeof(*rcfg)); + if (rcfg == NULL) + goto err3; +@@ -857,6 +860,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; + +@@ -874,7 +878,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); +@@ -884,10 +890,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) +@@ -895,13 +903,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; +@@ -949,8 +960,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; +@@ -980,7 +993,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 +@@ -25,7 +25,6 @@ NEED_SME=y + NEED_AP_MLME=y + NEED_NETLINK=y + NEED_LINUX_IOCTL=y +-NEED_RFKILL=y + + ifdef CONFIG_LIBNL32 + DRV_LIBS += -lnl-3 +@@ -109,7 +108,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_NDIS +@@ -135,7 +133,6 @@ endif + ifdef CONFIG_WIRELESS_EXTENSION + DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION + DRV_WPA_OBJS += ../src/drivers/driver_wext.o +-NEED_RFKILL=y + endif + + ifdef NEED_NETLINK +@@ -148,6 +145,7 @@ endif + + ifdef NEED_RFKILL + DRV_OBJS += ../src/drivers/rfkill.o ++DRV_WPA_CFLAGS += -DCONFIG_RFKILL + endif + + ifdef CONFIG_VLAN_NETLINK +--- a/src/drivers/driver_wext.h ++++ b/src/drivers/driver_wext.h +@@ -22,7 +22,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/network/services/hostapd/patches/450-reload_freq_change.patch b/package/network/services/hostapd/patches/450-reload_freq_change.patch new file mode 100644 index 0000000..bf48fe4 --- /dev/null +++ b/package/network/services/hostapd/patches/450-reload_freq_change.patch @@ -0,0 +1,27 @@ +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -140,6 +140,24 @@ int hostapd_reload_config(struct hostapd + oldconf = hapd->iconf; + iface->conf = newconf; + ++ hostapd_select_hw_mode(iface); ++ iface->freq = hostapd_hw_get_freq(hapd, newconf->channel); ++ ++ if (hostapd_set_freq(hapd, newconf->hw_mode, iface->freq, ++ newconf->channel, ++ newconf->ieee80211n, ++ newconf->ieee80211ac, ++ newconf->secondary_channel, ++ newconf->vht_oper_chwidth, ++ newconf->vht_oper_centr_freq_seg0_idx, ++ newconf->vht_oper_centr_freq_seg1_idx)) { ++ wpa_printf(MSG_ERROR, "Could not set channel for " ++ "kernel driver"); ++ } ++ ++ if (iface->current_mode) ++ hostapd_prepare_rates(iface, iface->current_mode); ++ + for (j = 0; j < iface->num_bss; j++) { + hapd = iface->bss[j]; + hapd->iconf = newconf; diff --git a/package/network/services/hostapd/patches/451-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/451-nl80211_del_beacon_bss.patch new file mode 100644 index 0000000..2eaa5dc --- /dev/null +++ b/package/network/services/hostapd/patches/451-nl80211_del_beacon_bss.patch @@ -0,0 +1,63 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -3538,16 +3538,18 @@ 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; + + nl80211_cmd(drv, msg, 0, NL80211_CMD_DEL_BEACON); +- 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: +@@ -3555,6 +3557,21 @@ static int wpa_driver_nl80211_del_beacon + 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); ++ ++ return 0; ++} ++ ++static int wpa_driver_nl80211_stop_ap(void *priv) ++{ ++ struct i802_bss *bss = priv; ++ return wpa_driver_nl80211_del_beacon(bss->drv); ++} + + /** + * wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface +@@ -9547,4 +9564,5 @@ const struct wpa_driver_ops wpa_driver_n + .send_tdls_mgmt = nl80211_send_tdls_mgmt, + .tdls_oper = nl80211_tdls_oper, + #endif /* CONFIG_TDLS */ ++ .stop_ap = wpa_driver_nl80211_stop_ap, + }; +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -2071,6 +2071,9 @@ struct wpa_driver_ops { + */ + int (*probe_req_report)(void *priv, int report); + ++ ++ int (*stop_ap)(void *priv); ++ + /** + * deinit_ap - Deinitialize AP mode + * @priv: Private driver interface data diff --git a/package/network/services/hostapd/patches/452-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/452-ctrl_iface_reload.patch new file mode 100644 index 0000000..85e871f --- /dev/null +++ b/package/network/services/hostapd/patches/452-ctrl_iface_reload.patch @@ -0,0 +1,98 @@ +--- a/hostapd/ctrl_iface.c ++++ b/hostapd/ctrl_iface.c +@@ -33,6 +33,7 @@ + #include "wps/wps.h" + #include "config_file.h" + #include "ctrl_iface.h" ++#include "config_file.h" + + + struct wpa_ctrl_dst { +@@ -43,6 +44,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); +@@ -152,6 +154,68 @@ static int hostapd_ctrl_iface_new_sta(st + 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, "hw_mode="))) ++ 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_update(struct hostapd_data *hapd, char *txt) ++{ ++ struct hostapd_config * (*config_read_cb)(const char *config_fname); ++ struct hostapd_iface *iface = hapd->iface; ++ ++ config_read_cb = iface->interfaces->config_read_cb; ++ iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read; ++ reload_opts = txt; ++ ++ hostapd_reload_config(iface); ++ ++ iface->interfaces->config_read_cb = config_read_cb; ++} + + #ifdef CONFIG_IEEE80211W + #ifdef NEED_AP_MLME +@@ -902,6 +966,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, "UPDATE ", 7) == 0) { ++ hostapd_ctrl_iface_update(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/network/services/hostapd/patches/453-ap_sta_support.patch b/package/network/services/hostapd/patches/453-ap_sta_support.patch new file mode 100644 index 0000000..df04d3d --- /dev/null +++ b/package/network/services/hostapd/patches/453-ap_sta_support.patch @@ -0,0 +1,222 @@ +--- a/wpa_supplicant/wpa_supplicant_i.h ++++ b/wpa_supplicant/wpa_supplicant_i.h +@@ -96,6 +96,8 @@ struct wpa_interface { + * receiving of EAPOL frames from an additional interface. + */ + const char *bridge_ifname; ++ ++ const char *hostapd_ctrl; + }; + + /** +@@ -305,6 +307,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 +@@ -13,6 +13,10 @@ PKG_CONFIG ?= pkg-config + CFLAGS += -I../src + CFLAGS += -I../src/utils + ++ifdef MULTICALL ++CFLAGS += -DMULTICALL ++endif ++ + -include .config + -include $(if $(MULTICALL),../hostapd/.config) + +@@ -76,6 +80,10 @@ OBJS_c = wpa_cli.o ../src/common/wpa_ctr + OBJS_c += ../src/utils/wpa_debug.o + OBJS_c += ../src/utils/common.o + ++ifdef MULTICALL ++OBJS += ../src/common/wpa_ctrl.o ++endif ++ + ifndef CONFIG_OS + ifdef CONFIG_NATIVE_WINDOWS + CONFIG_OS=win32 +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -107,6 +107,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, "UPDATE 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) + { +@@ -676,8 +725,16 @@ void wpa_supplicant_set_state(struct wpa + #endif /* CONFIG_P2P */ + + sme_sched_obss_scan(wpa_s, 1); ++#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 +@@ -2778,6 +2835,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 +@@ -11,6 +11,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" +@@ -227,6 +228,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 os_time *fetch_time) + { ++ struct ieee80211_ht_capabilities *capab; ++ struct ieee802_11_elems elems; + os_time_t usec; + + dst->flags = src->flags; +@@ -239,6 +242,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); ++ + dst->last_update.sec = fetch_time->sec; + dst->last_update.usec = fetch_time->usec; + dst->last_update.sec -= src->age / 1000; +--- a/wpa_supplicant/main.c ++++ b/wpa_supplicant/main.c +@@ -25,7 +25,7 @@ static void usage(void) + "usage:\n" + " wpa_supplicant [-BddhKLqqstuvW] [-P<pid file>] " + "[-g<global ctrl>] \\\n" +- " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] " ++ " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-H<hostapd path>]" + "[-p<driver_param>] \\\n" + " [-b<br_ifname>] [-f<debug file>] [-e<entropy file>] " + "\\\n" +@@ -67,6 +67,7 @@ static void usage(void) + #endif /* CONFIG_DEBUG_LINUX_TRACING */ + 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 (BSD)\n" + " -o = override driver parameter for new interfaces\n" + " -O = override ctrl_interface parameter for new interfaces\n" +@@ -155,7 +156,7 @@ int main(int argc, char *argv[]) + + for (;;) { + c = getopt(argc, argv, +- "b:Bc:C:D:de:f:g:hi:KLNo:O:p:P:qsTtuvW"); ++ "b:Bc:C:D:de:f:g:hH:i:KLNo:O:p:P:qsTtuvW"); + if (c < 0) + break; + switch (c) { +@@ -199,6 +200,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; +--- a/wpa_supplicant/bss.h ++++ b/wpa_supplicant/bss.h +@@ -69,6 +69,8 @@ struct wpa_bss { + u8 ssid[32]; + /** Length of SSID */ + size_t ssid_len; ++ /** HT caapbilities */ ++ u16 ht_capab; + /** Frequency of the channel in MHz (e.g., 2412 = channel 1) */ + int freq; + /** Beacon interval in TUs (host byte order) */ diff --git a/package/network/services/hostapd/patches/460-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/460-disable_ctrl_iface_mib.patch new file mode 100644 index 0000000..e5db6b4 --- /dev/null +++ b/package/network/services/hostapd/patches/460-disable_ctrl_iface_mib.patch @@ -0,0 +1,168 @@ +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -136,6 +136,9 @@ endif + ifdef CONFIG_NO_CTRL_IFACE + CFLAGS += -DCONFIG_NO_CTRL_IFACE + else ++ifdef CONFIG_CTRL_IFACE_MIB ++CFLAGS += -DCONFIG_CTRL_IFACE_MIB ++endif + OBJS += ctrl_iface.o + OBJS += ../src/ap/ctrl_iface_ap.o + endif +--- a/hostapd/ctrl_iface.c ++++ b/hostapd/ctrl_iface.c +@@ -937,6 +937,7 @@ static void hostapd_ctrl_iface_receive(i + } else if (os_strncmp(buf, "RELOG", 5) == 0) { + if (wpa_debug_reopen_file() < 0) + reply_len = -1; ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "MIB") == 0) { + reply_len = ieee802_11_get_mib(hapd, reply, reply_size); + if (reply_len >= 0) { +@@ -966,10 +967,12 @@ static void hostapd_ctrl_iface_receive(i + reply_len += res; + } + #endif /* CONFIG_NO_RADIUS */ ++#endif + } else if (os_strcmp(buf, "DOWN") == 0) { + hostapd_ctrl_iface_set_down(hapd); + } else if (os_strncmp(buf, "UPDATE ", 7) == 0) { + hostapd_ctrl_iface_update(hapd, buf + 7); ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "STA-FIRST") == 0) { + reply_len = hostapd_ctrl_iface_sta_first(hapd, reply, + reply_size); +@@ -979,6 +982,7 @@ static void hostapd_ctrl_iface_receive(i + } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { + reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, + reply_size); ++#endif + } else if (os_strcmp(buf, "ATTACH") == 0) { + if (hostapd_ctrl_iface_attach(hapd, &from, fromlen)) + reply_len = -1; +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -754,6 +754,9 @@ ifdef CONFIG_WNM + OBJS += ../src/ap/wnm_ap.o + endif + ifdef CONFIG_CTRL_IFACE ++ifdef CONFIG_CTRL_IFACE_MIB ++CFLAGS += -DCONFIG_CTRL_IFACE_MIB ++endif + OBJS += ../src/ap/ctrl_iface_ap.o + endif + +--- a/wpa_supplicant/ctrl_iface.c ++++ b/wpa_supplicant/ctrl_iface.c +@@ -4933,6 +4933,7 @@ char * wpa_supplicant_ctrl_iface_process + reply_len = -1; + } else if (os_strncmp(buf, "NOTE ", 5) == 0) { + wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "MIB") == 0) { + reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); + if (reply_len >= 0) { +@@ -4944,6 +4945,7 @@ char * wpa_supplicant_ctrl_iface_process + else + reply_len += res; + } ++#endif + } else if (os_strncmp(buf, "STATUS", 6) == 0) { + reply_len = wpa_supplicant_ctrl_iface_status( + wpa_s, buf + 6, reply, reply_size); +@@ -5350,6 +5352,7 @@ char * wpa_supplicant_ctrl_iface_process + reply_len = wpa_supplicant_ctrl_iface_bss( + wpa_s, buf + 4, reply, reply_size); + #ifdef CONFIG_AP ++#ifdef CONFIG_CTRL_IFACE_MIB + } else if (os_strcmp(buf, "STA-FIRST") == 0) { + reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); + } else if (os_strncmp(buf, "STA ", 4) == 0) { +@@ -5358,6 +5361,7 @@ char * wpa_supplicant_ctrl_iface_process + } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { + reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, + reply_size); ++#endif + } else if (os_strncmp(buf, "DEAUTHENTICATE ", 15) == 0) { + if (ap_ctrl_iface_sta_deauthenticate(wpa_s, buf + 15)) + reply_len = -1; +--- a/src/ap/ctrl_iface_ap.c ++++ b/src/ap/ctrl_iface_ap.c +@@ -20,6 +20,7 @@ + #include "ctrl_iface_ap.h" + #include "ap_drv_ops.h" + ++#ifdef CONFIG_CTRL_IFACE_MIB + + static int hostapd_get_sta_conn_time(struct sta_info *sta, + char *buf, size_t buflen) +@@ -129,6 +130,7 @@ int hostapd_ctrl_iface_sta_next(struct h + return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); + } + ++#endif + + #ifdef CONFIG_P2P_MANAGER + static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, +@@ -303,3 +305,4 @@ int hostapd_ctrl_iface_disassociate(stru + + return 0; + } ++ +--- a/src/ap/ieee802_1x.c ++++ b/src/ap/ieee802_1x.c +@@ -2048,6 +2048,7 @@ static const char * bool_txt(Boolean boo + return bool ? "TRUE" : "FALSE"; + } + ++#ifdef CONFIG_CTRL_IFACE_MIB + + int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) + { +@@ -2200,6 +2201,7 @@ int ieee802_1x_get_mib_sta(struct hostap + return len; + } + ++#endif + + static void ieee802_1x_finished(struct hostapd_data *hapd, + struct sta_info *sta, int success) +--- a/src/ap/wpa_auth.c ++++ b/src/ap/wpa_auth.c +@@ -2687,6 +2687,7 @@ static const char * wpa_bool_txt(int boo + return bool ? "TRUE" : "FALSE"; + } + ++#ifdef CONFIG_CTRL_IFACE_MIB + + #define RSN_SUITE "%02x-%02x-%02x-%d" + #define RSN_SUITE_ARG(s) \ +@@ -2831,7 +2832,7 @@ int wpa_get_mib_sta(struct wpa_state_mac + + return len; + } +- ++#endif + + void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth) + { +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -1848,6 +1848,8 @@ static u32 wpa_key_mgmt_suite(struct wpa + } + + ++#ifdef CONFIG_CTRL_IFACE_MIB ++ + #define RSN_SUITE "%02x-%02x-%02x-%d" + #define RSN_SUITE_ARG(s) \ + ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff +@@ -1931,6 +1933,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch + + return (int) len; + } ++#endif + #endif /* CONFIG_CTRL_IFACE */ + + diff --git a/package/network/services/hostapd/patches/470-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/470-wpa_ie_cap_workaround.patch new file mode 100644 index 0000000..974ec3d --- /dev/null +++ b/package/network/services/hostapd/patches/470-wpa_ie_cap_workaround.patch @@ -0,0 +1,56 @@ +--- a/src/common/wpa_common.c ++++ b/src/common/wpa_common.c +@@ -965,6 +965,31 @@ const char * wpa_key_mgmt_txt(int key_mg + } + + ++static void wpa_fixup_wpa_ie_rsn(u8 *assoc_ie, const u8 *wpa_msg_ie, ++ size_t rsn_ie_len) ++{ ++ int pos, count; ++ ++ pos = sizeof(struct rsn_ie_hdr) + RSN_SELECTOR_LEN; ++ if (rsn_ie_len < pos + 2) ++ return; ++ ++ count = WPA_GET_LE16(wpa_msg_ie + pos); ++ pos += 2 + count * RSN_SELECTOR_LEN; ++ if (rsn_ie_len < pos + 2) ++ return; ++ ++ count = WPA_GET_LE16(wpa_msg_ie + pos); ++ pos += 2 + count * RSN_SELECTOR_LEN; ++ if (rsn_ie_len < pos + 2) ++ return; ++ ++ if (!assoc_ie[pos] && !assoc_ie[pos + 1] && ++ (wpa_msg_ie[pos] || wpa_msg_ie[pos + 1])) ++ memcpy(&assoc_ie[pos], &wpa_msg_ie[pos], 2); ++} ++ ++ + int wpa_compare_rsn_ie(int ft_initial_assoc, + const u8 *ie1, size_t ie1len, + const u8 *ie2, size_t ie2len) +@@ -972,8 +997,19 @@ int wpa_compare_rsn_ie(int ft_initial_as + if (ie1 == NULL || ie2 == NULL) + return -1; + +- if (ie1len == ie2len && os_memcmp(ie1, ie2, ie1len) == 0) +- return 0; /* identical IEs */ ++ if (ie1len == ie2len) { ++ u8 *ie_tmp; ++ ++ if (os_memcmp(ie1, ie2, ie1len) == 0) ++ return 0; /* identical IEs */ ++ ++ ie_tmp = alloca(ie1len); ++ memcpy(ie_tmp, ie1, ie1len); ++ wpa_fixup_wpa_ie_rsn(ie_tmp, ie2, ie1len); ++ ++ if (os_memcmp(ie_tmp, ie2, ie1len) == 0) ++ return 0; /* only mismatch in RSN capabilties */ ++ } + + #ifdef CONFIG_IEEE80211R + if (ft_initial_assoc) { diff --git a/package/network/services/hostapd/patches/480-terminate_on_setup_failure.patch b/package/network/services/hostapd/patches/480-terminate_on_setup_failure.patch new file mode 100644 index 0000000..f9d7425 --- /dev/null +++ b/package/network/services/hostapd/patches/480-terminate_on_setup_failure.patch @@ -0,0 +1,81 @@ +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -895,11 +895,8 @@ int hostapd_setup_interface_complete(str + size_t j; + u8 *prev_addr; + +- if (err) { +- wpa_printf(MSG_ERROR, "Interface initialization failed"); +- eloop_terminate(); +- return -1; +- } ++ if (err) ++ goto error; + + wpa_printf(MSG_DEBUG, "Completing interface initialization"); + if (hapd->iconf->channel) { +@@ -919,7 +916,7 @@ int hostapd_setup_interface_complete(str + hapd->iconf->vht_oper_centr_freq_seg1_idx)) { + wpa_printf(MSG_ERROR, "Could not set channel for " + "kernel driver"); +- return -1; ++ goto error; + } + } + +@@ -930,7 +927,7 @@ int hostapd_setup_interface_complete(str + hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, + HOSTAPD_LEVEL_WARNING, + "Failed to prepare rates table."); +- return -1; ++ goto error; + } + } + +@@ -938,14 +935,14 @@ int hostapd_setup_interface_complete(str + hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) { + wpa_printf(MSG_ERROR, "Could not set RTS threshold for " + "kernel driver"); +- return -1; ++ goto error; + } + + if (hapd->iconf->fragm_threshold > -1 && + hostapd_set_frag(hapd, hapd->iconf->fragm_threshold)) { + wpa_printf(MSG_ERROR, "Could not set fragmentation threshold " + "for kernel driver"); +- return -1; ++ goto error; + } + + prev_addr = hapd->own_addr; +@@ -955,7 +952,7 @@ int hostapd_setup_interface_complete(str + if (j) + os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN); + if (hostapd_setup_bss(hapd, j == 0)) +- return -1; ++ goto error; + if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0) + prev_addr = hapd->own_addr; + } +@@ -967,7 +964,7 @@ int hostapd_setup_interface_complete(str + if (hostapd_driver_commit(hapd) < 0) { + wpa_printf(MSG_ERROR, "%s: Failed to commit driver " + "configuration", __func__); +- return -1; ++ goto error; + } + + /* +@@ -988,6 +985,11 @@ int hostapd_setup_interface_complete(str + iface->bss[0]->conf->iface); + + return 0; ++ ++error: ++ wpa_printf(MSG_ERROR, "Interface initialization failed"); ++ eloop_terminate(); ++ return -1; + } + + diff --git a/package/network/services/hostapd/patches/500-random_pool_add_kernel.patch b/package/network/services/hostapd/patches/500-random_pool_add_kernel.patch new file mode 100644 index 0000000..2280537 --- /dev/null +++ b/package/network/services/hostapd/patches/500-random_pool_add_kernel.patch @@ -0,0 +1,176 @@ +--- a/src/crypto/random.c ++++ b/src/crypto/random.c +@@ -25,6 +25,7 @@ + #include "utils/includes.h" + #ifdef __linux__ + #include <fcntl.h> ++#include <sys/stat.h> + #endif /* __linux__ */ + + #include "utils/common.h" +@@ -33,6 +34,8 @@ + #include "sha1.h" + #include "random.h" + ++#define RANDOM_STAMPFILE "/var/run/.random_available" ++ + #define POOL_WORDS 32 + #define POOL_WORDS_MASK (POOL_WORDS - 1) + #define POOL_TAP1 26 +@@ -43,6 +46,8 @@ + #define EXTRACT_LEN 16 + #define MIN_READY_MARK 2 + ++#ifndef CONFIG_NO_RANDOM_POOL ++ + static u32 pool[POOL_WORDS]; + static unsigned int input_rotate = 0; + static unsigned int pool_pos = 0; +@@ -123,7 +128,7 @@ static void random_extract(u8 *out) + } + + +-void random_add_randomness(const void *buf, size_t len) ++static void random_pool_add_randomness(const void *buf, size_t len) + { + struct os_time t; + static unsigned int count = 0; +@@ -213,16 +218,22 @@ int random_get_bytes(void *buf, size_t l + int random_pool_ready(void) + { + #ifdef __linux__ ++ struct stat st; + int fd; + ssize_t res; + ++ if (stat(RANDOM_STAMPFILE, &st) == 0) ++ return 1; ++ + /* + * Make sure that there is reasonable entropy available before allowing + * some key derivation operations to proceed. + */ + +- if (dummy_key_avail == sizeof(dummy_key)) ++ if (dummy_key_avail == sizeof(dummy_key)) { ++ random_mark_pool_ready(); + return 1; /* Already initialized - good to continue */ ++ } + + /* + * Try to fetch some more data from the kernel high quality +@@ -257,6 +268,7 @@ int random_pool_ready(void) + if (dummy_key_avail == sizeof(dummy_key)) { + if (own_pool_ready < MIN_READY_MARK) + own_pool_ready = MIN_READY_MARK; ++ random_mark_pool_ready(); + random_write_entropy(); + return 1; + } +@@ -269,6 +281,7 @@ int random_pool_ready(void) + total_collected + 10 * own_pool_ready > MIN_COLLECT_ENTROPY) { + wpa_printf(MSG_INFO, "random: Allow operation to proceed " + "based on internal entropy"); ++ random_mark_pool_ready(); + return 1; + } + +@@ -284,10 +297,16 @@ int random_pool_ready(void) + + void random_mark_pool_ready(void) + { ++ int fd; ++ + own_pool_ready++; + wpa_printf(MSG_DEBUG, "random: Mark internal entropy pool to be " + "ready (count=%u/%u)", own_pool_ready, MIN_READY_MARK); + random_write_entropy(); ++ ++ fd = open(RANDOM_STAMPFILE, O_CREAT | O_WRONLY | O_EXCL | O_NOFOLLOW, 0600); ++ if (fd >= 0) ++ close(fd); + } + + +@@ -444,3 +463,22 @@ void random_deinit(void) + os_free(random_entropy_file); + random_entropy_file = NULL; + } ++ ++#endif /* CONFIG_NO_RANDOM_POOL */ ++ ++ ++void random_add_randomness(const void *buf, size_t len) ++{ ++#ifdef __linux__ ++ int fd; ++ ++ fd = open("/dev/random", O_RDWR); ++ if (fd >= 0) { ++ write(fd, buf, len); ++ close(fd); ++ } ++#endif ++#ifndef CONFIG_NO_RANDOM_POOL ++ random_pool_add_randomness(buf, len); ++#endif ++} +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -1222,9 +1222,8 @@ endif + + ifdef CONFIG_NO_RANDOM_POOL + CFLAGS += -DCONFIG_NO_RANDOM_POOL +-else +-OBJS += ../src/crypto/random.o + endif ++OBJS += ../src/crypto/random.o + + ifdef CONFIG_CTRL_IFACE + ifeq ($(CONFIG_CTRL_IFACE), y) +--- a/wpa_supplicant/Android.mk ++++ b/wpa_supplicant/Android.mk +@@ -1162,9 +1162,8 @@ endif + + ifdef CONFIG_NO_RANDOM_POOL + L_CFLAGS += -DCONFIG_NO_RANDOM_POOL +-else +-OBJS += src/crypto/random.c + endif ++OBJS += src/crypto/random.c + + ifdef CONFIG_CTRL_IFACE + ifeq ($(CONFIG_CTRL_IFACE), y) +--- a/hostapd/Android.mk ++++ b/hostapd/Android.mk +@@ -745,11 +745,11 @@ endif + ifdef CONFIG_NO_RANDOM_POOL + L_CFLAGS += -DCONFIG_NO_RANDOM_POOL + else +-OBJS += src/crypto/random.c +-HOBJS += src/crypto/random.c + HOBJS += $(SHA1OBJS) + HOBJS += src/crypto/md5.c + endif ++OBJS += src/crypto/random.c ++HOBJS += src/crypto/random.c + + ifdef CONFIG_RADIUS_SERVER + L_CFLAGS += -DRADIUS_SERVER +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -748,12 +748,12 @@ endif + ifdef CONFIG_NO_RANDOM_POOL + CFLAGS += -DCONFIG_NO_RANDOM_POOL + else +-OBJS += ../src/crypto/random.o +-HOBJS += ../src/crypto/random.o + HOBJS += ../src/utils/eloop.o + HOBJS += $(SHA1OBJS) + HOBJS += ../src/crypto/md5.o + endif ++OBJS += ../src/crypto/random.o ++HOBJS += ../src/crypto/random.o + + ifdef CONFIG_RADIUS_SERVER + CFLAGS += -DRADIUS_SERVER diff --git a/package/network/services/hostapd/patches/510-bring_down_interface.patch b/package/network/services/hostapd/patches/510-bring_down_interface.patch new file mode 100644 index 0000000..1288e9e --- /dev/null +++ b/package/network/services/hostapd/patches/510-bring_down_interface.patch @@ -0,0 +1,19 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -7346,8 +7346,6 @@ static int wpa_driver_nl80211_set_mode(s + ret = nl80211_set_mode(drv, drv->ifindex, nlmode); + if (ret == -EACCES) + break; +- res = linux_set_iface_flags(drv->global->ioctl_sock, +- bss->ifname, 1); + if (res && !ret) + ret = -1; + else if (ret != -EBUSY) +@@ -7363,6 +7361,7 @@ static int wpa_driver_nl80211_set_mode(s + "interface is down"); + drv->nlmode = nlmode; + drv->ignore_if_down_event = 1; ++ linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1); + } + + done: diff --git a/package/network/services/hostapd/patches/520-fix_wps_pin_crash.patch b/package/network/services/hostapd/patches/520-fix_wps_pin_crash.patch new file mode 100644 index 0000000..80d562c --- /dev/null +++ b/package/network/services/hostapd/patches/520-fix_wps_pin_crash.patch @@ -0,0 +1,12 @@ +--- a/hostapd/ctrl_iface.c ++++ b/hostapd/ctrl_iface.c +@@ -479,6 +479,9 @@ static int hostapd_ctrl_iface_wps_ap_pin + char *pos; + const char *pin_txt; + ++ if (!hapd->wps) ++ return -1; ++ + pos = os_strchr(txt, ' '); + if (pos) + *pos++ = '\0'; diff --git a/package/network/services/hostapd/patches/530-wps_single_auth_enc_type.patch b/package/network/services/hostapd/patches/530-wps_single_auth_enc_type.patch new file mode 100644 index 0000000..51c7669 --- /dev/null +++ b/package/network/services/hostapd/patches/530-wps_single_auth_enc_type.patch @@ -0,0 +1,25 @@ +--- a/src/ap/wps_hostapd.c ++++ b/src/ap/wps_hostapd.c +@@ -871,11 +871,9 @@ int hostapd_init_wps(struct hostapd_data + + if (conf->rsn_pairwise & WPA_CIPHER_CCMP) + wps->encr_types |= WPS_ENCR_AES; +- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) ++ else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) + wps->encr_types |= WPS_ENCR_TKIP; +- } +- +- if (conf->wpa & WPA_PROTO_WPA) { ++ } else if (conf->wpa & WPA_PROTO_WPA) { + if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK) + wps->auth_types |= WPS_AUTH_WPAPSK; + if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X) +@@ -883,7 +881,7 @@ int hostapd_init_wps(struct hostapd_data + + if (conf->wpa_pairwise & WPA_CIPHER_CCMP) + wps->encr_types |= WPS_ENCR_AES; +- if (conf->wpa_pairwise & WPA_CIPHER_TKIP) ++ else if (conf->wpa_pairwise & WPA_CIPHER_TKIP) + wps->encr_types |= WPS_ENCR_TKIP; + } + diff --git a/package/network/services/hostapd/patches/540-dynamic_20_40_mhz.patch b/package/network/services/hostapd/patches/540-dynamic_20_40_mhz.patch new file mode 100644 index 0000000..ce2a339 --- /dev/null +++ b/package/network/services/hostapd/patches/540-dynamic_20_40_mhz.patch @@ -0,0 +1,206 @@ +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -2474,6 +2474,10 @@ static int hostapd_config_fill(struct ho + "ht_capab", line); + errors++; + } ++ } else if (os_strcmp(buf, "dynamic_ht40") == 0) { ++ conf->dynamic_ht40 = atoi(pos); ++ if (conf->dynamic_ht40 == 1) ++ conf->dynamic_ht40 = 1500; + } else if (os_strcmp(buf, "require_ht") == 0) { + conf->require_ht = atoi(pos); + #endif /* CONFIG_IEEE80211N */ +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -514,6 +514,7 @@ struct hostapd_config { + int ieee80211n; + int secondary_channel; + int require_ht; ++ int dynamic_ht40; + u32 vht_capab; + int ieee80211ac; + int require_vht; +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -22,6 +22,7 @@ + #include "beacon.h" + #include "iapp.h" + #include "ieee802_1x.h" ++#include "ieee802_11.h" + #include "ieee802_11_auth.h" + #include "vlan_init.h" + #include "wpa_auth.h" +@@ -332,6 +333,7 @@ static void hostapd_cleanup_iface_pre(st + + static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) + { ++ hostapd_deinit_ht(iface); + hostapd_free_hw_features(iface->hw_features, iface->num_hw_features); + iface->hw_features = NULL; + os_free(iface->current_rates); +--- a/src/ap/hostapd.h ++++ b/src/ap/hostapd.h +@@ -265,6 +265,9 @@ struct hostapd_iface { + /* Overlapping BSS information */ + int olbc_ht; + ++ int force_20mhz; ++ struct os_time last_20mhz_trigger; ++ + u16 ht_op_mode; + void (*scan_cb)(struct hostapd_iface *iface); + }; +--- a/src/ap/ieee802_11.c ++++ b/src/ap/ieee802_11.c +@@ -1484,6 +1484,9 @@ static void handle_beacon(struct hostapd + sizeof(mgmt->u.beacon)), &elems, + 0); + ++ if (!elems.ht_capabilities) ++ hostapd_trigger_20mhz(hapd->iface); ++ + ap_list_process_beacon(hapd->iface, mgmt, &elems, fi); + } + +--- a/src/ap/ieee802_11.h ++++ b/src/ap/ieee802_11.h +@@ -81,4 +81,17 @@ int hostapd_update_time_adv(struct hosta + void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr); + u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid); + ++#ifdef CONFIG_IEEE80211N ++void hostapd_trigger_20mhz(struct hostapd_iface *iface); ++void hostapd_deinit_ht(struct hostapd_iface *iface); ++ ++#else ++static inline void hostapd_deinit_ht(struct hostapd_iface *iface) ++{ ++} ++static inline void hostapd_trigger_20mhz(struct hostapd_iface *iface) ++{ ++} ++#endif /* CONFIG_IEEE80211N */ ++ + #endif /* IEEE802_11_H */ +--- a/src/ap/ieee802_11_ht.c ++++ b/src/ap/ieee802_11_ht.c +@@ -20,9 +20,11 @@ + #include "drivers/driver.h" + #include "hostapd.h" + #include "ap_config.h" ++#include "ap_drv_ops.h" + #include "sta_info.h" + #include "beacon.h" + #include "ieee802_11.h" ++#include "utils/eloop.h" + + + u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid) +@@ -70,12 +72,15 @@ u8 * hostapd_eid_ht_operation(struct hos + + oper->control_chan = hapd->iconf->channel; + oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode); +- if (hapd->iconf->secondary_channel == 1) +- oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | +- HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; +- if (hapd->iconf->secondary_channel == -1) +- oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | +- HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; ++ ++ if (!hapd->iface->force_20mhz) { ++ if (hapd->iconf->secondary_channel == 1) ++ oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | ++ HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; ++ if (hapd->iconf->secondary_channel == -1) ++ oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | ++ HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; ++ } + + pos += sizeof(*oper); + +@@ -270,3 +275,84 @@ void hostapd_get_ht_capab(struct hostapd + + neg_ht_cap->ht_capabilities_info = host_to_le16(cap); + } ++ ++static void hostapd_set_force_20mhz(struct hostapd_iface *iface); ++ ++static void hostapd_restore_40mhz(void *eloop_data, void *user_ctx) ++{ ++ struct hostapd_iface *iface = eloop_data; ++ struct os_time time; ++ int timeout; ++ ++ if (!iface->last_20mhz_trigger.sec) ++ return; ++ ++ os_get_time(&time); ++ timeout = iface->last_20mhz_trigger.sec + iface->conf->dynamic_ht40 - ++ time.sec; ++ ++ if (timeout > 0) { ++ eloop_register_timeout(timeout, 0, hostapd_restore_40mhz, ++ iface, NULL); ++ return; ++ } ++ ++ iface->last_20mhz_trigger.sec = 0; ++ iface->last_20mhz_trigger.usec = 0; ++ ++ iface->force_20mhz = 0; ++ hostapd_set_force_20mhz(iface); ++} ++ ++static void hostapd_set_force_20mhz(struct hostapd_iface *iface) ++{ ++ int secondary_channel; ++ int i; ++ ++ ieee802_11_set_beacons(iface); ++ ++ for (i = 0; i < iface->num_bss; i++) { ++ struct hostapd_data *hapd = iface->bss[i]; ++ ++ if (iface->force_20mhz) ++ secondary_channel = 0; ++ else ++ secondary_channel = hapd->iconf->secondary_channel; ++ ++ if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq, ++ hapd->iconf->channel, ++ hapd->iconf->ieee80211n, ++ hapd->iconf->ieee80211ac, ++ secondary_channel, ++ hapd->iconf->vht_oper_chwidth, ++ hapd->iconf->vht_oper_centr_freq_seg0_idx, ++ hapd->iconf->vht_oper_centr_freq_seg1_idx)) { ++ wpa_printf(MSG_ERROR, "Could not set channel for " ++ "kernel driver"); ++ } ++ } ++} ++ ++void hostapd_deinit_ht(struct hostapd_iface *iface) ++{ ++ eloop_cancel_timeout(hostapd_restore_40mhz, iface, NULL); ++} ++ ++void hostapd_trigger_20mhz(struct hostapd_iface *iface) ++{ ++ if (!iface->conf->dynamic_ht40) ++ return; ++ ++ if (!iface->force_20mhz) { ++ iface->force_20mhz = 1; ++ hostapd_set_force_20mhz(iface); ++ } ++ ++ if (!iface->last_20mhz_trigger.sec) { ++ eloop_cancel_timeout(hostapd_restore_40mhz, iface, NULL); ++ eloop_register_timeout(iface->conf->dynamic_ht40, 0, ++ hostapd_restore_40mhz, iface, NULL); ++ } ++ ++ os_get_time(&iface->last_20mhz_trigger); ++} diff --git a/package/network/services/hostapd/patches/550-limit_debug_messages.patch b/package/network/services/hostapd/patches/550-limit_debug_messages.patch new file mode 100644 index 0000000..659e980 --- /dev/null +++ b/package/network/services/hostapd/patches/550-limit_debug_messages.patch @@ -0,0 +1,213 @@ +--- a/src/utils/wpa_debug.c ++++ b/src/utils/wpa_debug.c +@@ -201,7 +201,7 @@ void wpa_debug_close_linux_tracing(void) + * + * Note: New line '\n' is added to the end of the text when printing to stdout. + */ +-void wpa_printf(int level, const char *fmt, ...) ++void _wpa_printf(int level, const char *fmt, ...) + { + va_list ap; + +@@ -248,8 +248,8 @@ void wpa_printf(int level, const char *f + } + + +-static void _wpa_hexdump(int level, const char *title, const u8 *buf, +- size_t len, int show) ++void _wpa_hexdump(int level, const char *title, const u8 *buf, ++ size_t len, int show) + { + size_t i; + +@@ -375,20 +375,9 @@ static void _wpa_hexdump(int level, cons + #endif /* CONFIG_ANDROID_LOG */ + } + +-void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len) +-{ +- _wpa_hexdump(level, title, buf, len, 1); +-} +- +- +-void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len) +-{ +- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); +-} + +- +-static void _wpa_hexdump_ascii(int level, const char *title, const u8 *buf, +- size_t len, int show) ++void _wpa_hexdump_ascii(int level, const char *title, const u8 *buf, ++ size_t len, int show) + { + size_t i, llen; + const u8 *pos = buf; +@@ -495,19 +484,6 @@ static void _wpa_hexdump_ascii(int level + } + + +-void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, size_t len) +-{ +- _wpa_hexdump_ascii(level, title, buf, len, 1); +-} +- +- +-void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, +- size_t len) +-{ +- _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys); +-} +- +- + #ifdef CONFIG_DEBUG_FILE + static char *last_path = NULL; + #endif /* CONFIG_DEBUG_FILE */ +@@ -591,7 +567,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_ + } + + +-void wpa_msg(void *ctx, int level, const char *fmt, ...) ++void _wpa_msg(void *ctx, int level, const char *fmt, ...) + { + va_list ap; + char *buf; +@@ -625,7 +601,7 @@ void wpa_msg(void *ctx, int level, const + } + + +-void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) ++void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) + { + va_list ap; + char *buf; +--- a/src/utils/wpa_debug.h ++++ b/src/utils/wpa_debug.h +@@ -43,6 +43,17 @@ int wpa_debug_open_file(const char *path + int wpa_debug_reopen_file(void); + void wpa_debug_close_file(void); + ++/* internal */ ++void _wpa_hexdump(int level, const char *title, const u8 *buf, ++ size_t len, int show); ++void _wpa_hexdump_ascii(int level, const char *title, const u8 *buf, ++ size_t len, int show); ++extern int wpa_debug_show_keys; ++ ++#ifndef CONFIG_MSG_MIN_PRIORITY ++#define CONFIG_MSG_MIN_PRIORITY 0 ++#endif ++ + /** + * wpa_debug_printf_timestamp - Print timestamp for debug output + * +@@ -63,9 +74,15 @@ void wpa_debug_print_timestamp(void); + * + * Note: New line '\n' is added to the end of the text when printing to stdout. + */ +-void wpa_printf(int level, const char *fmt, ...) ++void _wpa_printf(int level, const char *fmt, ...) + PRINTF_FORMAT(2, 3); + ++#define wpa_printf(level, ...) \ ++ do { \ ++ if (level >= CONFIG_MSG_MIN_PRIORITY) \ ++ _wpa_printf(level, __VA_ARGS__); \ ++ } while(0) ++ + /** + * wpa_hexdump - conditional hex dump + * @level: priority level (MSG_*) of the message +@@ -77,7 +94,13 @@ PRINTF_FORMAT(2, 3); + * output may be directed to stdout, stderr, and/or syslog based on + * configuration. The contents of buf is printed out has hex dump. + */ +-void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len); ++static inline void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump(level, title, buf, len, 1); ++} + + static inline void wpa_hexdump_buf(int level, const char *title, + const struct wpabuf *buf) +@@ -99,7 +122,13 @@ static inline void wpa_hexdump_buf(int l + * like wpa_hexdump(), but by default, does not include secret keys (passwords, + * etc.) in debug output. + */ +-void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len); ++static inline void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); ++} + + static inline void wpa_hexdump_buf_key(int level, const char *title, + const struct wpabuf *buf) +@@ -121,8 +150,14 @@ static inline void wpa_hexdump_buf_key(i + * the hex numbers and ASCII characters (for printable range) are shown. 16 + * bytes per line will be shown. + */ +-void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, +- size_t len); ++static inline void wpa_hexdump_ascii(int level, const char *title, ++ const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump_ascii(level, title, buf, len, 1); ++} + + /** + * wpa_hexdump_ascii_key - conditional hex dump, hide keys +@@ -138,8 +173,14 @@ void wpa_hexdump_ascii(int level, const + * bytes per line will be shown. This works like wpa_hexdump_ascii(), but by + * default, does not include secret keys (passwords, etc.) in debug output. + */ +-void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, +- size_t len); ++static inline void wpa_hexdump_ascii_key(int level, const char *title, ++ const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys); ++} + + /* + * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce +@@ -172,7 +213,12 @@ void wpa_hexdump_ascii_key(int level, co + * + * Note: New line '\n' is added to the end of the text when printing to stdout. + */ +-void wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); ++void _wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); ++#define wpa_msg(ctx, level, ...) \ ++ do { \ ++ if (level >= CONFIG_MSG_MIN_PRIORITY) \ ++ _wpa_msg(ctx, level, __VA_ARGS__); \ ++ } while(0) + + /** + * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors +@@ -186,8 +232,13 @@ void wpa_msg(void *ctx, int level, const + * attached ctrl_iface monitors. In other words, it can be used for frequent + * events that do not need to be sent to syslog. + */ +-void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) ++void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) + PRINTF_FORMAT(3, 4); ++#define wpa_msg_ctrl(ctx, level, ...) \ ++ do { \ ++ if (level >= CONFIG_MSG_MIN_PRIORITY) \ ++ _wpa_msg_ctrl(ctx, level, __VA_ARGS__); \ ++ } while(0) + + typedef void (*wpa_msg_cb_func)(void *ctx, int level, const char *txt, + size_t len); diff --git a/package/network/services/hostapd/patches/560-indicate-features.patch b/package/network/services/hostapd/patches/560-indicate-features.patch new file mode 100644 index 0000000..d01e18b --- /dev/null +++ b/package/network/services/hostapd/patches/560-indicate-features.patch @@ -0,0 +1,82 @@ +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -13,6 +13,7 @@ + + #include "utils/common.h" + #include "utils/eloop.h" ++#include "utils/build_features.h" + #include "crypto/random.h" + #include "crypto/tls.h" + #include "common/version.h" +@@ -560,7 +561,7 @@ int main(int argc, char *argv[]) + + wpa_supplicant_event = hostapd_wpa_event; + for (;;) { +- c = getopt(argc, argv, "Bde:f:hKP:tvg:"); ++ c = getopt(argc, argv, "Bde:f:hKP:tg:v::"); + if (c < 0) + break; + switch (c) { +@@ -592,6 +593,8 @@ int main(int argc, char *argv[]) + wpa_debug_timestamp++; + break; + case 'v': ++ if (optarg) ++ exit(!has_feature(optarg)); + show_version(); + exit(1); + break; +--- a/wpa_supplicant/main.c ++++ b/wpa_supplicant/main.c +@@ -12,6 +12,7 @@ + #endif /* __linux__ */ + + #include "common.h" ++#include "build_features.h" + #include "wpa_supplicant_i.h" + #include "driver_i.h" + +@@ -156,7 +157,7 @@ int main(int argc, char *argv[]) + + for (;;) { + c = getopt(argc, argv, +- "b:Bc:C:D:de:f:g:hH:i:KLNo:O:p:P:qsTtuvW"); ++ "b:Bc:C:D:de:f:g:hH:i:KLNo:O:p:P:qsTtuv::W"); + if (c < 0) + break; + switch (c) { +@@ -248,8 +249,12 @@ int main(int argc, char *argv[]) + break; + #endif /* CONFIG_DBUS */ + case 'v': +- printf("%s\n", wpa_supplicant_version); +- exitcode = 0; ++ if (optarg) { ++ exitcode = !has_feature(optarg); ++ } else { ++ printf("%s\n", wpa_supplicant_version); ++ exitcode = 0; ++ } + goto out; + case 'W': + params.wait_for_monitor++; +--- /dev/null ++++ b/src/utils/build_features.h +@@ -0,0 +1,17 @@ ++#ifndef BUILD_FEATURES_H ++#define BUILD_FEATURES_H ++ ++static inline int has_feature(const char *feat) ++{ ++#ifdef IEEE8021X_EAPOL ++ if (!strcmp(feat, "eap")) ++ return 1; ++#endif ++#ifdef IEEE80211N ++ if (!strcmp(feat, "11n")) ++ return 1; ++#endif ++ return 0; ++} ++ ++#endif /* BUILD_FEATURES_H */ diff --git a/package/network/services/hostapd/patches/570-genl_connect_debug.patch b/package/network/services/hostapd/patches/570-genl_connect_debug.patch new file mode 100644 index 0000000..5f14048 --- /dev/null +++ b/package/network/services/hostapd/patches/570-genl_connect_debug.patch @@ -0,0 +1,11 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -127,7 +127,7 @@ static struct nl_handle * nl_create_hand + } + + if (genl_connect(handle)) { +- wpa_printf(MSG_ERROR, "nl80211: Failed to connect to generic " ++ wpa_printf(MSG_DEBUG, "nl80211: Failed to connect to generic " + "netlink (%s)", dbg); + nl80211_handle_destroy(handle); + return NULL; diff --git a/package/network/services/hostapd/patches/590-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/590-hostapd_cli_ifdef.patch new file mode 100644 index 0000000..cbf1e48 --- /dev/null +++ b/package/network/services/hostapd/patches/590-hostapd_cli_ifdef.patch @@ -0,0 +1,50 @@ +--- a/hostapd/hostapd_cli.c ++++ b/hostapd/hostapd_cli.c +@@ -67,7 +67,6 @@ static const char *commands_help = + #ifdef CONFIG_IEEE80211W + " sa_query <addr> send SA Query to a station\n" + #endif /* CONFIG_IEEE80211W */ +-#ifdef CONFIG_WPS + " wps_pin <uuid> <pin> [timeout] [addr] add WPS Enrollee PIN\n" + " wps_check_pin <PIN> verify PIN checksum\n" + " wps_pbc indicate button pushed to initiate PBC\n" +@@ -79,7 +78,6 @@ static const char *commands_help = + #endif /* CONFIG_WPS_NFC */ + " wps_ap_pin <cmd> [params..] enable/disable AP PIN\n" + " wps_config <SSID> <auth> <encr> <key> configure AP\n" +-#endif /* CONFIG_WPS */ + " get_config show current configuration\n" + " help show this usage help\n" + " interface [ifname] show interfaces/select interface\n" +@@ -340,7 +338,6 @@ static int hostapd_cli_cmd_sa_query(stru + #endif /* CONFIG_IEEE80211W */ + + +-#ifdef CONFIG_WPS + static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, + char *argv[]) + { +@@ -559,7 +556,6 @@ static int hostapd_cli_cmd_wps_config(st + ssid_hex, argv[1]); + return wpa_ctrl_command(ctrl, buf); + } +-#endif /* CONFIG_WPS */ + + + static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, +@@ -805,7 +801,6 @@ static struct hostapd_cli_cmd hostapd_cl + #ifdef CONFIG_IEEE80211W + { "sa_query", hostapd_cli_cmd_sa_query }, + #endif /* CONFIG_IEEE80211W */ +-#ifdef CONFIG_WPS + { "wps_pin", hostapd_cli_cmd_wps_pin }, + { "wps_check_pin", hostapd_cli_cmd_wps_check_pin }, + { "wps_pbc", hostapd_cli_cmd_wps_pbc }, +@@ -818,7 +813,6 @@ static struct hostapd_cli_cmd hostapd_cl + #endif /* CONFIG_WPS_NFC */ + { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin }, + { "wps_config", hostapd_cli_cmd_wps_config }, +-#endif /* CONFIG_WPS */ + { "disassoc_imminent", hostapd_cli_cmd_disassoc_imminent }, + { "ess_disassoc", hostapd_cli_cmd_ess_disassoc }, + { "get_config", hostapd_cli_cmd_get_config }, diff --git a/package/network/services/hostapd/patches/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch new file mode 100644 index 0000000..977bce4 --- /dev/null +++ b/package/network/services/hostapd/patches/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -0,0 +1,209 @@ +From 4bb69d15477e0f2b00e166845341dc933de47c58 Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli <ordex@autistici.org> +Date: Sun, 3 Jun 2012 18:22:56 +0200 +Subject: [PATCHv2 601/602] wpa_supplicant: add new config params to be used + with the ibss join command + +Signed-hostap: Antonio Quartulli <ordex@autistici.org> +--- + src/drivers/driver.h | 6 +++ + wpa_supplicant/config.c | 96 +++++++++++++++++++++++++++++++++++++++ + wpa_supplicant/config_ssid.h | 6 +++ + wpa_supplicant/wpa_supplicant.c | 23 +++++++--- + 4 files changed, 124 insertions(+), 7 deletions(-) + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -19,6 +19,7 @@ + + #define WPA_SUPPLICANT_DRIVER_VERSION 4 + ++#include "drivers/nl80211_copy.h" + #include "common/defs.h" + + #define HOSTAPD_CHAN_DISABLED 0x00000001 +@@ -363,6 +364,11 @@ struct wpa_driver_associate_params { + */ + int freq; + ++ int beacon_interval; ++ int fixed_freq; ++ unsigned char rates[NL80211_MAX_SUPP_RATES]; ++ int mcast_rate; ++ + /** + * bg_scan_period - Background scan period in seconds, 0 to disable + * background scan, or -1 to indicate no change to default driver +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -14,6 +14,7 @@ + #include "rsn_supp/wpa.h" + #include "eap_peer/eap.h" + #include "p2p/p2p.h" ++#include "drivers/nl80211_copy.h" + #include "config.h" + + +@@ -1369,6 +1370,97 @@ static char * wpa_config_write_p2p_clien + + #endif /* CONFIG_P2P */ + ++static int wpa_config_parse_mcast_rate(const struct parse_data *data, ++ struct wpa_ssid *ssid, int line, ++ const char *value) ++{ ++ ssid->mcast_rate = (int)(strtod(value, NULL) * 10); ++ ++ return 0; ++} ++ ++#ifndef NO_CONFIG_WRITE ++static char * wpa_config_write_mcast_rate(const struct parse_data *data, ++ struct wpa_ssid *ssid) ++{ ++ char *value; ++ int res; ++ ++ if (!ssid->mcast_rate == 0) ++ return NULL; ++ ++ value = os_malloc(6); /* longest: 300.0 */ ++ if (value == NULL) ++ return NULL; ++ res = os_snprintf(value, 5, "%.1f", (double)ssid->mcast_rate / 10); ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ return value; ++} ++#endif /* NO_CONFIG_WRITE */ ++ ++static int wpa_config_parse_rates(const struct parse_data *data, ++ struct wpa_ssid *ssid, int line, ++ const char *value) ++{ ++ int i; ++ char *pos, *r, *sptr, *end; ++ double rate; ++ ++ pos = (char *)value; ++ r = strtok_r(pos, ",", &sptr); ++ i = 0; ++ while (pos && i < NL80211_MAX_SUPP_RATES) { ++ rate = 0.0; ++ if (r) ++ rate = strtod(r, &end); ++ ssid->rates[i] = rate * 2; ++ if (*end != '\0' || rate * 2 != ssid->rates[i]) ++ return 1; ++ ++ i++; ++ r = strtok_r(NULL, ",", &sptr); ++ } ++ ++ return 0; ++} ++ ++#ifndef NO_CONFIG_WRITE ++static char * wpa_config_write_rates(const struct parse_data *data, ++ struct wpa_ssid *ssid) ++{ ++ char *value, *pos; ++ int res, i; ++ ++ if (ssid->rates[0] <= 0) ++ return NULL; ++ ++ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1); ++ if (value == NULL) ++ return NULL; ++ pos = value; ++ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) { ++ res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2); ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ pos += res; ++ } ++ res = os_snprintf(pos, 6, "%.1f", ++ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2); ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ ++ value[6 * NL80211_MAX_SUPP_RATES] = '\0'; ++ return value; ++} ++#endif /* NO_CONFIG_WRITE */ ++ + /* Helper macros for network block parser */ + + #ifdef OFFSET +@@ -1546,6 +1638,9 @@ static const struct parse_data ssid_fiel + { INT(ap_max_inactivity) }, + { INT(dtim_period) }, + { INT(beacon_int) }, ++ { INT_RANGE(fixed_freq, 0, 1) }, ++ { FUNC(rates) }, ++ { FUNC(mcast_rate) }, + }; + + #undef OFFSET +--- a/wpa_supplicant/config_ssid.h ++++ b/wpa_supplicant/config_ssid.h +@@ -11,6 +11,7 @@ + + #include "common/defs.h" + #include "eap_peer/eap_config.h" ++#include "drivers/nl80211_copy.h" + + #define MAX_SSID_LEN 32 + +@@ -571,6 +572,10 @@ struct wpa_ssid { + * dereferences since it may not be updated in all cases. + */ + void *parent_cred; ++ ++ int fixed_freq; ++ unsigned char rates[NL80211_MAX_SUPP_RATES]; ++ double mcast_rate; + }; + + #endif /* CONFIG_SSID_H */ +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -1570,15 +1570,24 @@ void wpa_supplicant_associate(struct wpa + params.ssid_len = ssid->ssid_len; + } + +- if (ssid->mode == WPAS_MODE_IBSS && ssid->bssid_set && +- wpa_s->conf->ap_scan == 2) { +- params.bssid = ssid->bssid; +- params.fixed_bssid = 1; ++ if (ssid->mode == WPAS_MODE_IBSS) { ++ if (ssid->bssid_set && wpa_s->conf->ap_scan == 2) { ++ params.bssid = ssid->bssid; ++ params.fixed_bssid = 1; ++ } ++ if (ssid->frequency > 0 && params.freq == 0) ++ /* Initial channel for IBSS */ ++ params.freq = ssid->frequency; ++ params.fixed_freq = ssid->fixed_freq; ++ params.beacon_interval = ssid->beacon_int; ++ i = 0; ++ while (i < NL80211_MAX_SUPP_RATES) { ++ params.rates[i] = ssid->rates[i]; ++ i++; ++ } ++ params.mcast_rate = ssid->mcast_rate; + } + +- if (ssid->mode == WPAS_MODE_IBSS && ssid->frequency > 0 && +- params.freq == 0) +- params.freq = ssid->frequency; /* Initial channel for IBSS */ + params.wpa_ie = wpa_ie; + params.wpa_ie_len = wpa_ie_len; + params.pairwise_suite = cipher_pairwise; diff --git a/package/network/services/hostapd/patches/602-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/602-driver_nl80211-use-new-parameters-during-ibss-join.patch new file mode 100644 index 0000000..bf80185 --- /dev/null +++ b/package/network/services/hostapd/patches/602-driver_nl80211-use-new-parameters-during-ibss-join.patch @@ -0,0 +1,59 @@ +From ffc4445958a3ed4064f2e1bf73fa478a61c5cf7b Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli <ordex@autistici.org> +Date: Sun, 3 Jun 2012 18:42:25 +0200 +Subject: [PATCHv2 602/602] driver_nl80211: use new parameters during ibss join + +Signed-hostap: Antonio Quartulli <ordex@autistici.org> +--- + src/drivers/driver_nl80211.c | 33 ++++++++++++++++++++++++++++++++- + 1 file changed, 32 insertions(+), 1 deletion(-) + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -6806,7 +6806,7 @@ static int wpa_driver_nl80211_ibss(struc + struct wpa_driver_associate_params *params) + { + struct nl_msg *msg; +- int ret = -1; ++ int ret = -1, i; + int count = 0; + + wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); +@@ -6839,6 +6839,37 @@ retry: + wpa_printf(MSG_DEBUG, " * freq=%d", params->freq); + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, params->freq); + ++ if (params->fixed_freq) { ++ wpa_printf(MSG_DEBUG, " * fixed_freq"); ++ NLA_PUT_FLAG(msg, NL80211_ATTR_FREQ_FIXED); ++ } ++ ++ if (params->beacon_interval > 0) { ++ wpa_printf(MSG_DEBUG, " * beacon_interval=%d", ++ params->beacon_interval); ++ NLA_PUT_U32(msg, NL80211_ATTR_BEACON_INTERVAL, ++ params->beacon_interval); ++ } ++ ++ if (params->rates[0] > 0) { ++ wpa_printf(MSG_DEBUG, " * basic_rates:"); ++ i = 0; ++ while (i < NL80211_MAX_SUPP_RATES && ++ params->rates[i] > 0) { ++ wpa_printf(MSG_DEBUG, " %.1f", ++ (double)params->rates[i] / 2); ++ i++; ++ } ++ NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, i, ++ params->rates); ++ } ++ ++ if (params->mcast_rate > 0) { ++ wpa_printf(MSG_DEBUG, " * mcast_rates=%.1f", ++ (double)params->mcast_rate / 10); ++ NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate); ++ } ++ + ret = nl80211_set_conn_keys(params, msg); + if (ret) + goto nla_put_failure; diff --git a/package/network/services/hostapd/patches/604-wpa_s-support-htmode-param.patch b/package/network/services/hostapd/patches/604-wpa_s-support-htmode-param.patch new file mode 100644 index 0000000..00272a5 --- /dev/null +++ b/package/network/services/hostapd/patches/604-wpa_s-support-htmode-param.patch @@ -0,0 +1,156 @@ +From b9329c5dfeed7d5c55d2117d8dfe326fc40c8fb1 Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli <ordex@autistici.org> +Date: Tue, 3 Jul 2012 00:36:24 +0200 +Subject: [PATCH] wpa_s: support htmode param + +possible values are HT20, HT40-, HT40+ and NOHT + +Signed-off-by: Antonio Quartulli <ordex@autistici.org> +--- + src/drivers/driver.h | 2 ++ + src/drivers/driver_nl80211.c | 16 ++++++++++ + wpa_supplicant/config.c | 66 +++++++++++++++++++++++++++++++++++++++ + wpa_supplicant/config_ssid.h | 2 ++ + wpa_supplicant/wpa_supplicant.c | 2 ++ + 5 files changed, 88 insertions(+) + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -368,6 +368,8 @@ struct wpa_driver_associate_params { + int fixed_freq; + unsigned char rates[NL80211_MAX_SUPP_RATES]; + int mcast_rate; ++ int ht_set; ++ unsigned int htmode; + + /** + * bg_scan_period - Background scan period in seconds, 0 to disable +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -6870,6 +6870,22 @@ retry: + NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate); + } + ++ if (params->ht_set) { ++ switch(params->htmode) { ++ case NL80211_CHAN_HT20: ++ wpa_printf(MSG_DEBUG, " * ht=HT20"); ++ break; ++ case NL80211_CHAN_HT40PLUS: ++ wpa_printf(MSG_DEBUG, " * ht=HT40+"); ++ break; ++ case NL80211_CHAN_HT40MINUS: ++ wpa_printf(MSG_DEBUG, " * ht=HT40-"); ++ break; ++ } ++ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, ++ params->htmode); ++ } ++ + ret = nl80211_set_conn_keys(params, msg); + if (ret) + goto nla_put_failure; +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -1401,6 +1401,71 @@ static char * wpa_config_write_mcast_rat + } + #endif /* NO_CONFIG_WRITE */ + ++static int wpa_config_parse_htmode(const struct parse_data *data, ++ struct wpa_ssid *ssid, int line, ++ const char *value) ++{ ++ int i; ++ static const struct { ++ const char *name; ++ unsigned int val; ++ } htmap[] = { ++ { .name = "HT20", .val = NL80211_CHAN_HT20, }, ++ { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, }, ++ { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, }, ++ { .name = "NOHT", .val = NL80211_CHAN_NO_HT, }, ++ }; ++ ssid->ht_set = 0;; ++ for (i = 0; i < 4; i++) { ++ if (strcasecmp(htmap[i].name, value) == 0) { ++ ssid->htmode = htmap[i].val; ++ ssid->ht_set = 1; ++ break; ++ } ++ } ++ ++ return 0; ++} ++ ++#ifndef NO_CONFIG_WRITE ++static char * wpa_config_write_htmode(const struct parse_data *data, ++ struct wpa_ssid *ssid) ++{ ++ char *value; ++ int res; ++ ++ value = os_malloc(6); /* longest: HT40+ */ ++ if (value == NULL) ++ return NULL; ++ ++ switch(ssid->htmode) { ++ case NL80211_CHAN_HT20: ++ res = os_snprintf(value, 4, "HT20"); ++ break; ++ case NL80211_CHAN_HT40PLUS: ++ res = os_snprintf(value, 5, "HT40+"); ++ break; ++ case NL80211_CHAN_HT40MINUS: ++ res = os_snprintf(value, 5, "HT40-"); ++ break; ++ case NL80211_CHAN_NO_HT: ++ res = os_snprintf(value, 4, "NOHT"); ++ break; ++ default: ++ os_free(value); ++ return NULL; ++ } ++ ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ ++ return value; ++} ++#endif /* NO_CONFIG_WRITE */ ++ ++ + static int wpa_config_parse_rates(const struct parse_data *data, + struct wpa_ssid *ssid, int line, + const char *value) +@@ -1641,6 +1706,7 @@ static const struct parse_data ssid_fiel + { INT_RANGE(fixed_freq, 0, 1) }, + { FUNC(rates) }, + { FUNC(mcast_rate) }, ++ { FUNC(htmode) }, + }; + + #undef OFFSET +--- a/wpa_supplicant/config_ssid.h ++++ b/wpa_supplicant/config_ssid.h +@@ -576,6 +576,8 @@ struct wpa_ssid { + int fixed_freq; + unsigned char rates[NL80211_MAX_SUPP_RATES]; + double mcast_rate; ++ int ht_set; ++ unsigned int htmode; + }; + + #endif /* CONFIG_SSID_H */ +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -1586,6 +1586,8 @@ void wpa_supplicant_associate(struct wpa + i++; + } + params.mcast_rate = ssid->mcast_rate; ++ params.ht_set = ssid->ht_set; ++ params.htmode = ssid->htmode; + } + + params.wpa_ie = wpa_ie; diff --git a/package/network/services/hostapd/patches/610-max_num_sta_probe.patch b/package/network/services/hostapd/patches/610-max_num_sta_probe.patch new file mode 100644 index 0000000..141eb5b --- /dev/null +++ b/package/network/services/hostapd/patches/610-max_num_sta_probe.patch @@ -0,0 +1,13 @@ +--- a/src/ap/beacon.c ++++ b/src/ap/beacon.c +@@ -455,6 +455,10 @@ void handle_probe_req(struct hostapd_dat + return; + } + ++ if (!sta && hapd->num_sta >= hapd->conf->max_num_sta) ++ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " ignored," ++ " too many connected stations.", MAC2STR(mgmt->sa)); ++ + #ifdef CONFIG_INTERWORKING + if (elems.interworking && elems.interworking_len >= 1) { + u8 ant = elems.interworking[0] & 0x0f; diff --git a/package/network/services/hostapd/patches/620-scan_wait.patch b/package/network/services/hostapd/patches/620-scan_wait.patch new file mode 100644 index 0000000..d9c7f30 --- /dev/null +++ b/package/network/services/hostapd/patches/620-scan_wait.patch @@ -0,0 +1,65 @@ +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -32,6 +32,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; + + extern struct wpa_driver_ops *wpa_drivers[]; + +@@ -146,6 +148,14 @@ static void hostapd_logger_cb(void *ctx, + } + #endif /* CONFIG_NO_HOSTAPD_LOGGER */ + ++static void hostapd_setup_complete_cb(void *ctx) ++{ ++ if (daemonize && os_daemonize(pid_file)) { ++ perror("daemon"); ++ return; ++ } ++ daemonize = 0; ++} + + /** + * hostapd_init - Allocate and initialize per-interface data +@@ -189,6 +199,7 @@ static struct hostapd_iface * hostapd_in + if (hapd == NULL) + goto fail; + hapd->msg_ctx = hapd; ++ hapd->setup_complete_cb = hostapd_setup_complete_cb; + } + + return hapd_iface; +@@ -425,8 +436,6 @@ static void hostapd_global_deinit(const + #endif /* CONFIG_NATIVE_WINDOWS */ + + eap_server_unregister_methods(); +- +- os_daemonize_terminate(pid_file); + } + + +@@ -452,11 +461,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; +@@ -540,8 +544,7 @@ int main(int argc, char *argv[]) + struct hapd_interfaces interfaces; + int ret = 1; + size_t i; +- int c, debug = 0, daemonize = 0; +- char *pid_file = NULL; ++ int c, debug = 0; + const char *log_file = NULL; + const char *entropy_file = NULL; + |