From: Felix Fietkau Date: Fri, 4 Nov 2011 01:05:26 +0000 (+0000) Subject: hostapd: update to latest git version X-Git-Tag: v19.07.0-rc1~26326 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c8321c3ca6de1dc1767c90afbe73afc822fb0194;p=openwrt%2Fstaging%2Fhauke.git hostapd: update to latest git version SVN-Revision: 28746 --- diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index 9f93054db7..01c9ff66ad 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -8,16 +8,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_VERSION:=20110527 -PKG_RELEASE:=2 -PKG_REV:=ceb34f250af7a7082f18c1e0451dc7fbc0f000f3 +PKG_VERSION:=20111103 +PKG_RELEASE:=1 +PKG_REV:=6caaae1e48da247b21b54ea6001646597e35d9b1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_VERSION:=$(PKG_REV) PKG_SOURCE_PROTO:=git -PKG_MIRROR_MD5SUM:=4b98902d782813b41aca1faff613f677 +PKG_MIRROR_MD5SUM:=2650d83c1d4649a5df9fe265f8a5775f PKG_BUILD_DEPENDS:= \ PACKAGE_kmod-madwifi:madwifi \ diff --git a/package/hostapd/patches/100-pending_work.patch b/package/hostapd/patches/100-pending_work.patch new file mode 100644 index 0000000000..d9824f3178 --- /dev/null +++ b/package/hostapd/patches/100-pending_work.patch @@ -0,0 +1,162 @@ +--- a/src/ap/ieee802_11.c ++++ b/src/ap/ieee802_11.c +@@ -1471,13 +1471,6 @@ static void handle_assoc_cb(struct hosta + int new_assoc = 1; + struct ieee80211_ht_capabilities ht_cap; + +- if (!ok) { +- hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, +- HOSTAPD_LEVEL_DEBUG, +- "did not acknowledge association response"); +- return; +- } +- + if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_resp) : + sizeof(mgmt->u.assoc_resp))) { + printf("handle_assoc_cb(reassoc=%d) - too short payload " +@@ -1485,11 +1478,6 @@ static void handle_assoc_cb(struct hosta + return; + } + +- if (reassoc) +- status = le_to_host16(mgmt->u.reassoc_resp.status_code); +- else +- status = le_to_host16(mgmt->u.assoc_resp.status_code); +- + sta = ap_get_sta(hapd, mgmt->da); + if (!sta) { + printf("handle_assoc_cb: STA " MACSTR " not found\n", +@@ -1497,6 +1485,19 @@ static void handle_assoc_cb(struct hosta + return; + } + ++ if (!ok) { ++ hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, ++ HOSTAPD_LEVEL_DEBUG, ++ "did not acknowledge association response"); ++ sta->flags &= ~WLAN_STA_ASSOC_REQ_OK; ++ return; ++ } ++ ++ if (reassoc) ++ status = le_to_host16(mgmt->u.reassoc_resp.status_code); ++ else ++ status = le_to_host16(mgmt->u.assoc_resp.status_code); ++ + if (status != WLAN_STATUS_SUCCESS) + goto fail; + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -181,6 +181,7 @@ struct i802_bss { + struct wpa_driver_nl80211_data *drv; + struct i802_bss *next; + int ifindex; ++ u8 addr[ETH_ALEN]; + char ifname[IFNAMSIZ + 1]; + char brname[IFNAMSIZ]; + unsigned int beacon_set:1; +@@ -191,7 +192,6 @@ struct i802_bss { + struct wpa_driver_nl80211_data { + struct nl80211_global *global; + struct dl_list list; +- u8 addr[ETH_ALEN]; + char phyname[32]; + void *ctx; + int ifindex; +@@ -2482,7 +2482,7 @@ wpa_driver_nl80211_finish_drv_init(struc + return -1; + + if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname, +- drv->addr)) ++ bss->addr)) + return -1; + + if (nl80211_register_action_frames(drv) < 0) { +@@ -5176,8 +5176,8 @@ static int wpa_driver_nl80211_hapd_send_ + pos = (u8 *) (hdr + 1); + + if (qos) { +- /* add an empty QoS header if needed */ +- pos[0] = 0; ++ /* Set highest priority in QoS header */ ++ pos[0] = 7; + pos[1] = 0; + pos += 2; + } +@@ -6407,7 +6407,7 @@ static int i802_set_wds_sta(void *priv, + if (!if_nametoindex(name)) { + if (nl80211_create_iface(drv, name, + NL80211_IFTYPE_AP_VLAN, +- NULL, 1) < 0) ++ bss->addr, 1) < 0) + return -1; + if (bridge_ifname && + linux_br_add_if(drv->global->ioctl_sock, +@@ -6417,6 +6417,10 @@ static int i802_set_wds_sta(void *priv, + linux_set_iface_flags(drv->global->ioctl_sock, name, 1); + return i802_set_sta_vlan(priv, addr, name, 0); + } else { ++ if (bridge_ifname) ++ linux_br_del_if(drv->global->ioctl_sock, bridge_ifname, ++ name); ++ + i802_set_sta_vlan(priv, addr, bss->ifname, 0); + return wpa_driver_nl80211_if_remove(priv, WPA_IF_AP_VLAN, + name); +@@ -6625,7 +6629,7 @@ static int nl80211_addr_in_use(struct nl + struct wpa_driver_nl80211_data *drv; + dl_list_for_each(drv, &global->interfaces, + struct wpa_driver_nl80211_data, list) { +- if (os_memcmp(addr, drv->addr, ETH_ALEN) == 0) ++ if (os_memcmp(addr, drv->first_bss.addr, ETH_ALEN) == 0) + return 1; + } + return 0; +@@ -6640,9 +6644,9 @@ static int nl80211_p2p_interface_addr(st + if (!drv->global) + return -1; + +- os_memcpy(new_addr, drv->addr, ETH_ALEN); ++ os_memcpy(new_addr, drv->first_bss.addr, ETH_ALEN); + for (idx = 0; idx < 64; idx++) { +- new_addr[0] = drv->addr[0] | 0x02; ++ new_addr[0] = drv->first_bss.addr[0] | 0x02; + new_addr[0] ^= idx << 2; + if (!nl80211_addr_in_use(drv->global, new_addr)) + break; +@@ -6745,6 +6749,7 @@ static int wpa_driver_nl80211_if_add(voi + os_free(new_bss); + return -1; + } ++ memcpy(new_bss->addr, addr ? addr : if_addr, ETH_ALEN); + os_strlcpy(new_bss->ifname, ifname, IFNAMSIZ); + new_bss->ifindex = ifidx; + new_bss->drv = drv; +@@ -6775,7 +6780,12 @@ static int wpa_driver_nl80211_if_remove( + if (ifindex <= 0) + return -1; + ++ nl80211_remove_iface(drv, ifindex); ++ + #ifdef HOSTAPD ++ if (type != WPA_IF_AP_BSS) ++ return 0; ++ + if (bss->added_if_into_bridge) { + if (linux_br_del_if(drv->global->ioctl_sock, bss->brname, + bss->ifname) < 0) +@@ -6789,13 +6799,6 @@ static int wpa_driver_nl80211_if_remove( + "bridge %s: %s", + bss->brname, strerror(errno)); + } +-#endif /* HOSTAPD */ +- +- nl80211_remove_iface(drv, ifindex); +- +-#ifdef HOSTAPD +- if (type != WPA_IF_AP_BSS) +- return 0; + + if (bss != &drv->first_bss) { + struct i802_bss *tbss; diff --git a/package/hostapd/patches/300-scan_ssid.patch b/package/hostapd/patches/300-scan_ssid.patch index 47528f8b6b..2309d1cd65 100644 --- a/package/hostapd/patches/300-scan_ssid.patch +++ b/package/hostapd/patches/300-scan_ssid.patch @@ -1,16 +1,16 @@ --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c -@@ -251,6 +251,7 @@ static void wpa_supplicant_scan(void *el - enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO; - #endif /* CONFIG_WPS */ +@@ -423,6 +423,7 @@ static void wpa_supplicant_scan(void *el + int scan_req = 0, ret; + struct wpabuf *extra_ie; struct wpa_driver_scan_params params; + int scan_ssid_all = 1; size_t max_ssids; enum wpa_states prev_state; -@@ -307,6 +308,16 @@ static void wpa_supplicant_scan(void *el - wpa_s->wpa_state == WPA_INACTIVE) - wpa_supplicant_set_state(wpa_s, WPA_SCANNING); +@@ -502,6 +503,16 @@ static void wpa_supplicant_scan(void *el + } + } + /* check if all configured ssids should be scanned directly */ + ssid = wpa_s->conf->ssid; @@ -25,7 +25,7 @@ /* Find the starting point from which to continue scanning */ ssid = wpa_s->conf->ssid; if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) { -@@ -370,6 +381,9 @@ static void wpa_supplicant_scan(void *el +@@ -564,6 +575,9 @@ static void wpa_supplicant_scan(void *el int_array_sort_unique(params.freqs); } diff --git a/package/hostapd/patches/310-madwifi_merge.patch b/package/hostapd/patches/310-madwifi_merge.patch index f0888f073b..a9646ec1c8 100644 --- a/package/hostapd/patches/310-madwifi_merge.patch +++ b/package/hostapd/patches/310-madwifi_merge.patch @@ -131,7 +131,7 @@ f = fopen(buf, "r"); if (!f) { -@@ -757,7 +758,7 @@ static int madwifi_receive_probe_req(str +@@ -759,7 +760,7 @@ static int madwifi_receive_probe_req(str if (ret) return ret; @@ -140,7 +140,16 @@ madwifi_raw_receive, drv, 1); if (drv->sock_raw == NULL) return -1; -@@ -1017,7 +1018,7 @@ madwifi_get_we_version(struct madwifi_dr +@@ -812,7 +813,7 @@ static int madwifi_set_freq(void *priv, + struct iwreq iwr; + + os_memset(&iwr, 0, sizeof(iwr)); +- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ); ++ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); + iwr.u.freq.m = freq->channel; + iwr.u.freq.e = 0; + +@@ -1037,7 +1038,7 @@ madwifi_get_we_version(struct madwifi_dr return -1; memset(&iwr, 0, sizeof(iwr)); @@ -149,7 +158,7 @@ iwr.u.data.pointer = (caddr_t) range; iwr.u.data.length = buflen; -@@ -1134,17 +1135,17 @@ madwifi_init(struct hostapd_data *hapd, +@@ -1154,17 +1155,17 @@ madwifi_init(struct hostapd_data *hapd, perror("socket[PF_INET,SOCK_DGRAM]"); goto bad; } @@ -170,7 +179,7 @@ handle_read, drv, 1); if (drv->sock_xmit == NULL) goto bad; -@@ -1158,7 +1159,7 @@ madwifi_init(struct hostapd_data *hapd, +@@ -1178,7 +1179,7 @@ madwifi_init(struct hostapd_data *hapd, 1); if (drv->sock_recv == NULL) goto bad; @@ -179,7 +188,7 @@ wpa_printf(MSG_DEBUG, "Interface in bridge %s; configure for " "EAPOL receive", brname); drv->sock_recv = l2_packet_init(brname, NULL, ETH_P_EAPOL, -@@ -1169,7 +1170,7 @@ madwifi_init(struct hostapd_data *hapd, +@@ -1189,7 +1190,7 @@ madwifi_init(struct hostapd_data *hapd, drv->sock_recv = drv->sock_xmit; memset(&iwr, 0, sizeof(iwr)); @@ -188,7 +197,7 @@ iwr.u.mode = IW_MODE_MASTER; -@@ -1180,7 +1181,7 @@ madwifi_init(struct hostapd_data *hapd, +@@ -1200,7 +1201,7 @@ madwifi_init(struct hostapd_data *hapd, } /* mark down during setup */ @@ -197,7 +206,7 @@ madwifi_set_privacy(drv, 0); /* default to no privacy */ madwifi_receive_probe_req(drv); -@@ -1206,7 +1207,7 @@ madwifi_deinit(void *priv) +@@ -1226,7 +1227,7 @@ madwifi_deinit(void *priv) struct madwifi_driver_data *drv = priv; netlink_deinit(drv->netlink); @@ -206,7 +215,7 @@ if (drv->ioctl_sock >= 0) close(drv->ioctl_sock); if (drv->sock_recv != NULL && drv->sock_recv != drv->sock_xmit) -@@ -1225,7 +1226,7 @@ madwifi_set_ssid(void *priv, const u8 *b +@@ -1245,7 +1246,7 @@ madwifi_set_ssid(void *priv, const u8 *b struct iwreq iwr; memset(&iwr, 0, sizeof(iwr)); @@ -215,7 +224,7 @@ iwr.u.essid.flags = 1; /* SSID active */ iwr.u.essid.pointer = (caddr_t) buf; iwr.u.essid.length = len + 1; -@@ -1246,7 +1247,7 @@ madwifi_get_ssid(void *priv, u8 *buf, in +@@ -1266,7 +1267,7 @@ madwifi_get_ssid(void *priv, u8 *buf, in int ret = 0; memset(&iwr, 0, sizeof(iwr)); @@ -224,7 +233,7 @@ iwr.u.essid.pointer = (caddr_t) buf; iwr.u.essid.length = len; -@@ -1271,140 +1272,19 @@ static int +@@ -1291,140 +1292,19 @@ static int madwifi_commit(void *priv) { struct madwifi_driver_data *drv = priv; @@ -344,7 +353,7 @@ - return 0; -} - --static int + static int -set80211param(struct wpa_driver_madwifi_data *drv, int op, int arg, - int show_err) -{ @@ -363,13 +372,13 @@ - return 0; -} - - static int +-static int -wpa_driver_madwifi_set_wpa_ie(struct wpa_driver_madwifi_data *drv, +wpa_driver_madwifi_set_wpa_ie(struct madwifi_driver_data *drv, const u8 *wpa_ie, size_t wpa_ie_len) { struct iwreq iwr; -@@ -1415,7 +1295,7 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa +@@ -1435,7 +1315,7 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa iwr.u.data.pointer = (void *) wpa_ie; iwr.u.data.length = wpa_ie_len; @@ -378,7 +387,7 @@ perror("ioctl[IEEE80211_IOCTL_SETOPTIE]"); return -1; } -@@ -1423,157 +1303,51 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa +@@ -1443,157 +1323,51 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa } static int @@ -544,7 +553,7 @@ ret = -1; if (wpa_driver_madwifi_set_auth_alg(drv, params->auth_alg) < 0) ret = -1; -@@ -1596,12 +1370,12 @@ wpa_driver_madwifi_associate(void *priv, +@@ -1616,12 +1390,12 @@ wpa_driver_madwifi_associate(void *priv, params->wpa_ie_len == 0) privacy = 0; @@ -559,7 +568,7 @@ ret = -1; if (params->bssid == NULL) { -@@ -1609,14 +1383,14 @@ wpa_driver_madwifi_associate(void *priv, +@@ -1629,14 +1403,14 @@ wpa_driver_madwifi_associate(void *priv, * roaming */ /* FIX: this does not seem to work; would probably need to * change something in the driver */ @@ -576,7 +585,7 @@ ret = -1; if (wpa_driver_wext_set_ssid(drv->wext, params->ssid, params->ssid_len) < 0) -@@ -1625,7 +1399,7 @@ wpa_driver_madwifi_associate(void *priv, +@@ -1645,7 +1419,7 @@ wpa_driver_madwifi_associate(void *priv, mlme.im_op = IEEE80211_MLME_ASSOC; os_memcpy(mlme.im_macaddr, params->bssid, IEEE80211_ADDR_LEN); if (set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, @@ -585,7 +594,7 @@ wpa_printf(MSG_DEBUG, "%s: SETMLME[ASSOC] failed", __func__); ret = -1; -@@ -1638,7 +1412,7 @@ wpa_driver_madwifi_associate(void *priv, +@@ -1658,7 +1432,7 @@ wpa_driver_madwifi_associate(void *priv, static int wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg) { @@ -594,7 +603,7 @@ int authmode; if ((auth_alg & WPA_AUTH_ALG_OPEN) && -@@ -1649,13 +1423,13 @@ wpa_driver_madwifi_set_auth_alg(void *pr +@@ -1669,13 +1443,13 @@ wpa_driver_madwifi_set_auth_alg(void *pr else authmode = IEEE80211_AUTH_OPEN; @@ -610,7 +619,7 @@ struct iwreq iwr; int ret = 0; const u8 *ssid = params->ssids[0].ssid; -@@ -1673,7 +1447,7 @@ wpa_driver_madwifi_scan(void *priv, stru +@@ -1693,7 +1467,7 @@ wpa_driver_madwifi_scan(void *priv, stru if (wpa_driver_wext_set_ssid(drv->wext, ssid, ssid_len) < 0) ret = -1; @@ -619,7 +628,7 @@ perror("ioctl[SIOCSIWSCAN]"); ret = -1; } -@@ -1695,14 +1469,14 @@ wpa_driver_madwifi_scan(void *priv, stru +@@ -1715,14 +1489,14 @@ wpa_driver_madwifi_scan(void *priv, stru static int wpa_driver_madwifi_get_bssid(void *priv, u8 *bssid) { @@ -636,7 +645,7 @@ return wpa_driver_wext_get_ssid(drv->wext, ssid); } -@@ -1710,14 +1484,16 @@ static int wpa_driver_madwifi_get_ssid(v +@@ -1730,14 +1504,16 @@ static int wpa_driver_madwifi_get_ssid(v static struct wpa_scan_results * wpa_driver_madwifi_get_scan_results(void *priv) { @@ -655,7 +664,7 @@ return wpa_driver_wext_set_operstate(drv->wext, state); } -@@ -1738,7 +1514,7 @@ static int wpa_driver_madwifi_set_probe_ +@@ -1758,7 +1534,7 @@ static int wpa_driver_madwifi_set_probe_ ret = set80211priv(priv, IEEE80211_IOCTL_SET_APPIEBUF, probe_req_ie, sizeof(struct ieee80211req_getset_appiebuf) + @@ -664,7 +673,7 @@ os_free(probe_req_ie); -@@ -1748,7 +1524,7 @@ static int wpa_driver_madwifi_set_probe_ +@@ -1768,7 +1544,7 @@ static int wpa_driver_madwifi_set_probe_ static void * wpa_driver_madwifi_init(void *ctx, const char *ifname) { @@ -673,7 +682,7 @@ drv = os_zalloc(sizeof(*drv)); if (drv == NULL) -@@ -1759,17 +1535,17 @@ static void * wpa_driver_madwifi_init(vo +@@ -1779,17 +1555,17 @@ static void * wpa_driver_madwifi_init(vo drv->ctx = ctx; os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname)); @@ -695,7 +704,7 @@ wpa_printf(MSG_DEBUG, "%s: failed to enable WPA support", __FUNCTION__); goto fail3; -@@ -1778,7 +1554,7 @@ static void * wpa_driver_madwifi_init(vo +@@ -1798,7 +1574,7 @@ static void * wpa_driver_madwifi_init(vo return drv; fail3: @@ -704,7 +713,7 @@ fail2: wpa_driver_wext_deinit(drv->wext); fail: -@@ -1789,38 +1565,37 @@ fail: +@@ -1809,38 +1585,37 @@ fail: static void wpa_driver_madwifi_deinit(void *priv) { @@ -750,17 +759,17 @@ #ifdef HOSTAPD .hapd_init = madwifi_init, .hapd_deinit = madwifi_deinit, -@@ -1840,7 +1615,8 @@ const struct wpa_driver_ops wpa_driver_m - .sta_clear_stats = madwifi_sta_clear_stats, +@@ -1861,7 +1636,8 @@ const struct wpa_driver_ops wpa_driver_m .commit = madwifi_commit, .set_ap_wps_ie = madwifi_set_ap_wps_ie, + .set_freq = madwifi_set_freq, -#else /* HOSTAPD */ +#endif /* HOSTAPD */ +#if !defined(NO_SUPPLICANT) .get_bssid = wpa_driver_madwifi_get_bssid, .get_ssid = wpa_driver_madwifi_get_ssid, .init = wpa_driver_madwifi_init, -@@ -1852,5 +1628,5 @@ const struct wpa_driver_ops wpa_driver_m +@@ -1873,5 +1649,5 @@ const struct wpa_driver_ops wpa_driver_m .disassociate = wpa_driver_madwifi_disassociate, .associate = wpa_driver_madwifi_associate, .set_operstate = wpa_driver_madwifi_set_operstate, diff --git a/package/hostapd/patches/320-nl80211_multicall_fixes.patch b/package/hostapd/patches/320-nl80211_multicall_fixes.patch index 2403e72075..6a8926d478 100644 --- a/package/hostapd/patches/320-nl80211_multicall_fixes.patch +++ b/package/hostapd/patches/320-nl80211_multicall_fixes.patch @@ -1,29 +1,32 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -1890,6 +1890,7 @@ static void * wpa_driver_nl80211_init(vo +@@ -2289,6 +2289,7 @@ static void * wpa_driver_nl80211_init(vo drv->monitor_ifidx = -1; drv->monitor_sock = -1; - drv->ioctl_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); -@@ -2056,29 +2057,29 @@ wpa_driver_nl80211_finish_drv_init(struc +@@ -2446,37 +2447,37 @@ wpa_driver_nl80211_finish_drv_init(struc drv->ifindex = if_nametoindex(bss->ifname); drv->first_bss.ifindex = drv->ifindex; -#ifndef HOSTAPD -- if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) { -- wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to " +- /* +- * Make sure the interface starts up in station mode unless this is a +- * dynamically added interface (e.g., P2P) that was already configured +- * with proper iftype. +- */ +- if ((drv->global == NULL || +- drv->ifindex != drv->global->if_add_ifindex) && +- wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION) < 0) { +- wpa_printf(MSG_ERROR, "nl80211: Could not configure driver to " - "use managed mode"); +- return -1; - } -+ if (drv->nlmode == NL80211_IFTYPE_STATION) { -+ if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) { -+ wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to " -+ "use managed mode"); -+ } - -- if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { +- +- if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) { - if (rfkill_is_blocked(drv->rfkill)) { - wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " - "interface '%s' due to rfkill", @@ -33,8 +36,25 @@ - } else { - wpa_printf(MSG_ERROR, "nl80211: Could not set " - "interface '%s' UP", bss->ifname); -- return -1; -+ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { ++ if (drv->nlmode == NL80211_IFTYPE_STATION) { ++ /* ++ * Make sure the interface starts up in station mode unless this is a ++ * dynamically added interface (e.g., P2P) that was already configured ++ * with proper iftype. ++ */ ++ if ((drv->global == NULL || ++ drv->ifindex != drv->global->if_add_ifindex) && ++ wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION) < 0) { ++ wpa_printf(MSG_ERROR, "nl80211: Could not configure driver to " ++ "use managed mode"); + return -1; + } +- } + +- netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, +- 1, IF_OPER_DORMANT); +-#endif /* HOSTAPD */ ++ if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) { + if (rfkill_is_blocked(drv->rfkill)) { + wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " + "interface '%s' due to rfkill", @@ -46,35 +66,11 @@ + "interface '%s' UP", bss->ifname); + return -1; + } - } -- } - -- netlink_send_oper_ifla(drv->netlink, drv->ifindex, -- 1, IF_OPER_DORMANT); --#endif /* HOSTAPD */ -+ netlink_send_oper_ifla(drv->netlink, drv->ifindex, -+ 1, IF_OPER_DORMANT); ++ } ++ ++ netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, ++ 1, IF_OPER_DORMANT); + } if (wpa_driver_nl80211_capa(drv)) return -1; -@@ -3849,7 +3850,8 @@ static void nl80211_remove_iface(struct - - #ifdef HOSTAPD - /* stop listening for EAPOL on this interface */ -- del_ifidx(drv, ifidx); -+ if (drv->nlmode == NL80211_IFTYPE_AP) -+ del_ifidx(drv, ifidx); - #endif /* HOSTAPD */ - - msg = nlmsg_alloc(); -@@ -3922,7 +3924,8 @@ static int nl80211_create_iface_once(str - - #ifdef HOSTAPD - /* start listening for EAPOL on this interface */ -- add_ifidx(drv, ifidx); -+ if (drv->nlmode == NL80211_IFTYPE_AP) -+ add_ifidx(drv, ifidx); - #endif /* HOSTAPD */ - - if (addr && iftype != NL80211_IFTYPE_MONITOR && diff --git a/package/hostapd/patches/330-multicall_bridge_fix.patch b/package/hostapd/patches/330-multicall_bridge_fix.patch index 350e722e89..f446b3c154 100644 --- a/package/hostapd/patches/330-multicall_bridge_fix.patch +++ b/package/hostapd/patches/330-multicall_bridge_fix.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -475,6 +475,10 @@ static void wpa_driver_nl80211_event_rtm +@@ -600,6 +600,10 @@ static void wpa_driver_nl80211_event_rtm return; } @@ -11,7 +11,7 @@ wpa_printf(MSG_DEBUG, "RTM_NEWLINK: operstate=%d ifi_flags=0x%x " "(%s%s%s%s)", drv->operstate, ifi->ifi_flags, -@@ -546,6 +550,10 @@ static void wpa_driver_nl80211_event_rtm +@@ -692,6 +696,10 @@ static void wpa_driver_nl80211_event_rtm attrlen = len; attr = (struct rtattr *) buf; @@ -22,19 +22,19 @@ rta_len = RTA_ALIGN(sizeof(struct rtattr)); while (RTA_OK(attr, attrlen)) { if (attr->rta_type == IFLA_IFNAME) { -@@ -1679,6 +1687,11 @@ static int wpa_driver_nl80211_capa(struc - drv->capa.flags |= WPA_DRIVER_FLAGS_EAPOL_TX_STATUS; - drv->capa.max_remain_on_chan = info.max_remain_on_chan; +@@ -2291,6 +2299,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 + - return 0; - } - -@@ -5715,8 +5728,6 @@ static void *i802_init(struct hostapd_da + if (wpa_driver_nl80211_init_nl(drv)) { + os_free(drv); + return NULL; +@@ -6531,8 +6544,6 @@ static void *i802_init(struct hostapd_da br_ifindex = 0; } diff --git a/package/hostapd/patches/350-hostap_multicall_fix.patch b/package/hostapd/patches/350-hostap_multicall_fix.patch index 20c50605d6..2664341e5e 100644 --- a/package/hostapd/patches/350-hostap_multicall_fix.patch +++ b/package/hostapd/patches/350-hostap_multicall_fix.patch @@ -10,7 +10,7 @@ #include #include -@@ -42,10 +39,16 @@ +@@ -43,10 +40,16 @@ static const u8 rfc1042_header[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; struct hostap_driver_data { @@ -28,7 +28,7 @@ int ioctl_sock; /* socket for ioctl() use */ struct netlink_data *netlink; -@@ -55,9 +58,11 @@ struct hostap_driver_data { +@@ -56,9 +59,11 @@ struct hostap_driver_data { size_t generic_ie_len; u8 *wps_ie; size_t wps_ie_len; @@ -40,7 +40,7 @@ static int hostapd_ioctl(void *priv, struct prism2_hostapd_param *param, int len); static int hostap_set_iface_flags(void *priv, int dev_up); -@@ -400,65 +405,6 @@ static int hostapd_ioctl(void *priv, str +@@ -399,65 +404,6 @@ static int hostapd_ioctl(void *priv, str } @@ -106,8 +106,8 @@ static int hostap_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx, u8 *seq) { -@@ -1126,21 +1072,9 @@ static struct hostapd_hw_modes * hostap_ - return mode; +@@ -1171,21 +1117,9 @@ static void wpa_driver_hostap_poll_clien + hostap_send_mlme(priv, (u8 *)&hdr, sizeof(hdr)); } -#else /* HOSTAPD */ @@ -130,7 +130,7 @@ struct prism2_hostapd_param *param, int len, int show_err) { -@@ -1162,7 +1096,12 @@ static int hostapd_ioctl(struct wpa_driv +@@ -1207,7 +1141,12 @@ static int hostapd_ioctl(struct wpa_driv } @@ -144,7 +144,7 @@ const u8 *wpa_ie, size_t wpa_ie_len) { struct prism2_hostapd_param *param; -@@ -1178,7 +1117,7 @@ static int wpa_driver_hostap_set_wpa_ie( +@@ -1223,7 +1162,7 @@ static int wpa_driver_hostap_set_wpa_ie( param->cmd = PRISM2_HOSTAPD_SET_GENERIC_ELEMENT; param->u.generic_elem.len = wpa_ie_len; os_memcpy(param->u.generic_elem.data, wpa_ie, wpa_ie_len); @@ -153,7 +153,7 @@ os_free(param); -@@ -1186,7 +1125,7 @@ static int wpa_driver_hostap_set_wpa_ie( +@@ -1231,7 +1170,7 @@ static int wpa_driver_hostap_set_wpa_ie( } @@ -162,7 +162,7 @@ int value) { struct iwreq iwr; -@@ -1208,7 +1147,7 @@ static int prism2param(struct wpa_driver +@@ -1253,7 +1192,7 @@ static int prism2param(struct wpa_driver static int wpa_driver_hostap_set_wpa(void *priv, int enabled) { @@ -171,7 +171,7 @@ int ret = 0; wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled); -@@ -1224,125 +1163,15 @@ static int wpa_driver_hostap_set_wpa(voi +@@ -1269,125 +1208,15 @@ static int wpa_driver_hostap_set_wpa(voi } @@ -299,7 +299,7 @@ int type) { struct iwreq iwr; -@@ -1363,7 +1192,7 @@ static int wpa_driver_hostap_reset(struc +@@ -1408,7 +1237,7 @@ static int wpa_driver_hostap_reset(struc } @@ -308,7 +308,7 @@ const u8 *addr, int cmd, int reason_code) { struct prism2_hostapd_param param; -@@ -1378,7 +1207,7 @@ static int wpa_driver_hostap_mlme(struct +@@ -1423,7 +1252,7 @@ static int wpa_driver_hostap_mlme(struct os_memcpy(param.sta_addr, addr, ETH_ALEN); param.u.mlme.cmd = cmd; param.u.mlme.reason_code = reason_code; @@ -317,7 +317,7 @@ if (ret == 0) { os_sleep(0, 100000); ret = wpa_driver_hostap_reset(drv, 2); -@@ -1390,7 +1219,7 @@ static int wpa_driver_hostap_mlme(struct +@@ -1435,7 +1264,7 @@ static int wpa_driver_hostap_mlme(struct static int wpa_driver_hostap_deauthenticate(void *priv, const u8 *addr, int reason_code) { @@ -326,7 +326,7 @@ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__); return wpa_driver_hostap_mlme(drv, addr, MLME_STA_DEAUTH, reason_code); -@@ -1400,7 +1229,7 @@ static int wpa_driver_hostap_deauthentic +@@ -1445,7 +1274,7 @@ static int wpa_driver_hostap_deauthentic static int wpa_driver_hostap_disassociate(void *priv, const u8 *addr, int reason_code) { @@ -335,7 +335,7 @@ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__); return wpa_driver_hostap_mlme(drv, addr, MLME_STA_DISASSOC, reason_code); -@@ -1411,7 +1240,7 @@ static int +@@ -1456,7 +1285,7 @@ static int wpa_driver_hostap_associate(void *priv, struct wpa_driver_associate_params *params) { @@ -344,7 +344,7 @@ int ret = 0; int allow_unencrypted_eapol; -@@ -1475,7 +1304,7 @@ wpa_driver_hostap_associate(void *priv, +@@ -1520,7 +1349,7 @@ wpa_driver_hostap_associate(void *priv, static int wpa_driver_hostap_scan(void *priv, struct wpa_driver_scan_params *params) { @@ -353,7 +353,7 @@ struct prism2_hostapd_param param; int ret; const u8 *ssid = params->ssids[0].ssid; -@@ -1496,7 +1325,7 @@ static int wpa_driver_hostap_scan(void * +@@ -1541,7 +1370,7 @@ static int wpa_driver_hostap_scan(void * param.cmd = PRISM2_HOSTAPD_SCAN_REQ; param.u.scan_req.ssid_len = ssid_len; os_memcpy(param.u.scan_req.ssid, ssid, ssid_len); @@ -362,7 +362,7 @@ /* Not all drivers generate "scan completed" wireless event, so try to * read results after a timeout. */ -@@ -1511,7 +1340,7 @@ static int wpa_driver_hostap_scan(void * +@@ -1556,7 +1385,7 @@ static int wpa_driver_hostap_scan(void * static int wpa_driver_hostap_set_auth_alg(void *priv, int auth_alg) { @@ -371,7 +371,7 @@ int algs = 0; if (auth_alg & WPA_AUTH_ALG_OPEN) -@@ -1529,35 +1358,35 @@ static int wpa_driver_hostap_set_auth_al +@@ -1574,35 +1403,35 @@ static int wpa_driver_hostap_set_auth_al static int wpa_driver_hostap_get_bssid(void *priv, u8 *bssid) { @@ -412,7 +412,7 @@ drv = os_zalloc(sizeof(*drv)); if (drv == NULL) -@@ -1597,14 +1426,120 @@ static void * wpa_driver_hostap_init(voi +@@ -1642,14 +1471,120 @@ static void * wpa_driver_hostap_init(voi static void wpa_driver_hostap_deinit(void *priv) { @@ -535,17 +535,17 @@ const struct wpa_driver_ops wpa_driver_hostap_ops = { -@@ -1632,7 +1567,8 @@ const struct wpa_driver_ops wpa_driver_h - .sta_clear_stats = hostap_sta_clear_stats, - .get_hw_feature_data = hostap_get_hw_feature_data, +@@ -1679,7 +1614,8 @@ const struct wpa_driver_ops wpa_driver_h .set_ap_wps_ie = hostap_set_ap_wps_ie, + .set_freq = hostap_set_freq, + .poll_client = wpa_driver_hostap_poll_client, -#else /* HOSTAPD */ +#endif /* HOSTAPD */ +#if !defined(NO_SUPPLICANT) .get_bssid = wpa_driver_hostap_get_bssid, .get_ssid = wpa_driver_hostap_get_ssid, .set_countermeasures = wpa_driver_hostap_set_countermeasures, -@@ -1644,5 +1580,5 @@ const struct wpa_driver_ops wpa_driver_h +@@ -1691,5 +1627,5 @@ const struct wpa_driver_ops wpa_driver_h .init = wpa_driver_hostap_init, .deinit = wpa_driver_hostap_deinit, .set_operstate = wpa_driver_hostap_set_operstate, diff --git a/package/hostapd/patches/360-fix_ctrl_iface.patch b/package/hostapd/patches/360-fix_ctrl_iface.patch new file mode 100644 index 0000000000..a8b3f911f8 --- /dev/null +++ b/package/hostapd/patches/360-fix_ctrl_iface.patch @@ -0,0 +1,18 @@ +--- a/wpa_supplicant/ctrl_iface.c ++++ b/wpa_supplicant/ctrl_iface.c +@@ -685,6 +685,7 @@ static int wpa_supplicant_ctrl_iface_ibs + #endif /* CONFIG_IBSS_RSN */ + + ++#ifdef IEEE8021X_EAPOL + int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid, + const char *field, +@@ -750,6 +751,7 @@ int wpa_supplicant_ctrl_iface_ctrl_rsp_h + + return 0; + } ++#endif + + + static int wpa_supplicant_ctrl_iface_ctrl_rsp(struct wpa_supplicant *wpa_s, diff --git a/package/hostapd/patches/500-scan_wait.patch b/package/hostapd/patches/500-scan_wait.patch index d4c5938de2..4ca35537b6 100644 --- a/package/hostapd/patches/500-scan_wait.patch +++ b/package/hostapd/patches/500-scan_wait.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -229,6 +229,7 @@ struct hostapd_iface { +@@ -235,6 +235,7 @@ struct hostapd_iface { int (*for_each_interface)(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); @@ -10,7 +10,7 @@ /* hostapd.c */ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -807,6 +807,9 @@ int hostapd_setup_interface_complete(str +@@ -804,6 +804,9 @@ int hostapd_setup_interface_complete(str wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", iface->bss[0]->conf->iface); @@ -29,9 +29,9 @@ +static int daemonize = 0; +static char *pid_file = NULL; + extern struct wpa_driver_ops *wpa_drivers[]; - struct hapd_interfaces { -@@ -163,6 +165,16 @@ static void hostapd_logger_cb(void *ctx, +@@ -173,6 +175,16 @@ static void hostapd_logger_cb(void *ctx, } #endif /* CONFIG_NO_HOSTAPD_LOGGER */ @@ -48,7 +48,7 @@ /** * hostapd_init - Allocate and initialize per-interface data -@@ -184,6 +196,7 @@ static struct hostapd_iface * hostapd_in +@@ -194,6 +206,7 @@ static struct hostapd_iface * hostapd_in if (hapd_iface == NULL) goto fail; @@ -56,16 +56,16 @@ hapd_iface->reload_config = hostapd_reload_config; hapd_iface->config_read_cb = hostapd_config_read; hapd_iface->config_fname = os_strdup(config_file); -@@ -399,7 +412,7 @@ static int hostapd_global_init(struct ha +@@ -442,7 +455,7 @@ static int hostapd_global_init(struct ha } -static void hostapd_global_deinit(const char *pid_file) +static void hostapd_global_deinit(void) { - #ifdef EAP_SERVER_TNC - tncs_global_deinit(); -@@ -419,8 +432,7 @@ static void hostapd_global_deinit(const + int i; + +@@ -472,8 +485,7 @@ static void hostapd_global_deinit(const } @@ -75,7 +75,7 @@ { #ifdef EAP_SERVER_TNC int tnc = 0; -@@ -441,11 +453,6 @@ static int hostapd_global_run(struct hap +@@ -494,11 +506,6 @@ static int hostapd_global_run(struct hap } #endif /* EAP_SERVER_TNC */ @@ -87,7 +87,7 @@ eloop_run(); return 0; -@@ -501,8 +508,7 @@ int main(int argc, char *argv[]) +@@ -555,8 +562,7 @@ int main(int argc, char *argv[]) struct hapd_interfaces interfaces; int ret = 1; size_t i; @@ -95,9 +95,9 @@ - char *pid_file = NULL; + int c, debug = 0; const char *log_file = NULL; + const char *entropy_file = NULL; - if (os_program_init()) -@@ -576,7 +582,7 @@ int main(int argc, char *argv[]) +@@ -634,7 +640,7 @@ int main(int argc, char *argv[]) goto out; } @@ -106,7 +106,7 @@ goto out; ret = 0; -@@ -587,7 +593,7 @@ int main(int argc, char *argv[]) +@@ -645,7 +651,7 @@ int main(int argc, char *argv[]) hostapd_interface_deinit_free(interfaces.iface[i]); os_free(interfaces.iface); @@ -117,7 +117,7 @@ if (log_file) --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -1891,6 +1891,8 @@ struct hostapd_config * hostapd_config_r +@@ -1925,6 +1925,8 @@ struct hostapd_config * hostapd_config_r } #endif /* CONFIG_IEEE80211W */ #ifdef CONFIG_IEEE80211N @@ -128,7 +128,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -390,6 +390,7 @@ struct hostapd_config { +@@ -412,6 +412,7 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; @@ -138,7 +138,7 @@ int require_ht; --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c -@@ -463,7 +463,7 @@ static int ieee80211n_check_40mhz(struct +@@ -449,7 +449,7 @@ static int ieee80211n_check_40mhz(struct { struct wpa_driver_scan_params params; diff --git a/package/hostapd/patches/510-multicall.patch b/package/hostapd/patches/510-multicall.patch index 98d89f1095..99fb76c43e 100644 --- a/package/hostapd/patches/510-multicall.patch +++ b/package/hostapd/patches/510-multicall.patch @@ -8,7 +8,7 @@ ifndef CONFIG_OS ifdef CONFIG_NATIVE_WINDOWS -@@ -159,10 +160,14 @@ ifdef CONFIG_IEEE80211N +@@ -168,10 +169,14 @@ ifdef CONFIG_IEEE80211N CFLAGS += -DCONFIG_IEEE80211N endif @@ -26,7 +26,7 @@ LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -780,6 +785,12 @@ install: all +@@ -799,6 +804,12 @@ install: all BCHECK=../src/drivers/build.hostapd @@ -39,7 +39,7 @@ hostapd: $(BCHECK) $(OBJS) $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) @$(E) " LD " $@ -@@ -820,6 +831,12 @@ HOBJS += ../src/crypto/aes-internal.o +@@ -837,6 +848,12 @@ HOBJS += ../src/crypto/aes-internal.o HOBJS += ../src/crypto/aes-internal-enc.o endif @@ -54,15 +54,15 @@ @$(E) " LD " $@ --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -53,6 +53,7 @@ OBJS_c = wpa_cli.o ../src/common/wpa_ctr - OBJS_c += ../src/utils/wpa_debug.o +@@ -14,6 +14,7 @@ CFLAGS += -I../src + CFLAGS += -I../src/utils -include .config +-include $(if $(MULTICALL),../hostapd/.config) - ifndef CONFIG_OS - ifdef CONFIG_NATIVE_WINDOWS -@@ -634,6 +635,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS + ALL=wpa_supplicant wpa_cli + +@@ -663,6 +664,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS LIBS += -ldl -rdynamic endif @@ -73,7 +73,7 @@ endif ifdef CONFIG_AP -@@ -642,9 +647,11 @@ NEED_EAP_COMMON=y +@@ -671,9 +676,11 @@ NEED_EAP_COMMON=y NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_AP OBJS += ap.o @@ -85,7 +85,7 @@ OBJS += ../src/ap/hostapd.o OBJS += ../src/ap/wpa_auth_glue.o OBJS += ../src/ap/utils.o -@@ -688,10 +695,18 @@ CFLAGS += -DEAP_SERVER_WSC +@@ -718,10 +725,18 @@ CFLAGS += -DEAP_SERVER_WSC OBJS += ../src/ap/wps_hostapd.o OBJS += ../src/eap_server/eap_server_wsc.o endif @@ -104,7 +104,7 @@ NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -1352,6 +1367,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -1397,6 +1412,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) $(Q)$(LDO) $(LDFLAGS) -o wpa_priv $(OBJS_priv) $(LIBS) @$(E) " LD " $@ @@ -117,9 +117,9 @@ wpa_supplicant: .config $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -1412,6 +1433,12 @@ eap_ikev2.so: ../src/eap_peer/eap_ikev2. - $(Q)$(CC) -c -o $@ $(CFLAGS) $< - @$(E) " CC " $< +@@ -1460,6 +1481,12 @@ eap_ikev2.so: ../src/eap_peer/eap_ikev2. + %.service: %.service.in + sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ +dump_cflags: + @echo -n $(CFLAGS) " " @@ -132,7 +132,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -3199,8 +3199,8 @@ union wpa_event_data { +@@ -3452,8 +3452,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -145,7 +145,7 @@ /* --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -448,8 +448,8 @@ static void hostapd_event_eapol_rx(struc +@@ -467,8 +467,8 @@ static void hostapd_event_eapol_rx(struc } @@ -162,9 +162,9 @@ } --void wpa_supplicant_event(void *ctx, wpa_event_type event, +-void wpa_supplicant_event(void *ctx, enum wpa_event_type event, - union wpa_event_data *data) -+static void supplicant_event(void *ctx, wpa_event_type event, ++static void supplicant_event(void *ctx, enum wpa_event_type event, + union wpa_event_data *data) { struct wpa_priv_interface *iface = ctx; @@ -179,7 +179,7 @@ for (;;) { --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -1746,8 +1746,8 @@ static void wpa_supplicant_event_unprot_ +@@ -1936,8 +1936,8 @@ static void wnm_action_rx(struct wpa_sup } @@ -192,7 +192,7 @@ u16 reason_code = 0; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2314,6 +2314,9 @@ static void wpa_supplicant_deinit_iface( +@@ -2412,6 +2412,9 @@ static void wpa_supplicant_deinit_iface( wpa_drv_deinit(wpa_s); } @@ -202,7 +202,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -2497,6 +2500,7 @@ struct wpa_global * wpa_supplicant_init( +@@ -2602,6 +2605,7 @@ struct wpa_global * wpa_supplicant_init( wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ @@ -212,7 +212,7 @@ wpa_debug_open_syslog(); --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -502,6 +502,9 @@ static const char * hostapd_msg_ifname_c +@@ -556,6 +556,9 @@ static const char * hostapd_msg_ifname_c return NULL; } @@ -222,13 +222,13 @@ int main(int argc, char *argv[]) { -@@ -514,6 +517,7 @@ int main(int argc, char *argv[]) +@@ -569,6 +572,7 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; + wpa_supplicant_event = hostapd_wpa_event; for (;;) { - c = getopt(argc, argv, "Bdf:hKP:tv"); + c = getopt(argc, argv, "Bde:f:hKP:tv"); if (c < 0) --- a/src/drivers/drivers.c +++ b/src/drivers/drivers.c diff --git a/package/hostapd/patches/520-timestamp_check.patch b/package/hostapd/patches/520-timestamp_check.patch index 70ac63597c..058239e893 100644 --- a/package/hostapd/patches/520-timestamp_check.patch +++ b/package/hostapd/patches/520-timestamp_check.patch @@ -1,15 +1,12 @@ --- a/src/tls/x509v3.c +++ b/src/tls/x509v3.c -@@ -1854,8 +1854,11 @@ int x509_certificate_chain_validate(stru +@@ -1854,6 +1854,9 @@ int x509_certificate_chain_validate(stru if (chain_trusted) continue; -- if ((unsigned long) now.sec < -+ if ( -+#ifndef NO_TIMESTAMP_CHECK -+ (unsigned long) now.sec < - (unsigned long) cert->not_before || ++#ifdef NO_TIMESTAMP_CHECK ++ disable_time_checks = 1; +#endif - (unsigned long) now.sec > - (unsigned long) cert->not_after) { - wpa_printf(MSG_INFO, "X509: Certificate not valid " + if (!disable_time_checks && + ((unsigned long) now.sec < + (unsigned long) cert->not_before || diff --git a/package/hostapd/patches/530-rescan_immediately.patch b/package/hostapd/patches/530-rescan_immediately.patch index f916a7bf6d..b5d5e7aa02 100644 --- a/package/hostapd/patches/530-rescan_immediately.patch +++ b/package/hostapd/patches/530-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2070,7 +2070,7 @@ static struct wpa_supplicant * wpa_suppl +@@ -2157,7 +2157,7 @@ static struct wpa_supplicant * wpa_suppl if (wpa_s == NULL) return NULL; wpa_s->scan_req = 1; @@ -8,4 +8,4 @@ + wpa_s->scan_interval = 1; wpa_s->new_connection = 1; wpa_s->parent = wpa_s; - + wpa_s->sched_scanning = 0; diff --git a/package/hostapd/patches/540-optional_rfkill.patch b/package/hostapd/patches/540-optional_rfkill.patch index 1c15f6448d..028c160758 100644 --- a/package/hostapd/patches/540-optional_rfkill.patch +++ b/package/hostapd/patches/540-optional_rfkill.patch @@ -1,16 +1,16 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -129,7 +129,9 @@ struct wpa_driver_nl80211_data { - int ifindex; +@@ -198,7 +198,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; -@@ -1819,7 +1821,7 @@ err1: +@@ -2203,7 +2205,7 @@ err3: return -1; } @@ -19,7 +19,7 @@ static void wpa_driver_nl80211_rfkill_blocked(void *ctx) { wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked"); -@@ -1841,6 +1843,7 @@ static void wpa_driver_nl80211_rfkill_un +@@ -2226,6 +2228,7 @@ static void wpa_driver_nl80211_rfkill_un } /* rtnetlink ifup handler will report interface as enabled */ } @@ -27,25 +27,25 @@ static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv) -@@ -1889,7 +1892,9 @@ static void * wpa_driver_nl80211_init(vo +@@ -2283,7 +2286,9 @@ static void * wpa_driver_nl80211_init(vo + void *global_priv) { struct wpa_driver_nl80211_data *drv; - struct netlink_config *cfg; +#ifdef CONFIG_RFKILL struct rfkill_config *rcfg; +#endif struct i802_bss *bss; drv = os_zalloc(sizeof(*drv)); -@@ -1930,6 +1935,7 @@ static void * wpa_driver_nl80211_init(vo - goto failed; - } +@@ -2311,6 +2316,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; -@@ -1942,6 +1948,7 @@ static void * wpa_driver_nl80211_init(vo +@@ -2323,6 +2329,7 @@ static void * wpa_driver_nl80211_init(vo wpa_printf(MSG_DEBUG, "nl80211: RFKILL status not available"); os_free(rcfg); } @@ -53,17 +53,7 @@ if (wpa_driver_nl80211_finish_drv_init(drv)) goto failed; -@@ -1952,7 +1959,9 @@ static void * wpa_driver_nl80211_init(vo - return bss; - - failed: -+#ifdef CONFIG_RFKILL - rfkill_deinit(drv->rfkill); -+#endif - netlink_deinit(drv->netlink); - if (drv->ioctl_sock >= 0) - close(drv->ioctl_sock); -@@ -2055,10 +2064,12 @@ static int nl80211_register_action_frame +@@ -2445,10 +2452,12 @@ static int nl80211_register_action_frame } @@ -76,10 +66,10 @@ static int -@@ -2077,13 +2088,16 @@ wpa_driver_nl80211_finish_drv_init(struc +@@ -2475,13 +2484,16 @@ wpa_driver_nl80211_finish_drv_init(struc } - if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { + 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 " @@ -94,7 +84,7 @@ wpa_printf(MSG_ERROR, "nl80211: Could not set " "interface '%s' UP", bss->ifname); return -1; -@@ -2111,8 +2125,10 @@ wpa_driver_nl80211_finish_drv_init(struc +@@ -2510,8 +2522,10 @@ wpa_driver_nl80211_finish_drv_init(struc } if (send_rfkill_event) { @@ -105,26 +95,16 @@ } return 0; -@@ -2193,7 +2209,9 @@ static void wpa_driver_nl80211_deinit(vo +@@ -2596,7 +2610,9 @@ static void wpa_driver_nl80211_deinit(vo - netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP); - netlink_deinit(drv->netlink); + 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); -@@ -5785,7 +5803,9 @@ static void *i802_init(struct hostapd_da - - failed: - nl80211_remove_monitor_interface(drv); -+#ifdef CONFIG_RFKILL - rfkill_deinit(drv->rfkill); -+#endif - netlink_deinit(drv->netlink); - if (drv->ioctl_sock >= 0) - close(drv->ioctl_sock); --- a/src/drivers/driver_wext.c +++ b/src/drivers/driver_wext.c @@ -702,7 +702,7 @@ static void wpa_driver_wext_event_rtm_de diff --git a/package/hostapd/patches/550-reload_freq_change.patch b/package/hostapd/patches/550-reload_freq_change.patch index ce9c1bf019..046f7ccc65 100644 --- a/package/hostapd/patches/550-reload_freq_change.patch +++ b/package/hostapd/patches/550-reload_freq_change.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -120,6 +120,10 @@ int hostapd_reload_config(struct hostapd +@@ -124,6 +124,10 @@ int hostapd_reload_config(struct hostapd oldconf = hapd->iconf; iface->conf = newconf; diff --git a/package/hostapd/patches/551-nl80211_del_beacon_bss.patch b/package/hostapd/patches/551-nl80211_del_beacon_bss.patch index e40c8678d0..3728bedd67 100644 --- a/package/hostapd/patches/551-nl80211_del_beacon_bss.patch +++ b/package/hostapd/patches/551-nl80211_del_beacon_bss.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -2135,23 +2135,43 @@ wpa_driver_nl80211_finish_drv_init(struc +@@ -2532,22 +2532,41 @@ wpa_driver_nl80211_finish_drv_init(struc } @@ -11,13 +11,11 @@ struct nl_msg *msg; + bss->beacon_set = 0; -+ msg = nlmsg_alloc(); if (!msg) return -ENOMEM; - genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, - 0, NL80211_CMD_DEL_BEACON, 0); + 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); @@ -46,18 +44,18 @@ /** * wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface -@@ -6658,4 +6678,5 @@ const struct wpa_driver_ops wpa_driver_n - .set_intra_bss = nl80211_set_intra_bss, - .set_param = nl80211_set_param, - .get_radio_name = nl80211_get_radio_name, +@@ -7654,4 +7673,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 -@@ -2253,6 +2253,8 @@ struct wpa_driver_ops { - * implementation, there is no need to implement this function. +@@ -2452,6 +2452,8 @@ struct wpa_driver_ops { */ - int (*set_authmode)(void *priv, int authmode); + void (*poll_client)(void *priv, const u8 *own_addr, + const u8 *addr, int qos); + + int (*stop_ap)(void *priv); }; diff --git a/package/hostapd/patches/552-ctrl_iface_reload.patch b/package/hostapd/patches/552-ctrl_iface_reload.patch index a780f7dca9..00d2e77522 100644 --- a/package/hostapd/patches/552-ctrl_iface_reload.patch +++ b/package/hostapd/patches/552-ctrl_iface_reload.patch @@ -83,7 +83,7 @@ #ifdef CONFIG_IEEE80211W #ifdef NEED_AP_MLME -@@ -822,6 +884,10 @@ static void hostapd_ctrl_iface_receive(i +@@ -873,6 +935,10 @@ static void hostapd_ctrl_iface_receive(i reply_len += res; } #endif /* CONFIG_NO_RADIUS */ diff --git a/package/hostapd/patches/553-ap_sta_support.patch b/package/hostapd/patches/553-ap_sta_support.patch index dfc24c42c4..6053ee25d2 100644 --- a/package/hostapd/patches/553-ap_sta_support.patch +++ b/package/hostapd/patches/553-ap_sta_support.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h -@@ -99,6 +99,8 @@ struct wpa_interface { +@@ -100,6 +100,8 @@ struct wpa_interface { * receiving of EAPOL frames from an additional interface. */ const char *bridge_ifname; @@ -9,7 +9,7 @@ }; /** -@@ -337,6 +339,8 @@ struct wpa_supplicant { +@@ -260,6 +262,8 @@ struct wpa_supplicant { #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ char bridge_ifname[16]; @@ -20,21 +20,31 @@ int countermeasures; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -52,6 +52,11 @@ OBJS_p += ../src/utils/wpabuf.o - OBJS_c = wpa_cli.o ../src/common/wpa_ctrl.o - OBJS_c += ../src/utils/wpa_debug.o +@@ -13,6 +13,10 @@ PKG_CONFIG ?= pkg-config + CFLAGS += -I../src + CFLAGS += -I../src/utils +ifdef MULTICALL -+OBJS += ../src/common/wpa_ctrl.o +CFLAGS += -DMULTICALL +endif + -include .config -include $(if $(MULTICALL),../hostapd/.config) +@@ -69,6 +73,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 -@@ -123,6 +123,55 @@ extern int wpa_debug_show_keys; +@@ -125,6 +125,55 @@ extern int wpa_debug_show_keys; extern int wpa_debug_timestamp; extern struct wpa_driver_ops *wpa_drivers[]; @@ -90,7 +100,7 @@ /* Configure default/group WEP keys for static WEP */ int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { -@@ -598,8 +647,16 @@ void wpa_supplicant_set_state(struct wpa +@@ -632,8 +681,16 @@ void wpa_supplicant_set_state(struct wpa #ifdef CONFIG_P2P wpas_p2p_completed(wpa_s); #endif /* CONFIG_P2P */ @@ -107,7 +117,7 @@ wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -2157,6 +2214,21 @@ static int wpa_supplicant_init_iface(str +@@ -2245,6 +2302,21 @@ static int wpa_supplicant_init_iface(str os_strlcpy(wpa_s->bridge_ifname, iface->bridge_ifname, sizeof(wpa_s->bridge_ifname)); } @@ -139,7 +149,7 @@ #include "drivers/driver.h" #include "wpa_supplicant_i.h" #include "config.h" -@@ -70,6 +71,8 @@ struct wpa_bss * wpa_bss_get(struct wpa_ +@@ -79,6 +80,8 @@ struct wpa_bss * wpa_bss_get(struct wpa_ static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src) { @@ -148,7 +158,7 @@ os_time_t usec; dst->flags = src->flags; -@@ -82,6 +85,12 @@ static void wpa_bss_copy_res(struct wpa_ +@@ -91,6 +94,12 @@ static void wpa_bss_copy_res(struct wpa_ dst->level = src->level; dst->tsf = src->tsf; @@ -163,7 +173,7 @@ usec = (src->age % 1000) * 1000; --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h -@@ -56,6 +56,7 @@ struct wpa_bss { +@@ -57,6 +57,7 @@ struct wpa_bss { unsigned int flags; u8 bssid[ETH_ALEN]; u8 ssid[32]; @@ -180,9 +190,9 @@ - " -i -c [-C] [-D] " + " -i -c [-C] [-D] [-H]" "[-p] \\\n" - " [-b] [-f] \\\n" - " [-o] [-O] \\\n" -@@ -67,6 +67,7 @@ static void usage(void) + " [-b] [-f] [-e] " + "\\\n" +@@ -69,6 +69,7 @@ static void usage(void) #endif /* CONFIG_DEBUG_SYSLOG */ printf(" -t = include timestamp in debug messages\n" " -h = show this help text\n" @@ -190,16 +200,16 @@ " -L = show license (GPL and BSD)\n" " -o = override driver parameter for new interfaces\n" " -O = override ctrl_interface parameter for new interfaces\n" -@@ -143,7 +144,7 @@ int main(int argc, char *argv[]) +@@ -145,7 +146,7 @@ int main(int argc, char *argv[]) wpa_supplicant_fd_workaround(); for (;;) { -- c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNo:O:p:P:qstuvW"); -+ c = getopt(argc, argv, "b:Bc:C:D:df:g:hH:i:KLNo:O:p:P:qstuvW"); +- c = getopt(argc, argv, "b:Bc:C:D:de:f:g:hi:KLNo:O:p:P:qstuvW"); ++ c = getopt(argc, argv, "b:Bc:C:D:de:f:g:hH:i:KLNo:O:p:P:qstuvW"); if (c < 0) break; switch (c) { -@@ -184,6 +185,9 @@ int main(int argc, char *argv[]) +@@ -189,6 +190,9 @@ int main(int argc, char *argv[]) usage(); exitcode = 0; goto out; diff --git a/package/hostapd/patches/560-disable_ctrl_iface_mib.patch b/package/hostapd/patches/560-disable_ctrl_iface_mib.patch index 77352f1324..22f282ab5b 100644 --- a/package/hostapd/patches/560-disable_ctrl_iface_mib.patch +++ b/package/hostapd/patches/560-disable_ctrl_iface_mib.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -119,6 +119,9 @@ endif +@@ -128,6 +128,9 @@ endif ifdef CONFIG_NO_CTRL_IFACE CFLAGS += -DCONFIG_NO_CTRL_IFACE else @@ -12,7 +12,7 @@ endif --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -855,6 +855,7 @@ static void hostapd_ctrl_iface_receive(i +@@ -906,6 +906,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; @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -884,10 +885,12 @@ static void hostapd_ctrl_iface_receive(i +@@ -935,10 +936,12 @@ static void hostapd_ctrl_iface_receive(i reply_len += res; } #endif /* CONFIG_NO_RADIUS */ @@ -33,7 +33,7 @@ } else if (os_strcmp(buf, "STA-FIRST") == 0) { reply_len = hostapd_ctrl_iface_sta_first(hapd, reply, reply_size); -@@ -897,6 +900,7 @@ static void hostapd_ctrl_iface_receive(i +@@ -948,6 +951,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); @@ -43,7 +43,7 @@ reply_len = -1; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -675,6 +675,9 @@ ifdef CONFIG_IEEE80211N +@@ -709,6 +709,9 @@ ifdef CONFIG_IEEE80211N OBJS += ../src/ap/ieee802_11_ht.o endif ifdef CONFIG_CTRL_IFACE @@ -55,7 +55,7 @@ --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -2929,6 +2929,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -3231,6 +3231,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); @@ -63,7 +63,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -2940,6 +2941,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -3242,6 +3243,7 @@ char * wpa_supplicant_ctrl_iface_process else reply_len += res; } @@ -71,7 +71,7 @@ } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -3245,6 +3247,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -3570,6 +3572,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -79,7 +79,7 @@ } 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) { -@@ -3253,6 +3256,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -3578,6 +3581,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); @@ -105,7 +105,7 @@ +#endif --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -1896,6 +1896,7 @@ static const char * bool_txt(Boolean boo +@@ -1926,6 +1926,7 @@ static const char * bool_txt(Boolean boo return bool ? "TRUE" : "FALSE"; } @@ -113,7 +113,7 @@ int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -2047,6 +2048,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -2078,6 +2079,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -123,7 +123,7 @@ struct sta_info *sta, int success) --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c -@@ -2491,6 +2491,7 @@ static int wpa_cipher_bits(int cipher) +@@ -2534,6 +2534,7 @@ static int wpa_cipher_bits(int cipher) } } @@ -131,7 +131,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -2654,7 +2655,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -2697,7 +2698,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -142,7 +142,7 @@ { --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -1913,6 +1913,8 @@ static u32 wpa_cipher_suite(struct wpa_s +@@ -1919,6 +1919,8 @@ static u32 wpa_cipher_suite(struct wpa_s } @@ -151,7 +151,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -1992,6 +1994,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch +@@ -1998,6 +2000,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch return (int) len; } diff --git a/package/hostapd/patches/570-wpa_ie_cap_workaround.patch b/package/hostapd/patches/570-wpa_ie_cap_workaround.patch index a7697cfcb5..00a32229d4 100644 --- a/package/hostapd/patches/570-wpa_ie_cap_workaround.patch +++ b/package/hostapd/patches/570-wpa_ie_cap_workaround.patch @@ -1,6 +1,6 @@ --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c -@@ -811,6 +811,31 @@ const char * wpa_key_mgmt_txt(int key_mg +@@ -959,6 +959,31 @@ const char * wpa_key_mgmt_txt(int key_mg } @@ -32,7 +32,7 @@ int wpa_compare_rsn_ie(int ft_initial_assoc, const u8 *ie1, size_t ie1len, const u8 *ie2, size_t ie2len) -@@ -818,8 +843,19 @@ int wpa_compare_rsn_ie(int ft_initial_as +@@ -966,8 +991,19 @@ int wpa_compare_rsn_ie(int ft_initial_as if (ie1 == NULL || ie2 == NULL) return -1; diff --git a/package/hostapd/patches/600-terminate_on_setup_failure.patch b/package/hostapd/patches/600-terminate_on_setup_failure.patch index f94684cd6b..25879548e4 100644 --- a/package/hostapd/patches/600-terminate_on_setup_failure.patch +++ b/package/hostapd/patches/600-terminate_on_setup_failure.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -723,11 +723,8 @@ int hostapd_setup_interface_complete(str +@@ -720,11 +720,8 @@ int hostapd_setup_interface_complete(str size_t j; u8 *prev_addr; @@ -14,7 +14,7 @@ wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (hapd->iconf->channel) { -@@ -743,7 +740,7 @@ int hostapd_setup_interface_complete(str +@@ -740,7 +737,7 @@ int hostapd_setup_interface_complete(str hapd->iconf->secondary_channel)) { wpa_printf(MSG_ERROR, "Could not set channel for " "kernel driver"); @@ -23,7 +23,7 @@ } } -@@ -754,7 +751,7 @@ int hostapd_setup_interface_complete(str +@@ -751,7 +748,7 @@ int hostapd_setup_interface_complete(str hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_WARNING, "Failed to prepare rates table."); @@ -32,7 +32,7 @@ } } -@@ -762,14 +759,14 @@ int hostapd_setup_interface_complete(str +@@ -759,14 +756,14 @@ int hostapd_setup_interface_complete(str hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) { wpa_printf(MSG_ERROR, "Could not set RTS threshold for " "kernel driver"); @@ -49,7 +49,7 @@ } prev_addr = hapd->own_addr; -@@ -779,7 +776,7 @@ int hostapd_setup_interface_complete(str +@@ -776,7 +773,7 @@ int hostapd_setup_interface_complete(str if (j) os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN); if (hostapd_setup_bss(hapd, j == 0)) @@ -58,7 +58,7 @@ if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0) prev_addr = hapd->own_addr; } -@@ -791,7 +788,7 @@ int hostapd_setup_interface_complete(str +@@ -788,7 +785,7 @@ int hostapd_setup_interface_complete(str if (hostapd_driver_commit(hapd) < 0) { wpa_printf(MSG_ERROR, "%s: Failed to commit driver " "configuration", __func__); @@ -67,7 +67,7 @@ } /* -@@ -815,6 +812,11 @@ int hostapd_setup_interface_complete(str +@@ -812,6 +809,11 @@ int hostapd_setup_interface_complete(str iface->init_complete(iface); return 0; diff --git a/package/hostapd/patches/700-random_pool_add_kernel.patch b/package/hostapd/patches/700-random_pool_add_kernel.patch index bf95848eeb..1a30a0266e 100644 --- a/package/hostapd/patches/700-random_pool_add_kernel.patch +++ b/package/hostapd/patches/700-random_pool_add_kernel.patch @@ -18,7 +18,7 @@ static u32 pool[POOL_WORDS]; static unsigned int input_rotate = 0; static unsigned int pool_pos = 0; -@@ -122,7 +126,7 @@ static void random_extract(u8 *out) +@@ -128,7 +132,7 @@ static void random_extract(u8 *out) } @@ -27,7 +27,7 @@ { struct os_time t; static unsigned int count = 0; -@@ -191,16 +195,22 @@ int random_get_bytes(void *buf, size_t l +@@ -197,16 +201,22 @@ int random_get_bytes(void *buf, size_t l int random_pool_ready(void) { #ifdef __linux__ @@ -51,19 +51,15 @@ /* * Try to fetch some more data from the kernel high quality -@@ -232,8 +242,10 @@ int random_pool_ready(void) - dummy_key_avail += res; - close(fd); - -- if (dummy_key_avail == sizeof(dummy_key)) -+ if (dummy_key_avail == sizeof(dummy_key)) { +@@ -241,6 +251,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; -+ } - - wpa_printf(MSG_INFO, "random: Only %u/%u bytes of strong " - "random data available from /dev/random", -@@ -243,6 +255,7 @@ int random_pool_ready(void) + } +@@ -253,6 +264,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"); @@ -71,7 +67,7 @@ return 1; } -@@ -258,9 +271,15 @@ int random_pool_ready(void) +@@ -268,10 +280,16 @@ int random_pool_ready(void) void random_mark_pool_ready(void) { @@ -80,6 +76,7 @@ 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) @@ -87,9 +84,9 @@ } -@@ -335,3 +354,22 @@ void random_deinit(void) - random_close_fd(); - #endif /* __linux__ */ +@@ -428,3 +446,22 @@ void random_deinit(void) + os_free(random_entropy_file); + random_entropy_file = NULL; } + +#endif /* CONFIG_NO_RANDOM_POOL */ @@ -110,25 +107,9 @@ + random_pool_add_randomness(buf, len); +#endif +} ---- a/hostapd/Makefile -+++ b/hostapd/Makefile -@@ -698,11 +698,11 @@ endif - ifdef CONFIG_NO_RANDOM_POOL - CFLAGS += -DCONFIG_NO_RANDOM_POOL - else --OBJS += ../src/crypto/random.o --HOBJS += ../src/crypto/random.o - HOBJS += $(SHA1OBJS) - HOBJS += ../src/crypto/md5.o - endif -+OBJS += ../src/crypto/random.o -+HOBJS += ../src/crypto/random.o - - ifdef CONFIG_RADIUS_SERVER - CFLAGS += -DRADIUS_SERVER --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -1101,9 +1101,8 @@ endif +@@ -1137,9 +1137,8 @@ endif ifdef CONFIG_NO_RANDOM_POOL CFLAGS += -DCONFIG_NO_RANDOM_POOL @@ -141,7 +122,7 @@ ifeq ($(CONFIG_CTRL_IFACE), y) --- a/wpa_supplicant/Android.mk +++ b/wpa_supplicant/Android.mk -@@ -1109,9 +1109,8 @@ endif +@@ -1132,9 +1132,8 @@ endif ifdef CONFIG_NO_RANDOM_POOL L_CFLAGS += -DCONFIG_NO_RANDOM_POOL @@ -154,7 +135,7 @@ ifeq ($(CONFIG_CTRL_IFACE), y) --- a/hostapd/Android.mk +++ b/hostapd/Android.mk -@@ -717,11 +717,11 @@ endif +@@ -720,11 +720,11 @@ endif ifdef CONFIG_NO_RANDOM_POOL L_CFLAGS += -DCONFIG_NO_RANDOM_POOL else @@ -168,24 +149,20 @@ ifdef CONFIG_RADIUS_SERVER L_CFLAGS += -DRADIUS_SERVER ---- a/src/crypto/random.h -+++ b/src/crypto/random.h -@@ -18,17 +18,16 @@ - #ifdef CONFIG_NO_RANDOM_POOL - #define random_init() do { } while (0) - #define random_deinit() do { } while (0) --#define random_add_randomness(b, l) do { } while (0) - #define random_get_bytes(b, l) os_get_random((b), (l)) - #define random_pool_ready() 1 - #define random_mark_pool_ready() do { } while (0) - #else /* CONFIG_NO_RANDOM_POOL */ - void random_init(void); - void random_deinit(void); --void random_add_randomness(const void *buf, size_t len); - int random_get_bytes(void *buf, size_t len); - int random_pool_ready(void); - void random_mark_pool_ready(void); - #endif /* CONFIG_NO_RANDOM_POOL */ -+void random_add_randomness(const void *buf, size_t len); - - #endif /* RANDOM_H */ +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -707,12 +707,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/hostapd/patches/710-bring_down_interface.patch b/package/hostapd/patches/710-bring_down_interface.patch index 270a6438d8..4f3bc55297 100644 --- a/package/hostapd/patches/710-bring_down_interface.patch +++ b/package/hostapd/patches/710-bring_down_interface.patch @@ -1,21 +1,19 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5005,9 +5005,6 @@ static int wpa_driver_nl80211_set_mode(v - /* Try to set the mode again while the interface is - * down */ +@@ -5867,8 +5867,6 @@ static int wpa_driver_nl80211_set_mode(s ret = nl80211_set_mode(drv, drv->ifindex, nlmode); -- if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, -- 1)) -- ret = -1; - if (!ret) + if (ret == -EACCES) break; - } else -@@ -5020,6 +5017,8 @@ static int wpa_driver_nl80211_set_mode(v - wpa_printf(MSG_DEBUG, "nl80211: Mode change succeeded while " +- res = linux_set_iface_flags(drv->global->ioctl_sock, +- bss->ifname, 1); + if (res && !ret) + ret = -1; + else if (ret != -EBUSY) +@@ -5884,6 +5882,7 @@ static int wpa_driver_nl80211_set_mode(s "interface is down"); drv->nlmode = nlmode; -+ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) -+ ret = -1; + drv->ignore_if_down_event = 1; ++ linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1); } done: diff --git a/package/hostapd/patches/730-fix_wds_bridge_handling.patch b/package/hostapd/patches/730-fix_wds_bridge_handling.patch deleted file mode 100644 index 850988d1ab..0000000000 --- a/package/hostapd/patches/730-fix_wds_bridge_handling.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -5660,6 +5660,9 @@ static int i802_set_wds_sta(void *priv, - linux_set_iface_flags(drv->ioctl_sock, name, 1); - return i802_set_sta_vlan(priv, addr, name, 0); - } else { -+ if (bridge_ifname) -+ linux_br_del_if(drv->ioctl_sock, bridge_ifname, name); -+ - i802_set_sta_vlan(priv, addr, bss->ifname, 0); - return wpa_driver_nl80211_if_remove(priv, WPA_IF_AP_VLAN, - name); -@@ -6021,14 +6024,14 @@ static int wpa_driver_nl80211_if_remove( - return -1; - - #ifdef HOSTAPD -- if (bss->added_if_into_bridge) { -+ if (type == WPA_IF_AP_BSS && bss->added_if_into_bridge) { - if (linux_br_del_if(drv->ioctl_sock, bss->brname, bss->ifname) - < 0) - wpa_printf(MSG_INFO, "nl80211: Failed to remove " - "interface %s from bridge %s: %s", - bss->ifname, bss->brname, strerror(errno)); - } -- if (bss->added_bridge) { -+ if (type == WPA_IF_AP_BSS && bss->added_bridge) { - if (linux_br_del(drv->ioctl_sock, bss->brname) < 0) - wpa_printf(MSG_INFO, "nl80211: Failed to remove " - "bridge %s: %s", diff --git a/package/hostapd/patches/730-wps_single_auth_enc_type.patch b/package/hostapd/patches/730-wps_single_auth_enc_type.patch new file mode 100644 index 0000000000..1381e72b7c --- /dev/null +++ b/package/hostapd/patches/730-wps_single_auth_enc_type.patch @@ -0,0 +1,25 @@ +--- a/src/ap/wps_hostapd.c ++++ b/src/ap/wps_hostapd.c +@@ -799,11 +799,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) +@@ -811,7 +809,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/hostapd/patches/740-group_key_timeout.patch b/package/hostapd/patches/740-group_key_timeout.patch new file mode 100644 index 0000000000..694b0661fb --- /dev/null +++ b/package/hostapd/patches/740-group_key_timeout.patch @@ -0,0 +1,11 @@ +--- a/src/ap/wpa_auth.c ++++ b/src/ap/wpa_auth.c +@@ -1330,7 +1330,7 @@ static void wpa_send_eapol(struct wpa_au + keyidx, encr, 0); + + ctr = pairwise ? sm->TimeoutCtr : sm->GTimeoutCtr; +- if (ctr == 1 && wpa_auth->conf.tx_status) ++ if (ctr == 1 && wpa_auth->conf.tx_status && pairwise) + timeout_ms = eapol_key_timeout_first; + else + timeout_ms = eapol_key_timeout_subseq; diff --git a/package/hostapd/patches/740-process_assoc_resp_tx_status.patch b/package/hostapd/patches/740-process_assoc_resp_tx_status.patch deleted file mode 100644 index a0d9a0ffcb..0000000000 --- a/package/hostapd/patches/740-process_assoc_resp_tx_status.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/src/ap/ieee802_11.c -+++ b/src/ap/ieee802_11.c -@@ -1629,13 +1629,6 @@ static void handle_assoc_cb(struct hosta - int new_assoc = 1; - struct ieee80211_ht_capabilities ht_cap; - -- if (!ok) { -- hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, -- HOSTAPD_LEVEL_DEBUG, -- "did not acknowledge association response"); -- return; -- } -- - if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_resp) : - sizeof(mgmt->u.assoc_resp))) { - printf("handle_assoc_cb(reassoc=%d) - too short payload " -@@ -1643,11 +1636,6 @@ static void handle_assoc_cb(struct hosta - return; - } - -- if (reassoc) -- status = le_to_host16(mgmt->u.reassoc_resp.status_code); -- else -- status = le_to_host16(mgmt->u.assoc_resp.status_code); -- - sta = ap_get_sta(hapd, mgmt->da); - if (!sta) { - printf("handle_assoc_cb: STA " MACSTR " not found\n", -@@ -1655,6 +1643,19 @@ static void handle_assoc_cb(struct hosta - return; - } - -+ if (!ok) { -+ hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_DEBUG, -+ "did not acknowledge association response"); -+ sta->flags &= ~WLAN_STA_ASSOC_REQ_OK; -+ return; -+ } -+ -+ if (reassoc) -+ status = le_to_host16(mgmt->u.reassoc_resp.status_code); -+ else -+ status = le_to_host16(mgmt->u.assoc_resp.status_code); -+ - if (status != WLAN_STATUS_SUCCESS) - goto fail; - diff --git a/package/hostapd/patches/750-dynamic_20_40_mhz.patch b/package/hostapd/patches/750-dynamic_20_40_mhz.patch new file mode 100644 index 0000000000..5585951dd0 --- /dev/null +++ b/package/hostapd/patches/750-dynamic_20_40_mhz.patch @@ -0,0 +1,202 @@ +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -1935,6 +1935,10 @@ struct hostapd_config * hostapd_config_r + "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 +@@ -416,6 +416,7 @@ struct hostapd_config { + int ieee80211n; + int secondary_channel; + int require_ht; ++ int dynamic_ht40; + }; + + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -27,6 +27,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" +@@ -291,6 +292,7 @@ static void hostapd_cleanup_iface_pre(st + */ + static void hostapd_cleanup_iface(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 +@@ -226,6 +226,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 +@@ -1193,6 +1193,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 +@@ -77,4 +77,17 @@ u8 * hostapd_eid_time_zone(struct hostap + int hostapd_update_time_adv(struct hostapd_data *hapd); + void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr); + ++#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); + +@@ -271,3 +276,80 @@ 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, ++ secondary_channel)) { ++ 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/hostapd/patches/750-wps_single_auth_enc_type.patch b/package/hostapd/patches/750-wps_single_auth_enc_type.patch deleted file mode 100644 index 4925e9c7fb..0000000000 --- a/package/hostapd/patches/750-wps_single_auth_enc_type.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/src/ap/wps_hostapd.c -+++ b/src/ap/wps_hostapd.c -@@ -773,11 +773,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) -@@ -785,7 +783,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/hostapd/patches/760-eapol_qos_high_priority.patch b/package/hostapd/patches/760-eapol_qos_high_priority.patch deleted file mode 100644 index 9b1fcbf197..0000000000 --- a/package/hostapd/patches/760-eapol_qos_high_priority.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -4413,8 +4413,8 @@ static int wpa_driver_nl80211_hapd_send_ - pos = (u8 *) (hdr + 1); - - if (qos) { -- /* add an empty QoS header if needed */ -- pos[0] = 0; -+ /* Set highest priority in QoS header */ -+ pos[0] = 7; - pos[1] = 0; - pos += 2; - } diff --git a/package/hostapd/patches/770-group_key_timeout.patch b/package/hostapd/patches/770-group_key_timeout.patch deleted file mode 100644 index a41a89bed6..0000000000 --- a/package/hostapd/patches/770-group_key_timeout.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/ap/wpa_auth.c -+++ b/src/ap/wpa_auth.c -@@ -1288,7 +1288,7 @@ static void wpa_send_eapol(struct wpa_au - keyidx, encr, 0); - - ctr = pairwise ? sm->TimeoutCtr : sm->GTimeoutCtr; -- if (ctr == 1 && wpa_auth->conf.tx_status) -+ if (ctr == 1 && wpa_auth->conf.tx_status && pairwise) - timeout_ms = eapol_key_timeout_first; - else - timeout_ms = eapol_key_timeout_subseq; diff --git a/package/hostapd/patches/780-wds_addr_fix.patch b/package/hostapd/patches/780-wds_addr_fix.patch deleted file mode 100644 index 4c91d03a52..0000000000 --- a/package/hostapd/patches/780-wds_addr_fix.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -111,6 +111,7 @@ struct i802_bss { - struct wpa_driver_nl80211_data *drv; - struct i802_bss *next; - int ifindex; -+ u8 addr[ETH_ALEN]; - char ifname[IFNAMSIZ + 1]; - char brname[IFNAMSIZ]; - unsigned int beacon_set:1; -@@ -121,7 +122,6 @@ struct i802_bss { - struct wpa_driver_nl80211_data { - struct nl80211_global *global; - struct dl_list list; -- u8 addr[ETH_ALEN]; - char phyname[32]; - void *ctx; - struct netlink_data *netlink; -@@ -2111,7 +2111,7 @@ wpa_driver_nl80211_finish_drv_init(struc - if (wpa_driver_nl80211_capa(drv)) - return -1; - -- if (linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, drv->addr)) -+ if (linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, bss->addr)) - return -1; - - if (nl80211_register_action_frames(drv) < 0) { -@@ -5650,7 +5650,7 @@ static int i802_set_wds_sta(void *priv, - if (!if_nametoindex(name)) { - if (nl80211_create_iface(drv, name, - NL80211_IFTYPE_AP_VLAN, -- NULL, 1) < 0) -+ bss->addr, 1) < 0) - return -1; - if (bridge_ifname && - linux_br_add_if(drv->ioctl_sock, bridge_ifname, -@@ -5878,7 +5878,7 @@ static int nl80211_addr_in_use(struct nl - struct wpa_driver_nl80211_data *drv; - dl_list_for_each(drv, &global->interfaces, - struct wpa_driver_nl80211_data, list) { -- if (os_memcmp(addr, drv->addr, ETH_ALEN) == 0) -+ if (os_memcmp(addr, drv->first_bss.addr, ETH_ALEN) == 0) - return 1; - } - return 0; -@@ -5893,9 +5893,9 @@ static int nl80211_p2p_interface_addr(st - if (!drv->global) - return -1; - -- os_memcpy(new_addr, drv->addr, ETH_ALEN); -+ os_memcpy(new_addr, drv->first_bss.addr, ETH_ALEN); - for (idx = 0; idx < 64; idx++) { -- new_addr[0] = drv->addr[0] | 0x02; -+ new_addr[0] = drv->first_bss.addr[0] | 0x02; - new_addr[0] ^= idx << 2; - if (!nl80211_addr_in_use(drv->global, new_addr)) - break; -@@ -5996,6 +5996,7 @@ static int wpa_driver_nl80211_if_add(voi - os_free(new_bss); - return -1; - } -+ memcpy(new_bss->addr, addr ? addr : if_addr, ETH_ALEN); - os_strlcpy(new_bss->ifname, ifname, IFNAMSIZ); - new_bss->ifindex = ifidx; - new_bss->drv = drv; diff --git a/package/hostapd/patches/800-dynamic_20_40_mhz.patch b/package/hostapd/patches/800-dynamic_20_40_mhz.patch deleted file mode 100644 index a870e8ed39..0000000000 --- a/package/hostapd/patches/800-dynamic_20_40_mhz.patch +++ /dev/null @@ -1,202 +0,0 @@ ---- a/hostapd/config_file.c -+++ b/hostapd/config_file.c -@@ -1901,6 +1901,10 @@ struct hostapd_config * hostapd_config_r - "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 -@@ -394,6 +394,7 @@ struct hostapd_config { - int ieee80211n; - int secondary_channel; - int require_ht; -+ int dynamic_ht40; - }; - - ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -27,6 +27,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" -@@ -285,6 +286,7 @@ static void hostapd_cleanup_iface_pre(st - */ - static void hostapd_cleanup_iface(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 -@@ -220,6 +220,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 -@@ -1242,6 +1242,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 -@@ -65,4 +65,17 @@ void hostapd_tx_status(struct hostapd_da - void ieee802_11_rx_from_unknown(struct hostapd_data *hapd, const u8 *src, - int wds); - -+#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); - -@@ -265,3 +270,80 @@ 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, -+ secondary_channel)) { -+ 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); -+}