From: Daniel Golle Date: Sat, 28 Apr 2018 19:12:19 +0000 (+0200) Subject: hostapd: update to git HEAD of 2018-05-21, allow build against wolfssl X-Git-Tag: v18.06.2~249 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a35f24309021c1c0e9cbed0faedf58b941cb4bd3;p=oweals%2Fopenwrt.git hostapd: update to git HEAD of 2018-05-21, allow build against wolfssl Support for building wpa_supplicant/hostapd against wolfssl has been added upstream recently, add build option to allow users using it. Signed-off-by: Daniel Golle (backported from 69f544937f8498e856690f9809a016f0d7f5f68b) (rebased patches) Signed-off-by: Jo-Philipp Wich --- diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index fea5ed3ba3..ba0b235990 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -1,7 +1,7 @@ # wpa_supplicant config config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK bool "Disable timestamp check" - depends on PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mesh || PACKAGE_wpa-supplicant-mini || PACKAGE_wpad || PACKAGE_wpad-mini || PACAKGE_wpad-mesh + depends on PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mesh || PACKAGE_wpa-supplicant-mini || PACKAGE_wpad || PACKAGE_wpad-mini || PACKAGE_wpad-mesh default n help This disables the timestamp check for certificates in wpa_supplicant @@ -10,15 +10,30 @@ config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK choice prompt "Choose TLS provider" default WPA_SUPPLICANT_INTERNAL - depends on PACKAGE_wpa-supplicant || PACKAGE_wpad + depends on PACKAGE_wpa-supplicant || PACKAGE_wpad || PACKAGE_wpad-mesh config WPA_SUPPLICANT_INTERNAL bool "internal" + depends on PACKAGE_wpa-supplicant || PACKAGE_wpad config WPA_SUPPLICANT_OPENSSL bool "openssl" select PACKAGE_libopenssl +config WPA_SUPPLICANT_WOLFSSL + bool "wolfssl" + select PACKAGE_libwolfssl + select WOLFSSL_HAS_AES_CCM + select WOLFSSL_HAS_AES_GCM + select WOLFSSL_HAS_ARC4 + select WOLFSSL_HAS_DES3 + select WOLFSSL_HAS_DH + select WOLFSSL_HAS_ECC + select WOLFSSL_HAS_OCSP + select WOLFSSL_HAS_PSK + select WOLFSSL_HAS_SESSION_TICKET + select WOLFSSL_HAS_WPAS + endchoice config WPA_RFKILL_SUPPORT diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index ed9bcfc3d9..933ad9a231 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=5 +PKG_RELEASE:=1 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2018-04-09 -PKG_SOURCE_VERSION:=fa617ee6a0b2d39e6372c93ef9437caa3bd9065a -PKG_MIRROR_HASH:=5e6f20153c3405ac905f89fea8a614a57e9ba19583b2de2777179381a74aa7b1 +PKG_SOURCE_DATE:=2018-05-21 +PKG_SOURCE_VERSION:=62566bc23d041e88f8e35933d5fd8c2fd0f7cf2a +PKG_MIRROR_HASH:=f234b24f9471ae9cb34460feec6d6614641691544101535673595272c91448eb PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause @@ -47,7 +47,13 @@ ifneq ($(LOCAL_TYPE),hostapd) ifeq ($(LOCAL_VARIANT),full) PKG_CONFIG_DEPENDS += \ CONFIG_WPA_SUPPLICANT_INTERNAL \ - CONFIG_WPA_SUPPLICANT_OPENSSL + CONFIG_WPA_SUPPLICANT_OPENSSL \ + CONFIG_WPA_SUPPLICANT_WOLFSSL + endif + ifeq ($(LOCAL_VARIANT),mesh) + PKG_CONFIG_DEPENDS += \ + CONFIG_WPA_SUPPLICANT_OPENSSL \ + CONFIG_WPA_SUPPLICANT_WOLFSSL endif endif @@ -83,10 +89,23 @@ ifneq ($(LOCAL_TYPE),hostapd) TARGET_LDFLAGS += -lcrypto -lssl endif endif + ifdef CONFIG_WPA_SUPPLICANT_WOLFSSL + ifeq ($(LOCAL_VARIANT),full) + DRIVER_MAKEOPTS += CONFIG_TLS=wolfssl CONFIG_WPS_NFC=1 + TARGET_LDFLAGS += -lwolfssl + endif + endif + ifeq ($(LOCAL_VARIANT),mesh) - DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y - TARGET_LDFLAGS += -lcrypto -lssl + ifndef CONFIG_WPA_SUPPLICANT_WOLFSSL + DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y + TARGET_LDFLAGS += -lcrypto -lssl + else + DRIVER_MAKEOPTS += CONFIG_TLS=wolfssl CONFIG_WPS_NFC=1 CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y + TARGET_LDFLAGS += -lwolfssl + endif endif + ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK endif @@ -157,7 +176,7 @@ endef define Package/wpad $(call Package/wpad/Default) TITLE+= (full) - DEPENDS+=+WPA_SUPPLICANT_OPENSSL:libopenssl + DEPENDS+=+WPA_SUPPLICANT_OPENSSL:libopenssl +WPA_SUPPLICANT_WOLFSSL:libwolfssl VARIANT:=wpad-full endef @@ -179,7 +198,7 @@ endef define Package/wpad-mesh $(call Package/wpad/Default) TITLE+= (with 802.11s mesh and SAE support) - DEPENDS:=$(DRV_DEPENDS) +libubus +PACKAGE_wpad-mesh:libopenssl @PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) + DEPENDS:=$(DRV_DEPENDS) +libubus +WPA_SUPPLICANT_OPENSSL:libopenssl +WPA_SUPPLICANT_INTERNAL:libopenssl +WPA_SUPPLICANT_WOLFSSL:libwolfssl @PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) VARIANT:=wpad-mesh endef @@ -192,7 +211,7 @@ define Package/wpa-supplicant CATEGORY:=Network TITLE:=WPA Supplicant URL:=http://hostap.epitest.fi/wpa_supplicant/ - DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl + DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl +WPA_SUPPLICANT_WOLFSSL:libwolfssl CONFLICTS:=wpad wpad-mini wpad-mesh VARIANT:=supplicant-full endef @@ -212,7 +231,7 @@ endef define Package/wpa-supplicant-mesh $(Package/wpa-supplicant) TITLE:=WPA Supplicant (with 802.11s and SAE) - DEPENDS:=$(DRV_DEPENDS) +PACKAGE_wpa-supplicant-mesh:libopenssl @PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) + DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl +WPA_SUPPLICANT_INTERNAL:libopenssl +WPA_SUPPLICANT_WOLFSSL:libwolfssl @PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN) CONFLICTS:=wpad wpad-mesh wpad-mesh VARIANT:=supplicant-mesh endef @@ -243,7 +262,7 @@ define Package/eapol-test SECTION:=net CATEGORY:=Network VARIANT:=supplicant-full - DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl + DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl +WPA_SUPPLICANT_WOLFSSL:libwolfssl endef diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 4deb0b97ae..7ffff4e7e1 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -688,11 +688,12 @@ wpa_supplicant_add_network() { } [[ "$_w_mode" = "mesh" ]] && { - json_get_vars mesh_id mesh_fwding + json_get_vars mesh_id mesh_fwding mesh_rssi_threshold [ -n "$mesh_id" ] && ssid="${mesh_id}" append network_data "mode=5" "$N$T" [ -n "$mesh_fwding" ] && append network_data "mesh_fwding=${mesh_fwding}" "$N$T" + [ -n "$mesh_rssi_threshold" ] && append network_data "mesh_rssi_threshold=${mesh_rssi_threshold}" "$N$T" [ -n "$freq" ] && wpa_supplicant_set_fixed_freq "$freq" "$htmode" [ "$noscan" = "1" ] && append network_data "noscan=1" "$N$T" append wpa_key_mgmt "SAE" diff --git a/package/network/services/hostapd/patches/0001-Revert-wpa_supplicant-Increase-authentication-timeou.patch b/package/network/services/hostapd/patches/0001-Revert-wpa_supplicant-Increase-authentication-timeou.patch new file mode 100644 index 0000000000..8d9cd456d5 --- /dev/null +++ b/package/network/services/hostapd/patches/0001-Revert-wpa_supplicant-Increase-authentication-timeou.patch @@ -0,0 +1,185 @@ +From 8a6a7112e5b1391018531f6b6c317f8870e0fcb6 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 3 May 2018 13:12:28 +0200 +Subject: [PATCH 1/2] Revert "wpa_supplicant: Increase authentication timeout + if CAC is started" + +This reverts commit 37547ad63c9df61ce6899675028594da2527efef. +--- + wpa_supplicant/events.c | 95 ++++--------------------------- + wpa_supplicant/wpa_supplicant.c | 20 ------- + wpa_supplicant/wpa_supplicant_i.h | 3 - + 3 files changed, 10 insertions(+), 108 deletions(-) + +--- a/wpa_supplicant/events.c ++++ b/wpa_supplicant/events.c +@@ -3776,81 +3776,6 @@ static void wpa_supplicant_event_port_au + } + + +-static unsigned int wpas_event_cac_ms(const struct wpa_supplicant *wpa_s, +- int freq) +-{ +- size_t i; +- int j; +- +- for (i = 0; i < wpa_s->hw.num_modes; i++) { +- const struct hostapd_hw_modes *mode = &wpa_s->hw.modes[i]; +- +- for (j = 0; j < mode->num_channels; j++) { +- const struct hostapd_channel_data *chan; +- +- chan = &mode->channels[j]; +- if (chan->freq == freq) +- return chan->dfs_cac_ms; +- } +- } +- +- return 0; +-} +- +- +-static void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar) +-{ +-#if defined(NEED_AP_MLME) && defined(CONFIG_AP) +- if (wpa_s->ap_iface) { +- wpas_ap_event_dfs_cac_started(wpa_s, radar); +- } else +-#endif /* NEED_AP_MLME && CONFIG_AP */ +- { +- unsigned int cac_time = wpas_event_cac_ms(wpa_s, radar->freq); +- +- cac_time /= 1000; /* convert from ms to sec */ +- if (!cac_time) +- cac_time = 10 * 60; /* max timeout: 10 minutes */ +- +- /* Restart auth timeout: CAC time added to initial timeout */ +- wpas_auth_timeout_restart(wpa_s, cac_time); +- } +-} +- +- +-static void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar) +-{ +-#if defined(NEED_AP_MLME) && defined(CONFIG_AP) +- if (wpa_s->ap_iface) { +- wpas_ap_event_dfs_cac_finished(wpa_s, radar); +- } else +-#endif /* NEED_AP_MLME && CONFIG_AP */ +- { +- /* Restart auth timeout with original value after CAC is +- * finished */ +- wpas_auth_timeout_restart(wpa_s, 0); +- } +-} +- +- +-static void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar) +-{ +-#if defined(NEED_AP_MLME) && defined(CONFIG_AP) +- if (wpa_s->ap_iface) { +- wpas_ap_event_dfs_cac_aborted(wpa_s, radar); +- } else +-#endif /* NEED_AP_MLME && CONFIG_AP */ +- { +- /* Restart auth timeout with original value after CAC is +- * aborted */ +- wpas_auth_timeout_restart(wpa_s, 0); +- } +-} +- +- + static void wpa_supplicant_event_assoc_auth(struct wpa_supplicant *wpa_s, + union wpa_event_data *data) + { +@@ -4298,25 +4223,25 @@ void wpa_supplicant_event(void *ctx, enu + wpas_ap_event_dfs_radar_detected(wpa_s, + &data->dfs_event); + break; +- case EVENT_DFS_NOP_FINISHED: +- if (data) +- wpas_ap_event_dfs_cac_nop_finished(wpa_s, +- &data->dfs_event); +- break; +-#endif /* NEED_AP_MLME */ +-#endif /* CONFIG_AP */ + case EVENT_DFS_CAC_STARTED: + if (data) +- wpas_event_dfs_cac_started(wpa_s, &data->dfs_event); ++ wpas_ap_event_dfs_cac_started(wpa_s, &data->dfs_event); + break; + case EVENT_DFS_CAC_FINISHED: + if (data) +- wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event); ++ wpas_ap_event_dfs_cac_finished(wpa_s, &data->dfs_event); + break; + case EVENT_DFS_CAC_ABORTED: + if (data) +- wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event); ++ wpas_ap_event_dfs_cac_aborted(wpa_s, &data->dfs_event); ++ break; ++ case EVENT_DFS_NOP_FINISHED: ++ if (data) ++ wpas_ap_event_dfs_cac_nop_finished(wpa_s, ++ &data->dfs_event); + break; ++#endif /* NEED_AP_MLME */ ++#endif /* CONFIG_AP */ + case EVENT_RX_MGMT: { + u16 fc, stype; + const struct ieee80211_mgmt *mgmt; +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -243,30 +243,10 @@ void wpa_supplicant_req_auth_timeout(str + wpa_dbg(wpa_s, MSG_DEBUG, "Setting authentication timeout: %d sec " + "%d usec", sec, usec); + eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL); +- wpa_s->last_auth_timeout_sec = sec; + eloop_register_timeout(sec, usec, wpa_supplicant_timeout, wpa_s, NULL); + } + + +-/* +- * wpas_auth_timeout_restart - Restart and change timeout for authentication +- * @wpa_s: Pointer to wpa_supplicant data +- * @sec_diff: difference in seconds applied to original timeout value +- */ +-void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff) +-{ +- int new_sec = wpa_s->last_auth_timeout_sec + sec_diff; +- +- if (eloop_is_timeout_registered(wpa_supplicant_timeout, wpa_s, NULL)) { +- wpa_dbg(wpa_s, MSG_DEBUG, +- "Authentication timeout restart: %d sec", new_sec); +- eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL); +- eloop_register_timeout(new_sec, 0, wpa_supplicant_timeout, +- wpa_s, NULL); +- } +-} +- +- + /** + * wpa_supplicant_cancel_auth_timeout - Cancel authentication timeout + * @wpa_s: Pointer to wpa_supplicant data +--- a/wpa_supplicant/wpa_supplicant_i.h ++++ b/wpa_supplicant/wpa_supplicant_i.h +@@ -1182,8 +1182,6 @@ struct wpa_supplicant { + /* RIC elements for FT protocol */ + struct wpabuf *ric_ies; + +- int last_auth_timeout_sec; +- + #ifdef CONFIG_DPP + struct dl_list dpp_bootstrap; /* struct dpp_bootstrap_info */ + struct dl_list dpp_configurator; /* struct dpp_configurator */ +@@ -1258,7 +1256,6 @@ void wpa_supplicant_initiate_eapol(struc + void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr); + void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s, + int sec, int usec); +-void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff); + void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s); + void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, + enum wpa_states state); diff --git a/package/network/services/hostapd/patches/0001-WPA-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch b/package/network/services/hostapd/patches/0001-WPA-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch index 1b84f7e86a..633ab58623 100644 --- a/package/network/services/hostapd/patches/0001-WPA-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch +++ b/package/network/services/hostapd/patches/0001-WPA-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch @@ -21,11 +21,9 @@ Signed-off-by: Mathy Vanhoef src/rsn_supp/wpa.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c -index 56f3af7..db94a49 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -2215,6 +2215,17 @@ int wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr, +@@ -2208,6 +2208,17 @@ int wpa_sm_rx_eapol(struct wpa_sm *sm, c if ((sm->proto == WPA_PROTO_RSN || sm->proto == WPA_PROTO_OSEN) && (key_info & WPA_KEY_INFO_ENCR_KEY_DATA) && mic_len) { @@ -43,6 +41,3 @@ index 56f3af7..db94a49 100644 if (wpa_supplicant_decrypt_key_data(sm, key, mic_len, ver, key_data, &key_data_len)) --- -2.7.4 - diff --git a/package/network/services/hostapd/patches/0002-Revert-wpa_supplicant-Rename-wpas_event_-to-wpas_ap_.patch b/package/network/services/hostapd/patches/0002-Revert-wpa_supplicant-Rename-wpas_event_-to-wpas_ap_.patch new file mode 100644 index 0000000000..281bb5bba4 --- /dev/null +++ b/package/network/services/hostapd/patches/0002-Revert-wpa_supplicant-Rename-wpas_event_-to-wpas_ap_.patch @@ -0,0 +1,132 @@ +From 0d4900ccd1c7ec5c5ffecf5040f9c07a6a32deef Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 3 May 2018 13:12:35 +0200 +Subject: [PATCH 2/2] Revert "wpa_supplicant: Rename wpas_event_*() to + wpas_ap_event_*()" + +This reverts commit 2dd5fbbff884af488870a37e339b4817c83954de. +--- + wpa_supplicant/ap.c | 20 ++++++++++---------- + wpa_supplicant/ap.h | 18 +++++++++--------- + wpa_supplicant/events.c | 13 ++++++------- + 3 files changed, 25 insertions(+), 26 deletions(-) + +--- a/wpa_supplicant/ap.c ++++ b/wpa_supplicant/ap.c +@@ -1537,8 +1537,8 @@ int wpas_ap_pmksa_cache_add_external(str + + + #ifdef NEED_AP_MLME +-void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar) ++void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s, ++ struct dfs_event *radar) + { + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) + return; +@@ -1550,8 +1550,8 @@ void wpas_ap_event_dfs_radar_detected(st + } + + +-void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar) ++void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s, ++ struct dfs_event *radar) + { + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) + return; +@@ -1562,8 +1562,8 @@ void wpas_ap_event_dfs_cac_started(struc + } + + +-void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar) ++void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, ++ struct dfs_event *radar) + { + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) + return; +@@ -1574,8 +1574,8 @@ void wpas_ap_event_dfs_cac_finished(stru + } + + +-void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar) ++void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, ++ struct dfs_event *radar) + { + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) + return; +@@ -1586,8 +1586,8 @@ void wpas_ap_event_dfs_cac_aborted(struc + } + + +-void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar) ++void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s, ++ struct dfs_event *radar) + { + if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) + return; +--- a/wpa_supplicant/ap.h ++++ b/wpa_supplicant/ap.h +@@ -89,16 +89,16 @@ int wpas_ap_pmksa_cache_list_mesh(struct + char *buf, size_t len); + int wpas_ap_pmksa_cache_add_external(struct wpa_supplicant *wpa_s, char *cmd); + +-void wpas_ap_event_dfs_radar_detected(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar); +-void wpas_ap_event_dfs_cac_started(struct wpa_supplicant *wpa_s, ++void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s, + struct dfs_event *radar); +-void wpas_ap_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar); +-void wpas_ap_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar); +-void wpas_ap_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s, +- struct dfs_event *radar); ++void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s, ++ struct dfs_event *radar); ++void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, ++ struct dfs_event *radar); ++void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, ++ struct dfs_event *radar); ++void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s, ++ struct dfs_event *radar); + + void ap_periodic(struct wpa_supplicant *wpa_s); + +--- a/wpa_supplicant/events.c ++++ b/wpa_supplicant/events.c +@@ -4220,25 +4220,24 @@ void wpa_supplicant_event(void *ctx, enu + #ifdef NEED_AP_MLME + case EVENT_DFS_RADAR_DETECTED: + if (data) +- wpas_ap_event_dfs_radar_detected(wpa_s, +- &data->dfs_event); ++ wpas_event_dfs_radar_detected(wpa_s, &data->dfs_event); + break; + case EVENT_DFS_CAC_STARTED: + if (data) +- wpas_ap_event_dfs_cac_started(wpa_s, &data->dfs_event); ++ wpas_event_dfs_cac_started(wpa_s, &data->dfs_event); + break; + case EVENT_DFS_CAC_FINISHED: + if (data) +- wpas_ap_event_dfs_cac_finished(wpa_s, &data->dfs_event); ++ wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event); + break; + case EVENT_DFS_CAC_ABORTED: + if (data) +- wpas_ap_event_dfs_cac_aborted(wpa_s, &data->dfs_event); ++ wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event); + break; + case EVENT_DFS_NOP_FINISHED: + if (data) +- wpas_ap_event_dfs_cac_nop_finished(wpa_s, +- &data->dfs_event); ++ wpas_event_dfs_cac_nop_finished(wpa_s, ++ &data->dfs_event); + break; + #endif /* NEED_AP_MLME */ + #endif /* CONFIG_AP */ diff --git a/package/network/services/hostapd/patches/001-mesh-factor-out-mesh-join-function.patch b/package/network/services/hostapd/patches/001-mesh-factor-out-mesh-join-function.patch new file mode 100644 index 0000000000..72c3c75ae9 --- /dev/null +++ b/package/network/services/hostapd/patches/001-mesh-factor-out-mesh-join-function.patch @@ -0,0 +1,211 @@ +From 032e70833de4b251fc4a159b2cc4ef28d0f1df0d Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:54:58 -0700 +Subject: [PATCH 01/16] mesh: factor out mesh join function + +mesh join function consitss of 2 parts which are preparing +configurations and sending join event to driver. +Since physical mesh join event could happen either right +after mesh configuration is done or after CAC is done +in case of DFS channel is used, factor out the function +into 2 parts to reduce redundant calls. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 119 ++++++++++++++++-------------- + wpa_supplicant/mesh.h | 1 + + wpa_supplicant/wpa_supplicant_i.h | 1 + + 3 files changed, 67 insertions(+), 54 deletions(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -364,13 +364,48 @@ void wpa_supplicant_mesh_add_scan_ie(str + } + + ++void wpas_join_mesh(struct wpa_supplicant *wpa_s) ++{ ++ struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; ++ struct wpa_ssid *ssid = wpa_s->current_ssid; ++ int ret = 0; ++ ++ if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { ++ wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher; ++ wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher; ++ wpa_s->mgmt_group_cipher = wpa_s->mesh_rsn->mgmt_group_cipher; ++ } ++ ++ if (wpa_s->ifmsh) { ++ params->ies = wpa_s->ifmsh->mconf->rsn_ie; ++ params->ie_len = wpa_s->ifmsh->mconf->rsn_ie_len; ++ params->basic_rates = wpa_s->ifmsh->basic_rates; ++ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE; ++ params->conf.ht_opmode = wpa_s->ifmsh->bss[0]->iface->ht_op_mode; ++ } ++ ++ ret = wpa_drv_join_mesh(wpa_s, params); ++ if (ret) ++ wpa_msg(wpa_s, MSG_ERROR, "mesh join error=%d\n", ret); ++ ++ /* hostapd sets the interface down until we associate */ ++ wpa_drv_set_operstate(wpa_s, 1); ++ ++ if (!ret) ++ wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); ++ ++ return; ++} ++ ++ + int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid) + { +- struct wpa_driver_mesh_join_params params; ++ struct wpa_driver_mesh_join_params *params = ++ os_zalloc(sizeof(struct wpa_driver_mesh_join_params)); + int ret = 0; + +- if (!ssid || !ssid->ssid || !ssid->ssid_len || !ssid->frequency) { ++ if (!ssid || !ssid->ssid || !ssid->ssid_len || !ssid->frequency || !params) { + ret = -ENOENT; + goto out; + } +@@ -381,22 +416,22 @@ int wpa_supplicant_join_mesh(struct wpa_ + wpa_s->group_cipher = WPA_CIPHER_NONE; + wpa_s->mgmt_group_cipher = 0; + +- os_memset(¶ms, 0, sizeof(params)); +- params.meshid = ssid->ssid; +- params.meshid_len = ssid->ssid_len; +- ibss_mesh_setup_freq(wpa_s, ssid, ¶ms.freq); +- wpa_s->mesh_ht_enabled = !!params.freq.ht_enabled; +- wpa_s->mesh_vht_enabled = !!params.freq.vht_enabled; +- if (params.freq.ht_enabled && params.freq.sec_channel_offset) +- ssid->ht40 = params.freq.sec_channel_offset; ++ params->meshid = ssid->ssid; ++ params->meshid_len = ssid->ssid_len; ++ ibss_mesh_setup_freq(wpa_s, ssid, ¶ms->freq); ++ wpa_s->mesh_ht_enabled = !!params->freq.ht_enabled; ++ wpa_s->mesh_vht_enabled = !!params->freq.vht_enabled; ++ if (params->freq.ht_enabled && params->freq.sec_channel_offset) ++ ssid->ht40 = params->freq.sec_channel_offset; ++ + if (wpa_s->mesh_vht_enabled) { + ssid->vht = 1; +- switch (params.freq.bandwidth) { ++ switch (params->freq.bandwidth) { + case 80: +- if (params.freq.center_freq2) { ++ if (params->freq.center_freq2) { + ssid->max_oper_chwidth = VHT_CHANWIDTH_80P80MHZ; + ssid->vht_center_freq2 = +- params.freq.center_freq2; ++ params->freq.center_freq2; + } else { + ssid->max_oper_chwidth = VHT_CHANWIDTH_80MHZ; + } +@@ -410,67 +445,43 @@ int wpa_supplicant_join_mesh(struct wpa_ + } + } + if (ssid->beacon_int > 0) +- params.beacon_int = ssid->beacon_int; ++ params->beacon_int = ssid->beacon_int; + else if (wpa_s->conf->beacon_int > 0) +- params.beacon_int = wpa_s->conf->beacon_int; ++ params->beacon_int = wpa_s->conf->beacon_int; + if (ssid->dtim_period > 0) +- params.dtim_period = ssid->dtim_period; ++ params->dtim_period = ssid->dtim_period; + else if (wpa_s->conf->dtim_period > 0) +- params.dtim_period = wpa_s->conf->dtim_period; +- params.conf.max_peer_links = wpa_s->conf->max_peer_links; ++ params->dtim_period = wpa_s->conf->dtim_period; ++ params->conf.max_peer_links = wpa_s->conf->max_peer_links; + if (ssid->mesh_rssi_threshold < DEFAULT_MESH_RSSI_THRESHOLD) { +- params.conf.rssi_threshold = ssid->mesh_rssi_threshold; +- params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD; ++ params->conf.rssi_threshold = ssid->mesh_rssi_threshold; ++ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD; + } + + if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { +- params.flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH; +- params.flags |= WPA_DRIVER_MESH_FLAG_AMPE; ++ params->flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH; ++ params->flags |= WPA_DRIVER_MESH_FLAG_AMPE; + wpa_s->conf->user_mpm = 1; + } + + if (wpa_s->conf->user_mpm) { +- params.flags |= WPA_DRIVER_MESH_FLAG_USER_MPM; +- params.conf.auto_plinks = 0; ++ params->flags |= WPA_DRIVER_MESH_FLAG_USER_MPM; ++ params->conf.auto_plinks = 0; + } else { +- params.flags |= WPA_DRIVER_MESH_FLAG_DRIVER_MPM; +- params.conf.auto_plinks = 1; ++ params->flags |= WPA_DRIVER_MESH_FLAG_DRIVER_MPM; ++ params->conf.auto_plinks = 1; + } +- params.conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; ++ params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; + +- if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms.freq)) { ++ wpa_s->mesh_params = params; ++ if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { + wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh"); + wpa_drv_leave_mesh(wpa_s); + ret = -1; + goto out; + } + +- if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { +- wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher; +- wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher; +- wpa_s->mgmt_group_cipher = wpa_s->mesh_rsn->mgmt_group_cipher; +- } +- +- if (wpa_s->ifmsh) { +- params.ies = wpa_s->ifmsh->mconf->rsn_ie; +- params.ie_len = wpa_s->ifmsh->mconf->rsn_ie_len; +- params.basic_rates = wpa_s->ifmsh->basic_rates; +- params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE; +- params.conf.ht_opmode = wpa_s->ifmsh->bss[0]->iface->ht_op_mode; +- } +- +- wpa_msg(wpa_s, MSG_INFO, "joining mesh %s", +- wpa_ssid_txt(ssid->ssid, ssid->ssid_len)); +- ret = wpa_drv_join_mesh(wpa_s, ¶ms); +- if (ret) +- wpa_msg(wpa_s, MSG_ERROR, "mesh join error=%d", ret); +- +- /* hostapd sets the interface down until we associate */ +- wpa_drv_set_operstate(wpa_s, 1); +- +- if (!ret) +- wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); +- ++ wpas_join_mesh(wpa_s); + out: + return ret; + } +--- a/wpa_supplicant/mesh.h ++++ b/wpa_supplicant/mesh.h +@@ -21,6 +21,7 @@ int wpas_mesh_add_interface(struct wpa_s + int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr); + int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr, + int duration); ++void wpas_join_mesh(struct wpa_supplicant *wpa_s); + + #ifdef CONFIG_MESH + +--- a/wpa_supplicant/wpa_supplicant_i.h ++++ b/wpa_supplicant/wpa_supplicant_i.h +@@ -810,6 +810,7 @@ struct wpa_supplicant { + unsigned int mesh_if_created:1; + unsigned int mesh_ht_enabled:1; + unsigned int mesh_vht_enabled:1; ++ struct wpa_driver_mesh_join_params *mesh_params; + #ifdef CONFIG_PMKSA_CACHE_EXTERNAL + /* struct external_pmksa_cache::list */ + struct dl_list mesh_external_pmksa_cache; diff --git a/package/network/services/hostapd/patches/002-mesh-factor-out-rsn-initialization.patch b/package/network/services/hostapd/patches/002-mesh-factor-out-rsn-initialization.patch new file mode 100644 index 0000000000..ad2ab91fe3 --- /dev/null +++ b/package/network/services/hostapd/patches/002-mesh-factor-out-rsn-initialization.patch @@ -0,0 +1,133 @@ +From 6da64b1e056e0b1be18b6ab37c820acb4a0f3cf4 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:54:59 -0700 +Subject: [PATCH 02/16] mesh: factor out rsn initialization + +RSN initialization can be used in different phases +if mesh initialization and mesh join don't happen +in sequence such as DFS CAC is done in between, +hence factor it out to help convering the case. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 84 +++++++++++++++++++++++++------------------ + wpa_supplicant/mesh.h | 1 + + 2 files changed, 50 insertions(+), 35 deletions(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -147,6 +147,53 @@ static void wpas_mesh_copy_groups(struct + } + + ++int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s) ++{ ++ struct hostapd_iface *ifmsh = wpa_s->ifmsh; ++ struct mesh_conf *mconf = wpa_s->ifmsh->mconf; ++ struct wpa_ssid *ssid = wpa_s->current_ssid; ++ struct hostapd_data *bss = ifmsh->bss[0]; ++ static int default_groups[] = { 19, 20, 21, 25, 26, -1 }; ++ const char *password; ++ size_t len; ++ ++ if (mconf->security != MESH_CONF_SEC_NONE) { ++ password = ssid->sae_password; ++ if (!password) ++ password = ssid->passphrase; ++ if (!password) { ++ wpa_printf(MSG_ERROR, ++ "mesh: Passphrase for SAE not configured"); ++ return -1; ++ } ++ ++ bss->conf->wpa = ssid->proto; ++ bss->conf->wpa_key_mgmt = ssid->key_mgmt; ++ ++ if (wpa_s->conf->sae_groups && ++ wpa_s->conf->sae_groups[0] > 0) { ++ wpas_mesh_copy_groups(bss, wpa_s); ++ } else { ++ bss->conf->sae_groups = ++ os_memdup(default_groups, ++ sizeof(default_groups)); ++ if (!bss->conf->sae_groups) ++ return -1; ++ } ++ ++ len = os_strlen(password); ++ bss->conf->ssid.wpa_passphrase = ++ dup_binstr(password, len); ++ ++ wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf); ++ if (!wpa_s->mesh_rsn) ++ return -1; ++ } ++ ++ return 0; ++} ++ ++ + static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid, + struct hostapd_freq_params *freq) +@@ -156,9 +203,6 @@ static int wpa_supplicant_mesh_init(stru + struct hostapd_config *conf; + struct mesh_conf *mconf; + int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 }; +- static int default_groups[] = { 19, 20, 21, 25, 26, -1 }; +- const char *password; +- size_t len; + int rate_len; + int frequency; + +@@ -292,38 +336,8 @@ static int wpa_supplicant_mesh_init(stru + return -1; + } + +- if (mconf->security != MESH_CONF_SEC_NONE) { +- password = ssid->sae_password; +- if (!password) +- password = ssid->passphrase; +- if (!password) { +- wpa_printf(MSG_ERROR, +- "mesh: Passphrase for SAE not configured"); +- goto out_free; +- } +- +- bss->conf->wpa = ssid->proto; +- bss->conf->wpa_key_mgmt = ssid->key_mgmt; +- +- if (wpa_s->conf->sae_groups && +- wpa_s->conf->sae_groups[0] > 0) { +- wpas_mesh_copy_groups(bss, wpa_s); +- } else { +- bss->conf->sae_groups = +- os_memdup(default_groups, +- sizeof(default_groups)); +- if (!bss->conf->sae_groups) +- goto out_free; +- } +- +- len = os_strlen(password); +- bss->conf->ssid.wpa_passphrase = +- dup_binstr(password, len); +- +- wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf); +- if (!wpa_s->mesh_rsn) +- goto out_free; +- } ++ if (wpas_mesh_init_rsn(wpa_s)) ++ goto out_free; + + wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); + +--- a/wpa_supplicant/mesh.h ++++ b/wpa_supplicant/mesh.h +@@ -22,6 +22,7 @@ int wpas_mesh_peer_remove(struct wpa_sup + int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr, + int duration); + void wpas_join_mesh(struct wpa_supplicant *wpa_s); ++int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s); + + #ifdef CONFIG_MESH + diff --git a/package/network/services/hostapd/patches/003-mesh-relocate-RSN-init-function.patch b/package/network/services/hostapd/patches/003-mesh-relocate-RSN-init-function.patch new file mode 100644 index 0000000000..fa0605cfaf --- /dev/null +++ b/package/network/services/hostapd/patches/003-mesh-relocate-RSN-init-function.patch @@ -0,0 +1,41 @@ +From 95425b5becaeda8a515c942f417696e5df34bbc8 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:00 -0700 +Subject: [PATCH 03/16] mesh: relocate RSN init function + +RSN init function should work together with mesh join +when it's used. Since mesh join could be called at different stage +if DFS channel is used, relocate the function to mesh join. +It is still the same call flows of mesh join before this changes +if non-DFS channels are used, hence no side effect will occur. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -336,9 +336,6 @@ static int wpa_supplicant_mesh_init(stru + return -1; + } + +- if (wpas_mesh_init_rsn(wpa_s)) +- goto out_free; +- + wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); + + return 0; +@@ -384,6 +381,12 @@ void wpas_join_mesh(struct wpa_supplican + struct wpa_ssid *ssid = wpa_s->current_ssid; + int ret = 0; + ++ if (wpas_mesh_init_rsn(wpa_s)) { ++ wpa_printf(MSG_ERROR, "Init RSN failed. Deinit mesh..."); ++ wpa_supplicant_mesh_deinit(wpa_s); ++ return; ++ } ++ + if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { + wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher; + wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher; diff --git a/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch b/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch new file mode 100644 index 0000000000..73ab99e072 --- /dev/null +++ b/package/network/services/hostapd/patches/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch @@ -0,0 +1,73 @@ +From 32044a7bb26858bedaf147c77f49f5cef1133de3 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:01 -0700 +Subject: [PATCH 04/16] mesh: use setup completion callback to complete mesh + join + +mesh join function is the last function to be called during +mesh join process, but it's been called a bit earlier than +it's supposed to be, so that some mesh parameter values +such as VHT capabilities not applied correct when mesh join +is in process. Moreover current design of mesh join that is called +directly after mesh initialization is not suitable for DFS channels +to use, since mesh join process should be paused until DFS CAC is +done and resumed once it's done. +Using setup completion callback is how AP mode is using for DFS channels +and mesh can use the same way. +The callback will be called by hostapd_setup_interface_complete_sync. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 7 +++++-- + wpa_supplicant/mesh.h | 2 +- + 2 files changed, 6 insertions(+), 3 deletions(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -217,6 +217,7 @@ static int wpa_supplicant_mesh_init(stru + if (!ifmsh) + return -ENOMEM; + ++ ifmsh->owner = wpa_s; + ifmsh->drv_flags = wpa_s->drv_flags; + ifmsh->num_bss = 1; + ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss, +@@ -234,6 +235,8 @@ static int wpa_supplicant_mesh_init(stru + bss->drv_priv = wpa_s->drv_priv; + bss->iface = ifmsh; + bss->mesh_sta_free_cb = mesh_mpm_free_sta; ++ bss->setup_complete_cb = wpas_mesh_complete_cb; ++ bss->setup_complete_cb_ctx = wpa_s; + frequency = ssid->frequency; + if (frequency != freq->freq && + frequency == freq->freq + freq->sec_channel_offset * 20) { +@@ -375,8 +378,9 @@ void wpa_supplicant_mesh_add_scan_ie(str + } + + +-void wpas_join_mesh(struct wpa_supplicant *wpa_s) ++void wpas_mesh_complete_cb(void *ctx) + { ++ struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)ctx; + struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; + struct wpa_ssid *ssid = wpa_s->current_ssid; + int ret = 0; +@@ -498,7 +502,6 @@ int wpa_supplicant_join_mesh(struct wpa_ + goto out; + } + +- wpas_join_mesh(wpa_s); + out: + return ret; + } +--- a/wpa_supplicant/mesh.h ++++ b/wpa_supplicant/mesh.h +@@ -21,7 +21,7 @@ int wpas_mesh_add_interface(struct wpa_s + int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr); + int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr, + int duration); +-void wpas_join_mesh(struct wpa_supplicant *wpa_s); ++void wpas_mesh_complete_cb(void *ctx); + int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s); + + #ifdef CONFIG_MESH diff --git a/package/network/services/hostapd/patches/005-mesh-reflect-country-setting-to-mesh-configuration.patch b/package/network/services/hostapd/patches/005-mesh-reflect-country-setting-to-mesh-configuration.patch new file mode 100644 index 0000000000..6f7a968259 --- /dev/null +++ b/package/network/services/hostapd/patches/005-mesh-reflect-country-setting-to-mesh-configuration.patch @@ -0,0 +1,33 @@ +From e2f13b1fac9799db83a37fc57df9471d9bb5b711 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:02 -0700 +Subject: [PATCH 05/16] mesh: reflect country setting to mesh configuration + +wpa_supplicant configuration has country parameter that is +supposed to be used in AP mode to indicate supporting 802.11h +and 802.11d. Reflect this configuration to Mesh also since Mesh +is required to support 802.11h and 802.11d to use DFS channels. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -255,6 +255,15 @@ static int wpa_supplicant_mesh_init(stru + bss->conf->start_disabled = 1; + bss->conf->mesh = MESH_ENABLED; + bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; ++ ++ if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, ++ wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { ++ conf->ieee80211h = 1; ++ conf->ieee80211d = 1; ++ conf->country[0] = wpa_s->conf->country[0]; ++ conf->country[1] = wpa_s->conf->country[1]; ++ } ++ + bss->iconf = conf; + ifmsh->conf = conf; + diff --git a/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch b/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch new file mode 100644 index 0000000000..0d956be2b3 --- /dev/null +++ b/package/network/services/hostapd/patches/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch @@ -0,0 +1,48 @@ +From 37bf08621eee53f30b464be71876c02e235077ba Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:03 -0700 +Subject: [PATCH 06/16] mesh: inform kernel driver DFS handler in userspace + +NL80211_ATTR_HANDLE_DFS is required by kerenel space +to enable DFS channels that indicates DFS handler +resides in userspace. + +Signed-off-by: Peter Oh +--- + src/drivers/driver.h | 1 + + src/drivers/driver_nl80211.c | 3 +++ + wpa_supplicant/mesh.c | 1 + + 3 files changed, 5 insertions(+) + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -1390,6 +1390,7 @@ struct wpa_driver_mesh_join_params { + #define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004 + #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 + unsigned int flags; ++ u8 handle_dfs; + }; + + /** +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -9270,6 +9270,9 @@ static int nl80211_join_mesh(struct i802 + + wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags); + ++ if (params->handle_dfs) ++ if (nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS)) ++ goto fail; + container = nla_nest_start(msg, NL80211_ATTR_MESH_SETUP); + if (!container) + goto fail; +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -262,6 +262,7 @@ static int wpa_supplicant_mesh_init(stru + conf->ieee80211d = 1; + conf->country[0] = wpa_s->conf->country[0]; + conf->country[1] = wpa_s->conf->country[1]; ++ wpa_s->mesh_params->handle_dfs = 1; + } + + bss->iconf = conf; diff --git a/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch b/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch new file mode 100644 index 0000000000..d8722c7cf9 --- /dev/null +++ b/package/network/services/hostapd/patches/007-mesh-apply-channel-attributes-before-running-Mesh.patch @@ -0,0 +1,33 @@ +From 8190aab3344ae9746c897093f88f3679239d135d Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:04 -0700 +Subject: [PATCH 07/16] mesh: apply channel attributes before running Mesh + +This helps mesh interface initializes with correct +channel parameters. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -338,6 +338,8 @@ static int wpa_supplicant_mesh_init(stru + conf->basic_rates[rate_len] = -1; + } + ++ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); ++ + if (hostapd_setup_interface(ifmsh)) { + wpa_printf(MSG_ERROR, + "Failed to initialize hostapd interface for mesh"); +@@ -349,8 +351,6 @@ static int wpa_supplicant_mesh_init(stru + return -1; + } + +- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); +- + return 0; + out_free: + wpa_supplicant_mesh_deinit(wpa_s); diff --git a/package/network/services/hostapd/patches/008-mesh-set-interface-type-to-mesh-before-setting-inter.patch b/package/network/services/hostapd/patches/008-mesh-set-interface-type-to-mesh-before-setting-inter.patch new file mode 100644 index 0000000000..ec6cadb223 --- /dev/null +++ b/package/network/services/hostapd/patches/008-mesh-set-interface-type-to-mesh-before-setting-inter.patch @@ -0,0 +1,36 @@ +From e001251cb5708c406d477eca6aa912e5692b17fe Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:05 -0700 +Subject: [PATCH 08/16] mesh: set interface type to mesh before setting + interface + +Correct interface type is required to start DFS CAC that can be +triggered during interface setup. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -340,14 +340,14 @@ static int wpa_supplicant_mesh_init(stru + + wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); + +- if (hostapd_setup_interface(ifmsh)) { +- wpa_printf(MSG_ERROR, +- "Failed to initialize hostapd interface for mesh"); ++ if (wpa_drv_init_mesh(wpa_s)) { ++ wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); + return -1; + } + +- if (wpa_drv_init_mesh(wpa_s)) { +- wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); ++ if (hostapd_setup_interface(ifmsh)) { ++ wpa_printf(MSG_ERROR, ++ "Failed to initialize hostapd interface for mesh"); + return -1; + } + diff --git a/package/network/services/hostapd/patches/009-mesh-set-mesh-center-frequency.patch b/package/network/services/hostapd/patches/009-mesh-set-mesh-center-frequency.patch new file mode 100644 index 0000000000..2fbbc950ce --- /dev/null +++ b/package/network/services/hostapd/patches/009-mesh-set-mesh-center-frequency.patch @@ -0,0 +1,22 @@ +From 3cefd0bf495ad51a860b56281a8cae32bc4bd086 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:06 -0700 +Subject: [PATCH 09/16] mesh: set mesh center frequency + +vht center frequency value is required to compose the correct channel info. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -457,6 +457,7 @@ int wpa_supplicant_join_mesh(struct wpa_ + + if (wpa_s->mesh_vht_enabled) { + ssid->vht = 1; ++ ssid->vht_center_freq1 = params->freq.center_freq1; + switch (params->freq.bandwidth) { + case 80: + if (params->freq.center_freq2) { diff --git a/package/network/services/hostapd/patches/010-mesh-consider-mesh-interface-on-dfs-event-handler.patch b/package/network/services/hostapd/patches/010-mesh-consider-mesh-interface-on-dfs-event-handler.patch new file mode 100644 index 0000000000..e4711a8bdd --- /dev/null +++ b/package/network/services/hostapd/patches/010-mesh-consider-mesh-interface-on-dfs-event-handler.patch @@ -0,0 +1,148 @@ +From 90aa570a894a907d11f85ced43a248198e24acc1 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:07 -0700 +Subject: [PATCH 10/16] mesh: consider mesh interface on dfs event handler + +Once mesh starts supporting DFS channels, it has to handle DFS related events +from drivers, hence add mesh interface to the check list. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/ap.c | 71 ++++++++++++++++++++++++++++++----------- + wpa_supplicant/events.c | 1 + + 2 files changed, 54 insertions(+), 18 deletions(-) + +--- a/wpa_supplicant/ap.c ++++ b/wpa_supplicant/ap.c +@@ -1337,13 +1337,18 @@ int ap_ctrl_iface_chanswitch(struct wpa_ + void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht, + int offset, int width, int cf1, int cf2) + { +- if (!wpa_s->ap_iface) +- return; ++ struct hostapd_iface *iface = wpa_s->ap_iface; + ++ if (!wpa_s->ap_iface) { ++ if (!wpa_s->ifmsh) ++ return; ++ else ++ iface = wpa_s->ifmsh; ++ } + wpa_s->assoc_freq = freq; + if (wpa_s->current_ssid) + wpa_s->current_ssid->frequency = freq; +- hostapd_event_ch_switch(wpa_s->ap_iface->bss[0], freq, ht, ++ hostapd_event_ch_switch(iface->bss[0], freq, ht, + offset, width, cf1, cf2); + } + +@@ -1540,10 +1545,16 @@ int wpas_ap_pmksa_cache_add_external(str + void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) + { +- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) +- return; ++ struct hostapd_iface *iface = wpa_s->ap_iface; ++ ++ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) { ++ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) ++ return; ++ else ++ iface = wpa_s->ifmsh; ++ } + wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq); +- hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq, ++ hostapd_dfs_radar_detected(iface, radar->freq, + radar->ht_enabled, radar->chan_offset, + radar->chan_width, + radar->cf1, radar->cf2); +@@ -1553,10 +1564,16 @@ void wpas_event_dfs_radar_detected(struc + void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) + { +- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) +- return; ++ struct hostapd_iface *iface = wpa_s->ap_iface; ++ ++ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) { ++ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) ++ return; ++ else ++ iface = wpa_s->ifmsh; ++ } + wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq); +- hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq, ++ hostapd_dfs_start_cac(iface, radar->freq, + radar->ht_enabled, radar->chan_offset, + radar->chan_width, radar->cf1, radar->cf2); + } +@@ -1565,10 +1582,16 @@ void wpas_event_dfs_cac_started(struct w + void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) + { +- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) +- return; ++ struct hostapd_iface *iface = wpa_s->ap_iface; ++ ++ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) { ++ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) ++ return; ++ else ++ iface = wpa_s->ifmsh; ++ } + wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq); +- hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq, ++ hostapd_dfs_complete_cac(iface, 1, radar->freq, + radar->ht_enabled, radar->chan_offset, + radar->chan_width, radar->cf1, radar->cf2); + } +@@ -1577,10 +1600,16 @@ void wpas_event_dfs_cac_finished(struct + void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) + { +- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) +- return; ++ struct hostapd_iface *iface = wpa_s->ap_iface; ++ ++ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) { ++ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) ++ return; ++ else ++ iface = wpa_s->ifmsh; ++ } + wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq); +- hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq, ++ hostapd_dfs_complete_cac(iface, 0, radar->freq, + radar->ht_enabled, radar->chan_offset, + radar->chan_width, radar->cf1, radar->cf2); + } +@@ -1589,10 +1618,16 @@ void wpas_event_dfs_cac_aborted(struct w + void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s, + struct dfs_event *radar) + { +- if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) +- return; ++ struct hostapd_iface *iface = wpa_s->ap_iface; ++ ++ if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) { ++ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) ++ return; ++ else ++ iface = wpa_s->ifmsh; ++ } + wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq); +- hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq, ++ hostapd_dfs_nop_finished(iface, radar->freq, + radar->ht_enabled, radar->chan_offset, + radar->chan_width, radar->cf1, radar->cf2); + } +--- a/wpa_supplicant/events.c ++++ b/wpa_supplicant/events.c +@@ -4203,6 +4203,7 @@ void wpa_supplicant_event(void *ctx, enu + #ifdef CONFIG_AP + if (wpa_s->current_ssid->mode == WPAS_MODE_AP || + wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO || ++ wpa_s->current_ssid->mode == WPAS_MODE_MESH || + wpa_s->current_ssid->mode == + WPAS_MODE_P2P_GROUP_FORMATION) { + wpas_ap_ch_switch(wpa_s, data->ch_switch.freq, diff --git a/package/network/services/hostapd/patches/0101-mesh-factor-out-mesh-join-function.patch b/package/network/services/hostapd/patches/0101-mesh-factor-out-mesh-join-function.patch deleted file mode 100644 index 7671d1e96c..0000000000 --- a/package/network/services/hostapd/patches/0101-mesh-factor-out-mesh-join-function.patch +++ /dev/null @@ -1,219 +0,0 @@ -From 91c0f3f6a9ecae3c9106bef8a8606fab0792dd28 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:48:58 -0700 -Subject: [PATCH 01/15] mesh: factor out mesh join function - -mesh join function consitss of 2 parts which are preparing -configurations and sending join event to driver. -Since physical mesh join event could happen either right -after mesh configuration is done or after CAC is done -in case of DFS channel is used, factor out the function -into 2 parts to reduce redundant calls. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 120 ++++++++++++++++-------------- - wpa_supplicant/mesh.h | 1 + - wpa_supplicant/wpa_supplicant_i.h | 1 + - 3 files changed, 68 insertions(+), 54 deletions(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -25,6 +25,7 @@ - #include "mesh_mpm.h" - #include "mesh_rsn.h" - #include "mesh.h" -+#include "drivers/driver_nl80211.h" - - - static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s) -@@ -359,13 +360,48 @@ void wpa_supplicant_mesh_add_scan_ie(str - } - - -+void wpas_join_mesh(struct wpa_supplicant *wpa_s) -+{ -+ struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; -+ struct wpa_ssid *ssid = wpa_s->current_ssid; -+ int ret = 0; -+ -+ if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { -+ wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher; -+ wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher; -+ wpa_s->mgmt_group_cipher = wpa_s->mesh_rsn->mgmt_group_cipher; -+ } -+ -+ if (wpa_s->ifmsh) { -+ params->ies = wpa_s->ifmsh->mconf->rsn_ie; -+ params->ie_len = wpa_s->ifmsh->mconf->rsn_ie_len; -+ params->basic_rates = wpa_s->ifmsh->basic_rates; -+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE; -+ params->conf.ht_opmode = wpa_s->ifmsh->bss[0]->iface->ht_op_mode; -+ } -+ -+ ret = wpa_drv_join_mesh(wpa_s, params); -+ if (ret) -+ wpa_msg(wpa_s, MSG_ERROR, "mesh join error=%d\n", ret); -+ -+ /* hostapd sets the interface down until we associate */ -+ wpa_drv_set_operstate(wpa_s, 1); -+ -+ if (!ret) -+ wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); -+ -+ return; -+} -+ -+ - int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, - struct wpa_ssid *ssid) - { -- struct wpa_driver_mesh_join_params params; -+ struct wpa_driver_mesh_join_params *params = -+ os_zalloc(sizeof(struct wpa_driver_mesh_join_params)); - int ret = 0; - -- if (!ssid || !ssid->ssid || !ssid->ssid_len || !ssid->frequency) { -+ if (!ssid || !ssid->ssid || !ssid->ssid_len || !ssid->frequency || !params) { - ret = -ENOENT; - goto out; - } -@@ -376,22 +412,22 @@ int wpa_supplicant_join_mesh(struct wpa_ - wpa_s->group_cipher = WPA_CIPHER_NONE; - wpa_s->mgmt_group_cipher = 0; - -- os_memset(¶ms, 0, sizeof(params)); -- params.meshid = ssid->ssid; -- params.meshid_len = ssid->ssid_len; -- ibss_mesh_setup_freq(wpa_s, ssid, ¶ms.freq); -- wpa_s->mesh_ht_enabled = !!params.freq.ht_enabled; -- wpa_s->mesh_vht_enabled = !!params.freq.vht_enabled; -- if (params.freq.ht_enabled && params.freq.sec_channel_offset) -- ssid->ht40 = params.freq.sec_channel_offset; -+ params->meshid = ssid->ssid; -+ params->meshid_len = ssid->ssid_len; -+ ibss_mesh_setup_freq(wpa_s, ssid, ¶ms->freq); -+ wpa_s->mesh_ht_enabled = !!params->freq.ht_enabled; -+ wpa_s->mesh_vht_enabled = !!params->freq.vht_enabled; -+ if (params->freq.ht_enabled && params->freq.sec_channel_offset) -+ ssid->ht40 = params->freq.sec_channel_offset; -+ - if (wpa_s->mesh_vht_enabled) { - ssid->vht = 1; -- switch (params.freq.bandwidth) { -+ switch (params->freq.bandwidth) { - case 80: -- if (params.freq.center_freq2) { -+ if (params->freq.center_freq2) { - ssid->max_oper_chwidth = VHT_CHANWIDTH_80P80MHZ; - ssid->vht_center_freq2 = -- params.freq.center_freq2; -+ params->freq.center_freq2; - } else { - ssid->max_oper_chwidth = VHT_CHANWIDTH_80MHZ; - } -@@ -405,67 +441,43 @@ int wpa_supplicant_join_mesh(struct wpa_ - } - } - if (ssid->beacon_int > 0) -- params.beacon_int = ssid->beacon_int; -+ params->beacon_int = ssid->beacon_int; - else if (wpa_s->conf->beacon_int > 0) -- params.beacon_int = wpa_s->conf->beacon_int; -+ params->beacon_int = wpa_s->conf->beacon_int; - if (ssid->dtim_period > 0) -- params.dtim_period = ssid->dtim_period; -+ params->dtim_period = ssid->dtim_period; - else if (wpa_s->conf->dtim_period > 0) -- params.dtim_period = wpa_s->conf->dtim_period; -- params.conf.max_peer_links = wpa_s->conf->max_peer_links; -+ params->dtim_period = wpa_s->conf->dtim_period; -+ params->conf.max_peer_links = wpa_s->conf->max_peer_links; - if (ssid->mesh_rssi_threshold < DEFAULT_MESH_RSSI_THRESHOLD) { -- params.conf.rssi_threshold = ssid->mesh_rssi_threshold; -- params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD; -+ params->conf.rssi_threshold = ssid->mesh_rssi_threshold; -+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD; - } - - if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { -- params.flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH; -- params.flags |= WPA_DRIVER_MESH_FLAG_AMPE; -+ params->flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH; -+ params->flags |= WPA_DRIVER_MESH_FLAG_AMPE; - wpa_s->conf->user_mpm = 1; - } - - if (wpa_s->conf->user_mpm) { -- params.flags |= WPA_DRIVER_MESH_FLAG_USER_MPM; -- params.conf.auto_plinks = 0; -+ params->flags |= WPA_DRIVER_MESH_FLAG_USER_MPM; -+ params->conf.auto_plinks = 0; - } else { -- params.flags |= WPA_DRIVER_MESH_FLAG_DRIVER_MPM; -- params.conf.auto_plinks = 1; -+ params->flags |= WPA_DRIVER_MESH_FLAG_DRIVER_MPM; -+ params->conf.auto_plinks = 1; - } -- params.conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; -+ params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; - -- if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms.freq)) { -+ wpa_s->mesh_params = params; -+ if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { - wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh"); - wpa_drv_leave_mesh(wpa_s); - ret = -1; - goto out; - } - -- if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { -- wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher; -- wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher; -- wpa_s->mgmt_group_cipher = wpa_s->mesh_rsn->mgmt_group_cipher; -- } -- -- if (wpa_s->ifmsh) { -- params.ies = wpa_s->ifmsh->mconf->rsn_ie; -- params.ie_len = wpa_s->ifmsh->mconf->rsn_ie_len; -- params.basic_rates = wpa_s->ifmsh->basic_rates; -- params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE; -- params.conf.ht_opmode = wpa_s->ifmsh->bss[0]->iface->ht_op_mode; -- } -- -- wpa_msg(wpa_s, MSG_INFO, "joining mesh %s", -- wpa_ssid_txt(ssid->ssid, ssid->ssid_len)); -- ret = wpa_drv_join_mesh(wpa_s, ¶ms); -- if (ret) -- wpa_msg(wpa_s, MSG_ERROR, "mesh join error=%d", ret); -- -- /* hostapd sets the interface down until we associate */ -- wpa_drv_set_operstate(wpa_s, 1); -- -- if (!ret) -- wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); -- -+ wpas_join_mesh(wpa_s); - out: - return ret; - } ---- a/wpa_supplicant/mesh.h -+++ b/wpa_supplicant/mesh.h -@@ -21,6 +21,7 @@ int wpas_mesh_add_interface(struct wpa_s - int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr); - int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr, - int duration); -+void wpas_join_mesh(struct wpa_supplicant *wpa_s); - - #ifdef CONFIG_MESH - ---- a/wpa_supplicant/wpa_supplicant_i.h -+++ b/wpa_supplicant/wpa_supplicant_i.h -@@ -810,6 +810,7 @@ struct wpa_supplicant { - unsigned int mesh_if_created:1; - unsigned int mesh_ht_enabled:1; - unsigned int mesh_vht_enabled:1; -+ struct wpa_driver_mesh_join_params *mesh_params; - #ifdef CONFIG_PMKSA_CACHE_EXTERNAL - /* struct external_pmksa_cache::list */ - struct dl_list mesh_external_pmksa_cache; diff --git a/package/network/services/hostapd/patches/0102-mesh-factor-out-rsn-initialization.patch b/package/network/services/hostapd/patches/0102-mesh-factor-out-rsn-initialization.patch deleted file mode 100644 index 75717a50e0..0000000000 --- a/package/network/services/hostapd/patches/0102-mesh-factor-out-rsn-initialization.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 04ebcadc059a6cfd45cd8ec06e6321b69bdb68b8 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:48:59 -0700 -Subject: [PATCH 02/15] mesh: factor out rsn initialization - -RSN initialization can be used in different phases -if mesh initialization and mesh join don't happen -in sequence such as DFS CAC is done in between, -hence factor it out to help convering the case. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 73 ++++++++++++++++++++++++++----------------- - wpa_supplicant/mesh.h | 1 + - 2 files changed, 45 insertions(+), 29 deletions(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -147,6 +147,48 @@ static void wpas_mesh_copy_groups(struct - groups_size); - } - -+int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s) -+{ -+ struct hostapd_iface *ifmsh = wpa_s->ifmsh; -+ struct mesh_conf *mconf = wpa_s->ifmsh->mconf; -+ struct wpa_ssid *ssid = wpa_s->current_ssid; -+ struct hostapd_data *bss = ifmsh->bss[0]; -+ static int default_groups[] = { 19, 20, 21, 25, 26, -1 }; -+ size_t len; -+ -+ if (mconf->security != MESH_CONF_SEC_NONE) { -+ if (ssid->passphrase == NULL) { -+ wpa_printf(MSG_ERROR, -+ "mesh: Passphrase for SAE not configured"); -+ return -1; -+ } -+ -+ bss->conf->wpa = ssid->proto; -+ bss->conf->wpa_key_mgmt = ssid->key_mgmt; -+ -+ if (wpa_s->conf->sae_groups && -+ wpa_s->conf->sae_groups[0] > 0) { -+ wpas_mesh_copy_groups(bss, wpa_s); -+ } else { -+ bss->conf->sae_groups = -+ os_memdup(default_groups, -+ sizeof(default_groups)); -+ if (!bss->conf->sae_groups) -+ return -1; -+ } -+ -+ len = os_strlen(ssid->passphrase); -+ bss->conf->ssid.wpa_passphrase = -+ dup_binstr(ssid->passphrase, len); -+ -+ wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf); -+ if (!wpa_s->mesh_rsn) -+ return -1; -+ } -+ -+ return 0; -+} -+ - - static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, - struct wpa_ssid *ssid, -@@ -291,35 +333,8 @@ static int wpa_supplicant_mesh_init(stru - return -1; - } - -- if (mconf->security != MESH_CONF_SEC_NONE) { -- if (ssid->passphrase == NULL) { -- wpa_printf(MSG_ERROR, -- "mesh: Passphrase for SAE not configured"); -- goto out_free; -- } -- -- bss->conf->wpa = ssid->proto; -- bss->conf->wpa_key_mgmt = ssid->key_mgmt; -- -- if (wpa_s->conf->sae_groups && -- wpa_s->conf->sae_groups[0] > 0) { -- wpas_mesh_copy_groups(bss, wpa_s); -- } else { -- bss->conf->sae_groups = -- os_memdup(default_groups, -- sizeof(default_groups)); -- if (!bss->conf->sae_groups) -- goto out_free; -- } -- -- len = os_strlen(ssid->passphrase); -- bss->conf->ssid.wpa_passphrase = -- dup_binstr(ssid->passphrase, len); -- -- wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf); -- if (!wpa_s->mesh_rsn) -- goto out_free; -- } -+ if (wpas_mesh_init_rsn(wpa_s)) -+ goto out_free; - - wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); - ---- a/wpa_supplicant/mesh.h -+++ b/wpa_supplicant/mesh.h -@@ -22,6 +22,7 @@ int wpas_mesh_peer_remove(struct wpa_sup - int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr, - int duration); - void wpas_join_mesh(struct wpa_supplicant *wpa_s); -+int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s); - - #ifdef CONFIG_MESH - diff --git a/package/network/services/hostapd/patches/0103-mesh-relocate-RSN-init-function.patch b/package/network/services/hostapd/patches/0103-mesh-relocate-RSN-init-function.patch deleted file mode 100644 index 153e9b2c67..0000000000 --- a/package/network/services/hostapd/patches/0103-mesh-relocate-RSN-init-function.patch +++ /dev/null @@ -1,41 +0,0 @@ -From cbe8b9901f9cc254cbaa1ec1cee1c52af8f828bf Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:00 -0700 -Subject: [PATCH 03/15] mesh: relocate RSN init function - -RSN init function should work together with mesh join -when it's used. Since mesh join could be called at different stage -if DFS channel is used, relocate the function to mesh join. -It is still the same call flows of mesh join before this changes -if non-DFS channels are used, hence no side effect will occur. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -333,9 +333,6 @@ static int wpa_supplicant_mesh_init(stru - return -1; - } - -- if (wpas_mesh_init_rsn(wpa_s)) -- goto out_free; -- - wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); - - return 0; -@@ -381,6 +378,12 @@ void wpas_join_mesh(struct wpa_supplican - struct wpa_ssid *ssid = wpa_s->current_ssid; - int ret = 0; - -+ if (wpas_mesh_init_rsn(wpa_s)) { -+ wpa_printf(MSG_ERROR, "Init RSN failed. Deinit mesh..."); -+ wpa_supplicant_mesh_deinit(wpa_s); -+ return; -+ } -+ - if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { - wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher; - wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher; diff --git a/package/network/services/hostapd/patches/0104-mesh-use-setup-completion-callback-to-complete-mesh-.patch b/package/network/services/hostapd/patches/0104-mesh-use-setup-completion-callback-to-complete-mesh-.patch deleted file mode 100644 index 8927d5ca8b..0000000000 --- a/package/network/services/hostapd/patches/0104-mesh-use-setup-completion-callback-to-complete-mesh-.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 8a4ebbb6bbbc1460c1d584d1a710bf1361797ffd Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:01 -0700 -Subject: [PATCH 04/15] mesh: use setup completion callback to complete mesh - join - -mesh join function is the last function to be called during -mesh join process, but it's been called a bit earlier than -it's supposed to be, so that some mesh parameter values -such as VHT capabilities not applied correct when mesh join -is in process. Moreover current design of mesh join that is called -directly after mesh initialization is not suitable for DFS channels -to use, since mesh join process should be paused until DFS CAC is -done and resumed once it's done. -Using setup completion callback is how AP mode is using for DFS channels -and mesh can use the same way. -The callback will be called by hostapd_setup_interface_complete_sync. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 7 +++++-- - wpa_supplicant/mesh.h | 2 +- - 2 files changed, 6 insertions(+), 3 deletions(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -215,6 +215,7 @@ static int wpa_supplicant_mesh_init(stru - if (!ifmsh) - return -ENOMEM; - -+ ifmsh->owner = wpa_s; - ifmsh->drv_flags = wpa_s->drv_flags; - ifmsh->num_bss = 1; - ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss, -@@ -231,6 +232,8 @@ static int wpa_supplicant_mesh_init(stru - bss->drv_priv = wpa_s->drv_priv; - bss->iface = ifmsh; - bss->mesh_sta_free_cb = mesh_mpm_free_sta; -+ bss->setup_complete_cb = wpas_mesh_complete_cb; -+ bss->setup_complete_cb_ctx = wpa_s; - frequency = ssid->frequency; - if (frequency != freq->freq && - frequency == freq->freq + freq->sec_channel_offset * 20) { -@@ -372,8 +375,9 @@ void wpa_supplicant_mesh_add_scan_ie(str - } - - --void wpas_join_mesh(struct wpa_supplicant *wpa_s) -+void wpas_mesh_complete_cb(void *ctx) - { -+ struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)ctx; - struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; - struct wpa_ssid *ssid = wpa_s->current_ssid; - int ret = 0; -@@ -495,7 +499,6 @@ int wpa_supplicant_join_mesh(struct wpa_ - goto out; - } - -- wpas_join_mesh(wpa_s); - out: - return ret; - } ---- a/wpa_supplicant/mesh.h -+++ b/wpa_supplicant/mesh.h -@@ -21,7 +21,7 @@ int wpas_mesh_add_interface(struct wpa_s - int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr); - int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr, - int duration); --void wpas_join_mesh(struct wpa_supplicant *wpa_s); -+void wpas_mesh_complete_cb(void *ctx); - int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s); - - #ifdef CONFIG_MESH diff --git a/package/network/services/hostapd/patches/0105-mesh-reflect-country-setting-to-mesh-configuration.patch b/package/network/services/hostapd/patches/0105-mesh-reflect-country-setting-to-mesh-configuration.patch deleted file mode 100644 index ba69478839..0000000000 --- a/package/network/services/hostapd/patches/0105-mesh-reflect-country-setting-to-mesh-configuration.patch +++ /dev/null @@ -1,32 +0,0 @@ -From e223e851cbe776029a2768b56e7aa1a9f2873d09 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:02 -0700 -Subject: [PATCH 05/15] mesh: reflect country setting to mesh configuration - -wpa_supplicant configuration has country parameter that is -supposed to be used in AP mode to indicate supporting 802.11h -and 802.11d. Reflect this configuration to Mesh also since Mesh -is required to support 802.11h and 802.11d to use DFS channels. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -252,6 +252,14 @@ static int wpa_supplicant_mesh_init(stru - bss->conf->start_disabled = 1; - bss->conf->mesh = MESH_ENABLED; - bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; -+ -+ if (ieee80211_is_dfs(ssid->frequency) && wpa_s->conf->country[0]) { -+ conf->ieee80211h = 1; -+ conf->ieee80211d = 1; -+ conf->country[0] = wpa_s->conf->country[0]; -+ conf->country[1] = wpa_s->conf->country[1]; -+ } -+ - bss->iconf = conf; - ifmsh->conf = conf; - diff --git a/package/network/services/hostapd/patches/0106-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch b/package/network/services/hostapd/patches/0106-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch deleted file mode 100644 index 66b956fecf..0000000000 --- a/package/network/services/hostapd/patches/0106-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch +++ /dev/null @@ -1,48 +0,0 @@ -From c7f107e52205dd5fdb20f7ae13413b3673b0547e Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:03 -0700 -Subject: [PATCH 06/15] mesh: inform kernel driver DFS handler in userspace - -NL80211_ATTR_HANDLE_DFS is required by kerenel space -to enable DFS channels that indicates DFS handler -resides in userspace. - -Signed-off-by: Peter Oh ---- - src/drivers/driver.h | 1 + - src/drivers/driver_nl80211.c | 3 +++ - wpa_supplicant/mesh.c | 1 + - 3 files changed, 5 insertions(+) - ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -1390,6 +1390,7 @@ struct wpa_driver_mesh_join_params { - #define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004 - #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 - unsigned int flags; -+ u8 handle_dfs; - }; - - /** ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -9244,6 +9244,9 @@ static int nl80211_join_mesh(struct i802 - - wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags); - -+ if (params->handle_dfs) -+ if (nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS)) -+ goto fail; - container = nla_nest_start(msg, NL80211_ATTR_MESH_SETUP); - if (!container) - goto fail; ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -258,6 +258,7 @@ static int wpa_supplicant_mesh_init(stru - conf->ieee80211d = 1; - conf->country[0] = wpa_s->conf->country[0]; - conf->country[1] = wpa_s->conf->country[1]; -+ wpa_s->mesh_params->handle_dfs = 1; - } - - bss->iconf = conf; diff --git a/package/network/services/hostapd/patches/0107-mesh-apply-channel-attributes-before-running-Mesh.patch b/package/network/services/hostapd/patches/0107-mesh-apply-channel-attributes-before-running-Mesh.patch deleted file mode 100644 index 9c8b2b9487..0000000000 --- a/package/network/services/hostapd/patches/0107-mesh-apply-channel-attributes-before-running-Mesh.patch +++ /dev/null @@ -1,33 +0,0 @@ -From a0c5eea22d5d1181dbe0861b24e4b9bb598f4e50 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:04 -0700 -Subject: [PATCH 07/15] mesh: apply channel attributes before running Mesh - -This helps mesh interface initializes with correct -channel parameters. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -334,6 +334,8 @@ static int wpa_supplicant_mesh_init(stru - conf->basic_rates[rate_len] = -1; - } - -+ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); -+ - if (hostapd_setup_interface(ifmsh)) { - wpa_printf(MSG_ERROR, - "Failed to initialize hostapd interface for mesh"); -@@ -345,8 +347,6 @@ static int wpa_supplicant_mesh_init(stru - return -1; - } - -- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); -- - return 0; - out_free: - wpa_supplicant_mesh_deinit(wpa_s); diff --git a/package/network/services/hostapd/patches/0108-mesh-set-interface-type-to-mesh-before-setting-inter.patch b/package/network/services/hostapd/patches/0108-mesh-set-interface-type-to-mesh-before-setting-inter.patch deleted file mode 100644 index da47aa8d2c..0000000000 --- a/package/network/services/hostapd/patches/0108-mesh-set-interface-type-to-mesh-before-setting-inter.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 143809f1e60f749a5a5c72735ffa8eb99d602cc1 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:05 -0700 -Subject: [PATCH 08/15] mesh: set interface type to mesh before setting - interface - -Correct interface type is required to start DFS CAC that can be -triggered during interface setup. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -336,14 +336,14 @@ static int wpa_supplicant_mesh_init(stru - - wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); - -- if (hostapd_setup_interface(ifmsh)) { -- wpa_printf(MSG_ERROR, -- "Failed to initialize hostapd interface for mesh"); -+ if (wpa_drv_init_mesh(wpa_s)) { -+ wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); - return -1; - } - -- if (wpa_drv_init_mesh(wpa_s)) { -- wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); -+ if (hostapd_setup_interface(ifmsh)) { -+ wpa_printf(MSG_ERROR, -+ "Failed to initialize hostapd interface for mesh"); - return -1; - } - diff --git a/package/network/services/hostapd/patches/0109-mesh-set-mesh-center-frequency.patch b/package/network/services/hostapd/patches/0109-mesh-set-mesh-center-frequency.patch deleted file mode 100644 index ac5e7d3891..0000000000 --- a/package/network/services/hostapd/patches/0109-mesh-set-mesh-center-frequency.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 4347c97600f4484be8df804dfb5ed85b867d3c43 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:06 -0700 -Subject: [PATCH 09/15] mesh: set mesh center frequency - -vht center frequency value is required to compose the correct channel info. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -453,6 +453,7 @@ int wpa_supplicant_join_mesh(struct wpa_ - - if (wpa_s->mesh_vht_enabled) { - ssid->vht = 1; -+ ssid->vht_center_freq1 = params->freq.center_freq1; - switch (params->freq.bandwidth) { - case 80: - if (params->freq.center_freq2) { diff --git a/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch b/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch new file mode 100644 index 0000000000..73ae00ce8d --- /dev/null +++ b/package/network/services/hostapd/patches/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch @@ -0,0 +1,79 @@ +From ce3e491e445ebea9705e76ac7ee3d4841ace1cad Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:08 -0700 +Subject: [PATCH 11/16] mesh: Allow DFS channels to be selected if dfs is + enabled + +Note: DFS is assumed to be usable if a country code has been set + +Signed-off-by: Benjamin Berg +Signed-off-by: Peter Oh +--- + wpa_supplicant/wpa_supplicant.c | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) + +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -2040,6 +2040,8 @@ void ibss_mesh_setup_freq(struct wpa_sup + struct hostapd_freq_params vht_freq; + int chwidth, seg0, seg1; + u32 vht_caps = 0; ++ int dfs_enabled = wpa_s->conf->country[0] && ++ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); + + freq->freq = ssid->frequency; + +@@ -2116,8 +2118,11 @@ void ibss_mesh_setup_freq(struct wpa_sup + return; + + /* Check primary channel flags */ +- if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) ++ if (pri_chan->flag & HOSTAPD_CHAN_DISABLED) + return; ++ if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) ++ if (!dfs_enabled) ++ return; + + #ifdef CONFIG_HT_OVERRIDES + if (ssid->disable_ht40) +@@ -2143,8 +2148,11 @@ void ibss_mesh_setup_freq(struct wpa_sup + return; + + /* Check secondary channel flags */ +- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) ++ if (sec_chan->flag & HOSTAPD_CHAN_DISABLED) + return; ++ if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) ++ if (!dfs_enabled) ++ return; + + freq->channel = pri_chan->chan; + +@@ -2234,8 +2242,11 @@ void ibss_mesh_setup_freq(struct wpa_sup + return; + + /* Back to HT configuration if channel not usable */ +- if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) ++ if (chan->flag & HOSTAPD_CHAN_DISABLED) + return; ++ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) ++ if (!dfs_enabled) ++ return; + } + + chwidth = VHT_CHANWIDTH_80MHZ; +@@ -2255,10 +2266,11 @@ void ibss_mesh_setup_freq(struct wpa_sup + if (!chan) + continue; + +- if (chan->flag & (HOSTAPD_CHAN_DISABLED | +- HOSTAPD_CHAN_NO_IR | +- HOSTAPD_CHAN_RADAR)) ++ if (chan->flag & HOSTAPD_CHAN_DISABLED) + continue; ++ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) ++ if (!dfs_enabled) ++ continue; + + /* Found a suitable second segment for 80+80 */ + chwidth = VHT_CHANWIDTH_80P80MHZ; diff --git a/package/network/services/hostapd/patches/0110-mesh-consider-mesh-interface-on-dfs-event-handler.patch b/package/network/services/hostapd/patches/0110-mesh-consider-mesh-interface-on-dfs-event-handler.patch deleted file mode 100644 index 0c78dd4324..0000000000 --- a/package/network/services/hostapd/patches/0110-mesh-consider-mesh-interface-on-dfs-event-handler.patch +++ /dev/null @@ -1,138 +0,0 @@ -From d0a0e1030005834b99225feb64ec3794d31beab0 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:07 -0700 -Subject: [PATCH 10/15] mesh: consider mesh interface on dfs event handler - -Once mesh starts supporting DFS channels, it has to handle DFS related events -from drivers, hence add mesh interface to the check list. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/ap.c | 55 ++++++++++++++++++++++++++++++++--------- - wpa_supplicant/events.c | 1 + - 2 files changed, 44 insertions(+), 12 deletions(-) - ---- a/wpa_supplicant/ap.c -+++ b/wpa_supplicant/ap.c -@@ -1328,13 +1328,18 @@ int ap_ctrl_iface_chanswitch(struct wpa_ - void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht, - int offset, int width, int cf1, int cf2) - { -+ struct hostapd_iface *iface = wpa_s->ap_iface; -+ - if (!wpa_s->ap_iface) -- return; -+ if (!wpa_s->ifmsh) -+ return; -+ else -+ iface = wpa_s->ifmsh; - - wpa_s->assoc_freq = freq; - if (wpa_s->current_ssid) - wpa_s->current_ssid->frequency = freq; -- hostapd_event_ch_switch(wpa_s->ap_iface->bss[0], freq, ht, -+ hostapd_event_ch_switch(iface->bss[0], freq, ht, - offset, width, cf1, cf2); - } - -@@ -1531,10 +1536,15 @@ int wpas_ap_pmksa_cache_add_external(str - void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s, - struct dfs_event *radar) - { -+ struct hostapd_iface *iface = wpa_s->ap_iface; -+ - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) -- return; -+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) -+ return; -+ else -+ iface = wpa_s->ifmsh; - wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq); -- hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq, -+ hostapd_dfs_radar_detected(iface, radar->freq, - radar->ht_enabled, radar->chan_offset, - radar->chan_width, - radar->cf1, radar->cf2); -@@ -1544,10 +1554,15 @@ void wpas_event_dfs_radar_detected(struc - void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s, - struct dfs_event *radar) - { -+ struct hostapd_iface *iface = wpa_s->ap_iface; -+ - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) -- return; -+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) -+ return; -+ else -+ iface = wpa_s->ifmsh; - wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq); -- hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq, -+ hostapd_dfs_start_cac(iface, radar->freq, - radar->ht_enabled, radar->chan_offset, - radar->chan_width, radar->cf1, radar->cf2); - } -@@ -1556,10 +1571,16 @@ void wpas_event_dfs_cac_started(struct w - void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, - struct dfs_event *radar) - { -+ struct hostapd_iface *iface = wpa_s->ap_iface; -+ - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) -- return; -+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) -+ return; -+ else -+ iface = wpa_s->ifmsh; -+ - wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq); -- hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq, -+ hostapd_dfs_complete_cac(iface, 1, radar->freq, - radar->ht_enabled, radar->chan_offset, - radar->chan_width, radar->cf1, radar->cf2); - } -@@ -1568,10 +1589,15 @@ void wpas_event_dfs_cac_finished(struct - void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, - struct dfs_event *radar) - { -+ struct hostapd_iface *iface = wpa_s->ap_iface; -+ - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) -- return; -+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) -+ return; -+ else -+ iface = wpa_s->ifmsh; - wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq); -- hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq, -+ hostapd_dfs_complete_cac(iface, 0, radar->freq, - radar->ht_enabled, radar->chan_offset, - radar->chan_width, radar->cf1, radar->cf2); - } -@@ -1580,10 +1606,15 @@ void wpas_event_dfs_cac_aborted(struct w - void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s, - struct dfs_event *radar) - { -+ struct hostapd_iface *iface = wpa_s->ap_iface; -+ - if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0]) -- return; -+ if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0]) -+ return; -+ else -+ iface = wpa_s->ifmsh; - wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq); -- hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq, -+ hostapd_dfs_nop_finished(iface, radar->freq, - radar->ht_enabled, radar->chan_offset, - radar->chan_width, radar->cf1, radar->cf2); - } ---- a/wpa_supplicant/events.c -+++ b/wpa_supplicant/events.c -@@ -4168,6 +4168,7 @@ void wpa_supplicant_event(void *ctx, enu - - if (wpa_s->current_ssid->mode == WPAS_MODE_AP || - wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO || -+ wpa_s->current_ssid->mode == WPAS_MODE_MESH || - wpa_s->current_ssid->mode == - WPAS_MODE_P2P_GROUP_FORMATION) { - wpas_ap_ch_switch(wpa_s, data->ch_switch.freq, diff --git a/package/network/services/hostapd/patches/0111-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch b/package/network/services/hostapd/patches/0111-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch deleted file mode 100644 index 928ba8eb91..0000000000 --- a/package/network/services/hostapd/patches/0111-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch +++ /dev/null @@ -1,79 +0,0 @@ -From e7fc5d2e6b34102282ff94a6e5255af4b6e9ccb5 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:08 -0700 -Subject: [PATCH 11/15] mesh: Allow DFS channels to be selected if dfs is - enabled - -Note: DFS is assumed to be usable if a country code has been set - -Signed-off-by: Benjamin Berg -Signed-off-by: Peter Oh ---- - wpa_supplicant/wpa_supplicant.c | 24 ++++++++++++++++++------ - 1 file changed, 18 insertions(+), 6 deletions(-) - ---- a/wpa_supplicant/wpa_supplicant.c -+++ b/wpa_supplicant/wpa_supplicant.c -@@ -2033,6 +2033,8 @@ void ibss_mesh_setup_freq(struct wpa_sup - struct hostapd_freq_params vht_freq; - int chwidth, seg0, seg1; - u32 vht_caps = 0; -+ int dfs_enabled = wpa_s->conf->country[0] && -+ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); - - freq->freq = ssid->frequency; - -@@ -2109,8 +2111,11 @@ void ibss_mesh_setup_freq(struct wpa_sup - return; - - /* Check primary channel flags */ -- if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) -+ if (pri_chan->flag & HOSTAPD_CHAN_DISABLED) - return; -+ if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) -+ if (!dfs_enabled) -+ return; - - #ifdef CONFIG_HT_OVERRIDES - if (ssid->disable_ht40) -@@ -2136,8 +2141,11 @@ void ibss_mesh_setup_freq(struct wpa_sup - return; - - /* Check secondary channel flags */ -- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) -+ if (sec_chan->flag & HOSTAPD_CHAN_DISABLED) - return; -+ if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) -+ if (!dfs_enabled) -+ return; - - freq->channel = pri_chan->chan; - -@@ -2227,8 +2235,11 @@ void ibss_mesh_setup_freq(struct wpa_sup - return; - - /* Back to HT configuration if channel not usable */ -- if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) -+ if (chan->flag & HOSTAPD_CHAN_DISABLED) - return; -+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) -+ if (!dfs_enabled) -+ return; - } - - chwidth = VHT_CHANWIDTH_80MHZ; -@@ -2248,10 +2259,11 @@ void ibss_mesh_setup_freq(struct wpa_sup - if (!chan) - continue; - -- if (chan->flag & (HOSTAPD_CHAN_DISABLED | -- HOSTAPD_CHAN_NO_IR | -- HOSTAPD_CHAN_RADAR)) -+ if (chan->flag & HOSTAPD_CHAN_DISABLED) - continue; -+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) -+ if (!dfs_enabled) -+ continue; - - /* Found a suitable second segment for 80+80 */ - chwidth = VHT_CHANWIDTH_80P80MHZ; diff --git a/package/network/services/hostapd/patches/0112-mesh-allow-mesh-to-send-channel-switch-request.patch b/package/network/services/hostapd/patches/0112-mesh-allow-mesh-to-send-channel-switch-request.patch deleted file mode 100644 index b011a3c350..0000000000 --- a/package/network/services/hostapd/patches/0112-mesh-allow-mesh-to-send-channel-switch-request.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 851f67301a8b9bc96c3d8cce08e355a64d30350d Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:09 -0700 -Subject: [PATCH 12/15] mesh: allow mesh to send channel switch request - -add mesh type to nl80211 channel switch request, -so mesh is able to send the request to kernel drivers. - -Signed-off-by: Peter Oh ---- - src/drivers/driver_nl80211.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -8659,7 +8659,8 @@ static int nl80211_switch_channel(void * - } - - if ((drv->nlmode != NL80211_IFTYPE_AP) && -- (drv->nlmode != NL80211_IFTYPE_P2P_GO)) -+ (drv->nlmode != NL80211_IFTYPE_P2P_GO) && -+ (drv->nlmode != NL80211_IFTYPE_MESH_POINT) ) - return -EOPNOTSUPP; - - /* diff --git a/package/network/services/hostapd/patches/0113-mesh-do-not-allow-pri-sec-channel-switch.patch b/package/network/services/hostapd/patches/0113-mesh-do-not-allow-pri-sec-channel-switch.patch deleted file mode 100644 index 988ccdbeb0..0000000000 --- a/package/network/services/hostapd/patches/0113-mesh-do-not-allow-pri-sec-channel-switch.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 5fe4fa1c1f426d81496458d2127bfbd7623fe5d5 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:10 -0700 -Subject: [PATCH 13/15] mesh: do not allow pri/sec channel switch - -We don't want mesh to switch the channel from primary to secondary, -since mesh points are not able to join each other in that case. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/mesh.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -333,7 +333,10 @@ static int wpa_supplicant_mesh_init(stru - rate_len * sizeof(int)); - conf->basic_rates[rate_len] = -1; - } -- -+ /* Do not allow primary/secondary channel switch in mesh mode, -+ * since mesh is not able to establish a physical link for it -+ */ -+ conf->no_pri_sec_switch = 1; - wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); - - if (wpa_drv_init_mesh(wpa_s)) { diff --git a/package/network/services/hostapd/patches/0114-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch b/package/network/services/hostapd/patches/0114-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch deleted file mode 100644 index 2545cb4a1e..0000000000 --- a/package/network/services/hostapd/patches/0114-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch +++ /dev/null @@ -1,24 +0,0 @@ -From fcc5fe675d1155d65df0471aa06f746c28b66b6c Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:11 -0700 -Subject: [PATCH 14/15] mesh: do not allow scan result to swap pri/sec - -Swapping between primary and secondary channel will break -mesh from joining, hence don't allow it. - -Signed-off-by: Peter Oh ---- - wpa_supplicant/wpa_supplicant.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/wpa_supplicant/wpa_supplicant.c -+++ b/wpa_supplicant/wpa_supplicant.c -@@ -2158,7 +2158,7 @@ void ibss_mesh_setup_freq(struct wpa_sup - } - freq->sec_channel_offset = ht40; - -- if (obss_scan) { -+ if (ssid->mode != WPAS_MODE_MESH && obss_scan) { - struct wpa_scan_results *scan_res; - - scan_res = wpa_supplicant_get_scan_results(wpa_s, NULL, 0); diff --git a/package/network/services/hostapd/patches/0115-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch b/package/network/services/hostapd/patches/0115-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch deleted file mode 100644 index 76b4fe64c9..0000000000 --- a/package/network/services/hostapd/patches/0115-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch +++ /dev/null @@ -1,40 +0,0 @@ -From ab2ba9fd9ac73c83dc15a6d76d93df4434d539d6 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Thu, 12 Apr 2018 02:49:12 -0700 -Subject: [PATCH 15/15] mesh: do not use offchan mgmt tx on DFS - -Drivers don't allow mesh to use offchannel on management Tx. - -Signed-off-by: Peter Oh ---- - src/drivers/driver_nl80211.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -7148,6 +7148,7 @@ static int wpa_driver_nl80211_send_actio - struct wpa_driver_nl80211_data *drv = bss->drv; - int ret = -1; - u8 *buf; -+ int offchanok = 1; - struct ieee80211_hdr *hdr; - - wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, " -@@ -7173,6 +7174,8 @@ static int wpa_driver_nl80211_send_actio - os_memset(bss->rand_addr, 0, ETH_ALEN); - } - -+ if (is_mesh_interface(drv->nlmode) && ieee80211_is_dfs(freq)) -+ offchanok = 0; - if (is_ap_interface(drv->nlmode) && - (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || - (int) freq == bss->freq || drv->device_ap_sme || -@@ -7184,7 +7187,7 @@ static int wpa_driver_nl80211_send_actio - ret = nl80211_send_frame_cmd(bss, freq, wait_time, buf, - 24 + data_len, - &drv->send_action_cookie, -- no_cck, 0, 1, NULL, 0); -+ no_cck, 0, offchanok, NULL, 0); - - os_free(buf); - return ret; diff --git a/package/network/services/hostapd/patches/012-mesh-allow-mesh-to-send-channel-switch-request.patch b/package/network/services/hostapd/patches/012-mesh-allow-mesh-to-send-channel-switch-request.patch new file mode 100644 index 0000000000..39df49870c --- /dev/null +++ b/package/network/services/hostapd/patches/012-mesh-allow-mesh-to-send-channel-switch-request.patch @@ -0,0 +1,25 @@ +From 912b5c89328f1f9585e64fd13460928c71f28352 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:09 -0700 +Subject: [PATCH 12/16] mesh: allow mesh to send channel switch request + +add mesh type to nl80211 channel switch request, +so mesh is able to send the request to kernel drivers. + +Signed-off-by: Peter Oh +--- + src/drivers/driver_nl80211.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -8685,7 +8685,8 @@ static int nl80211_switch_channel(void * + } + + if ((drv->nlmode != NL80211_IFTYPE_AP) && +- (drv->nlmode != NL80211_IFTYPE_P2P_GO)) ++ (drv->nlmode != NL80211_IFTYPE_P2P_GO) && ++ (drv->nlmode != NL80211_IFTYPE_MESH_POINT) ) + return -EOPNOTSUPP; + + /* diff --git a/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch b/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch new file mode 100644 index 0000000000..8a9818b187 --- /dev/null +++ b/package/network/services/hostapd/patches/013-mesh-do-not-allow-pri-sec-channel-switch.patch @@ -0,0 +1,27 @@ +From d7ae7271dce4203bfcd79a230acb24f03f38633d Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:10 -0700 +Subject: [PATCH 13/16] mesh: do not allow pri/sec channel switch + +We don't want mesh to switch the channel from primary to secondary, +since mesh points are not able to join each other in that case. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/mesh.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -337,7 +337,10 @@ static int wpa_supplicant_mesh_init(stru + rate_len * sizeof(int)); + conf->basic_rates[rate_len] = -1; + } +- ++ /* Do not allow primary/secondary channel switch in mesh mode, ++ * since mesh is not able to establish a physical link for it ++ */ ++ conf->no_pri_sec_switch = 1; + wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); + + if (wpa_drv_init_mesh(wpa_s)) { diff --git a/package/network/services/hostapd/patches/014-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch b/package/network/services/hostapd/patches/014-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch new file mode 100644 index 0000000000..3c692a581f --- /dev/null +++ b/package/network/services/hostapd/patches/014-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch @@ -0,0 +1,24 @@ +From cf2ba81fb307f3e87e13896f9dbf93c0c2a9eb92 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:11 -0700 +Subject: [PATCH 14/16] mesh: do not allow scan result to swap pri/sec + +Swapping between primary and secondary channel will break +mesh from joining, hence don't allow it. + +Signed-off-by: Peter Oh +--- + wpa_supplicant/wpa_supplicant.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -2165,7 +2165,7 @@ void ibss_mesh_setup_freq(struct wpa_sup + } + freq->sec_channel_offset = ht40; + +- if (obss_scan) { ++ if (ssid->mode != WPAS_MODE_MESH && obss_scan) { + struct wpa_scan_results *scan_res; + + scan_res = wpa_supplicant_get_scan_results(wpa_s, NULL, 0); diff --git a/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch b/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch new file mode 100644 index 0000000000..9d6ac82bf6 --- /dev/null +++ b/package/network/services/hostapd/patches/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch @@ -0,0 +1,47 @@ +From 48f31256ffebfc43d6b14b93597aa2c7e2975dc4 Mon Sep 17 00:00:00 2001 +From: Peter Oh +Date: Tue, 17 Apr 2018 21:55:12 -0700 +Subject: [PATCH 15/16] mesh: do not use offchan mgmt tx on DFS + +Drivers don't allow mesh to use offchannel on management Tx. + +Signed-off-by: Peter Oh +--- + src/drivers/driver_nl80211.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -7165,6 +7165,10 @@ static int wpa_driver_nl80211_send_actio + struct wpa_driver_nl80211_data *drv = bss->drv; + int ret = -1; + u8 *buf; ++ int offchanok = 1; ++ u16 num_modes, flags; ++ struct hostapd_hw_modes *modes; ++ u8 dfs_domain; + struct ieee80211_hdr *hdr; + + wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, " +@@ -7190,6 +7194,12 @@ static int wpa_driver_nl80211_send_actio + os_memset(bss->rand_addr, 0, ETH_ALEN); + } + ++ if (is_mesh_interface(drv->nlmode) && ++ (modes = nl80211_get_hw_feature_data(bss, &num_modes, &flags, ++ &dfs_domain)) && ++ ieee80211_is_dfs(freq, modes, num_modes)) ++ offchanok = 0; ++ + if (is_ap_interface(drv->nlmode) && + (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || + (int) freq == bss->freq || drv->device_ap_sme || +@@ -7201,7 +7211,7 @@ static int wpa_driver_nl80211_send_actio + ret = nl80211_send_frame_cmd(bss, freq, wait_time, buf, + 24 + data_len, + &drv->send_action_cookie, +- no_cck, 0, 1, NULL, 0); ++ no_cck, 0, offchanok, NULL, 0); + + os_free(buf); + return ret; diff --git a/package/network/services/hostapd/patches/016-mesh-make-forwarding-configurable.patch b/package/network/services/hostapd/patches/016-mesh-make-forwarding-configurable.patch new file mode 100644 index 0000000000..9f916c5266 --- /dev/null +++ b/package/network/services/hostapd/patches/016-mesh-make-forwarding-configurable.patch @@ -0,0 +1,219 @@ +From 9a01d7f21bd33725dc33325a437c3cc4185ee8bd Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 18 Apr 2018 19:24:31 +0200 +Subject: [PATCH 16/16] mesh: make forwarding configurable + +Allow mesh_fwding to be specified in a mesh bss config, pass that +to the driver (only nl80211 implemented for now) and announce +forwarding capability accordingly. + +Signed-off-by: Daniel Golle +--- + src/ap/ap_config.h | 2 ++ + src/drivers/driver.h | 2 ++ + src/drivers/driver_nl80211.c | 3 +++ + wpa_supplicant/config.c | 4 ++++ + wpa_supplicant/config.h | 9 +++++++++ + wpa_supplicant/config_file.c | 4 ++++ + wpa_supplicant/config_ssid.h | 5 +++++ + wpa_supplicant/mesh.c | 6 ++++++ + wpa_supplicant/mesh_mpm.c | 4 ++-- + wpa_supplicant/wpa_supplicant.conf | 3 +++ + 10 files changed, 40 insertions(+), 2 deletions(-) + +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -49,6 +49,7 @@ struct mesh_conf { + int dot11MeshRetryTimeout; /* msec */ + int dot11MeshConfirmTimeout; /* msec */ + int dot11MeshHoldingTimeout; /* msec */ ++ int mesh_fwding; + }; + + #define MAX_STA_COUNT 2007 +@@ -624,6 +625,7 @@ struct hostapd_bss_config { + + #define MESH_ENABLED BIT(0) + int mesh; ++ int mesh_fwding; + + u8 radio_measurements[RRM_CAPABILITIES_IE_LEN]; + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -1363,6 +1363,7 @@ struct wpa_driver_mesh_bss_params { + #define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004 + #define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008 + #define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010 ++#define WPA_DRIVER_MESH_CONF_FLAG_FORWARDING 0x00000020 + /* + * TODO: Other mesh configuration parameters would go here. + * See NL80211_MESHCONF_* for all the mesh config parameters. +@@ -1372,6 +1373,7 @@ struct wpa_driver_mesh_bss_params { + int peer_link_timeout; + int max_peer_links; + int rssi_threshold; ++ int forwarding; + u16 ht_opmode; + }; + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -9230,6 +9230,9 @@ static int nl80211_put_mesh_config(struc + if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && + nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, + params->auto_plinks)) || ++ ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_FORWARDING) && ++ nla_put_u8(msg, NL80211_MESHCONF_FORWARDING, ++ params->forwarding)) || + ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) && + nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, + params->max_peer_links)) || +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -2212,6 +2212,7 @@ static const struct parse_data ssid_fiel + #ifdef CONFIG_MESH + { INT_RANGE(mode, 0, 5) }, + { INT_RANGE(no_auto_peer, 0, 1) }, ++ { INT_RANGE(mesh_fwding, 0, 1) }, + { INT_RANGE(mesh_rssi_threshold, -255, 1) }, + #else /* CONFIG_MESH */ + { INT_RANGE(mode, 0, 4) }, +@@ -2763,6 +2764,7 @@ void wpa_config_set_network_defaults(str + ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; + ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; + ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; ++ ssid->mesh_fwding = DEFAULT_MESH_FWDING; + ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; + #endif /* CONFIG_MESH */ + #ifdef CONFIG_HT_OVERRIDES +@@ -3978,6 +3980,7 @@ struct wpa_config * wpa_config_alloc_emp + config->user_mpm = DEFAULT_USER_MPM; + config->max_peer_links = DEFAULT_MAX_PEER_LINKS; + config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; ++ config->mesh_fwding = DEFAULT_MESH_FWDING; + config->dot11RSNASAERetransPeriod = + DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; + config->fast_reauth = DEFAULT_FAST_REAUTH; +@@ -4600,6 +4603,7 @@ static const struct global_parse_data gl + { INT(user_mpm), 0 }, + { INT_RANGE(max_peer_links, 0, 255), 0 }, + { INT(mesh_max_inactivity), 0 }, ++ { INT_RANGE(mesh_fwding, 0, 1), 0 }, + { INT(dot11RSNASAERetransPeriod), 0 }, + #endif /* CONFIG_MESH */ + { INT(disable_scan_offload), 0 }, +--- a/wpa_supplicant/config.h ++++ b/wpa_supplicant/config.h +@@ -18,6 +18,7 @@ + #define DEFAULT_USER_MPM 1 + #define DEFAULT_MAX_PEER_LINKS 99 + #define DEFAULT_MESH_MAX_INACTIVITY 300 ++#define DEFAULT_MESH_FWDING 1 + /* + * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, + * but use 1000 ms in practice to avoid issues on low power CPUs. +@@ -1306,6 +1307,14 @@ struct wpa_config { + int mesh_max_inactivity; + + /** ++ * mesh_fwding - Mesh network layer-2 forwarding ++ * ++ * This controls whether to enable layer-2 forwarding. ++ * By default: 1: enabled ++ */ ++ int mesh_fwding; ++ ++ /** + * dot11RSNASAERetransPeriod - Timeout to retransmit SAE Auth frame + * + * This timeout value is used in mesh STA to retransmit +--- a/wpa_supplicant/config_file.c ++++ b/wpa_supplicant/config_file.c +@@ -818,6 +818,7 @@ static void wpa_config_write_network(FIL + #endif /* IEEE8021X_EAPOL */ + INT(mode); + INT(no_auto_peer); ++ INT(mesh_fwding); + INT(frequency); + INT(fixed_freq); + #ifdef CONFIG_ACS +@@ -1450,6 +1451,9 @@ static void wpa_config_write_global(FILE + fprintf(f, "mesh_max_inactivity=%d\n", + config->mesh_max_inactivity); + ++ if (config->mesh_fwding != DEFAULT_MESH_FWDING) ++ fprintf(f, "mesh_fwding=%d\n", config->mesh_fwding); ++ + if (config->dot11RSNASAERetransPeriod != + DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD) + fprintf(f, "dot11RSNASAERetransPeriod=%d\n", +--- a/wpa_supplicant/config_ssid.h ++++ b/wpa_supplicant/config_ssid.h +@@ -500,6 +500,11 @@ struct wpa_ssid { + int dot11MeshConfirmTimeout; /* msec */ + int dot11MeshHoldingTimeout; /* msec */ + ++ /** ++ * Mesh network layer-2 forwarding ++ */ ++ int mesh_fwding; ++ + int ht; + int ht40; + +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -120,6 +120,7 @@ static struct mesh_conf * mesh_config_cr + conf->mesh_cc_id = 0; + conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; + conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; ++ conf->mesh_fwding = ssid->mesh_fwding; + conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries; + conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout; + conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout; +@@ -255,6 +256,7 @@ static int wpa_supplicant_mesh_init(stru + bss->conf->start_disabled = 1; + bss->conf->mesh = MESH_ENABLED; + bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; ++ bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding; + + if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, + wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { +@@ -508,6 +510,10 @@ int wpa_supplicant_join_mesh(struct wpa_ + } + params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; + ++ /* always explicitely set forwarding to on or off for now */ ++ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_FORWARDING; ++ params->conf.forwarding = ssid->mesh_fwding; ++ + wpa_s->mesh_params = params; + if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { + wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh"); +--- a/wpa_supplicant/mesh_mpm.c ++++ b/wpa_supplicant/mesh_mpm.c +@@ -288,9 +288,9 @@ static void mesh_mpm_send_plink_action(s + info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1; + /* TODO: Add Connected to Mesh Gate/AS subfields */ + wpabuf_put_u8(buf, info); +- /* always forwarding & accepting plinks for now */ ++ /* set forwarding & always accepting plinks for now */ + wpabuf_put_u8(buf, MESH_CAP_ACCEPT_ADDITIONAL_PEER | +- MESH_CAP_FORWARDING); ++ (conf->mesh_fwding ? MESH_CAP_FORWARDING : 0)); + } else { /* Peer closing frame */ + /* IE: Mesh ID */ + wpabuf_put_u8(buf, WLAN_EID_MESH_ID); +--- a/wpa_supplicant/wpa_supplicant.conf ++++ b/wpa_supplicant/wpa_supplicant.conf +@@ -153,6 +153,9 @@ ap_scan=1 + # This timeout value is used in mesh STA to clean up inactive stations. + #mesh_max_inactivity=300 + ++# Enable 802.11s layer-2 routing and forwarding ++#mesh_fwding=1 ++ + # cert_in_cb - Whether to include a peer certificate dump in events + # This controls whether peer certificates for authentication server and + # its certificate chain are included in EAP peer certificate events. This is diff --git a/package/network/services/hostapd/patches/020-mesh-properly-handle-sae_password.patch b/package/network/services/hostapd/patches/020-mesh-properly-handle-sae_password.patch deleted file mode 100644 index 775774bf64..0000000000 --- a/package/network/services/hostapd/patches/020-mesh-properly-handle-sae_password.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 30c1693f42326d4f927e76120492bc9593b8f739 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Fri, 13 Apr 2018 00:42:10 +0200 -Subject: [PATCH] mesh: properly handle sae_password - -The recently introduced sae_password parameter is only handled properly -in wpa_supplicant/sme.c while wpa_supplicant/mesh.c assumed that -ssid->passphrase exclusively holds the secret. -Import the logic from sme.c to mesh.c to allow having only sae_password -set which otherwise throws this error: -AP-ENABLED -mesh: Passphrase for SAE not configured -Init RSN failed. Deinit mesh... -wlan1: interface state ENABLED->DISABLED -AP-DISABLED -Segmentation fault - -Signed-off-by: Daniel Golle ---- - wpa_supplicant/mesh.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -154,10 +154,14 @@ int wpas_mesh_init_rsn(struct wpa_suppli - struct wpa_ssid *ssid = wpa_s->current_ssid; - struct hostapd_data *bss = ifmsh->bss[0]; - static int default_groups[] = { 19, 20, 21, 25, 26, -1 }; -+ const char *password; - size_t len; - - if (mconf->security != MESH_CONF_SEC_NONE) { -- if (ssid->passphrase == NULL) { -+ password = ssid->sae_password; -+ if (!password) -+ password = ssid->passphrase; -+ if (!password) { - wpa_printf(MSG_ERROR, - "mesh: Passphrase for SAE not configured"); - return -1; -@@ -177,9 +181,9 @@ int wpas_mesh_init_rsn(struct wpa_suppli - return -1; - } - -- len = os_strlen(ssid->passphrase); -+ len = os_strlen(password); - bss->conf->ssid.wpa_passphrase = -- dup_binstr(ssid->passphrase, len); -+ dup_binstr(password, len); - - wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf); - if (!wpa_s->mesh_rsn) diff --git a/package/network/services/hostapd/patches/021-mesh-make-forwarding-configurable.patch b/package/network/services/hostapd/patches/021-mesh-make-forwarding-configurable.patch deleted file mode 100644 index 13f0deaaf0..0000000000 --- a/package/network/services/hostapd/patches/021-mesh-make-forwarding-configurable.patch +++ /dev/null @@ -1,219 +0,0 @@ -From d11881c1ad0d6a102962d1a040a398f597256ae0 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Wed, 18 Apr 2018 19:24:31 +0200 -Subject: [PATCH] mesh: make forwarding configurable -To: hostap@lists.infradead.org -Cc: Jouni Malinen , - Johannes Berg - -Allow mesh_fwding to be specified in a mesh bss config, pass that -to the driver (only nl80211 implemented for now) and announce -forwarding capability accordingly. - -Signed-off-by: Daniel Golle ---- - src/ap/ap_config.h | 2 ++ - src/drivers/driver.h | 2 ++ - src/drivers/driver_nl80211.c | 3 +++ - wpa_supplicant/config.c | 4 ++++ - wpa_supplicant/config.h | 3 +++ - wpa_supplicant/config_file.c | 4 ++++ - wpa_supplicant/config_ssid.h | 5 +++++ - wpa_supplicant/mesh.c | 6 ++++++ - wpa_supplicant/mesh_mpm.c | 4 ++-- - wpa_supplicant/wpa_supplicant.conf | 6 ++++++ - 10 files changed, 37 insertions(+), 2 deletions(-) - ---- a/src/ap/ap_config.h -+++ b/src/ap/ap_config.h -@@ -49,6 +49,7 @@ struct mesh_conf { - int dot11MeshRetryTimeout; /* msec */ - int dot11MeshConfirmTimeout; /* msec */ - int dot11MeshHoldingTimeout; /* msec */ -+ int mesh_fwding; - }; - - #define MAX_STA_COUNT 2007 -@@ -612,6 +613,7 @@ struct hostapd_bss_config { - - #define MESH_ENABLED BIT(0) - int mesh; -+ int mesh_fwding; - - u8 radio_measurements[RRM_CAPABILITIES_IE_LEN]; - ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -1363,6 +1363,7 @@ struct wpa_driver_mesh_bss_params { - #define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004 - #define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008 - #define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010 -+#define WPA_DRIVER_MESH_CONF_FLAG_FORWARDING 0x00000020 - /* - * TODO: Other mesh configuration parameters would go here. - * See NL80211_MESHCONF_* for all the mesh config parameters. -@@ -1372,6 +1373,7 @@ struct wpa_driver_mesh_bss_params { - int peer_link_timeout; - int max_peer_links; - int rssi_threshold; -+ int forwarding; - u16 ht_opmode; - }; - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -9197,6 +9197,9 @@ static int nl80211_put_mesh_config(struc - if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && - nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, - params->auto_plinks)) || -+ ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_FORWARDING) && -+ nla_put_u8(msg, NL80211_MESHCONF_FORWARDING, -+ params->forwarding)) || - ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) && - nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, - params->max_peer_links)) || ---- a/wpa_supplicant/config.c -+++ b/wpa_supplicant/config.c -@@ -2211,6 +2211,7 @@ static const struct parse_data ssid_fiel - #ifdef CONFIG_MESH - { INT_RANGE(mode, 0, 5) }, - { INT_RANGE(no_auto_peer, 0, 1) }, -+ { INT_RANGE(mesh_fwding, 0, 1) }, - { INT_RANGE(mesh_rssi_threshold, -255, 1) }, - #else /* CONFIG_MESH */ - { INT_RANGE(mode, 0, 4) }, -@@ -2757,6 +2758,7 @@ void wpa_config_set_network_defaults(str - ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; - ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; - ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; -+ ssid->mesh_fwding = DEFAULT_MESH_FWDING; - ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; - #endif /* CONFIG_MESH */ - #ifdef CONFIG_HT_OVERRIDES -@@ -3886,6 +3888,7 @@ struct wpa_config * wpa_config_alloc_emp - config->user_mpm = DEFAULT_USER_MPM; - config->max_peer_links = DEFAULT_MAX_PEER_LINKS; - config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; -+ config->mesh_fwding = DEFAULT_MESH_FWDING; - config->dot11RSNASAERetransPeriod = - DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; - config->fast_reauth = DEFAULT_FAST_REAUTH; -@@ -4508,6 +4511,7 @@ static const struct global_parse_data gl - { INT(user_mpm), 0 }, - { INT_RANGE(max_peer_links, 0, 255), 0 }, - { INT(mesh_max_inactivity), 0 }, -+ { INT_RANGE(mesh_fwding, 0, 1), 0 }, - { INT(dot11RSNASAERetransPeriod), 0 }, - #endif /* CONFIG_MESH */ - { INT(disable_scan_offload), 0 }, ---- a/wpa_supplicant/config.h -+++ b/wpa_supplicant/config.h -@@ -18,6 +18,7 @@ - #define DEFAULT_USER_MPM 1 - #define DEFAULT_MAX_PEER_LINKS 99 - #define DEFAULT_MESH_MAX_INACTIVITY 300 -+#define DEFAULT_MESH_FWDING 1 - /* - * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, - * but use 1000 ms in practice to avoid issues on low power CPUs. -@@ -1269,6 +1270,8 @@ struct wpa_config { - */ - int mesh_max_inactivity; - -+ int mesh_fwding; -+ - /** - * dot11RSNASAERetransPeriod - Timeout to retransmit SAE Auth frame - * ---- a/wpa_supplicant/config_file.c -+++ b/wpa_supplicant/config_file.c -@@ -816,6 +816,7 @@ static void wpa_config_write_network(FIL - #endif /* IEEE8021X_EAPOL */ - INT(mode); - INT(no_auto_peer); -+ INT(mesh_fwding); - INT(frequency); - INT(fixed_freq); - #ifdef CONFIG_ACS -@@ -1433,6 +1434,9 @@ static void wpa_config_write_global(FILE - fprintf(f, "mesh_max_inactivity=%d\n", - config->mesh_max_inactivity); - -+ if (config->mesh_fwding != DEFAULT_MESH_FWDING) -+ fprintf(f, "mesh_fwding=%d\n", config->mesh_fwding); -+ - if (config->dot11RSNASAERetransPeriod != - DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD) - fprintf(f, "dot11RSNASAERetransPeriod=%d\n", ---- a/wpa_supplicant/config_ssid.h -+++ b/wpa_supplicant/config_ssid.h -@@ -492,6 +492,11 @@ struct wpa_ssid { - int dot11MeshConfirmTimeout; /* msec */ - int dot11MeshHoldingTimeout; /* msec */ - -+ /** -+ * Mesh network layer-2 forwarding -+ */ -+ int mesh_fwding; -+ - int ht; - int ht40; - ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -121,6 +121,7 @@ static struct mesh_conf * mesh_config_cr - conf->mesh_cc_id = 0; - conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; - conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; -+ conf->mesh_fwding = ssid->mesh_fwding; - conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries; - conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout; - conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout; -@@ -256,6 +257,7 @@ static int wpa_supplicant_mesh_init(stru - bss->conf->start_disabled = 1; - bss->conf->mesh = MESH_ENABLED; - bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; -+ bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding; - - if (ieee80211_is_dfs(ssid->frequency) && wpa_s->conf->country[0]) { - conf->ieee80211h = 1; -@@ -508,6 +510,10 @@ int wpa_supplicant_join_mesh(struct wpa_ - } - params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; - -+ /* always explicitely set forwarding to on or off for now */ -+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_FORWARDING; -+ params->conf.forwarding = ssid->mesh_fwding; -+ - wpa_s->mesh_params = params; - if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { - wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh"); ---- a/wpa_supplicant/mesh_mpm.c -+++ b/wpa_supplicant/mesh_mpm.c -@@ -288,9 +288,9 @@ static void mesh_mpm_send_plink_action(s - info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1; - /* TODO: Add Connected to Mesh Gate/AS subfields */ - wpabuf_put_u8(buf, info); -- /* always forwarding & accepting plinks for now */ -+ /* set forwarding & always accepting plinks for now */ - wpabuf_put_u8(buf, MESH_CAP_ACCEPT_ADDITIONAL_PEER | -- MESH_CAP_FORWARDING); -+ (conf->mesh_fwding ? MESH_CAP_FORWARDING : 0)); - } else { /* Peer closing frame */ - /* IE: Mesh ID */ - wpabuf_put_u8(buf, WLAN_EID_MESH_ID); ---- a/wpa_supplicant/wpa_supplicant.conf -+++ b/wpa_supplicant/wpa_supplicant.conf -@@ -153,6 +153,12 @@ ap_scan=1 - # This timeout value is used in mesh STA to clean up inactive stations. - #mesh_max_inactivity=300 - -+# Enable 802.11s layer-2 routing and forwarding -+#mesh_fwding=1 -+ -+# Accept additional peer links -+#mesh_auto_open_plinks=1 -+ - # cert_in_cb - Whether to include a peer certificate dump in events - # This controls whether peer certificates for authentication server and - # its certificate chain are included in EAP peer certificate events. This is diff --git a/package/network/services/hostapd/patches/022-mesh-fix-crash-with-CONFIG_TAXONOMY-enabled.patch b/package/network/services/hostapd/patches/022-mesh-fix-crash-with-CONFIG_TAXONOMY-enabled.patch index bbc4672f9c..af0148bc4e 100644 --- a/package/network/services/hostapd/patches/022-mesh-fix-crash-with-CONFIG_TAXONOMY-enabled.patch +++ b/package/network/services/hostapd/patches/022-mesh-fix-crash-with-CONFIG_TAXONOMY-enabled.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -216,7 +216,7 @@ static int wpa_supplicant_mesh_init(stru +@@ -214,7 +214,7 @@ static int wpa_supplicant_mesh_init(stru return 0; } diff --git a/package/network/services/hostapd/patches/030-rsn_supp-fix-stub-pmksa_cache.patch b/package/network/services/hostapd/patches/030-rsn_supp-fix-stub-pmksa_cache.patch deleted file mode 100644 index db6ec04b35..0000000000 --- a/package/network/services/hostapd/patches/030-rsn_supp-fix-stub-pmksa_cache.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/src/rsn_supp/pmksa_cache.h -+++ b/src/rsn_supp/pmksa_cache.h -@@ -101,7 +101,7 @@ static inline void pmksa_cache_deinit(st - - static inline struct rsn_pmksa_cache_entry * - pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *pmkid, -- const void *network_ctx) -+ const void *network_ctx, int akmp) - { - return NULL; - } -@@ -148,7 +148,8 @@ static inline int pmksa_cache_set_curren - const u8 *bssid, - void *network_ctx, - int try_opportunistic, -- const u8 *fils_cache_id) -+ const u8 *fils_cache_id, -+ int akmp) - { - return -1; - } diff --git a/package/network/services/hostapd/patches/031-mesh-add-VHT_CHANWIDTH_USE_HT-to-max_oper_chwidth.patch b/package/network/services/hostapd/patches/031-mesh-add-VHT_CHANWIDTH_USE_HT-to-max_oper_chwidth.patch index 8ff11f3191..4b802d2a49 100644 --- a/package/network/services/hostapd/patches/031-mesh-add-VHT_CHANWIDTH_USE_HT-to-max_oper_chwidth.patch +++ b/package/network/services/hostapd/patches/031-mesh-add-VHT_CHANWIDTH_USE_HT-to-max_oper_chwidth.patch @@ -17,7 +17,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2796,6 +2796,7 @@ void wpa_config_set_network_defaults(str +@@ -2802,6 +2802,7 @@ void wpa_config_set_network_defaults(str ssid->mka_priority = DEFAULT_PRIO_NOT_KEY_SERVER; #endif /* CONFIG_MACSEC */ ssid->mac_addr = -1; @@ -37,7 +37,7 @@ Signed-off-by: Peter Oh struct dl_list list; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2285,6 +2285,9 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2292,6 +2292,9 @@ void ibss_mesh_setup_freq(struct wpa_sup vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; seg0 = 114; } diff --git a/package/network/services/hostapd/patches/032-mesh-implement-use-of-VHT20-config-in-mesh-mode.patch b/package/network/services/hostapd/patches/032-mesh-implement-use-of-VHT20-config-in-mesh-mode.patch index bd28fb8de9..f913b1282a 100644 --- a/package/network/services/hostapd/patches/032-mesh-implement-use-of-VHT20-config-in-mesh-mode.patch +++ b/package/network/services/hostapd/patches/032-mesh-implement-use-of-VHT20-config-in-mesh-mode.patch @@ -33,7 +33,7 @@ Signed-off-by: Peter Oh --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2117,9 +2117,15 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2124,9 +2124,15 @@ void ibss_mesh_setup_freq(struct wpa_sup if (!dfs_enabled) return; @@ -51,7 +51,7 @@ Signed-off-by: Peter Oh #endif /* CONFIG_HT_OVERRIDES */ /* Check/setup HT40+/HT40- */ -@@ -2147,8 +2153,6 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2154,8 +2160,6 @@ void ibss_mesh_setup_freq(struct wpa_sup if (!dfs_enabled) return; @@ -60,7 +60,7 @@ Signed-off-by: Peter Oh if (ht40 == -1) { if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) return; -@@ -2192,6 +2196,7 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2199,6 +2203,7 @@ void ibss_mesh_setup_freq(struct wpa_sup wpa_scan_results_free(scan_res); } @@ -68,7 +68,7 @@ Signed-off-by: Peter Oh wpa_printf(MSG_DEBUG, "IBSS/mesh: setup freq channel %d, sec_channel_offset %d", freq->channel, freq->sec_channel_offset); -@@ -2287,7 +2292,10 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2294,7 +2299,10 @@ void ibss_mesh_setup_freq(struct wpa_sup } } else if (ssid->max_oper_chwidth == VHT_CHANWIDTH_USE_HT) { chwidth = VHT_CHANWIDTH_USE_HT; diff --git a/package/network/services/hostapd/patches/033-mesh-fix-parsing-of-max_oper_chwidth.patch b/package/network/services/hostapd/patches/033-mesh-fix-parsing-of-max_oper_chwidth.patch index 6c9f6a7248..cb922ba1e2 100644 --- a/package/network/services/hostapd/patches/033-mesh-fix-parsing-of-max_oper_chwidth.patch +++ b/package/network/services/hostapd/patches/033-mesh-fix-parsing-of-max_oper_chwidth.patch @@ -34,7 +34,7 @@ Forwarded: https://patchwork.ozlabs.org/patch/909751/ --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -503,7 +503,7 @@ struct wpa_ssid { +@@ -511,7 +511,7 @@ struct wpa_ssid { int vht; diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index 9f476210f7..5d9a2397de 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -36,7 +36,7 @@ LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -1270,6 +1276,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) +@@ -1274,6 +1280,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) BCHECK=../src/drivers/build.hostapd @@ -49,7 +49,7 @@ hostapd: $(BCHECK) $(OBJS) $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) @$(E) " LD " $@ -@@ -1315,6 +1327,12 @@ ifeq ($(CONFIG_TLS), linux) +@@ -1316,6 +1328,12 @@ ifeq ($(CONFIG_TLS), linux) HOBJS += ../src/crypto/crypto_linux.o endif @@ -128,7 +128,7 @@ NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -1887,6 +1904,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -1888,6 +1905,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config @@ -141,7 +141,7 @@ wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -1989,6 +2012,12 @@ endif +@@ -1990,6 +2013,12 @@ endif -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@ @$(E) " sed" $< @@ -156,7 +156,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5430,8 +5430,8 @@ union wpa_event_data { +@@ -5449,8 +5449,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -167,7 +167,7 @@ /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -5443,7 +5443,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -5462,7 +5462,7 @@ void wpa_supplicant_event(void *ctx, enu * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -178,8 +178,8 @@ /* --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -1473,8 +1473,8 @@ static void hostapd_event_dfs_cac_starte - #endif /* NEED_AP_MLME */ +@@ -1515,8 +1515,8 @@ static void hostapd_event_wds_sta_interf + } -void wpa_supplicant_event(void *ctx, enum wpa_event_type event, @@ -189,7 +189,7 @@ { struct hostapd_data *hapd = ctx; #ifndef CONFIG_NO_STDOUT_DEBUG -@@ -1694,7 +1694,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -1742,7 +1742,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -231,7 +231,7 @@ os_memset(&global, 0, sizeof(global)); --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -3812,8 +3812,8 @@ static void wpa_supplicant_event_assoc_a +@@ -3901,8 +3901,8 @@ static void wpas_event_assoc_reject(stru } @@ -242,7 +242,7 @@ { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -4632,7 +4632,7 @@ void wpa_supplicant_event(void *ctx, enu +@@ -4669,7 +4669,7 @@ void wpa_supplicant_event(void *ctx, enu } @@ -253,7 +253,7 @@ struct wpa_supplicant *wpa_s; --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -5736,7 +5736,6 @@ struct wpa_interface * wpa_supplicant_ma +@@ -5777,7 +5777,6 @@ struct wpa_interface * wpa_supplicant_ma return NULL; } @@ -261,7 +261,7 @@ /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -5773,6 +5772,11 @@ static int wpa_supplicant_match_existing +@@ -5814,6 +5813,11 @@ static int wpa_supplicant_match_existing #endif /* CONFIG_MATCH_IFACE */ @@ -273,7 +273,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -6029,6 +6033,8 @@ struct wpa_global * wpa_supplicant_init( +@@ -6070,6 +6074,8 @@ struct wpa_global * wpa_supplicant_init( #ifndef CONFIG_NO_WPA_MSG wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index d5cf84fb37..4463c75c91 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3131,6 +3131,10 @@ static int hostapd_config_fill(struct ho +@@ -3214,6 +3214,10 @@ static int hostapd_config_fill(struct ho } #endif /* CONFIG_IEEE80211W */ #ifdef CONFIG_IEEE80211N @@ -13,7 +13,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -763,6 +763,8 @@ struct hostapd_config { +@@ -775,6 +775,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; diff --git a/package/network/services/hostapd/patches/301-mesh-noscan.patch b/package/network/services/hostapd/patches/301-mesh-noscan.patch index b2c59bc5be..c72d5e115c 100644 --- a/package/network/services/hostapd/patches/301-mesh-noscan.patch +++ b/package/network/services/hostapd/patches/301-mesh-noscan.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2216,6 +2216,7 @@ static const struct parse_data ssid_fiel +@@ -2217,6 +2217,7 @@ static const struct parse_data ssid_fiel #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, #endif /* CONFIG_MESH */ @@ -10,7 +10,7 @@ { STR(id_str) }, --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c -@@ -816,6 +816,7 @@ static void wpa_config_write_network(FIL +@@ -818,6 +818,7 @@ static void wpa_config_write_network(FIL #endif /* IEEE8021X_EAPOL */ INT(mode); INT(no_auto_peer); @@ -31,7 +31,7 @@ if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) { --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2024,12 +2024,12 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2031,12 +2031,12 @@ void ibss_mesh_setup_freq(struct wpa_sup { enum hostapd_hw_mode hw_mode; struct hostapd_hw_modes *mode = NULL; @@ -46,7 +46,7 @@ unsigned int j, k; struct hostapd_freq_params vht_freq; int chwidth, seg0, seg1; -@@ -2099,7 +2099,7 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2106,7 +2106,7 @@ void ibss_mesh_setup_freq(struct wpa_sup return; /* Setup higher BW only for 5 GHz */ @@ -57,7 +57,7 @@ for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) { --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -835,6 +835,8 @@ struct wpa_ssid { +@@ -856,6 +856,8 @@ struct wpa_ssid { */ int no_auto_peer; diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index f504ba805f..e72a5c816b 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -4187,7 +4187,7 @@ wpa_supplicant_alloc(struct wpa_supplica +@@ -4228,7 +4228,7 @@ wpa_supplicant_alloc(struct wpa_supplica if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch index 87c30976d0..d46f5144d0 100644 --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -90,6 +90,25 @@ static void hostapd_reload_bss(struct ho +@@ -93,6 +93,25 @@ static void hostapd_reload_bss(struct ho #endif /* CONFIG_NO_RADIUS */ ssid = &hapd->conf->ssid; @@ -26,7 +26,7 @@ if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && ssid->wpa_passphrase_set && ssid->wpa_passphrase) { /* -@@ -168,6 +187,7 @@ int hostapd_reload_config(struct hostapd +@@ -171,6 +190,7 @@ int hostapd_reload_config(struct hostapd struct hostapd_data *hapd = iface->bss[0]; struct hostapd_config *newconf, *oldconf; size_t j; @@ -34,7 +34,7 @@ if (iface->config_fname == NULL) { /* Only in-memory config in use - assume it has been updated */ -@@ -189,21 +209,20 @@ int hostapd_reload_config(struct hostapd +@@ -192,21 +212,20 @@ int hostapd_reload_config(struct hostapd oldconf = hapd->iconf; iface->conf = newconf; diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch index 2cf92c8a18..10c18674c4 100644 --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch @@ -27,7 +27,7 @@ } -@@ -7040,8 +7045,6 @@ static int wpa_driver_nl80211_if_remove( +@@ -7057,8 +7062,6 @@ static int wpa_driver_nl80211_if_remove( } else { wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); nl80211_teardown_ap(bss); @@ -36,7 +36,7 @@ nl80211_destroy_bss(bss); if (!bss->added_if) i802_set_iface_flags(bss, 0); -@@ -7415,7 +7418,6 @@ static int wpa_driver_nl80211_deinit_ap( +@@ -7439,7 +7442,6 @@ static int wpa_driver_nl80211_deinit_ap( if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); @@ -44,7 +44,7 @@ /* * If the P2P GO interface was dynamically added, then it is -@@ -7435,7 +7437,6 @@ static int wpa_driver_nl80211_stop_ap(vo +@@ -7459,7 +7461,6 @@ static int wpa_driver_nl80211_stop_ap(vo if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch index e7fc814d6a..07faead2c5 100644 --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch @@ -78,7 +78,7 @@ #ifdef CONFIG_IEEE80211W #ifdef NEED_AP_MLME -@@ -3026,6 +3083,8 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3031,6 +3088,8 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, reply_size); @@ -89,7 +89,7 @@ #ifdef RADIUS_SERVER --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c -@@ -857,7 +857,13 @@ int hostapd_parse_csa_settings(const cha +@@ -864,7 +864,13 @@ int hostapd_parse_csa_settings(const cha int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd) { diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch index 2f0c31848e..67cfc5a5c8 100644 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch @@ -30,7 +30,7 @@ #include "drivers/driver.h" #include "eap_peer/eap.h" #include "wpa_supplicant_i.h" -@@ -290,6 +291,10 @@ void calculate_update_time(const struct +@@ -292,6 +293,10 @@ void calculate_update_time(const struct static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src, struct os_reltime *fetch_time) { @@ -41,7 +41,7 @@ dst->flags = src->flags; os_memcpy(dst->bssid, src->bssid, ETH_ALEN); dst->freq = src->freq; -@@ -302,6 +307,15 @@ static void wpa_bss_copy_res(struct wpa_ +@@ -304,6 +309,15 @@ static void wpa_bss_copy_res(struct wpa_ dst->est_throughput = src->est_throughput; dst->snr = src->snr; @@ -59,7 +59,7 @@ --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h -@@ -80,6 +80,10 @@ struct wpa_bss { +@@ -81,6 +81,10 @@ struct wpa_bss { u8 ssid[SSID_MAX_LEN]; /** Length of SSID */ size_t ssid_len; @@ -183,7 +183,7 @@ wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -1920,6 +1973,8 @@ void wpa_supplicant_associate(struct wpa +@@ -1927,6 +1980,8 @@ void wpa_supplicant_associate(struct wpa wpa_ssid_txt(ssid->ssid, ssid->ssid_len), ssid->id); wpas_notify_mesh_group_started(wpa_s, ssid); @@ -192,7 +192,7 @@ #else /* CONFIG_MESH */ wpa_msg(wpa_s, MSG_ERROR, "mesh mode support not included in the build"); -@@ -5362,6 +5417,16 @@ static int wpa_supplicant_init_iface(str +@@ -5403,6 +5458,16 @@ static int wpa_supplicant_init_iface(str sizeof(wpa_s->bridge_ifname)); } @@ -209,7 +209,7 @@ /* RSNA Supplicant Key Management - INITIALIZE */ eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); eapol_sm_notify_portValid(wpa_s->eapol, FALSE); -@@ -5683,6 +5748,11 @@ static void wpa_supplicant_deinit_iface( +@@ -5724,6 +5789,11 @@ static void wpa_supplicant_deinit_iface( if (terminate) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index 93ac40e9bd..cd050fc0c9 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -12,7 +12,7 @@ else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -2852,6 +2852,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -2857,6 +2857,7 @@ static int hostapd_ctrl_iface_receive_pr reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -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) { -@@ -2893,6 +2894,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -2898,6 +2899,7 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -51,7 +51,7 @@ if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -9809,6 +9809,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -9825,6 +9825,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); @@ -59,7 +59,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -9816,6 +9817,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -9832,6 +9833,7 @@ char * wpa_supplicant_ctrl_iface_process reply + reply_len, reply_size - reply_len); } @@ -67,7 +67,7 @@ } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -10297,6 +10299,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10313,6 +10315,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -75,7 +75,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) { -@@ -10305,12 +10308,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -10321,12 +10324,15 @@ 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); @@ -101,7 +101,7 @@ static size_t hostapd_write_ht_mcs_bitmask(char *buf, size_t buflen, size_t curr_len, const u8 *mcs_set) -@@ -408,6 +409,7 @@ int hostapd_ctrl_iface_sta_next(struct h +@@ -415,6 +416,7 @@ int hostapd_ctrl_iface_sta_next(struct h return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); } @@ -109,7 +109,7 @@ #ifdef CONFIG_P2P_MANAGER static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, -@@ -746,12 +748,12 @@ int hostapd_ctrl_iface_status(struct hos +@@ -753,12 +755,12 @@ int hostapd_ctrl_iface_status(struct hos return len; len += ret; } @@ -126,7 +126,7 @@ if (os_snprintf_error(buflen - len, ret)) --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2504,6 +2504,7 @@ static const char * bool_txt(Boolean val +@@ -2555,6 +2555,7 @@ static const char * bool_txt(Boolean val return val ? "TRUE" : "FALSE"; } @@ -134,7 +134,7 @@ int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -2679,6 +2680,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -2730,6 +2731,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -163,7 +163,7 @@ { --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -2295,6 +2295,8 @@ static u32 wpa_key_mgmt_suite(struct wpa +@@ -2306,6 +2306,8 @@ static u32 wpa_key_mgmt_suite(struct wpa } @@ -172,7 +172,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -2378,6 +2380,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch +@@ -2389,6 +2391,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch return (int) len; } @@ -182,7 +182,7 @@ --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1170,7 +1170,7 @@ int wpas_ap_wps_nfc_report_handover(stru +@@ -1179,7 +1179,7 @@ int wpas_ap_wps_nfc_report_handover(stru #endif /* CONFIG_WPS */ diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index a8ae70196d..d52684e93b 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli /* Helper macros for network block parser */ #ifdef OFFSET -@@ -2281,6 +2373,8 @@ static const struct parse_data ssid_fiel +@@ -2282,6 +2374,8 @@ static const struct parse_data ssid_fiel { INT(ap_max_inactivity) }, { INT(dtim_period) }, { INT(beacon_int) }, @@ -162,7 +162,7 @@ Signed-hostap: Antonio Quartulli #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) -@@ -749,6 +751,9 @@ struct wpa_ssid { +@@ -757,6 +759,9 @@ struct wpa_ssid { */ void *parent_cred; @@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli * macsec_policy - Determines the policy for MACsec secure session --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3000,6 +3000,12 @@ static void wpas_start_assoc_cb(struct w +@@ -3041,6 +3041,12 @@ static void wpas_start_assoc_cb(struct w params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; diff --git a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch index 6216bf5003..aff00fe556 100644 --- a/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch +++ b/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch @@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich /** --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9217,6 +9217,18 @@ static int nl80211_put_mesh_id(struct nl +@@ -9250,6 +9250,18 @@ static int nl80211_put_mesh_id(struct nl } @@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich static int nl80211_put_mesh_config(struct nl_msg *msg, struct wpa_driver_mesh_bss_params *params) { -@@ -9278,6 +9290,7 @@ static int nl80211_join_mesh(struct i802 +@@ -9311,6 +9323,7 @@ static int nl80211_join_mesh(struct i802 nl80211_put_basic_rates(msg, params->basic_rates) || nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) || nl80211_put_beacon_int(msg, params->beacon_int) || diff --git a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch index df056f2074..6fe9d11585 100644 --- a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +++ b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2097,11 +2097,13 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -2104,11 +2104,13 @@ void ibss_mesh_setup_freq(struct wpa_sup for (j = 0; j < wpa_s->last_scan_res_used; j++) { struct wpa_bss *bss = wpa_s->last_scan_res[j]; diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index 91c5c411dc..022f02d0f1 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -49,7 +49,7 @@ struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -312,6 +312,7 @@ static void hostapd_free_hapd_data(struc +@@ -315,6 +315,7 @@ static void hostapd_free_hapd_data(struc hapd->started = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); @@ -57,7 +57,7 @@ iapp_deinit(hapd->iapp); hapd->iapp = NULL; accounting_deinit(hapd); -@@ -1189,6 +1190,8 @@ static int hostapd_setup_bss(struct host +@@ -1237,6 +1238,8 @@ static int hostapd_setup_bss(struct host if (hapd->driver && hapd->driver->set_operstate) hapd->driver->set_operstate(hapd->drv_priv, 1); @@ -66,7 +66,7 @@ return 0; } -@@ -1603,7 +1606,7 @@ static enum nr_chan_width hostapd_get_nr +@@ -1651,7 +1654,7 @@ static enum nr_chan_width hostapd_get_nr #endif /* NEED_AP_MLME */ @@ -75,7 +75,7 @@ { #ifdef NEED_AP_MLME u16 capab = hostapd_own_capab_info(hapd); -@@ -1810,6 +1813,7 @@ static int hostapd_setup_interface_compl +@@ -1872,6 +1875,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; @@ -83,7 +83,7 @@ wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->conf->channel) { #ifdef NEED_AP_MLME -@@ -1990,6 +1994,7 @@ dfs_offload: +@@ -2052,6 +2056,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -91,7 +91,7 @@ hostapd_set_state(iface, HAPD_IFACE_DISABLED); wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); #ifdef CONFIG_FST -@@ -2444,6 +2449,7 @@ void hostapd_interface_deinit_free(struc +@@ -2517,6 +2522,7 @@ void hostapd_interface_deinit_free(struc (unsigned int) iface->conf->num_bss); driver = iface->bss[0]->driver; drv_priv = iface->bss[0]->drv_priv; @@ -101,7 +101,7 @@ __func__, driver, drv_priv); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -1682,12 +1682,13 @@ ieee802_11_set_radius_info(struct hostap +@@ -1712,12 +1712,13 @@ ieee802_11_set_radius_info(struct hostap static void handle_auth(struct hostapd_data *hapd, @@ -117,7 +117,7 @@ u16 fc; const u8 *challenge = NULL; u32 session_timeout, acct_interim_interval; -@@ -1698,6 +1699,11 @@ static void handle_auth(struct hostapd_d +@@ -1728,6 +1729,11 @@ static void handle_auth(struct hostapd_d char *identity = NULL; char *radius_cui = NULL; u16 seq_ctrl; @@ -129,7 +129,7 @@ if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -1858,6 +1864,13 @@ static void handle_auth(struct hostapd_d +@@ -1888,6 +1894,13 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -143,7 +143,7 @@ if (res == HOSTAPD_ACL_PENDING) return; -@@ -3129,12 +3142,12 @@ void fils_hlp_timeout(void *eloop_ctx, v +@@ -3167,12 +3180,12 @@ void fils_hlp_timeout(void *eloop_ctx, v static void handle_assoc(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, @@ -158,7 +158,7 @@ struct sta_info *sta; u8 *tmp = NULL; struct hostapd_sta_wpa_psk_short *psk = NULL; -@@ -3143,6 +3156,11 @@ static void handle_assoc(struct hostapd_ +@@ -3181,6 +3194,11 @@ static void handle_assoc(struct hostapd_ #ifdef CONFIG_FILS int delay_assoc = 0; #endif /* CONFIG_FILS */ @@ -170,7 +170,7 @@ if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) : sizeof(mgmt->u.assoc_req))) { -@@ -3314,6 +3332,14 @@ static void handle_assoc(struct hostapd_ +@@ -3352,6 +3370,14 @@ static void handle_assoc(struct hostapd_ } #endif /* CONFIG_MBO */ @@ -185,7 +185,7 @@ /* * sta->capability is used in check_assoc_ies() for RRM enabled * capability element. -@@ -3527,6 +3553,7 @@ static void handle_disassoc(struct hosta +@@ -3565,6 +3591,7 @@ static void handle_disassoc(struct hosta wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.disassoc.reason_code)); @@ -193,7 +193,7 @@ sta = ap_get_sta(hapd, mgmt->sa); if (sta == NULL) { -@@ -3592,6 +3619,8 @@ static void handle_deauth(struct hostapd +@@ -3630,6 +3657,8 @@ static void handle_deauth(struct hostapd " reason_code=%d", MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code)); @@ -202,7 +202,7 @@ sta = ap_get_sta(hapd, mgmt->sa); if (sta == NULL) { wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying " -@@ -3911,7 +3940,7 @@ int ieee802_11_mgmt(struct hostapd_data +@@ -3949,7 +3978,7 @@ int ieee802_11_mgmt(struct hostapd_data if (stype == WLAN_FC_STYPE_PROBE_REQ) { @@ -211,7 +211,7 @@ return 1; } -@@ -3931,17 +3960,17 @@ int ieee802_11_mgmt(struct hostapd_data +@@ -3969,17 +3998,17 @@ int ieee802_11_mgmt(struct hostapd_data switch (stype) { case WLAN_FC_STYPE_AUTH: wpa_printf(MSG_DEBUG, "mgmt::auth"); @@ -315,7 +315,7 @@ wpabuf_free(sta->p2p_ie); --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c -@@ -412,6 +412,7 @@ void ap_handle_timer(void *eloop_ctx, vo +@@ -415,6 +415,7 @@ void ap_handle_timer(void *eloop_ctx, vo HOSTAPD_LEVEL_INFO, "deauthenticated due to " "local deauth request"); ap_free_sta(hapd, sta); @@ -323,7 +323,7 @@ return; } -@@ -559,6 +560,7 @@ skip_poll: +@@ -562,6 +563,7 @@ skip_poll: hapd, sta, WLAN_REASON_PREV_AUTH_NOT_VALID); ap_free_sta(hapd, sta); @@ -331,7 +331,7 @@ break; } } -@@ -1220,6 +1222,7 @@ void ap_sta_set_authorized(struct hostap +@@ -1223,6 +1225,7 @@ void ap_sta_set_authorized(struct hostap buf, ip_addr); } else { wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);