aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services
diff options
context:
space:
mode:
Diffstat (limited to 'package/network/services')
-rw-r--r--package/network/services/hostapd/Makefile6
-rw-r--r--package/network/services/hostapd/patches/0101-mesh-factor-out-mesh-join-function.patch219
-rw-r--r--package/network/services/hostapd/patches/0102-mesh-factor-out-rsn-initialization.patch115
-rw-r--r--package/network/services/hostapd/patches/0103-mesh-relocate-RSN-init-function.patch41
-rw-r--r--package/network/services/hostapd/patches/0104-mesh-use-setup-completion-callback-to-complete-mesh-.patch73
-rw-r--r--package/network/services/hostapd/patches/0105-mesh-reflect-country-setting-to-mesh-configuration.patch32
-rw-r--r--package/network/services/hostapd/patches/0106-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch48
-rw-r--r--package/network/services/hostapd/patches/0107-mesh-apply-channel-attributes-before-running-Mesh.patch33
-rw-r--r--package/network/services/hostapd/patches/0108-mesh-set-interface-type-to-mesh-before-setting-inter.patch36
-rw-r--r--package/network/services/hostapd/patches/0109-mesh-set-mesh-center-frequency.patch22
-rw-r--r--package/network/services/hostapd/patches/0110-mesh-consider-mesh-interface-on-dfs-event-handler.patch138
-rw-r--r--package/network/services/hostapd/patches/0111-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch79
-rw-r--r--package/network/services/hostapd/patches/0112-mesh-allow-mesh-to-send-channel-switch-request.patch25
-rw-r--r--package/network/services/hostapd/patches/0113-mesh-do-not-allow-pri-sec-channel-switch.patch27
-rw-r--r--package/network/services/hostapd/patches/0114-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch24
-rw-r--r--package/network/services/hostapd/patches/0115-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch40
-rw-r--r--package/network/services/hostapd/patches/020-mesh-properly-handle-sae_password.patch57
-rw-r--r--package/network/services/hostapd/patches/120-disable_bridge_packet_workaround.patch2
-rw-r--r--package/network/services/hostapd/patches/200-multicall.patch26
-rw-r--r--package/network/services/hostapd/patches/300-noscan.patch4
-rw-r--r--package/network/services/hostapd/patches/310-rescan_immediately.patch2
-rw-r--r--package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch2
-rw-r--r--package/network/services/hostapd/patches/340-reload_freq_change.patch6
-rw-r--r--package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch10
-rw-r--r--package/network/services/hostapd/patches/370-ap_sta_support.patch4
-rw-r--r--package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch20
-rw-r--r--package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch4
-rw-r--r--package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch2
-rw-r--r--package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch4
-rw-r--r--package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch24
-rw-r--r--package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch2
-rw-r--r--package/network/services/hostapd/patches/600-ubus_support.patch34
32 files changed, 1085 insertions, 76 deletions
diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index f279168031..983249c4ec 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -11,9 +11,9 @@ PKG_RELEASE:=1
PKG_SOURCE_URL:=http://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2018-03-26
-PKG_SOURCE_VERSION:=64624f31cf81dc6164462fa153ee7a5909e21183
-PKG_MIRROR_HASH:=2c9e2548b1e6bbafe1b4e545543999b587bbd31a85eba69d54ffced8d7394f30
+PKG_SOURCE_DATE:=2018-04-09
+PKG_SOURCE_VERSION:=fa617ee6a0b2d39e6372c93ef9437caa3bd9065a
+PKG_MIRROR_HASH:=5e6f20153c3405ac905f89fea8a614a57e9ba19583b2de2777179381a74aa7b1
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=BSD-3-Clause
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
new file mode 100644
index 0000000000..7671d1e96c
--- /dev/null
+++ b/package/network/services/hostapd/patches/0101-mesh-factor-out-mesh-join-function.patch
@@ -0,0 +1,219 @@
+From 91c0f3f6a9ecae3c9106bef8a8606fab0792dd28 Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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(&params, 0, sizeof(params));
+- params.meshid = ssid->ssid;
+- params.meshid_len = ssid->ssid_len;
+- ibss_mesh_setup_freq(wpa_s, ssid, &params.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, &params->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, &params.freq)) {
++ wpa_s->mesh_params = params;
++ if (wpa_supplicant_mesh_init(wpa_s, ssid, &params->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, &params);
+- 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
new file mode 100644
index 0000000000..75717a50e0
--- /dev/null
+++ b/package/network/services/hostapd/patches/0102-mesh-factor-out-rsn-initialization.patch
@@ -0,0 +1,115 @@
+From 04ebcadc059a6cfd45cd8ec06e6321b69bdb68b8 Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..153e9b2c67
--- /dev/null
+++ b/package/network/services/hostapd/patches/0103-mesh-relocate-RSN-init-function.patch
@@ -0,0 +1,41 @@
+From cbe8b9901f9cc254cbaa1ec1cee1c52af8f828bf Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..8927d5ca8b
--- /dev/null
+++ b/package/network/services/hostapd/patches/0104-mesh-use-setup-completion-callback-to-complete-mesh-.patch
@@ -0,0 +1,73 @@
+From 8a4ebbb6bbbc1460c1d584d1a710bf1361797ffd Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..ba69478839
--- /dev/null
+++ b/package/network/services/hostapd/patches/0105-mesh-reflect-country-setting-to-mesh-configuration.patch
@@ -0,0 +1,32 @@
+From e223e851cbe776029a2768b56e7aa1a9f2873d09 Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..66b956fecf
--- /dev/null
+++ b/package/network/services/hostapd/patches/0106-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch
@@ -0,0 +1,48 @@
+From c7f107e52205dd5fdb20f7ae13413b3673b0547e Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..9c8b2b9487
--- /dev/null
+++ b/package/network/services/hostapd/patches/0107-mesh-apply-channel-attributes-before-running-Mesh.patch
@@ -0,0 +1,33 @@
+From a0c5eea22d5d1181dbe0861b24e4b9bb598f4e50 Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..da47aa8d2c
--- /dev/null
+++ b/package/network/services/hostapd/patches/0108-mesh-set-interface-type-to-mesh-before-setting-inter.patch
@@ -0,0 +1,36 @@
+From 143809f1e60f749a5a5c72735ffa8eb99d602cc1 Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..ac5e7d3891
--- /dev/null
+++ b/package/network/services/hostapd/patches/0109-mesh-set-mesh-center-frequency.patch
@@ -0,0 +1,22 @@
+From 4347c97600f4484be8df804dfb5ed85b867d3c43 Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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/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
new file mode 100644
index 0000000000..0c78dd4324
--- /dev/null
+++ b/package/network/services/hostapd/patches/0110-mesh-consider-mesh-interface-on-dfs-event-handler.patch
@@ -0,0 +1,138 @@
+From d0a0e1030005834b99225feb64ec3794d31beab0 Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..928ba8eb91
--- /dev/null
+++ b/package/network/services/hostapd/patches/0111-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch
@@ -0,0 +1,79 @@
+From e7fc5d2e6b34102282ff94a6e5255af4b6e9ccb5 Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <benjamin@sipsolutions.net>
+Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..b011a3c350
--- /dev/null
+++ b/package/network/services/hostapd/patches/0112-mesh-allow-mesh-to-send-channel-switch-request.patch
@@ -0,0 +1,25 @@
+From 851f67301a8b9bc96c3d8cce08e355a64d30350d Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..988ccdbeb0
--- /dev/null
+++ b/package/network/services/hostapd/patches/0113-mesh-do-not-allow-pri-sec-channel-switch.patch
@@ -0,0 +1,27 @@
+From 5fe4fa1c1f426d81496458d2127bfbd7623fe5d5 Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..2545cb4a1e
--- /dev/null
+++ b/package/network/services/hostapd/patches/0114-mesh-do-not-allow-scan-result-to-swap-pri-sec.patch
@@ -0,0 +1,24 @@
+From fcc5fe675d1155d65df0471aa06f746c28b66b6c Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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
new file mode 100644
index 0000000000..76b4fe64c9
--- /dev/null
+++ b/package/network/services/hostapd/patches/0115-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch
@@ -0,0 +1,40 @@
+From ab2ba9fd9ac73c83dc15a6d76d93df4434d539d6 Mon Sep 17 00:00:00 2001
+From: Peter Oh <peter.oh@bowerswilkins.com>
+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 <peter.oh@bowerswilkins.com>
+---
+ 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/020-mesh-properly-handle-sae_password.patch b/package/network/services/hostapd/patches/020-mesh-properly-handle-sae_password.patch
new file mode 100644
index 0000000000..17cc1e7383
--- /dev/null
+++ b/package/network/services/hostapd/patches/020-mesh-properly-handle-sae_password.patch
@@ -0,0 +1,57 @@
+From 30c1693f42326d4f927e76120492bc9593b8f739 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel@makrotopia.org>
+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 <daniel@makrotopia.org>
+---
+ wpa_supplicant/mesh.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
+index 22dec4822..0bf87245d 100644
+--- a/wpa_supplicant/mesh.c
++++ b/wpa_supplicant/mesh.c
+@@ -154,10 +154,14 @@ int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s)
+ 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_supplicant *wpa_s)
+ 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)
+--
+2.17.0
+
diff --git a/package/network/services/hostapd/patches/120-disable_bridge_packet_workaround.patch b/package/network/services/hostapd/patches/120-disable_bridge_packet_workaround.patch
index 4a5b63716e..090aaaa0db 100644
--- a/package/network/services/hostapd/patches/120-disable_bridge_packet_workaround.patch
+++ b/package/network/services/hostapd/patches/120-disable_bridge_packet_workaround.patch
@@ -1,6 +1,6 @@
--- a/src/l2_packet/l2_packet_linux.c
+++ b/src/l2_packet/l2_packet_linux.c
-@@ -340,8 +340,7 @@ struct l2_packet_data * l2_packet_init_b
+@@ -360,8 +360,7 @@ struct l2_packet_data * l2_packet_init_b
l2 = l2_packet_init(br_ifname, own_addr, protocol, rx_callback,
rx_callback_ctx, l2_hdr);
diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch
index 92a47742b4..56cb8f95cc 100644
--- a/package/network/services/hostapd/patches/200-multicall.patch
+++ b/package/network/services/hostapd/patches/200-multicall.patch
@@ -72,7 +72,7 @@
ifndef CONFIG_NO_GITVER
# Add VERSION_STR postfix for builds from a git repository
-@@ -358,7 +359,9 @@ endif
+@@ -354,7 +355,9 @@ endif
ifdef CONFIG_IBSS_RSN
NEED_RSN_AUTHENTICATOR=y
CFLAGS += -DCONFIG_IBSS_RSN
@@ -82,7 +82,7 @@
OBJS += ibss_rsn.o
endif
-@@ -866,6 +869,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
+@@ -862,6 +865,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
LIBS += -ldl -rdynamic
endif
@@ -93,7 +93,7 @@
endif
ifdef CONFIG_AP
-@@ -873,9 +880,11 @@ NEED_EAP_COMMON=y
+@@ -869,9 +876,11 @@ NEED_EAP_COMMON=y
NEED_RSN_AUTHENTICATOR=y
CFLAGS += -DCONFIG_AP
OBJS += ap.o
@@ -105,7 +105,7 @@
OBJS += ../src/ap/hostapd.o
OBJS += ../src/ap/wpa_auth_glue.o
OBJS += ../src/ap/utils.o
-@@ -957,6 +966,12 @@ endif
+@@ -953,6 +962,12 @@ endif
ifdef CONFIG_HS20
OBJS += ../src/ap/hs20.o
endif
@@ -118,7 +118,7 @@
endif
ifdef CONFIG_MBO
-@@ -965,7 +980,9 @@ CFLAGS += -DCONFIG_MBO
+@@ -961,7 +976,9 @@ CFLAGS += -DCONFIG_MBO
endif
ifdef NEED_RSN_AUTHENTICATOR
@@ -128,7 +128,7 @@
NEED_AES_WRAP=y
OBJS += ../src/ap/wpa_auth.o
OBJS += ../src/ap/wpa_auth_ie.o
-@@ -1895,6 +1912,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
+@@ -1887,6 +1904,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 " $@
-@@ -1997,6 +2020,12 @@ endif
+@@ -1989,6 +2012,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
-@@ -5418,8 +5418,8 @@ union wpa_event_data {
+@@ -5428,8 +5428,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
-@@ -5431,7 +5431,7 @@ void wpa_supplicant_event(void *ctx, enu
+@@ -5441,7 +5441,7 @@ void wpa_supplicant_event(void *ctx, enu
* Same as wpa_supplicant_event(), but we search for the interface in
* wpa_global.
*/
@@ -242,7 +242,7 @@
{
struct wpa_supplicant *wpa_s = ctx;
int resched;
-@@ -4628,7 +4628,7 @@ void wpa_supplicant_event(void *ctx, enu
+@@ -4632,7 +4632,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
-@@ -5678,7 +5678,6 @@ struct wpa_interface * wpa_supplicant_ma
+@@ -5725,7 +5725,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()
-@@ -5715,6 +5714,11 @@ static int wpa_supplicant_match_existing
+@@ -5762,6 +5761,11 @@ static int wpa_supplicant_match_existing
#endif /* CONFIG_MATCH_IFACE */
@@ -273,7 +273,7 @@
/**
* wpa_supplicant_add_iface - Add a new network interface
-@@ -5971,6 +5975,8 @@ struct wpa_global * wpa_supplicant_init(
+@@ -6018,6 +6022,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 fcd7e5a8dd..e064ad7ebd 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
-@@ -3088,6 +3088,10 @@ static int hostapd_config_fill(struct ho
+@@ -3131,6 +3131,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
-@@ -750,6 +750,8 @@ struct hostapd_config {
+@@ -761,6 +761,8 @@ struct hostapd_config {
int ht_op_mode_fixed;
u16 ht_capab;
diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch
index 552fd182e4..f4ee1d1f68 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
-@@ -4126,7 +4126,7 @@ wpa_supplicant_alloc(struct wpa_supplica
+@@ -4176,7 +4176,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/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
index 272d4f9240..6aa8d1a3a7 100644
--- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
+++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
@@ -1,6 +1,6 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -4231,7 +4231,7 @@ static int nl80211_set_channel(struct i8
+@@ -4234,7 +4234,7 @@ static int nl80211_set_channel(struct i8
freq->freq, freq->ht_enabled, freq->vht_enabled,
freq->bandwidth, freq->center_freq1, freq->center_freq2);
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 f05b9147bf..87c30976d0 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
-@@ -87,6 +87,25 @@ static void hostapd_reload_bss(struct ho
+@@ -90,6 +90,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) {
/*
-@@ -165,6 +184,7 @@ int hostapd_reload_config(struct hostapd
+@@ -168,6 +187,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 */
-@@ -186,21 +206,20 @@ int hostapd_reload_config(struct hostapd
+@@ -189,21 +209,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 fcb572766b..2cf92c8a18 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
@@ -1,6 +1,6 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -2563,10 +2563,15 @@ static int wpa_driver_nl80211_del_beacon
+@@ -2566,10 +2566,15 @@ static int wpa_driver_nl80211_del_beacon
struct nl_msg *msg;
struct wpa_driver_nl80211_data *drv = bss->drv;
@@ -18,7 +18,7 @@
return send_and_recv_msgs(drv, msg, NULL, NULL);
}
-@@ -4832,7 +4837,7 @@ static void nl80211_teardown_ap(struct i
+@@ -4835,7 +4840,7 @@ static void nl80211_teardown_ap(struct i
nl80211_mgmt_unsubscribe(bss, "AP teardown");
nl80211_put_wiphy_data_ap(bss);
@@ -27,7 +27,7 @@
}
-@@ -7037,8 +7042,6 @@ static int wpa_driver_nl80211_if_remove(
+@@ -7040,8 +7045,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);
-@@ -7409,7 +7412,6 @@ static int wpa_driver_nl80211_deinit_ap(
+@@ -7415,7 +7418,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
-@@ -7429,7 +7431,6 @@ static int wpa_driver_nl80211_stop_ap(vo
+@@ -7435,7 +7437,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/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch
index 91731d34c0..f8cd34b00b 100644
--- a/package/network/services/hostapd/patches/370-ap_sta_support.patch
+++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch
@@ -118,7 +118,7 @@
wpa_s->new_connection = 1;
wpa_drv_set_operstate(wpa_s, 0);
#ifndef IEEE8021X_EAPOL
-@@ -5301,6 +5354,20 @@ static int wpa_supplicant_init_iface(str
+@@ -5351,6 +5404,20 @@ static int wpa_supplicant_init_iface(str
sizeof(wpa_s->bridge_ifname));
}
@@ -139,7 +139,7 @@
/* RSNA Supplicant Key Management - INITIALIZE */
eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
-@@ -5625,6 +5692,11 @@ static void wpa_supplicant_deinit_iface(
+@@ -5672,6 +5739,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 39eb415e5e..93ac40e9bd 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
@@ -30,7 +30,7 @@
reply_len = -1;
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -931,6 +931,9 @@ ifdef CONFIG_FILS
+@@ -927,6 +927,9 @@ ifdef CONFIG_FILS
OBJS += ../src/ap/fils_hlp.o
endif
ifdef CONFIG_CTRL_IFACE
@@ -42,7 +42,7 @@
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
-@@ -2130,7 +2130,7 @@ static int wpa_supplicant_ctrl_iface_sta
+@@ -2108,7 +2108,7 @@ static int wpa_supplicant_ctrl_iface_sta
pos += ret;
}
@@ -51,7 +51,7 @@
if (wpa_s->ap_iface) {
pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
end - pos,
-@@ -9831,6 +9831,7 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -9809,6 +9809,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) {
-@@ -9838,6 +9839,7 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -9816,6 +9817,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);
-@@ -10319,6 +10321,7 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -10297,6 +10299,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) {
-@@ -10327,12 +10330,15 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -10305,12 +10308,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);
@@ -126,7 +126,7 @@
if (os_snprintf_error(buflen - len, ret))
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
-@@ -2501,6 +2501,7 @@ static const char * bool_txt(Boolean val
+@@ -2504,6 +2504,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)
{
-@@ -2676,6 +2677,7 @@ int ieee802_1x_get_mib_sta(struct hostap
+@@ -2679,6 +2680,7 @@ int ieee802_1x_get_mib_sta(struct hostap
return len;
}
@@ -144,7 +144,7 @@
static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
-@@ -3773,6 +3773,7 @@ static const char * wpa_bool_txt(int val
+@@ -3772,6 +3772,7 @@ static const char * wpa_bool_txt(int val
return val ? "TRUE" : "FALSE";
}
@@ -152,7 +152,7 @@
#define RSN_SUITE "%02x-%02x-%02x-%d"
#define RSN_SUITE_ARG(s) \
-@@ -3917,7 +3918,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
+@@ -3916,7 +3917,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
return len;
}
diff --git a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
index 70d5d97c3a..1646627191 100644
--- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
+++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
@@ -1,6 +1,6 @@
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
-@@ -1847,6 +1847,31 @@ u32 wpa_akm_to_suite(int akm)
+@@ -1849,6 +1849,31 @@ u32 wpa_akm_to_suite(int akm)
}
@@ -32,7 +32,7 @@
int wpa_compare_rsn_ie(int ft_initial_assoc,
const u8 *ie1, size_t ie1len,
const u8 *ie2, size_t ie2len)
-@@ -1854,8 +1879,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
+@@ -1856,8 +1881,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
if (ie1 == NULL || ie2 == NULL)
return -1;
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 9df9239cb4..cab0325dd6 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
@@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
* macsec_policy - Determines the policy for MACsec secure session
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -2942,6 +2942,12 @@ static void wpas_start_assoc_cb(struct w
+@@ -2987,6 +2987,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/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
index bf9020e2b6..b56fa3d38e 100644
--- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
+++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
@@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -5091,7 +5091,7 @@ static int wpa_driver_nl80211_ibss(struc
+@@ -5094,7 +5094,7 @@ static int wpa_driver_nl80211_ibss(struc
struct wpa_driver_associate_params *params)
{
struct nl_msg *msg;
@@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
int count = 0;
wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
-@@ -5118,6 +5118,37 @@ retry:
+@@ -5121,6 +5121,37 @@ retry:
nl80211_put_beacon_int(msg, params->beacon_int))
goto fail;
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 ef615d2b2f..b868884a97 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
@@ -19,17 +19,17 @@ Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -1394,6 +1394,7 @@ struct wpa_driver_mesh_join_params {
- #define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004
+@@ -1395,6 +1395,7 @@ struct wpa_driver_mesh_join_params {
#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
unsigned int flags;
+ u8 handle_dfs;
+ int mcast_rate;
};
/**
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -9210,6 +9210,18 @@ static int nl80211_put_mesh_id(struct nl
+@@ -9217,6 +9217,18 @@ static int nl80211_put_mesh_id(struct nl
}
@@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
static int nl80211_put_mesh_config(struct nl_msg *msg,
struct wpa_driver_mesh_bss_params *params)
{
-@@ -9268,6 +9280,7 @@ static int nl80211_join_mesh(struct i802
+@@ -9275,6 +9287,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) ||
@@ -58,11 +58,11 @@ Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
-@@ -379,6 +379,7 @@ int wpa_supplicant_join_mesh(struct wpa_
- os_memset(&params, 0, sizeof(params));
- params.meshid = ssid->ssid;
- params.meshid_len = ssid->ssid_len;
-+ params.mcast_rate = ssid->mcast_rate;
- ibss_mesh_setup_freq(wpa_s, ssid, &params.freq);
- wpa_s->mesh_ht_enabled = !!params.freq.ht_enabled;
- wpa_s->mesh_vht_enabled = !!params.freq.vht_enabled;
+@@ -448,6 +448,7 @@ int wpa_supplicant_join_mesh(struct wpa_
+
+ params->meshid = ssid->ssid;
+ params->meshid_len = ssid->ssid_len;
++ params->mcast_rate = ssid->mcast_rate;
+ ibss_mesh_setup_freq(wpa_s, ssid, &params->freq);
+ wpa_s->mesh_ht_enabled = !!params->freq.ht_enabled;
+ wpa_s->mesh_vht_enabled = !!params->freq.vht_enabled;
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 4f8ea499c0..48682abd04 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
-@@ -2081,11 +2081,13 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2095,11 +2095,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 940e171ed0..91c5c411dc 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
-@@ -309,6 +309,7 @@ static void hostapd_free_hapd_data(struc
+@@ -312,6 +312,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);
-@@ -1186,6 +1187,8 @@ static int hostapd_setup_bss(struct host
+@@ -1189,6 +1190,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;
}
-@@ -1600,7 +1603,7 @@ static enum nr_chan_width hostapd_get_nr
+@@ -1603,7 +1606,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);
-@@ -1807,6 +1810,7 @@ static int hostapd_setup_interface_compl
+@@ -1810,6 +1813,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
-@@ -1987,6 +1991,7 @@ dfs_offload:
+@@ -1990,6 +1994,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
-@@ -2441,6 +2446,7 @@ void hostapd_interface_deinit_free(struc
+@@ -2444,6 +2449,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
-@@ -1662,12 +1662,13 @@ ieee802_11_set_radius_info(struct hostap
+@@ -1682,12 +1682,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;
-@@ -1678,6 +1679,11 @@ static void handle_auth(struct hostapd_d
+@@ -1698,6 +1699,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)",
-@@ -1836,6 +1842,13 @@ static void handle_auth(struct hostapd_d
+@@ -1858,6 +1864,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;
-@@ -3102,12 +3115,12 @@ void fils_hlp_timeout(void *eloop_ctx, v
+@@ -3129,12 +3142,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;
-@@ -3116,6 +3129,11 @@ static void handle_assoc(struct hostapd_
+@@ -3143,6 +3156,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))) {
-@@ -3287,6 +3305,14 @@ static void handle_assoc(struct hostapd_
+@@ -3314,6 +3332,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.
-@@ -3500,6 +3526,7 @@ static void handle_disassoc(struct hosta
+@@ -3527,6 +3553,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) {
-@@ -3565,6 +3592,8 @@ static void handle_deauth(struct hostapd
+@@ -3592,6 +3619,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 "
-@@ -3884,7 +3913,7 @@ int ieee802_11_mgmt(struct hostapd_data
+@@ -3911,7 +3940,7 @@ int ieee802_11_mgmt(struct hostapd_data
if (stype == WLAN_FC_STYPE_PROBE_REQ) {
@@ -211,7 +211,7 @@
return 1;
}
-@@ -3904,17 +3933,17 @@ int ieee802_11_mgmt(struct hostapd_data
+@@ -3931,17 +3960,17 @@ int ieee802_11_mgmt(struct hostapd_data
switch (stype) {
case WLAN_FC_STYPE_AUTH:
wpa_printf(MSG_DEBUG, "mgmt::auth");
@@ -341,7 +341,7 @@
hapd->msg_ctx_parent != hapd->msg_ctx)
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
-@@ -176,6 +176,7 @@ static void hostapd_wpa_auth_psk_failure
+@@ -177,6 +177,7 @@ static void hostapd_wpa_auth_psk_failure
struct hostapd_data *hapd = ctx;
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR,
MAC2STR(addr));