PKG_SOURCE_URL:=http://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2020-06-08
-PKG_SOURCE_VERSION:=5a8b366233f5585e68a4ffbb604fbb4a848eb325
-PKG_MIRROR_HASH:=1b2a4947034142587a3f81eac2ea27dd64650e77f8943d973623b47533be2393
+PKG_SOURCE_DATE:=2021-04-04
+PKG_SOURCE_VERSION:=5f082c158c49a23614b69e4465e9a7299f004f5f
+PKG_MIRROR_HASH:=1c36abf23ad7ba510232300c9d8138479398e6582d71a421867754e20487f083
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=BSD-3-Clause
+++ /dev/null
-From 7f8ac02e8524633d92941f7934440c19f1002616 Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 13:53:17 +0200
-Subject: HE/VHT: Fix frequency setup with HE enabled
-
-Some places in the code base were not using the wrappers like
-hostapd_set_oper_centr_freq_seg0_idx and friends. This could lead to
-errors, for example when joining 80 MHz mesh networks. Fix this, by
-enforcing usage of these wrappers.
-
-wpa_supplicant_conf_ap_ht() now checks for HE capability before dealing
-with VHT in order for these wrappers to work, as they first check HE
-support in the config.
-
-While doing these changes, I've noticed that the extra channel setup
-code for mesh networks in wpa_supplicant/mesh.c should not be necessary
-anymore and dropped it. wpa_supplicant_conf_ap_ht() should handle this
-setup already.
-
-Acked-by: John Crispin <john@phrozen.org>
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- src/ap/dfs.c | 8 ++++----
- wpa_supplicant/ap.c | 40 +++++++++++++++++++++++-----------------
- wpa_supplicant/mesh.c | 24 ------------------------
- 3 files changed, 27 insertions(+), 45 deletions(-)
-
---- a/src/ap/dfs.c
-+++ b/src/ap/dfs.c
-@@ -1028,7 +1028,7 @@ static int hostapd_dfs_start_channel_swi
- unsigned int i;
- int err = 1;
- struct hostapd_hw_modes *cmode = iface->current_mode;
-- u8 current_vht_oper_chwidth = iface->conf->vht_oper_chwidth;
-+ u8 current_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf);
-
- wpa_printf(MSG_DEBUG, "%s called (CAC active: %s, CSA active: %s)",
- __func__, iface->cac_started ? "yes" : "no",
-@@ -1089,8 +1089,8 @@ static int hostapd_dfs_start_channel_swi
- "freq=%d chan=%d sec_chan=%d", channel->freq,
- channel->chan, secondary_channel);
-
-- new_vht_oper_chwidth = iface->conf->vht_oper_chwidth;
-- iface->conf->vht_oper_chwidth = current_vht_oper_chwidth;
-+ new_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf);
-+ hostapd_set_oper_chwidth(iface->conf, current_vht_oper_chwidth);
-
- /* Setup CSA request */
- os_memset(&csa_settings, 0, sizeof(csa_settings));
-@@ -1130,7 +1130,7 @@ static int hostapd_dfs_start_channel_swi
- iface->freq = channel->freq;
- iface->conf->channel = channel->chan;
- iface->conf->secondary_channel = secondary_channel;
-- iface->conf->vht_oper_chwidth = new_vht_oper_chwidth;
-+ hostapd_set_oper_chwidth(iface->conf, new_vht_oper_chwidth);
- hostapd_set_oper_centr_freq_seg0_idx(iface->conf,
- oper_centr_freq_seg0_idx);
- hostapd_set_oper_centr_freq_seg1_idx(iface->conf,
---- a/wpa_supplicant/ap.c
-+++ b/wpa_supplicant/ap.c
-@@ -52,6 +52,7 @@ static void wpas_conf_ap_vht(struct wpa_
- #ifdef CONFIG_P2P
- u8 center_chan = 0;
- u8 channel = conf->channel;
-+ u8 freq_seg_idx;
- #endif /* CONFIG_P2P */
-
- if (!conf->secondary_channel)
-@@ -59,19 +60,21 @@ static void wpas_conf_ap_vht(struct wpa_
-
- /* Use the maximum oper channel width if it's given. */
- if (ssid->max_oper_chwidth)
-- conf->vht_oper_chwidth = ssid->max_oper_chwidth;
-+ hostapd_set_oper_chwidth(conf, ssid->max_oper_chwidth);
-
- ieee80211_freq_to_chan(ssid->vht_center_freq2,
-- &conf->vht_oper_centr_freq_seg1_idx);
-+ &freq_seg_idx);
-+ hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx);
-
- if (!ssid->p2p_group) {
- if (!ssid->vht_center_freq1 ||
-- conf->vht_oper_chwidth == CHANWIDTH_USE_HT)
-+ hostapd_get_oper_chwidth(conf) == CHANWIDTH_USE_HT)
- goto no_vht;
- ieee80211_freq_to_chan(ssid->vht_center_freq1,
-- &conf->vht_oper_centr_freq_seg0_idx);
-+ &freq_seg_idx);
-+ hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx);
- wpa_printf(MSG_DEBUG, "VHT seg0 index %d for AP",
-- conf->vht_oper_centr_freq_seg0_idx);
-+ hostapd_get_oper_centr_freq_seg0_idx(conf));
- return;
- }
-
-@@ -96,14 +99,14 @@ static void wpas_conf_ap_vht(struct wpa_
- * try oper_cwidth 160 MHz first then VHT 80 MHz, if 160 MHz is
- * not supported.
- */
-- conf->vht_oper_chwidth = CHANWIDTH_160MHZ;
-+ hostapd_set_oper_chwidth(conf, CHANWIDTH_160MHZ);
- center_chan = wpas_p2p_get_vht160_center(wpa_s, mode, channel);
- if (center_chan) {
- wpa_printf(MSG_DEBUG,
- "VHT center channel %u for auto-selected 160 MHz bandwidth",
- center_chan);
- } else {
-- conf->vht_oper_chwidth = CHANWIDTH_80MHZ;
-+ hostapd_set_oper_chwidth(conf, CHANWIDTH_80MHZ);
- center_chan = wpas_p2p_get_vht80_center(wpa_s, mode,
- channel);
- wpa_printf(MSG_DEBUG,
-@@ -115,9 +118,9 @@ static void wpas_conf_ap_vht(struct wpa_
- if (!center_chan)
- goto no_vht;
-
-- conf->vht_oper_centr_freq_seg0_idx = center_chan;
-+ hostapd_set_oper_centr_freq_seg0_idx(conf, center_chan);
- wpa_printf(MSG_DEBUG, "VHT seg0 index %d for P2P GO",
-- conf->vht_oper_centr_freq_seg0_idx);
-+ hostapd_get_oper_centr_freq_seg0_idx(conf));
- return;
- #endif /* CONFIG_P2P */
-
-@@ -125,9 +128,9 @@ no_vht:
- wpa_printf(MSG_DEBUG,
- "No VHT higher bandwidth support for the selected channel %d",
- conf->channel);
-- conf->vht_oper_centr_freq_seg0_idx =
-- conf->channel + conf->secondary_channel * 2;
-- conf->vht_oper_chwidth = CHANWIDTH_USE_HT;
-+ hostapd_set_oper_centr_freq_seg0_idx(
-+ conf, conf->channel + conf->secondary_channel * 2);
-+ hostapd_set_oper_chwidth(conf, CHANWIDTH_USE_HT);
- }
-
-
-@@ -231,16 +234,19 @@ int wpa_supplicant_conf_ap_ht(struct wpa
- HT_CAP_INFO_TX_STBC |
- HT_CAP_INFO_MAX_AMSDU_SIZE);
-
-+ /* check this before VHT, because setting oper chan
-+ * width and friends is the same call for HE and VHT
-+ * and checks if conf->ieee8021ax == 1 */
-+ if (mode->he_capab[wpas_mode_to_ieee80211_mode(
-+ ssid->mode)].he_supported &&
-+ ssid->he)
-+ conf->ieee80211ax = 1;
-+
- if (mode->vht_capab && ssid->vht) {
- conf->ieee80211ac = 1;
- conf->vht_capab |= mode->vht_capab;
- wpas_conf_ap_vht(wpa_s, ssid, conf, mode);
- }
--
-- if (mode->he_capab[wpas_mode_to_ieee80211_mode(
-- ssid->mode)].he_supported &&
-- ssid->he)
-- conf->ieee80211ax = 1;
- }
- }
-
---- a/wpa_supplicant/mesh.c
-+++ b/wpa_supplicant/mesh.c
-@@ -333,30 +333,6 @@ static int wpa_supplicant_mesh_init(stru
- frequency);
- goto out_free;
- }
-- if (ssid->ht40)
-- conf->secondary_channel = ssid->ht40;
-- if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) {
-- if (ssid->max_oper_chwidth != DEFAULT_MAX_OPER_CHWIDTH)
-- conf->vht_oper_chwidth = ssid->max_oper_chwidth;
-- switch (conf->vht_oper_chwidth) {
-- case CHANWIDTH_80MHZ:
-- case CHANWIDTH_80P80MHZ:
-- ieee80211_freq_to_chan(
-- frequency,
-- &conf->vht_oper_centr_freq_seg0_idx);
-- conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2;
-- break;
-- case CHANWIDTH_160MHZ:
-- ieee80211_freq_to_chan(
-- frequency,
-- &conf->vht_oper_centr_freq_seg0_idx);
-- conf->vht_oper_centr_freq_seg0_idx += ssid->ht40 * 2;
-- conf->vht_oper_centr_freq_seg0_idx += 40 / 5;
-- break;
-- }
-- ieee80211_freq_to_chan(ssid->vht_center_freq2,
-- &conf->vht_oper_centr_freq_seg1_idx);
-- }
-
- if (ssid->mesh_basic_rates == NULL) {
- /*
+++ /dev/null
-From 93da12fd9ff7596f057ddd3f0e67210960fe6a90 Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 13:53:18 +0200
-Subject: mesh: Fix channel init order, disable pri/sec channel switch
-
-wpa_supplicant_conf_ap_ht() has to happen before
-hostapd_setup_interface() in order for its configuration settings to
-have effect on interface configuration.
-
-Disable primary and secondary channel switch because of missing tie
-breaking rule/frames in mesh networks. A rather long comment about
-this issue is placed in mesh.c in the corresponding place.
-
-I was not able to reproduce the memory corruption during
-mesh_secure_ocv_mix_legacy, which lead to a revert of a similar patch in
-the past.
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- wpa_supplicant/mesh.c | 27 +++++++++++++++++++++++++--
- 1 file changed, 25 insertions(+), 2 deletions(-)
-
---- a/wpa_supplicant/mesh.c
-+++ b/wpa_supplicant/mesh.c
-@@ -363,6 +363,31 @@ static int wpa_supplicant_mesh_init(stru
- conf->basic_rates[rate_len] = -1;
- }
-
-+ /* While it can enhance performance to switch the primary channel, which
-+ * is also the secondary channel of another network at the same time),
-+ * to the other primary channel, problems exist with this in mesh
-+ * networks.
-+ *
-+ * Example with problems:
-+ * - 3 mesh nodes M1-M3, freq (5200, 5180)
-+ * - other node O1, e.g. AP mode, freq (5180, 5200),
-+ * Locations: O1 M1 M2 M3
-+ *
-+ * M3 can only send frames to M1 over M2, no direct connection is
-+ * possible
-+ * Start O1, M1 and M3 first, M1 or O1 will switch channels to align
-+ * with* each other. M3 does not swap, because M1 or O1 cannot be
-+ * reached. M2 is started afterwards and can either connect to M3 or M1
-+ * because of this primary secondary channel switch.
-+ *
-+ * Solutions: (1) central coordination -> not always possible
-+ * (2) disable pri/sec channel switch in mesh networks
-+ *
-+ * In AP mode, when all nodes can work independently, this poses of
-+ * course no problem, therefore disable it only in mesh mode. */
-+ conf->no_pri_sec_switch = 1;
-+ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
-+
- if (wpa_drv_init_mesh(wpa_s)) {
- wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver");
- return -1;
-@@ -374,8 +399,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);
+++ /dev/null
-From df6745e8c8c1312d41f3e7fd044f438408526a2b Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 13:53:19 +0200
-Subject: wpa_supplicant: Handle HT40 and mode downgrade in AP mode
-
-Add some missing pieces to the interface configuration of AP/mesh mode
-in wpa_supplicant.
- - check for secondary channel and HT40 capability
- - try to downgrade to IEEE 802.11b if 802.11g is not available
-Especially with the HT40 check, this code now performs all settings,
-which the deleted/duplicated mesh code did.
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- wpa_supplicant/ap.c | 52 +++++++++++++++++++++++++++++++++++++--------
- 1 file changed, 43 insertions(+), 9 deletions(-)
-
---- a/wpa_supplicant/ap.c
-+++ b/wpa_supplicant/ap.c
-@@ -134,6 +134,24 @@ no_vht:
- }
-
-
-+static struct hostapd_hw_modes *
-+wpa_supplicant_find_hw_mode(struct wpa_supplicant *wpa_s,
-+ enum hostapd_hw_mode hw_mode)
-+{
-+ struct hostapd_hw_modes *mode = NULL;
-+ int i;
-+
-+ for (i = 0; i < wpa_s->hw.num_modes; i++) {
-+ if (wpa_s->hw.modes[i].mode == hw_mode) {
-+ mode = &wpa_s->hw.modes[i];
-+ break;
-+ }
-+ }
-+
-+ return mode;
-+}
-+
-+
- int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid,
- struct hostapd_config *conf)
-@@ -147,9 +165,6 @@ int wpa_supplicant_conf_ap_ht(struct wpa
- return -1;
- }
-
-- /* TODO: enable HT40 if driver supports it;
-- * drop to 11b if driver does not support 11g */
--
- /*
- * Enable HT20 if the driver supports it, by setting conf->ieee80211n
- * and a mask of allowed capabilities within conf->ht_capab.
-@@ -158,17 +173,28 @@ int wpa_supplicant_conf_ap_ht(struct wpa
- */
- if (wpa_s->hw.modes) {
- struct hostapd_hw_modes *mode = NULL;
-- int i, no_ht = 0;
-+ int no_ht = 0;
-
- wpa_printf(MSG_DEBUG,
- "Determining HT/VHT options based on driver capabilities (freq=%u chan=%u)",
- ssid->frequency, conf->channel);
-
-- for (i = 0; i < wpa_s->hw.num_modes; i++) {
-- if (wpa_s->hw.modes[i].mode == conf->hw_mode) {
-- mode = &wpa_s->hw.modes[i];
-- break;
-- }
-+ mode = wpa_supplicant_find_hw_mode(wpa_s, conf->hw_mode);
-+
-+ /* May drop to IEEE 802.11b if the driver does not support IEEE
-+ * 802.11g */
-+ if (!mode && conf->hw_mode == HOSTAPD_MODE_IEEE80211G) {
-+ conf->hw_mode = HOSTAPD_MODE_IEEE80211B;
-+ wpa_printf(MSG_INFO,
-+ "Try downgrade to IEEE 802.11b as 802.11g is not supported by the current hardware");
-+ mode = wpa_supplicant_find_hw_mode(wpa_s,
-+ conf->hw_mode);
-+ }
-+
-+ if (!mode) {
-+ wpa_printf(MSG_ERROR,
-+ "No match between requested and supported hw modes found");
-+ return -1;
- }
-
- #ifdef CONFIG_HT_OVERRIDES
-@@ -193,6 +219,14 @@ int wpa_supplicant_conf_ap_ht(struct wpa
- HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET),
- ssid->ht40);
- conf->ieee80211n = 1;
-+
-+ if (ssid->ht40 &&
-+ (mode->ht_capab &
-+ HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
-+ conf->secondary_channel = ssid->ht40;
-+ else
-+ conf->secondary_channel = 0;
-+
- #ifdef CONFIG_P2P
- if (ssid->p2p_group &&
- conf->hw_mode == HOSTAPD_MODE_IEEE80211A &&
+++ /dev/null
-From d34b33451c83414d690661905f14cf585fb10ccd Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Wed, 14 Oct 2020 21:31:15 +0200
-Subject: wpa_supplicant: Fix frequency config for VHT/HE cases
-
-Fix compilation without CONFIG_P2P and only set secondary channel seg
-idx if we use a mode supporting a sec channel for VHT/HE.
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- wpa_supplicant/ap.c | 22 +++++++++++++---------
- 1 file changed, 13 insertions(+), 9 deletions(-)
-
---- a/wpa_supplicant/ap.c
-+++ b/wpa_supplicant/ap.c
-@@ -52,8 +52,8 @@ static void wpas_conf_ap_vht(struct wpa_
- #ifdef CONFIG_P2P
- u8 center_chan = 0;
- u8 channel = conf->channel;
-- u8 freq_seg_idx;
- #endif /* CONFIG_P2P */
-+ u8 freq_seg_idx;
-
- if (!conf->secondary_channel)
- goto no_vht;
-@@ -62,24 +62,28 @@ static void wpas_conf_ap_vht(struct wpa_
- if (ssid->max_oper_chwidth)
- hostapd_set_oper_chwidth(conf, ssid->max_oper_chwidth);
-
-- ieee80211_freq_to_chan(ssid->vht_center_freq2,
-- &freq_seg_idx);
-- hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx);
-+ if (hostapd_get_oper_chwidth(conf) == CHANWIDTH_80P80MHZ) {
-+ ieee80211_freq_to_chan(ssid->vht_center_freq2,
-+ &freq_seg_idx);
-+ hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx);
-+ }
-
- if (!ssid->p2p_group) {
-- if (!ssid->vht_center_freq1 ||
-- hostapd_get_oper_chwidth(conf) == CHANWIDTH_USE_HT)
-+ if (!ssid->vht_center_freq1)
- goto no_vht;
- ieee80211_freq_to_chan(ssid->vht_center_freq1,
- &freq_seg_idx);
- hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx);
-- wpa_printf(MSG_DEBUG, "VHT seg0 index %d for AP",
-- hostapd_get_oper_centr_freq_seg0_idx(conf));
-+
-+ wpa_printf(MSG_DEBUG,
-+ "VHT seg0 index %d and seg1 index %d for AP",
-+ hostapd_get_oper_centr_freq_seg0_idx(conf),
-+ hostapd_get_oper_centr_freq_seg1_idx(conf));
- return;
- }
-
- #ifdef CONFIG_P2P
-- switch (conf->vht_oper_chwidth) {
-+ switch (hostapd_get_oper_chwidth(conf)) {
- case CHANWIDTH_80MHZ:
- case CHANWIDTH_80P80MHZ:
- center_chan = wpas_p2p_get_vht80_center(wpa_s, mode, channel);
+++ /dev/null
-From 5965c7da5d6d0b81ef32cd19d9f69efcd9e0aa5c Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 13:53:21 +0200
-Subject: wpa_supplicant: Enable VHT and HE in default config parameters
-
-Enable VHT and HE as default config parameters in order for
-wpa_supplicant AP mode to use it, if hw support is given.
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- wpa_supplicant/config.c | 2 ++
- wpa_supplicant/config_file.c | 3 ++-
- 2 files changed, 4 insertions(+), 1 deletion(-)
-
---- a/wpa_supplicant/config.c
-+++ b/wpa_supplicant/config.c
-@@ -3036,6 +3036,8 @@ void wpa_config_set_network_defaults(str
- ssid->wpa_deny_ptk0_rekey = PTK0_REKEY_ALLOW_ALWAYS;
- ssid->bg_scan_period = DEFAULT_BG_SCAN_PERIOD;
- ssid->ht = 1;
-+ ssid->vht = 1;
-+ ssid->he = 1;
- #ifdef IEEE8021X_EAPOL
- ssid->eapol_flags = DEFAULT_EAPOL_FLAGS;
- ssid->eap_workaround = DEFAULT_EAP_WORKAROUND;
---- a/wpa_supplicant/config_file.c
-+++ b/wpa_supplicant/config_file.c
-@@ -876,9 +876,10 @@ static void wpa_config_write_network(FIL
- write_int(f, "proactive_key_caching", ssid->proactive_key_caching, -1);
- INT(disabled);
- INT(mixed_cell);
-- INT(vht);
-+ INT_DEF(vht, 1);
- INT_DEF(ht, 1);
- INT(ht40);
-+ INT_DEF(he, 1);
- INT_DEF(max_oper_chwidth, DEFAULT_MAX_OPER_CHWIDTH);
- INT(vht_center_freq1);
- INT(vht_center_freq2);
+++ /dev/null
-From a72599b319ab0e17ebdf3415b45d6deb405c3a84 Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 13:53:22 +0200
-Subject: hw_features: Better debug messages for some error cases
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- src/common/hw_features_common.c | 36 ++++++++++++++++++++++++++-------
- 1 file changed, 29 insertions(+), 7 deletions(-)
-
---- a/src/common/hw_features_common.c
-+++ b/src/common/hw_features_common.c
-@@ -540,13 +540,20 @@ int hostapd_set_freq_params(struct hosta
- if (center_segment1 ||
- (center_segment0 != 0 &&
- 5000 + center_segment0 * 5 != data->center_freq1 &&
-- 2407 + center_segment0 * 5 != data->center_freq1))
-+ 2407 + center_segment0 * 5 != data->center_freq1)) {
-+ wpa_printf(MSG_ERROR,
-+ "20/40 MHz: center segment 0 (=%d) and center freq 1 (=%d) not in sync",
-+ center_segment0, data->center_freq1);
- return -1;
-+ }
- break;
- case CHANWIDTH_80P80MHZ:
- if (center_segment1 == center_segment0 + 4 ||
-- center_segment1 == center_segment0 - 4)
-+ center_segment1 == center_segment0 - 4) {
-+ wpa_printf(MSG_ERROR,
-+ "80+80 MHz: center segment 1 only 20 MHz apart");
- return -1;
-+ }
- data->center_freq2 = 5000 + center_segment1 * 5;
- /* fall through */
- case CHANWIDTH_80MHZ:
-@@ -555,8 +562,11 @@ int hostapd_set_freq_params(struct hosta
- center_segment1) ||
- (oper_chwidth == CHANWIDTH_80P80MHZ &&
- !center_segment1) ||
-- !sec_channel_offset)
-+ !sec_channel_offset) {
-+ wpa_printf(MSG_ERROR,
-+ "80/80+80 MHz: center segment 1 wrong or no second channel offset");
- return -1;
-+ }
- if (!center_segment0) {
- if (channel <= 48)
- center_segment0 = 42;
-@@ -582,16 +592,25 @@ int hostapd_set_freq_params(struct hosta
- center_segment0 == channel - 2 ||
- center_segment0 == channel - 6)
- data->center_freq1 = 5000 + center_segment0 * 5;
-- else
-+ else {
-+ wpa_printf(MSG_ERROR,
-+ "Wrong coupling between HT and VHT/HE channel setting");
- return -1;
-+ }
- }
- break;
- case CHANWIDTH_160MHZ:
- data->bandwidth = 160;
-- if (center_segment1)
-+ if (center_segment1) {
-+ wpa_printf(MSG_ERROR,
-+ "160 MHz: center segment 1 should not be set");
- return -1;
-- if (!sec_channel_offset)
-+ }
-+ if (!sec_channel_offset) {
-+ wpa_printf(MSG_ERROR,
-+ "160 MHz: second channel offset not set");
- return -1;
-+ }
- /*
- * Note: HT/VHT config and params are coupled. Check if
- * HT40 channel band is in VHT160 channel band configuration.
-@@ -605,8 +624,11 @@ int hostapd_set_freq_params(struct hosta
- center_segment0 == channel - 10 ||
- center_segment0 == channel - 14)
- data->center_freq1 = 5000 + center_segment0 * 5;
-- else
-+ else {
-+ wpa_printf(MSG_ERROR,
-+ "160 MHz: HT40 channel band is not in 160 MHz band");
- return -1;
-+ }
- break;
- }
-
+++ /dev/null
-From c3f37c35f0ef02bd88ce4faf25a466e52e7a64f8 Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 13:53:23 +0200
-Subject: DFS: Use helper functions for VHT/HE parameters
-
-This is needed to cover the HE-specific conf->he_oper_chwidth value in
-addition to conf->vht_oper_chwidth.
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- src/ap/dfs.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
---- a/src/ap/dfs.c
-+++ b/src/ap/dfs.c
-@@ -955,10 +955,13 @@ dfs_downgrade_bandwidth(struct hostapd_i
- if (*skip_radar) {
- *skip_radar = 0;
- } else {
-- if (iface->conf->vht_oper_chwidth == CHANWIDTH_USE_HT)
-+ int oper_chwidth;
-+
-+ oper_chwidth = hostapd_get_oper_chwidth(iface->conf);
-+ if (oper_chwidth == CHANWIDTH_USE_HT)
- break;
- *skip_radar = 1;
-- iface->conf->vht_oper_chwidth--;
-+ hostapd_set_oper_chwidth(iface->conf, oper_chwidth - 1);
- }
- }
-
+++ /dev/null
-From f1df4fbfc7ad3d8c18a8c9fe5c71628f2ed09bb7 Mon Sep 17 00:00:00 2001
-From: Peter Oh <peter.oh@bowerswilkins.com>
-Date: Tue, 30 Jun 2020 14:18:56 +0200
-Subject: 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 were not
-applied correct when mesh join is in process. Moreover, the current
-design of mesh join that is called directly after mesh initialization
-isn't suitable for DFS channels to use, since mesh join process should
-be paused until DFS CAC is done and resumed after it's done.
-
-The callback will be called by hostapd_setup_interface_complete_sync().
-There is a possibility that completing mesh init fails, so add error
-handling codes for that.
-
-Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
----
- src/ap/hostapd.c | 11 ++++++++++-
- wpa_supplicant/mesh.c | 12 +++++++++++-
- 2 files changed, 21 insertions(+), 2 deletions(-)
-
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -434,6 +434,8 @@ static void hostapd_free_hapd_data(struc
- #ifdef CONFIG_MESH
- wpabuf_free(hapd->mesh_pending_auth);
- hapd->mesh_pending_auth = NULL;
-+ /* handling setup failure is already done */
-+ hapd->setup_complete_cb = NULL;
- #endif /* CONFIG_MESH */
-
- hostapd_clean_rrm(hapd);
-@@ -2156,6 +2158,13 @@ dfs_offload:
- if (hapd->setup_complete_cb)
- hapd->setup_complete_cb(hapd->setup_complete_cb_ctx);
-
-+#ifdef CONFIG_MESH
-+ if (delay_apply_cfg && !iface->mconf) {
-+ wpa_printf(MSG_ERROR, "Error while completing mesh init");
-+ goto fail;
-+ }
-+#endif /* CONFIG_MESH */
-+
- wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
- iface->bss[0]->conf->iface);
- if (iface->interfaces && iface->interfaces->terminate_on_error > 0)
-@@ -2299,7 +2308,7 @@ int hostapd_setup_interface(struct hosta
- ret = setup_interface(iface);
- if (ret) {
- wpa_printf(MSG_ERROR, "%s: Unable to setup interface.",
-- iface->bss[0]->conf->iface);
-+ iface->conf ? iface->conf->bss[0]->iface : "N/A");
- return -1;
- }
-
---- a/wpa_supplicant/mesh.c
-+++ b/wpa_supplicant/mesh.c
-@@ -244,6 +244,14 @@ static int wpas_mesh_complete(struct wpa
- }
-
-
-+static void wpas_mesh_complete_cb(void *arg)
-+{
-+ struct wpa_supplicant *wpa_s = arg;
-+
-+ wpas_mesh_complete(wpa_s);
-+}
-+
-+
- static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid,
- struct hostapd_freq_params *freq)
-@@ -267,6 +275,7 @@ static int wpa_supplicant_mesh_init(stru
- if (!ifmsh)
- return -ENOMEM;
-
-+ ifmsh->owner = wpa_s;
- ifmsh->drv_flags = wpa_s->drv_flags;
- ifmsh->drv_flags2 = wpa_s->drv_flags2;
- ifmsh->num_bss = 1;
-@@ -285,6 +294,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) {
-@@ -525,7 +536,6 @@ int wpa_supplicant_join_mesh(struct wpa_
- goto out;
- }
-
-- ret = wpas_mesh_complete(wpa_s);
- out:
- return ret;
- }
+++ /dev/null
-From e3608040c4ebf7c5a5d6b6fd4ca2a4d2143df4cc Mon Sep 17 00:00:00 2001
-From: Peter Oh <peter.oh@bowerswilkins.com>
-Date: Tue, 30 Jun 2020 14:18:57 +0200
-Subject: mesh: Update ssid->frequency as pri/sec channels switch
-
-ssid->frequency is one of the variables used to get the channel number
-from a given frequency. Leaving it as unchanged when pri/sec channel
-switch will cause picking up a wrong channel number after applying the
-secondary channel offset for HT40 and leads to failing interface
-bring-up.
-
-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
-@@ -301,6 +301,7 @@ static int wpa_supplicant_mesh_init(stru
- frequency == freq->freq + freq->sec_channel_offset * 20) {
- wpa_printf(MSG_DEBUG, "mesh: pri/sec channels switched");
- frequency = freq->freq;
-+ ssid->frequency = frequency;
- }
- wpa_s->assoc_freq = frequency;
- wpa_s->current_ssid = ssid;
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -2349,6 +2349,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2395,6 +2395,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
int chwidth, seg0, seg1;
u32 vht_caps = 0;
int is_24ghz;
freq->freq = ssid->frequency;
-@@ -2436,8 +2438,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2484,8 +2486,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
return;
/* Check primary channel flags */
freq->channel = pri_chan->chan;
-@@ -2470,8 +2475,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2518,8 +2523,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
return;
/* Check secondary channel flags */
if (ht40 == -1) {
if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS))
-@@ -2564,8 +2572,11 @@ skip_ht40:
+@@ -2612,8 +2620,11 @@ skip_ht40:
return;
/* Back to HT configuration if channel not usable */
}
chwidth = CHANWIDTH_80MHZ;
-@@ -2585,10 +2596,12 @@ skip_ht40:
+@@ -2633,10 +2644,12 @@ skip_ht40:
if (!chan)
continue;
+++ /dev/null
-From 8725909789555e549d92b1f8f582fa63adb390a5 Mon Sep 17 00:00:00 2001
-From: Peter Oh <peter.oh@bowerswilkins.com>
-Date: Tue, 30 Jun 2020 14:18:59 +0200
-Subject: nl80211: Do not set offchanok on DFS channels in non-ETSI for mesh
-
-mac80211 does not allow mgmt tx to use off channel on
-DFS channels in non-ETSI domain, because it will invalidate
-CAC result on current operating channel.
-(mac80211 commit: 34373d12f3cbb74960a73431138ef619d857996f)
-Hence don't set offchanok for mgmt tx in case of DFS channels
-in non-ETSI.
-
-Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
----
- src/drivers/driver_nl80211.c | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -7817,6 +7817,28 @@ static int wpa_driver_nl80211_send_actio
- os_memset(bss->rand_addr, 0, ETH_ALEN);
- }
-
-+#ifdef CONFIG_MESH
-+ if (is_mesh_interface(drv->nlmode)) {
-+ struct hostapd_hw_modes *modes;
-+ u16 num_modes, flags;
-+ u8 dfs_domain;
-+ int i;
-+
-+ modes = nl80211_get_hw_feature_data(bss, &num_modes,
-+ &flags, &dfs_domain);
-+ if (dfs_domain != HOSTAPD_DFS_REGION_ETSI &&
-+ ieee80211_is_dfs(bss->freq, modes, num_modes))
-+ offchanok = 0;
-+ if (modes) {
-+ for (i = 0; i < num_modes; i++) {
-+ os_free(modes[i].channels);
-+ os_free(modes[i].rates);
-+ }
-+ os_free(modes);
-+ }
-+ }
-+#endif /* CONFIG_MESH */
-+
- if (is_ap_interface(drv->nlmode) &&
- (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) ||
- (int) freq == bss->freq || drv->device_ap_sme ||
+++ /dev/null
-From a27faf2c9a0c07f6a74420824b941cdc91c33b45 Mon Sep 17 00:00:00 2001
-From: Peter Oh <peter.oh@bowerswilkins.com>
-Date: Tue, 30 Jun 2020 14:19:00 +0200
-Subject: mesh: Fix channel switch error during CAC
-
-Mesh interface would have used its channel parameters that were
-configured during initialization even after channel switch due to DFS
-radar detection during CAC which could result in a channel switch error.
-Fix the error by updating the channel parameters when channel has been
-changed from the initial one.
-
-Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
----
- wpa_supplicant/mesh.c | 38 ++++++++++++++++++++++++++++++++++++++
- 1 file changed, 38 insertions(+)
-
---- a/wpa_supplicant/mesh.c
-+++ b/wpa_supplicant/mesh.c
-@@ -13,6 +13,7 @@
- #include "utils/uuid.h"
- #include "common/ieee802_11_defs.h"
- #include "common/wpa_ctrl.h"
-+#include "common/hw_features_common.h"
- #include "ap/sta_info.h"
- #include "ap/hostapd.h"
- #include "ap/ieee802_11.h"
-@@ -207,6 +208,43 @@ static int wpas_mesh_complete(struct wpa
- return -1;
- }
-
-+ /*
-+ * Update channel configuration if the channel has changed since the
-+ * initial setting, i.e., due to DFS radar detection during CAC.
-+ */
-+ if (ifmsh->freq != params->freq.freq) {
-+ struct he_capabilities *he_capab = NULL;
-+
-+ wpa_s->assoc_freq = ifmsh->freq;
-+ ssid->frequency = ifmsh->freq;
-+
-+ if (ifmsh->current_mode)
-+ he_capab = &ifmsh->current_mode->he_capab[
-+ IEEE80211_MODE_MESH];
-+
-+ if (hostapd_set_freq_params(
-+ ¶ms->freq,
-+ ifmsh->conf->hw_mode,
-+ ifmsh->freq,
-+ ifmsh->conf->channel,
-+ ifmsh->conf->enable_edmg,
-+ ifmsh->conf->edmg_channel,
-+ ifmsh->conf->ieee80211n,
-+ ifmsh->conf->ieee80211ac,
-+ ifmsh->conf->ieee80211ax,
-+ ifmsh->conf->secondary_channel,
-+ hostapd_get_oper_chwidth(ifmsh->conf),
-+ hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf),
-+ hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf),
-+ ifmsh->conf->vht_capab,
-+ he_capab)) {
-+ wpa_printf(MSG_ERROR,
-+ "Error updating mesh frequency params");
-+ wpa_supplicant_mesh_deinit(wpa_s);
-+ return -1;
-+ }
-+ }
-+
- if (ifmsh->mconf->security != MESH_CONF_SEC_NONE &&
- wpas_mesh_init_rsn(wpa_s)) {
- wpa_printf(MSG_ERROR,
+++ /dev/null
-From 12ae3e3dba0e0826a4b181e1e5f1f9fd8708845c Mon Sep 17 00:00:00 2001
-From: Peter Oh <peter.oh@bowerswilkins.com>
-Date: Tue, 30 Jun 2020 14:19:01 +0200
-Subject: mesh: Inform kernel driver about DFS handler in userspace
-
-The kernel requires indication of DFS handler residing in user space
-(NL80211_ATTR_HANDLE_DFS) to enable DFS channels.
-
-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
-@@ -1542,6 +1542,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;
-+ bool handle_dfs;
- };
-
- struct wpa_driver_set_key_params {
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -10073,6 +10073,9 @@ static int nl80211_join_mesh(struct i802
-
- wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags);
-
-+ if (params->handle_dfs && 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
-@@ -361,6 +361,7 @@ static int wpa_supplicant_mesh_init(stru
- conf->country[0] = wpa_s->conf->country[0];
- conf->country[1] = wpa_s->conf->country[1];
- conf->country[2] = ' ';
-+ wpa_s->mesh_params->handle_dfs = true;
- }
-
- bss->iconf = conf;
+++ /dev/null
-From 0896c442dcd5477ac8c49036c089f728f703df88 Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 14:19:02 +0200
-Subject: mesh: Fix for mesh init/deinit
-
-Send mesh group started notification after join completion
-callback is called.
-
-Implement outstanding TODO, to leave the mesh network on deinit.
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- wpa_supplicant/mesh.c | 32 ++++++++++++++++++++------------
- wpa_supplicant/mesh.h | 6 ++++--
- wpa_supplicant/wpa_supplicant.c | 8 ++------
- 3 files changed, 26 insertions(+), 20 deletions(-)
-
---- a/wpa_supplicant/mesh.c
-+++ b/wpa_supplicant/mesh.c
-@@ -30,20 +30,20 @@
-
- static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s)
- {
-- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh);
-+ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true);
- wpa_s->ifmsh = NULL;
- wpa_s->current_ssid = NULL;
- os_free(wpa_s->mesh_rsn);
- wpa_s->mesh_rsn = NULL;
- os_free(wpa_s->mesh_params);
- wpa_s->mesh_params = NULL;
-- /* TODO: leave mesh (stop beacon). This will happen on link down
-- * anyway, so it's not urgent */
-+ wpa_supplicant_leave_mesh(wpa_s, false);
- }
-
-
- void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s,
-- struct hostapd_iface *ifmsh)
-+ struct hostapd_iface *ifmsh,
-+ bool also_clear_hostapd)
- {
- if (!ifmsh)
- return;
-@@ -64,8 +64,10 @@ void wpa_supplicant_mesh_iface_deinit(st
- }
-
- /* take care of shared data */
-- hostapd_interface_deinit(ifmsh);
-- hostapd_interface_free(ifmsh);
-+ if (also_clear_hostapd) {
-+ hostapd_interface_deinit(ifmsh);
-+ hostapd_interface_free(ifmsh);
-+ }
- }
-
-
-@@ -249,8 +251,7 @@ static int wpas_mesh_complete(struct wpa
- wpas_mesh_init_rsn(wpa_s)) {
- wpa_printf(MSG_ERROR,
- "mesh: RSN initialization failed - deinit mesh");
-- wpa_supplicant_mesh_deinit(wpa_s);
-- wpa_drv_leave_mesh(wpa_s);
-+ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, false);
- return -1;
- }
-
-@@ -275,9 +276,15 @@ static int wpas_mesh_complete(struct wpa
- /* hostapd sets the interface down until we associate */
- wpa_drv_set_operstate(wpa_s, 1);
-
-- if (!ret)
-+ if (!ret) {
- wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
-
-+ wpa_msg(wpa_s, MSG_INFO, MESH_GROUP_STARTED "ssid=\"%s\" id=%d",
-+ wpa_ssid_txt(ssid->ssid, ssid->ssid_len),
-+ ssid->id);
-+ wpas_notify_mesh_group_started(wpa_s, ssid);
-+ }
-+
- return ret;
- }
-
-@@ -571,7 +578,7 @@ int wpa_supplicant_join_mesh(struct wpa_
- 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);
-+ wpa_supplicant_leave_mesh(wpa_s, true);
- ret = -1;
- goto out;
- }
-@@ -581,14 +588,15 @@ out:
- }
-
-
--int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s)
-+int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s, bool need_deinit)
- {
- int ret = 0;
-
- wpa_msg(wpa_s, MSG_INFO, "leaving mesh");
-
- /* Need to send peering close messages first */
-- wpa_supplicant_mesh_deinit(wpa_s);
-+ if (need_deinit)
-+ wpa_supplicant_mesh_deinit(wpa_s);
-
- ret = wpa_drv_leave_mesh(wpa_s);
- if (ret)
---- a/wpa_supplicant/mesh.h
-+++ b/wpa_supplicant/mesh.h
-@@ -11,9 +11,11 @@
-
- int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
--int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s);
-+int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s,
-+ bool need_deinit);
- void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s,
-- struct hostapd_iface *ifmsh);
-+ struct hostapd_iface *ifmsh,
-+ bool also_clear_hostapd);
- int wpas_mesh_scan_result_text(const u8 *ies, size_t ies_len, char *buf,
- char *end);
- int wpas_mesh_add_interface(struct wpa_supplicant *wpa_s, char *ifname,
---- a/wpa_supplicant/wpa_supplicant.c
-+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -2225,10 +2225,6 @@ void wpa_supplicant_associate(struct wpa
- return;
- }
- wpa_s->current_bss = bss;
-- wpa_msg(wpa_s, MSG_INFO, MESH_GROUP_STARTED "ssid=\"%s\" id=%d",
-- wpa_ssid_txt(ssid->ssid, ssid->ssid_len),
-- ssid->id);
-- wpas_notify_mesh_group_started(wpa_s, ssid);
- #else /* CONFIG_MESH */
- wpa_msg(wpa_s, MSG_ERROR,
- "mesh mode support not included in the build");
-@@ -3938,7 +3934,7 @@ void wpa_supplicant_deauthenticate(struc
- wpa_s->ifname);
- wpas_notify_mesh_group_removed(wpa_s, mconf->meshid,
- mconf->meshid_len, reason_code);
-- wpa_supplicant_leave_mesh(wpa_s);
-+ wpa_supplicant_leave_mesh(wpa_s, true);
- }
- #endif /* CONFIG_MESH */
-
-@@ -6551,7 +6547,7 @@ static void wpa_supplicant_deinit_iface(
-
- #ifdef CONFIG_MESH
- if (wpa_s->ifmsh) {
-- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh);
-+ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true);
- wpa_s->ifmsh = NULL;
- }
- #endif /* CONFIG_MESH */
+++ /dev/null
-From 7c2cad969a67453c35422cc6ad1d2803dc27adc1 Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 14:19:03 +0200
-Subject: mesh: Fix DFS deinit/init
-
-The hostapd DFS code deinitializes and initializes the AP interface, if
-a clean channel switch is not possible. In this case the AP code paths
-would deinit the driver, for example nl80211, without wpa_supplicant
-code paths getting notice of this.
-
-Therefore add callbacks for wpa_supplicant mesh methods, which are
-called on init/deinit of the AP BSS. These callbacks are then used to
-handle the reset in the mesh code.
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- src/ap/dfs.c | 7 +++-
- src/ap/hostapd.c | 15 +++++--
- src/ap/hostapd.h | 6 +++
- wpa_supplicant/mesh.c | 94 ++++++++++++++++++++++++++++++++++++++-----
- 4 files changed, 107 insertions(+), 15 deletions(-)
-
---- a/src/ap/dfs.c
-+++ b/src/ap/dfs.c
-@@ -1032,6 +1032,7 @@ static int hostapd_dfs_start_channel_swi
- int err = 1;
- struct hostapd_hw_modes *cmode = iface->current_mode;
- u8 current_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf);
-+ int ieee80211_mode = IEEE80211_MODE_AP;
-
- wpa_printf(MSG_DEBUG, "%s called (CAC active: %s, CSA active: %s)",
- __func__, iface->cac_started ? "yes" : "no",
-@@ -1099,6 +1100,10 @@ static int hostapd_dfs_start_channel_swi
- os_memset(&csa_settings, 0, sizeof(csa_settings));
- csa_settings.cs_count = 5;
- csa_settings.block_tx = 1;
-+#ifdef CONFIG_MESH
-+ if (iface->mconf)
-+ ieee80211_mode = IEEE80211_MODE_MESH;
-+#endif /* CONFIG_MESH */
- err = hostapd_set_freq_params(&csa_settings.freq_params,
- iface->conf->hw_mode,
- channel->freq,
-@@ -1113,7 +1118,7 @@ static int hostapd_dfs_start_channel_swi
- oper_centr_freq_seg0_idx,
- oper_centr_freq_seg1_idx,
- cmode->vht_capab,
-- &cmode->he_capab[IEEE80211_MODE_AP]);
-+ &cmode->he_capab[ieee80211_mode]);
-
- if (err) {
- wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -354,7 +354,7 @@ static int hostapd_broadcast_wep_set(str
- #endif /* CONFIG_WEP */
-
-
--static void hostapd_free_hapd_data(struct hostapd_data *hapd)
-+void hostapd_free_hapd_data(struct hostapd_data *hapd)
- {
- os_free(hapd->probereq_cb);
- hapd->probereq_cb = NULL;
-@@ -498,7 +498,7 @@ static void sta_track_deinit(struct host
- }
-
-
--static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
-+void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
- {
- wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
- #ifdef NEED_AP_MLME
-@@ -626,7 +626,7 @@ static int hostapd_flush_old_stations(st
- }
-
-
--static void hostapd_bss_deinit_no_free(struct hostapd_data *hapd)
-+void hostapd_bss_deinit_no_free(struct hostapd_data *hapd)
- {
- hostapd_free_stas(hapd);
- hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING);
-@@ -2690,6 +2690,12 @@ int hostapd_enable_iface(struct hostapd_
- {
- size_t j;
-
-+ if (!hapd_iface)
-+ return -1;
-+
-+ if (hapd_iface->enable_iface_cb)
-+ return hapd_iface->enable_iface_cb(hapd_iface);
-+
- if (hapd_iface->bss[0]->drv_priv != NULL) {
- wpa_printf(MSG_ERROR, "Interface %s already enabled",
- hapd_iface->conf->bss[0]->iface);
-@@ -2751,6 +2757,9 @@ int hostapd_disable_iface(struct hostapd
- if (hapd_iface == NULL)
- return -1;
-
-+ if (hapd_iface->disable_iface_cb)
-+ return hapd_iface->disable_iface_cb(hapd_iface);
-+
- if (hapd_iface->bss[0]->drv_priv == NULL) {
- wpa_printf(MSG_INFO, "Interface %s already disabled",
- hapd_iface->conf->bss[0]->iface);
---- a/src/ap/hostapd.h
-+++ b/src/ap/hostapd.h
-@@ -589,6 +589,9 @@ struct hostapd_iface {
-
- /* Previous WMM element information */
- struct hostapd_wmm_ac_params prev_wmm[WMM_AC_NUM];
-+
-+ int (*enable_iface_cb)(struct hostapd_iface *iface);
-+ int (*disable_iface_cb)(struct hostapd_iface *iface);
- };
-
- /* hostapd.c */
-@@ -617,6 +620,9 @@ void hostapd_interface_deinit_free(struc
- int hostapd_enable_iface(struct hostapd_iface *hapd_iface);
- int hostapd_reload_iface(struct hostapd_iface *hapd_iface);
- int hostapd_disable_iface(struct hostapd_iface *hapd_iface);
-+void hostapd_bss_deinit_no_free(struct hostapd_data *hapd);
-+void hostapd_free_hapd_data(struct hostapd_data *hapd);
-+void hostapd_cleanup_iface_partial(struct hostapd_iface *iface);
- int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf);
- int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf);
- void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator);
---- a/wpa_supplicant/mesh.c
-+++ b/wpa_supplicant/mesh.c
-@@ -28,15 +28,22 @@
- #include "mesh.h"
-
-
--static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s)
-+static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s,
-+ bool also_clear_hostapd)
- {
-- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true);
-- wpa_s->ifmsh = NULL;
-- wpa_s->current_ssid = NULL;
-+ wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh,
-+ also_clear_hostapd);
-+
-+ if (also_clear_hostapd) {
-+ wpa_s->ifmsh = NULL;
-+ wpa_s->current_ssid = NULL;
-+ os_free(wpa_s->mesh_params);
-+ wpa_s->mesh_params = NULL;
-+ }
-+
- os_free(wpa_s->mesh_rsn);
- wpa_s->mesh_rsn = NULL;
-- os_free(wpa_s->mesh_params);
-- wpa_s->mesh_params = NULL;
-+
- wpa_supplicant_leave_mesh(wpa_s, false);
- }
-
-@@ -242,7 +249,7 @@ static int wpas_mesh_complete(struct wpa
- he_capab)) {
- wpa_printf(MSG_ERROR,
- "Error updating mesh frequency params");
-- wpa_supplicant_mesh_deinit(wpa_s);
-+ wpa_supplicant_mesh_deinit(wpa_s, true);
- return -1;
- }
- }
-@@ -251,7 +258,7 @@ static int wpas_mesh_complete(struct wpa
- wpas_mesh_init_rsn(wpa_s)) {
- wpa_printf(MSG_ERROR,
- "mesh: RSN initialization failed - deinit mesh");
-- wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, false);
-+ wpa_supplicant_mesh_deinit(wpa_s, false);
- return -1;
- }
-
-@@ -297,6 +304,69 @@ static void wpas_mesh_complete_cb(void *
- }
-
-
-+static int wpa_supplicant_mesh_enable_iface_cb(struct hostapd_iface *ifmsh)
-+{
-+ struct wpa_supplicant *wpa_s = ifmsh->owner;
-+ struct hostapd_data *bss;
-+
-+ ifmsh->mconf = mesh_config_create(wpa_s, wpa_s->current_ssid);
-+
-+ bss = ifmsh->bss[0];
-+ bss->msg_ctx = wpa_s;
-+ os_memcpy(bss->own_addr, wpa_s->own_addr, ETH_ALEN);
-+ bss->driver = wpa_s->driver;
-+ 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;
-+
-+ bss->conf->start_disabled = 1;
-+ bss->conf->mesh = MESH_ENABLED;
-+ bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity;
-+
-+ if (wpa_drv_init_mesh(wpa_s)) {
-+ wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver");
-+ return -1;
-+ }
-+
-+ if (hostapd_setup_interface(ifmsh)) {
-+ wpa_printf(MSG_ERROR,
-+ "Failed to initialize hostapd interface for mesh");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+
-+static int wpa_supplicant_mesh_disable_iface_cb(struct hostapd_iface *ifmsh)
-+{
-+ struct wpa_supplicant *wpa_s = ifmsh->owner;
-+ size_t j;
-+
-+ wpa_supplicant_mesh_deinit(wpa_s, false);
-+
-+#ifdef NEED_AP_MLME
-+ for (j = 0; j < ifmsh->num_bss; j++)
-+ hostapd_cleanup_cs_params(ifmsh->bss[j]);
-+#endif /* NEED_AP_MLME */
-+
-+ /* Same as hostapd_interface_deinit() without deinitializing control
-+ * interface */
-+ for (j = 0; j < ifmsh->num_bss; j++) {
-+ struct hostapd_data *hapd = ifmsh->bss[j];
-+
-+ hostapd_bss_deinit_no_free(hapd);
-+ hostapd_free_hapd_data(hapd);
-+ }
-+
-+ hostapd_cleanup_iface_partial(ifmsh);
-+
-+ return 0;
-+}
-+
-+
- static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid,
- struct hostapd_freq_params *freq)
-@@ -324,6 +394,8 @@ static int wpa_supplicant_mesh_init(stru
- ifmsh->drv_flags = wpa_s->drv_flags;
- ifmsh->drv_flags2 = wpa_s->drv_flags2;
- ifmsh->num_bss = 1;
-+ ifmsh->enable_iface_cb = wpa_supplicant_mesh_enable_iface_cb;
-+ ifmsh->disable_iface_cb = wpa_supplicant_mesh_disable_iface_cb;
- ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss,
- sizeof(struct hostapd_data *));
- if (!ifmsh->bss)
-@@ -459,7 +531,7 @@ static int wpa_supplicant_mesh_init(stru
-
- return 0;
- out_free:
-- wpa_supplicant_mesh_deinit(wpa_s);
-+ wpa_supplicant_mesh_deinit(wpa_s, true);
- return -ENOMEM;
- }
-
-@@ -507,7 +579,7 @@ int wpa_supplicant_join_mesh(struct wpa_
- goto out;
- }
-
-- wpa_supplicant_mesh_deinit(wpa_s);
-+ wpa_supplicant_mesh_deinit(wpa_s, true);
-
- wpa_s->pairwise_cipher = WPA_CIPHER_NONE;
- wpa_s->group_cipher = WPA_CIPHER_NONE;
-@@ -596,7 +668,7 @@ int wpa_supplicant_leave_mesh(struct wpa
-
- /* Need to send peering close messages first */
- if (need_deinit)
-- wpa_supplicant_mesh_deinit(wpa_s);
-+ wpa_supplicant_mesh_deinit(wpa_s, true);
-
- ret = wpa_drv_leave_mesh(wpa_s);
- if (ret)
+++ /dev/null
-From 6ee4e70d469b8ce05013ed524eea32ea303e6563 Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 14:19:04 +0200
-Subject: [PATCH 16/19] tests: DFS test for wpa_supplicant mesh
-
-Add a test with uses a DFS channel, waits for CAC
-afterwards successfull mesh join and then triggers
-a radar event and check if the mesh comes up again
-on the same device.
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- tests/hwsim/test_wpas_mesh.py | 56 +++++++++++++++++++++++++++++++++--
- 1 file changed, 54 insertions(+), 2 deletions(-)
-
---- a/tests/hwsim/test_wpas_mesh.py
-+++ b/tests/hwsim/test_wpas_mesh.py
-@@ -80,8 +80,23 @@ def check_mesh_scan(dev, params, other_s
- if '[MESH]' not in bss['flags']:
- raise Exception("BSS output did not include MESH flag")
-
--def check_mesh_group_added(dev):
-- ev = dev.wait_event(["MESH-GROUP-STARTED"])
-+def check_dfs_started(dev, timeout=10):
-+ ev = dev.wait_event(["DFS-CAC-START"], timeout=timeout)
-+ if ev is None:
-+ raise Exception("Test exception: CAC did not start")
-+
-+def check_dfs_finished(dev, timeout=70):
-+ ev = dev.wait_event(["DFS-CAC-COMPLETED"], timeout=timeout)
-+ if ev is None:
-+ raise Exception("Test exception: CAC did not finish")
-+
-+def check_mesh_radar_handling_finished(dev, timeout=75):
-+ ev = dev.wait_event(["CTRL-EVENT-CHANNEL-SWITCH", "MESH-GROUP-STARTED"], timeout=timeout)
-+ if ev is None:
-+ raise Exception("Test exception: Couldn't join mesh")
-+
-+def check_mesh_group_added(dev, timeout=10):
-+ ev = dev.wait_event(["MESH-GROUP-STARTED"], timeout=timeout)
- if ev is None:
- raise Exception("Test exception: Couldn't join mesh")
-
-@@ -91,6 +106,10 @@ def check_mesh_group_removed(dev):
- if ev is None:
- raise Exception("Test exception: Couldn't leave mesh")
-
-+def check_regdom_change(dev, timeout=10):
-+ ev = dev.wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=timeout)
-+ if ev is None:
-+ raise Exception("Test exception: No regdom change happened.")
-
- def check_mesh_peer_connected(dev, timeout=10):
- ev = dev.wait_event(["MESH-PEER-CONNECTED"], timeout=timeout)
-@@ -167,6 +186,39 @@ def test_wpas_mesh_group_remove(dev):
- check_mesh_group_removed(dev[0])
- dev[0].mesh_group_remove()
-
-+def dfs_simulate_radar(dev):
-+ logger.info("Trigger a simulated radar event")
-+ phyname = dev.get_driver_status_field("phyname")
-+ radar_file = '/sys/kernel/debug/ieee80211/' + phyname + '/hwsim/dfs_simulate_radar'
-+ with open(radar_file, 'w') as f:
-+ f.write('1')
-+
-+@long_duration_test
-+def test_wpas_mesh_peer_connected_dfs(dev):
-+ """wpa_supplicant MESH peer connected"""
-+ dev[0].set("country", "DE")
-+ dev[1].set("country", "DE")
-+
-+ check_regdom_change(dev[0])
-+ check_regdom_change(dev[1])
-+
-+ check_mesh_support(dev[0])
-+ add_open_mesh_network(dev[0], freq="5500", beacon_int=160)
-+ add_open_mesh_network(dev[1], freq="5500", beacon_int=160)
-+ check_dfs_started(dev[0])
-+ check_dfs_finished(dev[0])
-+ check_mesh_joined_connected(dev, timeout0=10)
-+
-+ dfs_simulate_radar(dev[0])
-+
-+ check_mesh_radar_handling_finished(dev[0], timeout=75)
-+
-+ dev[0].set("country", "00")
-+ dev[1].set("country", "00")
-+
-+ check_regdom_change(dev[0])
-+ check_regdom_change(dev[1])
-+
- def test_wpas_mesh_peer_connected(dev):
- """wpa_supplicant MESH peer connected"""
- check_mesh_support(dev[0])
+++ /dev/null
-From 06161d4f108905d10c63060c82973ad70a844247 Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 14:19:05 +0200
-Subject: mesh: Fix mesh_oom test
-
-Only change freq params, if ifmsh->freq is set initially, which only
-happens if hostapd_get_hw_features in setup_interface2 succeeds.
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- wpa_supplicant/mesh.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/wpa_supplicant/mesh.c
-+++ b/wpa_supplicant/mesh.c
-@@ -221,7 +221,7 @@ static int wpas_mesh_complete(struct wpa
- * Update channel configuration if the channel has changed since the
- * initial setting, i.e., due to DFS radar detection during CAC.
- */
-- if (ifmsh->freq != params->freq.freq) {
-+ if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) {
- struct he_capabilities *he_capab = NULL;
-
- wpa_s->assoc_freq = ifmsh->freq;
+++ /dev/null
-From 89ad24379d4a1c1decdb8ee693ffc50fcc5b4c1a Mon Sep 17 00:00:00 2001
-From: Markus Theil <markus.theil@tu-ilmenau.de>
-Date: Tue, 30 Jun 2020 14:19:06 +0200
-Subject: mesh: Move mesh frequency setting to its own function
-
-Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
----
- wpa_supplicant/mesh.c | 62 ++++++++++++++++++++++++-------------------
- 1 file changed, 35 insertions(+), 27 deletions(-)
-
---- a/wpa_supplicant/mesh.c
-+++ b/wpa_supplicant/mesh.c
-@@ -204,6 +204,40 @@ static int wpas_mesh_init_rsn(struct wpa
- }
-
-
-+static int wpas_mesh_update_freq_params(struct wpa_supplicant *wpa_s)
-+{
-+ struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
-+ struct hostapd_iface *ifmsh = wpa_s->ifmsh;
-+ struct he_capabilities *he_capab = NULL;
-+
-+ if (ifmsh->current_mode)
-+ he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH];
-+
-+ if (hostapd_set_freq_params(
-+ ¶ms->freq,
-+ ifmsh->conf->hw_mode,
-+ ifmsh->freq,
-+ ifmsh->conf->channel,
-+ ifmsh->conf->enable_edmg,
-+ ifmsh->conf->edmg_channel,
-+ ifmsh->conf->ieee80211n,
-+ ifmsh->conf->ieee80211ac,
-+ ifmsh->conf->ieee80211ax,
-+ ifmsh->conf->secondary_channel,
-+ hostapd_get_oper_chwidth(ifmsh->conf),
-+ hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf),
-+ hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf),
-+ ifmsh->conf->vht_capab,
-+ he_capab)) {
-+ wpa_printf(MSG_ERROR, "Error updating mesh frequency params");
-+ wpa_supplicant_mesh_deinit(wpa_s, true);
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+
- static int wpas_mesh_complete(struct wpa_supplicant *wpa_s)
- {
- struct hostapd_iface *ifmsh = wpa_s->ifmsh;
-@@ -222,36 +256,10 @@ static int wpas_mesh_complete(struct wpa
- * initial setting, i.e., due to DFS radar detection during CAC.
- */
- if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) {
-- struct he_capabilities *he_capab = NULL;
--
- wpa_s->assoc_freq = ifmsh->freq;
- ssid->frequency = ifmsh->freq;
--
-- if (ifmsh->current_mode)
-- he_capab = &ifmsh->current_mode->he_capab[
-- IEEE80211_MODE_MESH];
--
-- if (hostapd_set_freq_params(
-- ¶ms->freq,
-- ifmsh->conf->hw_mode,
-- ifmsh->freq,
-- ifmsh->conf->channel,
-- ifmsh->conf->enable_edmg,
-- ifmsh->conf->edmg_channel,
-- ifmsh->conf->ieee80211n,
-- ifmsh->conf->ieee80211ac,
-- ifmsh->conf->ieee80211ax,
-- ifmsh->conf->secondary_channel,
-- hostapd_get_oper_chwidth(ifmsh->conf),
-- hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf),
-- hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf),
-- ifmsh->conf->vht_capab,
-- he_capab)) {
-- wpa_printf(MSG_ERROR,
-- "Error updating mesh frequency params");
-- wpa_supplicant_mesh_deinit(wpa_s, true);
-+ if (wpas_mesh_update_freq_params(wpa_s) < 0)
- return -1;
-- }
- }
-
- if (ifmsh->mconf->security != MESH_CONF_SEC_NONE &&
if (!chan) {
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -9476,6 +9476,10 @@ static int nl80211_switch_channel(void *
+@@ -9862,6 +9862,10 @@ static int nl80211_switch_channel(void *
if (ret)
goto error;
+++ /dev/null
-From 58bbbb5981440da508164cbd423ca5dd7c1b98d8 Mon Sep 17 00:00:00 2001
-From: Jouni Malinen <j@w1.fi>
-Date: Sat, 13 Feb 2021 23:59:28 +0200
-Subject: nl80211: Ignore 4addr mode enabling error if it was already enabled
-
-nl80211_set_4addr_mode() could fail when trying to enable 4addr mode on
-an interface that is in a bridge and has 4addr mode already enabled.
-This operation would not have been necessary in the first place and this
-failure results in disconnecting, e.g., when roaming from one backhaul
-BSS to another BSS with Multi AP.
-
-Avoid this issue by ignoring the nl80211 command failure in the case
-where 4addr mode is being enabled while it has already been enabled.
-
-Signed-off-by: Jouni Malinen <j@w1.fi>
----
- src/drivers/driver_nl80211.c | 24 ++++++++++++++++++++++++
- 1 file changed, 24 insertions(+)
-
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -617,6 +617,7 @@ struct wiphy_idx_data {
- int wiphy_idx;
- enum nl80211_iftype nlmode;
- u8 *macaddr;
-+ u8 use_4addr;
- };
-
-
-@@ -639,6 +640,9 @@ static int netdev_info_handler(struct nl
- os_memcpy(info->macaddr, nla_data(tb[NL80211_ATTR_MAC]),
- ETH_ALEN);
-
-+ if (tb[NL80211_ATTR_4ADDR])
-+ info->use_4addr = nla_get_u8(tb[NL80211_ATTR_4ADDR]);
-+
- return NL_SKIP;
- }
-
-@@ -691,6 +695,20 @@ static int nl80211_get_macaddr(struct i8
- }
-
-
-+static int nl80211_get_4addr(struct i802_bss *bss)
-+{
-+ struct nl_msg *msg;
-+ struct wiphy_idx_data data = {
-+ .use_4addr = 0,
-+ };
-+
-+ if (!(msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_GET_INTERFACE)) ||
-+ send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data))
-+ return -1;
-+ return data.use_4addr;
-+}
-+
-+
- static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv,
- struct nl80211_wiphy_data *w)
- {
-@@ -11511,6 +11529,11 @@ static int nl80211_set_4addr_mode(void *
-
- ret = send_and_recv_msgs(drv, msg, NULL, NULL);
- msg = NULL;
-+ if (ret && val && nl80211_get_4addr(bss) == 1) {
-+ wpa_printf(MSG_DEBUG,
-+ "nl80211: 4addr mode was already enabled");
-+ ret = 0;
-+ }
- if (!ret) {
- if (bridge_ifname[0] && val &&
- i802_check_bridge(drv, bss, bridge_ifname, bss->ifname) < 0)
+++ /dev/null
-From 57fec19dab8adf6af7a34711e7a3e01b4f2e4ebc Mon Sep 17 00:00:00 2001
-From: Jouni Malinen <j@w1.fi>
-Date: Sun, 28 Feb 2021 11:51:16 +0200
-Subject: Use more consistent iface->conf checks
-
-Commit f1df4fbfc7ad ("mesh: Use setup completion callback to complete
-mesh join") added a check for iface->conf being NULL into a debug print.
-However, it is not clear how that could be NULL here. In any case,
-setup_interface() could end up dereferencing iface->conf in the call to
-hostapd_validate_bssid_configuration(), so better be consistent with the
-checks and not get warnings from static analyzers regardless of whether
-this can happen in practice.
-
-Signed-off-by: Jouni Malinen <j@w1.fi>
----
- src/ap/hostapd.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -2305,10 +2305,12 @@ int hostapd_setup_interface(struct hosta
- {
- int ret;
-
-+ if (!iface->conf)
-+ return -1;
- ret = setup_interface(iface);
- if (ret) {
- wpa_printf(MSG_ERROR, "%s: Unable to setup interface.",
-- iface->conf ? iface->conf->bss[0]->iface : "N/A");
-+ iface->conf->bss[0]->iface);
- return -1;
- }
-
+++ /dev/null
-From df0bfe4759d9f3eb6d933e318abc02bab0c3cc84 Mon Sep 17 00:00:00 2001
-From: Abinaya Kalaiselvan <akalaise@codeaurora.org>
-Date: Mon, 1 Feb 2021 10:29:36 +0530
-Subject: mesh: Fix for leaving mesh
-
-Avoid multiple execution of wpa_drv_leave_mesh().
-
-Fixes: 0896c442dcd5 ("mesh: Fix for mesh init/deinit")
-Signed-off-by: Abinaya Kalaiselvan <akalaise@codeaurora.org>
----
- wpa_supplicant/mesh.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- a/wpa_supplicant/mesh.c
-+++ b/wpa_supplicant/mesh.c
-@@ -44,7 +44,8 @@ static void wpa_supplicant_mesh_deinit(s
- os_free(wpa_s->mesh_rsn);
- wpa_s->mesh_rsn = NULL;
-
-- wpa_supplicant_leave_mesh(wpa_s, false);
-+ if (!also_clear_hostapd)
-+ wpa_supplicant_leave_mesh(wpa_s, false);
- }
-
-
};
#define MAX_STA_COUNT 2007
-@@ -701,6 +702,7 @@ struct hostapd_bss_config {
+@@ -696,6 +697,7 @@ struct hostapd_bss_config {
#define MESH_ENABLED BIT(0)
int mesh;
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -1515,6 +1515,7 @@ struct wpa_driver_mesh_bss_params {
+@@ -1584,6 +1584,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
/*
* TODO: Other mesh configuration parameters would go here.
* See NL80211_MESHCONF_* for all the mesh config parameters.
-@@ -1524,6 +1525,7 @@ struct wpa_driver_mesh_bss_params {
+@@ -1593,6 +1594,7 @@ struct wpa_driver_mesh_bss_params {
int peer_link_timeout;
int max_peer_links;
int rssi_threshold;
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -10044,6 +10044,9 @@ static int nl80211_put_mesh_config(struc
+@@ -10446,6 +10446,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->max_peer_links)) ||
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
-@@ -2473,6 +2473,7 @@ static const struct parse_data ssid_fiel
+@@ -2527,6 +2527,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_rssi_threshold, -255, 1) },
#else /* CONFIG_MESH */
{ INT_RANGE(mode, 0, 4) },
-@@ -3049,6 +3050,7 @@ void wpa_config_set_network_defaults(str
+@@ -3106,6 +3107,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_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD;
#endif /* CONFIG_MESH */
#ifdef CONFIG_HT_OVERRIDES
-@@ -4276,6 +4278,7 @@ struct wpa_config * wpa_config_alloc_emp
+@@ -4347,6 +4349,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->dot11RSNASAERetransPeriod =
DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD;
config->fast_reauth = DEFAULT_FAST_REAUTH;
-@@ -4914,6 +4917,7 @@ static const struct global_parse_data gl
+@@ -5047,6 +5050,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 },
/*
* The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard,
* but use 1000 ms in practice to avoid issues on low power CPUs.
-@@ -1351,6 +1352,14 @@ struct wpa_config {
+@@ -1378,6 +1379,14 @@ struct wpa_config {
int mesh_max_inactivity;
/**
* This timeout value is used in mesh STA to retransmit
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
-@@ -866,6 +866,7 @@ static void wpa_config_write_network(FIL
+@@ -768,6 +768,7 @@ static void wpa_config_write_network(FIL
#endif /* IEEE8021X_EAPOL */
INT(mode);
INT(no_auto_peer);
INT(frequency);
INT(enable_edmg);
INT(edmg_channel);
-@@ -1528,6 +1529,9 @@ static void wpa_config_write_global(FILE
+@@ -1449,6 +1450,9 @@ static void wpa_config_write_global(FILE
fprintf(f, "mesh_max_inactivity=%d\n",
config->mesh_max_inactivity);
+++ /dev/null
-From 8460e3230988ef2ec13ce6b69b687e941f6cdb32 Mon Sep 17 00:00:00 2001
-From: Jouni Malinen <jouni@codeaurora.org>
-Date: Tue, 8 Dec 2020 23:52:50 +0200
-Subject: [PATCH] P2P: Fix a corner case in peer addition based on PD Request
-
-p2p_add_device() may remove the oldest entry if there is no room in the
-peer table for a new peer. This would result in any pointer to that
-removed entry becoming stale. A corner case with an invalid PD Request
-frame could result in such a case ending up using (read+write) freed
-memory. This could only by triggered when the peer table has reached its
-maximum size and the PD Request frame is received from the P2P Device
-Address of the oldest remaining entry and the frame has incorrect P2P
-Device Address in the payload.
-
-Fix this by fetching the dev pointer again after having called
-p2p_add_device() so that the stale pointer cannot be used.
-
-Fixes: 17bef1e97a50 ("P2P: Add peer entry based on Provision Discovery Request")
-Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
----
- src/p2p/p2p_pd.c | 12 +++++-------
- 1 file changed, 5 insertions(+), 7 deletions(-)
-
---- a/src/p2p/p2p_pd.c
-+++ b/src/p2p/p2p_pd.c
-@@ -595,14 +595,12 @@ void p2p_process_prov_disc_req(struct p2
- goto out;
- }
-
-+ dev = p2p_get_device(p2p, sa);
- if (!dev) {
-- dev = p2p_get_device(p2p, sa);
-- if (!dev) {
-- p2p_dbg(p2p,
-- "Provision Discovery device not found "
-- MACSTR, MAC2STR(sa));
-- goto out;
-- }
-+ p2p_dbg(p2p,
-+ "Provision Discovery device not found "
-+ MACSTR, MAC2STR(sa));
-+ goto out;
- }
- } else if (msg.wfd_subelems) {
- wpabuf_free(dev->info.wfd_subelems);
+++ /dev/null
-From 4a7e0ac26839424e6a91d38fd126160b18a30a60 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
-Date: Mon, 30 Nov 2020 12:10:46 +0100
-Subject: hostapd: Add an option to notify management frames on ctrl_iface
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-In some contexts (e.g., Multi-AP) it can be useful to have access to
-some of the management frames in upper layers (e.g., to be able to
-process the content of association requests externally).
-
-Add 'notify_mgmt_frames'. When enabled, it will notify the ctrl_iface
-when a management frame arrives using the AP-MGMT-FRAME-RECEIVED event
-message.
-
-Note that to avoid completely flooding the ctrl_iface, not all
-management frames are included (e.g., Beacon and Probe Request frames
-are excluded).
-
-Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
----
- hostapd/config_file.c | 2 ++
- hostapd/hostapd.conf | 4 ++++
- src/ap/ap_config.h | 2 ++
- src/ap/ieee802_11.c | 28 ++++++++++++++++++++++++++++
- src/common/wpa_ctrl.h | 3 +++
- 5 files changed, 39 insertions(+)
-
---- a/hostapd/config_file.c
-+++ b/hostapd/config_file.c
-@@ -4456,6 +4456,8 @@ static int hostapd_config_fill(struct ho
- bss->multicast_to_unicast = atoi(pos);
- } else if (os_strcmp(buf, "broadcast_deauth") == 0) {
- bss->broadcast_deauth = atoi(pos);
-+ } else if (os_strcmp(buf, "notify_mgmt_frames") == 0) {
-+ bss->notify_mgmt_frames = atoi(pos);
- #ifdef CONFIG_DPP
- } else if (os_strcmp(buf, "dpp_name") == 0) {
- os_free(bss->dpp_name);
---- a/hostapd/hostapd.conf
-+++ b/hostapd/hostapd.conf
-@@ -571,6 +571,10 @@ wmm_ac_vo_acm=0
- # Default: 1 (enabled)
- #broadcast_deauth=1
-
-+# Get notifications for received Management frames on control interface
-+# Default: 0 (disabled)
-+#notify_mgmt_frames=0
-+
- ##### IEEE 802.11n related configuration ######################################
-
- # ieee80211n: Whether IEEE 802.11n (HT) is enabled
---- a/src/ap/ap_config.h
-+++ b/src/ap/ap_config.h
-@@ -745,6 +745,8 @@ struct hostapd_bss_config {
-
- int broadcast_deauth;
-
-+ int notify_mgmt_frames;
-+
- #ifdef CONFIG_DPP
- char *dpp_name;
- char *dpp_mud_url;
---- a/src/ap/ieee802_11.c
-+++ b/src/ap/ieee802_11.c
-@@ -4880,6 +4880,31 @@ static int handle_action(struct hostapd_
-
-
- /**
-+ * notify_mgmt_frame - Notify of Management frames on the control interface
-+ * @hapd: hostapd BSS data structure (the BSS to which the Management frame was
-+ * sent to)
-+ * @buf: Management frame data (starting from the IEEE 802.11 header)
-+ * @len: Length of frame data in octets
-+ *
-+ * Notify the control interface of any received Management frame.
-+ */
-+static void notify_mgmt_frame(struct hostapd_data *hapd, const u8 *buf,
-+ size_t len)
-+{
-+
-+ int hex_len = len * 2 + 1;
-+ char *hex = os_malloc(hex_len);
-+
-+ if (hex) {
-+ wpa_snprintf_hex(hex, hex_len, buf, len);
-+ wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO,
-+ AP_MGMT_FRAME_RECEIVED "buf=%s", hex);
-+ os_free(hex);
-+ }
-+}
-+
-+
-+/**
- * ieee802_11_mgmt - process incoming IEEE 802.11 management frames
- * @hapd: hostapd BSS data structure (the BSS to which the management frame was
- * sent to)
-@@ -4969,6 +4994,9 @@ int ieee802_11_mgmt(struct hostapd_data
- if (hapd->iconf->track_sta_max_num)
- sta_track_add(hapd->iface, mgmt->sa, ssi_signal);
-
-+ if (hapd->conf->notify_mgmt_frames)
-+ notify_mgmt_frame(hapd, buf, len);
-+
- switch (stype) {
- case WLAN_FC_STYPE_AUTH:
- wpa_printf(MSG_DEBUG, "mgmt::auth");
---- a/src/common/wpa_ctrl.h
-+++ b/src/common/wpa_ctrl.h
-@@ -392,6 +392,9 @@ extern "C" {
- * frame=<saqueryreq/saqueryresp> error=<error string> */
- #define OCV_FAILURE "OCV-FAILURE "
-
-+/* Event triggered for received management frame */
-+#define AP_MGMT_FRAME_RECEIVED "AP-MGMT-FRAME-RECEIVED "
-+
- #ifndef BIT
- #define BIT(x) (1U << (x))
- #endif
+++ /dev/null
---- a/src/crypto/tls_wolfssl.c
-+++ b/src/crypto/tls_wolfssl.c
-@@ -19,6 +19,7 @@
- #include <wolfssl/ssl.h>
- #include <wolfssl/error-ssl.h>
- #include <wolfssl/wolfcrypt/asn.h>
-+#include <wolfssl/openssl/x509v3.h>
-
- #if defined(EAP_FAST) || defined(EAP_FAST_DYNAMIC) || defined(EAP_SERVER_FAST)
- #define HAVE_AESGCM
+++ /dev/null
-From 2fd90eb095e18ce1c505bb6acaccff76072aeebe Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
-Date: Thu, 4 Feb 2021 16:36:13 +0100
-Subject: WPS: Use helper variables to clean up code
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This is in preparation of larger changes in hostapd_update_wps() to keep
-the commits more readable.
-
-Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
----
- src/ap/wps_hostapd.c | 23 +++++++++++++----------
- 1 file changed, 13 insertions(+), 10 deletions(-)
-
---- a/src/ap/wps_hostapd.c
-+++ b/src/ap/wps_hostapd.c
-@@ -1398,22 +1398,25 @@ void hostapd_deinit_wps(struct hostapd_d
-
- void hostapd_update_wps(struct hostapd_data *hapd)
- {
-- if (hapd->wps == NULL)
-+ struct wps_context *wps = hapd->wps;
-+ struct hostapd_bss_config *conf = hapd->conf;
-+
-+ if (!wps)
- return;
-
- #ifdef CONFIG_WPS_UPNP
-- hapd->wps->friendly_name = hapd->conf->friendly_name;
-- hapd->wps->manufacturer_url = hapd->conf->manufacturer_url;
-- hapd->wps->model_description = hapd->conf->model_description;
-- hapd->wps->model_url = hapd->conf->model_url;
-- hapd->wps->upc = hapd->conf->upc;
-+ wps->friendly_name = conf->friendly_name;
-+ wps->manufacturer_url = conf->manufacturer_url;
-+ wps->model_description = conf->model_description;
-+ wps->model_url = conf->model_url;
-+ wps->upc = conf->upc;
- #endif /* CONFIG_WPS_UPNP */
-
-- hostapd_wps_set_vendor_ext(hapd, hapd->wps);
-- hostapd_wps_set_application_ext(hapd, hapd->wps);
-+ hostapd_wps_set_vendor_ext(hapd, wps);
-+ hostapd_wps_set_application_ext(hapd, wps);
-
-- if (hapd->conf->wps_state)
-- wps_registrar_update_ie(hapd->wps->registrar);
-+ if (conf->wps_state)
-+ wps_registrar_update_ie(wps->registrar);
- else
- hostapd_deinit_wps(hapd);
- }
+++ /dev/null
-From f95ccc102a6e55bb2543ba68164d6a007a188b25 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
-Date: Thu, 4 Feb 2021 16:36:13 +0100
-Subject: WPS: Reconfigure credentials on hostapd config reload
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-When new credentials are configured and hostapd is reconfigured using
-SIGHUP (or RELOAD on the ctrl_iface), also update the WPS credentials.
-
-Before these changes, when WPS is triggered the Registar always serves
-the credentials that were configured when hostapd started.
-
-Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
----
- src/ap/wps_hostapd.c | 82 +++++++++++++++++++++++++++++++++++++++++
- src/wps/wps.h | 5 +++
- src/wps/wps_registrar.c | 29 +++++++++++++++
- 3 files changed, 116 insertions(+)
-
---- a/src/ap/wps_hostapd.c
-+++ b/src/ap/wps_hostapd.c
-@@ -1376,6 +1376,48 @@ static void hostapd_wps_nfc_clear(struct
- }
-
-
-+static int hostapd_wps_update_multi_ap(struct hostapd_data *hapd,
-+ struct wps_registrar *reg)
-+{
-+ struct hostapd_bss_config *conf = hapd->conf;
-+ u8 *multi_ap_backhaul_network_key = NULL;
-+ size_t multi_ap_backhaul_network_key_len = 0;
-+ int ret;
-+
-+ if (!(conf->multi_ap & FRONTHAUL_BSS) ||
-+ !conf->multi_ap_backhaul_ssid.ssid_len)
-+ return 0;
-+
-+ if (conf->multi_ap_backhaul_ssid.wpa_passphrase) {
-+ multi_ap_backhaul_network_key =
-+ (u8 *) os_strdup(
-+ conf->multi_ap_backhaul_ssid.wpa_passphrase);
-+ if (!multi_ap_backhaul_network_key)
-+ return -1;
-+ multi_ap_backhaul_network_key_len =
-+ os_strlen(conf->multi_ap_backhaul_ssid.wpa_passphrase);
-+ } else if (conf->multi_ap_backhaul_ssid.wpa_psk) {
-+ multi_ap_backhaul_network_key = os_malloc(2 * PMK_LEN + 1);
-+ if (!multi_ap_backhaul_network_key)
-+ return -1;
-+ wpa_snprintf_hex((char *) multi_ap_backhaul_network_key,
-+ 2 * PMK_LEN + 1,
-+ conf->multi_ap_backhaul_ssid.wpa_psk->psk,
-+ PMK_LEN);
-+ multi_ap_backhaul_network_key_len = 2 * PMK_LEN;
-+ }
-+
-+ ret = wps_registrar_update_multi_ap(
-+ reg, conf->multi_ap_backhaul_ssid.ssid,
-+ conf->multi_ap_backhaul_ssid.ssid_len,
-+ multi_ap_backhaul_network_key,
-+ multi_ap_backhaul_network_key_len);
-+ os_free(multi_ap_backhaul_network_key);
-+
-+ return ret;
-+}
-+
-+
- void hostapd_deinit_wps(struct hostapd_data *hapd)
- {
- eloop_cancel_timeout(hostapd_wps_reenable_ap_pin, hapd, NULL);
-@@ -1412,6 +1454,46 @@ void hostapd_update_wps(struct hostapd_d
- wps->upc = conf->upc;
- #endif /* CONFIG_WPS_UPNP */
-
-+ os_memcpy(wps->ssid, conf->ssid.ssid, conf->ssid.ssid_len);
-+ wps->ssid_len = conf->ssid.ssid_len;
-+
-+ /* Clear WPS settings, then fill them again */
-+ os_free(wps->network_key);
-+ wps->network_key = NULL;
-+ wps->network_key_len = 0;
-+ wps->psk_set = 0;
-+ if (conf->ssid.wpa_psk_file) {
-+ /* Use per-device PSKs */
-+ } else if (conf->ssid.wpa_passphrase) {
-+ wps->network_key = (u8 *) os_strdup(conf->ssid.wpa_passphrase);
-+ if (!wps->network_key)
-+ return;
-+ wps->network_key_len = os_strlen(conf->ssid.wpa_passphrase);
-+ } else if (conf->ssid.wpa_psk) {
-+ wps->network_key = os_malloc(2 * PMK_LEN + 1);
-+ if (!wps->network_key)
-+ return;
-+ wpa_snprintf_hex((char *) wps->network_key, 2 * PMK_LEN + 1,
-+ conf->ssid.wpa_psk->psk, PMK_LEN);
-+ wps->network_key_len = 2 * PMK_LEN;
-+#ifdef CONFIG_WEP
-+ } else if (conf->ssid.wep.keys_set && conf->ssid.wep.key[0]) {
-+ wps->network_key = os_malloc(conf->ssid.wep.len[0]);
-+ if (!wps->network_key)
-+ return;
-+ os_memcpy(wps->network_key, conf->ssid.wep.key[0],
-+ conf->ssid.wep.len[0]);
-+ wps->network_key_len = conf->ssid.wep.len[0];
-+#endif /* CONFIG_WEP */
-+ }
-+
-+ if (conf->ssid.wpa_psk) {
-+ os_memcpy(wps->psk, conf->ssid.wpa_psk->psk, PMK_LEN);
-+ wps->psk_set = 1;
-+ }
-+
-+ hostapd_wps_update_multi_ap(hapd, wps->registrar);
-+
- hostapd_wps_set_vendor_ext(hapd, wps);
- hostapd_wps_set_application_ext(hapd, wps);
-
---- a/src/wps/wps.h
-+++ b/src/wps/wps.h
-@@ -873,6 +873,11 @@ int wps_registrar_add_nfc_password_token
- const u8 *oob_dev_pw,
- size_t oob_dev_pw_len);
- void wps_registrar_flush(struct wps_registrar *reg);
-+int wps_registrar_update_multi_ap(struct wps_registrar *reg,
-+ const u8 *multi_ap_backhaul_ssid,
-+ size_t multi_ap_backhaul_ssid_len,
-+ const u8 *multi_ap_backhaul_network_key,
-+ size_t multi_ap_backhaul_network_key_len);
-
- int wps_build_credential_wrap(struct wpabuf *msg,
- const struct wps_credential *cred);
---- a/src/wps/wps_registrar.c
-+++ b/src/wps/wps_registrar.c
-@@ -3669,6 +3669,35 @@ int wps_registrar_config_ap(struct wps_r
- }
-
-
-+int wps_registrar_update_multi_ap(struct wps_registrar *reg,
-+ const u8 *multi_ap_backhaul_ssid,
-+ size_t multi_ap_backhaul_ssid_len,
-+ const u8 *multi_ap_backhaul_network_key,
-+ size_t multi_ap_backhaul_network_key_len)
-+{
-+ if (multi_ap_backhaul_ssid) {
-+ os_memcpy(reg->multi_ap_backhaul_ssid,
-+ multi_ap_backhaul_ssid, multi_ap_backhaul_ssid_len);
-+ reg->multi_ap_backhaul_ssid_len = multi_ap_backhaul_ssid_len;
-+ }
-+
-+ os_free(reg->multi_ap_backhaul_network_key);
-+ reg->multi_ap_backhaul_network_key = NULL;
-+ reg->multi_ap_backhaul_network_key_len = 0;
-+ if (multi_ap_backhaul_network_key) {
-+ reg->multi_ap_backhaul_network_key =
-+ os_memdup(multi_ap_backhaul_network_key,
-+ multi_ap_backhaul_network_key_len);
-+ if (!reg->multi_ap_backhaul_network_key)
-+ return -1;
-+ reg->multi_ap_backhaul_network_key_len =
-+ multi_ap_backhaul_network_key_len;
-+ }
-+
-+ return 0;
-+}
-+
-+
- #ifdef CONFIG_WPS_NFC
-
- int wps_registrar_add_nfc_pw_token(struct wps_registrar *reg,
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
-@@ -31,6 +31,7 @@ CFLAGS += -I$(abspath ../src/utils)
- export BINDIR ?= /usr/local/bin/
-
- -include .config
-+-include $(if $(MULTICALL), ../wpa_supplicant/.config)
-
- ifndef CONFIG_NO_GITVER
- # Add VERSION_STR postfix for builds from a git repository
-@@ -204,7 +205,8 @@ endif
+@@ -199,7 +199,8 @@ endif
ifdef CONFIG_NO_VLAN
CFLAGS += -DCONFIG_NO_VLAN
OBJS += ../src/ap/vlan_init.o
OBJS += ../src/ap/vlan_ifconfig.o
OBJS += ../src/ap/vlan.o
-@@ -354,10 +356,14 @@ CFLAGS += -DCONFIG_MBO
+@@ -349,10 +350,14 @@ CFLAGS += -DCONFIG_MBO
OBJS += ../src/ap/mbo_ap.o
endif
LIBS += $(DRV_AP_LIBS)
ifdef CONFIG_L2_PACKET
-@@ -1311,6 +1317,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
-
- BCHECK=../src/drivers/build.hostapd
+@@ -1277,6 +1282,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
+ _OBJS_VAR := OBJS
+ include ../src/objs.mk
-+hostapd_multi.a: $(BCHECK) $(OBJS)
++hostapd_multi.a: $(OBJS)
+ $(Q)$(CC) -c -o hostapd_multi.o -Dmain=hostapd_main $(CFLAGS) main.c
+ @$(E) " CC " $<
+ @rm -f $@
+ @$(AR) cr $@ hostapd_multi.o $(OBJS)
+
- hostapd: $(BCHECK) $(OBJS)
+ hostapd: $(OBJS)
$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
@$(E) " LD " $@
-@@ -1374,6 +1386,12 @@ SOBJS += ../src/crypto/sha256-kdf.o
- SOBJS += ../src/crypto/sha384-kdf.o
- SOBJS += ../src/crypto/sha512-kdf.o
+@@ -1351,6 +1362,12 @@ include ../src/objs.mk
+ _OBJS_VAR := SOBJS
+ include ../src/objs.mk
+dump_cflags:
+ @printf "%s " "$(CFLAGS)"
@$(E) " LD " $@
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src)
- CFLAGS += -I$(abspath ../src/utils)
-
- -include .config
-+-include $(if $(MULTICALL),../hostapd/.config)
-
- ifndef CONFIG_NO_GITVER
- # Add VERSION_STR postfix for builds from a git repository
-@@ -369,7 +370,9 @@ endif
+@@ -359,7 +359,9 @@ endif
ifdef CONFIG_IBSS_RSN
NEED_RSN_AUTHENTICATOR=y
CFLAGS += -DCONFIG_IBSS_RSN
OBJS += ibss_rsn.o
endif
-@@ -890,6 +893,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
+@@ -897,6 +899,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
LIBS += -ldl -rdynamic
endif
endif
ifdef CONFIG_AP
-@@ -897,9 +904,11 @@ NEED_EAP_COMMON=y
+@@ -904,9 +910,11 @@ NEED_EAP_COMMON=y
NEED_RSN_AUTHENTICATOR=y
CFLAGS += -DCONFIG_AP
OBJS += ap.o
OBJS += ../src/ap/hostapd.o
OBJS += ../src/ap/wpa_auth_glue.o
OBJS += ../src/ap/utils.o
-@@ -979,6 +988,12 @@ endif
+@@ -986,6 +994,12 @@ endif
ifdef CONFIG_HS20
OBJS += ../src/ap/hs20.o
endif
endif
ifdef CONFIG_MBO
-@@ -987,7 +1002,9 @@ CFLAGS += -DCONFIG_MBO
+@@ -994,7 +1008,9 @@ CFLAGS += -DCONFIG_MBO
endif
ifdef NEED_RSN_AUTHENTICATOR
NEED_AES_WRAP=y
OBJS += ../src/ap/wpa_auth.o
OBJS += ../src/ap/wpa_auth_ie.o
-@@ -1897,6 +1914,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
-
- $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
+@@ -1889,6 +1905,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
+ _OBJS_VAR := OBJS
+ include ../src/objs.mk
+wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
+ $(Q)$(CC) -c -o wpa_supplicant_multi.o -Dmain=wpa_supplicant_main $(CFLAGS) main.c
+ @$(E) " CC " $<
wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
$(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
@$(E) " LD " $@
-@@ -1997,6 +2020,12 @@ endif
+@@ -2021,6 +2043,12 @@ eap_gpsk.so: $(SRC_EAP_GPSK)
$(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
@$(E) " sed" $<
wpa_cli.exe: wpa_cli
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -5886,8 +5886,8 @@ union wpa_event_data {
+@@ -6024,8 +6024,8 @@ union wpa_event_data {
* Driver wrapper code should call this function whenever an event is received
* from the driver.
*/
/**
* wpa_supplicant_event_global - Report a driver event for wpa_supplicant
-@@ -5899,7 +5899,7 @@ void wpa_supplicant_event(void *ctx, enu
+@@ -6037,7 +6037,7 @@ void wpa_supplicant_event(void *ctx, enu
* Same as wpa_supplicant_event(), but we search for the interface in
* wpa_global.
*/
/*
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
-@@ -1789,8 +1789,8 @@ err:
+@@ -1836,8 +1836,8 @@ err:
#endif /* CONFIG_OWE */
{
struct hostapd_data *hapd = ctx;
#ifndef CONFIG_NO_STDOUT_DEBUG
-@@ -2035,7 +2035,7 @@ void wpa_supplicant_event(void *ctx, enu
+@@ -2082,7 +2082,7 @@ void wpa_supplicant_event(void *ctx, enu
}
os_memset(&global, 0, sizeof(global));
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
-@@ -4579,8 +4579,8 @@ static void wpas_event_unprot_beacon(str
+@@ -4666,8 +4666,8 @@ static void wpas_event_unprot_beacon(str
}
{
struct wpa_supplicant *wpa_s = ctx;
int resched;
-@@ -5398,7 +5398,7 @@ void wpa_supplicant_event(void *ctx, enu
+@@ -5512,7 +5512,7 @@ void wpa_supplicant_event(void *ctx, enu
}
struct wpa_supplicant *wpa_s;
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -6594,7 +6594,6 @@ struct wpa_interface * wpa_supplicant_ma
+@@ -6817,7 +6817,6 @@ struct wpa_interface * wpa_supplicant_ma
return NULL;
}
/**
* wpa_supplicant_match_existing - Match existing interfaces
* @global: Pointer to global data from wpa_supplicant_init()
-@@ -6631,6 +6630,11 @@ static int wpa_supplicant_match_existing
+@@ -6852,6 +6851,11 @@ static int wpa_supplicant_match_existing
#endif /* CONFIG_MATCH_IFACE */
/**
* wpa_supplicant_add_iface - Add a new network interface
-@@ -6887,6 +6891,8 @@ struct wpa_global * wpa_supplicant_init(
+@@ -7108,6 +7112,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 */
#ifdef CONFIG_WPS
static int gen_uuid(const char *txt_addr)
-@@ -684,6 +689,8 @@ int main(int argc, char *argv[])
+@@ -683,6 +688,8 @@ int main(int argc, char *argv[])
return -1;
#endif /* CONFIG_DPP */
const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
-@@ -1292,6 +1297,10 @@ static void usage(void)
+@@ -1291,6 +1296,10 @@ static void usage(void)
"option several times.\n");
}
int main(int argc, char *argv[])
{
-@@ -1312,6 +1321,8 @@ int main(int argc, char *argv[])
+@@ -1311,6 +1320,8 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3493,6 +3493,10 @@ static int hostapd_config_fill(struct ho
+@@ -3459,6 +3459,10 @@ static int hostapd_config_fill(struct ho
if (bss->ocv && !bss->ieee80211w)
bss->ieee80211w = 1;
#endif /* CONFIG_OCV */
} else if (os_strcmp(buf, "ht_capab") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -986,6 +986,8 @@ struct hostapd_config {
+@@ -1009,6 +1009,8 @@ struct hostapd_config {
int ht_op_mode_fixed;
u16 ht_capab;
int no_pri_sec_switch;
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
-@@ -500,7 +500,8 @@ static int ieee80211n_check_40mhz(struct
+@@ -517,7 +517,8 @@ static int ieee80211n_check_40mhz(struct
int ret;
/* Check that HT40 is used and PRI / SEC switch is allowed */
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
-@@ -2478,6 +2478,7 @@ static const struct parse_data ssid_fiel
+@@ -2532,6 +2532,7 @@ static const struct parse_data ssid_fiel
#else /* CONFIG_MESH */
{ INT_RANGE(mode, 0, 4) },
#endif /* CONFIG_MESH */
{ STR(id_str) },
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
-@@ -866,6 +866,7 @@ static void wpa_config_write_network(FIL
+@@ -768,6 +768,7 @@ static void wpa_config_write_network(FIL
#endif /* IEEE8021X_EAPOL */
INT(mode);
INT(no_auto_peer);
/*
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -2334,12 +2334,12 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2384,12 +2384,12 @@ void ibss_mesh_setup_freq(struct wpa_sup
int ieee80211_mode = wpas_mode_to_ieee80211_mode(ssid->mode);
enum hostapd_hw_mode hw_mode;
struct hostapd_hw_modes *mode = NULL;
unsigned int j, k;
struct hostapd_freq_params vht_freq;
int chwidth, seg0, seg1;
-@@ -2421,7 +2421,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2473,7 +2473,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
#endif /* CONFIG_HE_OVERRIDES */
/* Setup higher BW only for 5 GHz */
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -4949,7 +4949,7 @@ wpa_supplicant_alloc(struct wpa_supplica
+@@ -5152,7 +5152,7 @@ wpa_supplicant_alloc(struct wpa_supplica
if (wpa_s == NULL)
return NULL;
wpa_s->scan_req = INITIAL_SCAN_REQ;
--- a/src/drivers/drivers.mak
+++ b/src/drivers/drivers.mak
-@@ -50,7 +50,6 @@ NEED_SME=y
+@@ -54,7 +54,6 @@ NEED_SME=y
NEED_AP_MLME=y
NEED_NETLINK=y
NEED_LINUX_IOCTL=y
NEED_RADIOTAP=y
NEED_LIBNL=y
endif
-@@ -107,7 +106,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
+@@ -111,7 +110,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
CONFIG_WIRELESS_EXTENSION=y
NEED_NETLINK=y
NEED_LINUX_IOCTL=y
endif
ifdef CONFIG_DRIVER_NDIS
-@@ -133,7 +131,6 @@ endif
+@@ -137,7 +135,6 @@ endif
ifdef CONFIG_WIRELESS_EXTENSION
DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
DRV_WPA_OBJS += ../src/drivers/driver_wext.o
endif
ifdef NEED_NETLINK
-@@ -142,6 +139,7 @@ endif
+@@ -146,6 +143,7 @@ endif
ifdef NEED_RFKILL
DRV_OBJS += ../src/drivers/rfkill.o
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -4664,7 +4664,7 @@ static int nl80211_set_channel(struct i8
+@@ -4973,7 +4973,7 @@ static int nl80211_set_channel(struct i8
freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled,
freq->bandwidth, freq->center_freq1, freq->center_freq2);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -114,6 +114,28 @@ static void hostapd_reload_bss(struct ho
+@@ -115,6 +115,28 @@ static void hostapd_reload_bss(struct ho
#endif /* CONFIG_NO_RADIUS */
ssid = &hapd->conf->ssid;
if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
/*
-@@ -215,6 +237,7 @@ int hostapd_reload_config(struct hostapd
+@@ -216,6 +238,7 @@ int hostapd_reload_config(struct hostapd
struct hostapd_data *hapd = iface->bss[0];
struct hostapd_config *newconf, *oldconf;
size_t j;
if (iface->config_fname == NULL) {
/* Only in-memory config in use - assume it has been updated */
-@@ -265,24 +288,20 @@ int hostapd_reload_config(struct hostapd
+@@ -266,24 +289,20 @@ int hostapd_reload_config(struct hostapd
}
iface->conf = newconf;
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
-@@ -1470,15 +1470,35 @@ int ap_switch_channel(struct wpa_supplic
+@@ -1513,15 +1513,35 @@ int ap_switch_channel(struct wpa_supplic
#ifdef CONFIG_CTRL_IFACE
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -2806,10 +2806,15 @@ static int wpa_driver_nl80211_del_beacon
+@@ -2918,10 +2918,15 @@ static int wpa_driver_nl80211_del_beacon
struct nl_msg *msg;
struct wpa_driver_nl80211_data *drv = bss->drv;
nl80211_put_wiphy_data_ap(bss);
- msg = nl80211_drv_msg(drv, 0, NL80211_CMD_DEL_BEACON);
+ msg = nl80211_bss_msg(bss, 0, NL80211_CMD_DEL_BEACON);
- return send_and_recv_msgs(drv, msg, NULL, NULL);
+ return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
}
-@@ -5279,7 +5284,7 @@ static void nl80211_teardown_ap(struct i
+@@ -5602,7 +5607,7 @@ static void nl80211_teardown_ap(struct i
nl80211_mgmt_unsubscribe(bss, "AP teardown");
nl80211_put_wiphy_data_ap(bss);
}
-@@ -7697,8 +7702,6 @@ static int wpa_driver_nl80211_if_remove(
+@@ -8051,8 +8056,6 @@ static int wpa_driver_nl80211_if_remove(
} else {
wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context");
nl80211_teardown_ap(bss);
nl80211_destroy_bss(bss);
if (!bss->added_if)
i802_set_iface_flags(bss, 0);
-@@ -8095,7 +8098,6 @@ static int wpa_driver_nl80211_deinit_ap(
+@@ -8449,7 +8452,6 @@ static int wpa_driver_nl80211_deinit_ap(
if (!is_ap_interface(drv->nlmode))
return -1;
wpa_driver_nl80211_del_beacon(bss);
/*
* If the P2P GO interface was dynamically added, then it is
-@@ -8115,7 +8117,6 @@ static int wpa_driver_nl80211_stop_ap(vo
+@@ -8469,7 +8471,6 @@ static int wpa_driver_nl80211_stop_ap(vo
if (!is_ap_interface(drv->nlmode))
return -1;
wpa_driver_nl80211_del_beacon(bss);
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -65,6 +65,7 @@
+@@ -67,6 +67,7 @@
#include "fst/fst_ctrl_iface.h"
#include "config_file.h"
#include "ctrl_iface.h"
#define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
-@@ -80,6 +81,7 @@ static void hostapd_ctrl_iface_send(stru
+@@ -82,6 +83,7 @@ static void hostapd_ctrl_iface_send(stru
enum wpa_msg_type type,
const char *buf, size_t len);
static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
struct sockaddr_storage *from,
-@@ -131,6 +133,61 @@ static int hostapd_ctrl_iface_new_sta(st
+@@ -133,6 +135,61 @@ static int hostapd_ctrl_iface_new_sta(st
return 0;
}
#ifdef NEED_AP_MLME
static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd,
-@@ -3546,6 +3603,8 @@ static int hostapd_ctrl_iface_receive_pr
+@@ -3686,6 +3743,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);
#ifdef RADIUS_SERVER
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
-@@ -917,7 +917,13 @@ int hostapd_parse_csa_settings(const cha
+@@ -919,7 +919,13 @@ int hostapd_parse_csa_settings(const cha
int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
{
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS)
+@@ -39,6 +39,10 @@ CFLAGS += $(EXTRA_CFLAGS)
CFLAGS += -I$(abspath ../src)
CFLAGS += -I$(abspath ../src/utils)
+CFLAGS += -DMULTICALL
+endif
+
- -include .config
- -include $(if $(MULTICALL),../hostapd/.config)
-
-@@ -118,6 +122,8 @@ OBJS_c += ../src/utils/common.o
+ ifndef CONFIG_NO_GITVER
+ # Add VERSION_STR postfix for builds from a git repository
+ ifeq ($(wildcard ../.git),../.git)
+@@ -107,6 +111,8 @@ OBJS_c += ../src/utils/common.o
OBJS_c += ../src/common/cli.o
OBJS += wmm_ac.o
#include "drivers/driver.h"
#include "eap_peer/eap.h"
#include "wpa_supplicant_i.h"
-@@ -294,6 +295,10 @@ void calculate_update_time(const struct
+@@ -282,6 +283,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)
{
dst->flags = src->flags;
os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
dst->freq = src->freq;
-@@ -306,6 +311,15 @@ static void wpa_bss_copy_res(struct wpa_
+@@ -294,6 +299,15 @@ static void wpa_bss_copy_res(struct wpa_
dst->est_throughput = src->est_throughput;
dst->snr = src->snr;
--- a/wpa_supplicant/bss.h
+++ b/wpa_supplicant/bss.h
-@@ -83,6 +83,10 @@ struct wpa_bss {
+@@ -94,6 +94,10 @@ struct wpa_bss {
u8 ssid[SSID_MAX_LEN];
/** Length of SSID */
size_t ssid_len;
break;
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -129,6 +129,54 @@ static void wpas_update_fils_connect_par
+@@ -130,6 +130,54 @@ static void wpas_update_fils_connect_par
static void wpas_update_owe_connect_params(struct wpa_supplicant *wpa_s);
#endif /* CONFIG_OWE */
#ifdef CONFIG_WEP
/* Configure default/group WEP keys for static WEP */
-@@ -991,6 +1039,8 @@ void wpa_supplicant_set_state(struct wpa
+@@ -1007,6 +1055,8 @@ void wpa_supplicant_set_state(struct wpa
sme_sched_obss_scan(wpa_s, 1);
#if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL)
if (!fils_hlp_sent && ssid && ssid->eap.erp)
update_fils_connect_params = true;
-@@ -1001,6 +1051,8 @@ void wpa_supplicant_set_state(struct wpa
+@@ -1017,6 +1067,8 @@ void wpa_supplicant_set_state(struct wpa
#endif /* CONFIG_OWE */
} else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING ||
state == WPA_ASSOCIATED) {
wpa_s->new_connection = 1;
wpa_drv_set_operstate(wpa_s, 0);
#ifndef IEEE8021X_EAPOL
-@@ -2225,6 +2277,8 @@ void wpa_supplicant_associate(struct wpa
+@@ -2276,6 +2328,8 @@ void wpa_supplicant_associate(struct wpa
return;
}
wpa_s->current_bss = bss;
#else /* CONFIG_MESH */
wpa_msg(wpa_s, MSG_ERROR,
"mesh mode support not included in the build");
-@@ -6207,6 +6261,16 @@ static int wpa_supplicant_init_iface(str
+@@ -6424,6 +6478,16 @@ static int wpa_supplicant_init_iface(str
sizeof(wpa_s->bridge_ifname));
}
/* RSNA Supplicant Key Management - INITIALIZE */
eapol_sm_notify_portEnabled(wpa_s->eapol, false);
eapol_sm_notify_portValid(wpa_s->eapol, false);
-@@ -6540,6 +6604,11 @@ static void wpa_supplicant_deinit_iface(
+@@ -6761,6 +6825,11 @@ static void wpa_supplicant_deinit_iface(
if (terminate)
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
+ wpa_s->hostapd = NULL;
+ }
+
- if (wpa_s->ctrl_iface) {
- wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface);
- wpa_s->ctrl_iface = NULL;
+ wpa_supplicant_ctrl_iface_deinit(wpa_s, wpa_s->ctrl_iface);
+ wpa_s->ctrl_iface = NULL;
+
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
-@@ -104,6 +104,11 @@ struct wpa_interface {
+@@ -103,6 +103,11 @@ struct wpa_interface {
const char *ifname;
/**
* bridge_ifname - Optional bridge interface name
*
* If the driver interface (ifname) is included in a Linux bridge
-@@ -530,6 +535,8 @@ struct wpa_supplicant {
+@@ -614,6 +619,8 @@ struct wpa_supplicant {
#endif /* CONFIG_CTRL_IFACE_BINDER */
char bridge_ifname[16];
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -2712,6 +2712,11 @@ static int hostapd_ctrl_iface_chan_switc
+@@ -2821,6 +2821,11 @@ static int hostapd_ctrl_iface_chan_switc
return 0;
}
+
for (i = 0; i < iface->num_bss; i++) {
- /* Save CHAN_SWITCH VHT config */
+ /* Save CHAN_SWITCH VHT and HE config */
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
-@@ -1468,11 +1468,6 @@ int ieee802_11_set_beacon(struct hostapd
+@@ -1753,11 +1753,6 @@ int ieee802_11_set_beacon(struct hostapd
struct wpabuf *beacon, *proberesp, *assocresp;
int res, ret = -1;
if (ieee802_11_build_ap_params(hapd, ¶ms) < 0)
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
-@@ -4579,6 +4579,60 @@ static void wpas_event_unprot_beacon(str
+@@ -4666,6 +4666,60 @@ static void wpas_event_unprot_beacon(str
}
void supplicant_event(void *ctx, enum wpa_event_type event,
union wpa_event_data *data)
{
-@@ -4881,8 +4935,10 @@ void supplicant_event(void *ctx, enum wp
+@@ -4981,8 +5035,10 @@ void supplicant_event(void *ctx, enum wp
channel_width_to_string(data->ch_switch.ch_width),
data->ch_switch.cf1,
data->ch_switch.cf2);
wpa_s->current_ssid->frequency = data->ch_switch.freq;
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -5690,6 +5690,7 @@ union wpa_event_data {
+@@ -5828,6 +5828,7 @@ union wpa_event_data {
/**
* struct ch_switch
* @freq: Frequency of new channel in MHz
* @ht_enabled: Whether this is an HT channel
* @ch_offset: Secondary channel offset
-@@ -5698,6 +5699,7 @@ union wpa_event_data {
+@@ -5836,6 +5837,7 @@ union wpa_event_data {
* @cf2: Center frequency 2
*/
struct ch_switch {
int ch_offset;
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
-@@ -541,7 +541,7 @@ static void mlme_event_ch_switch(struct
+@@ -684,7 +684,7 @@ static void mlme_event_ch_switch(struct
struct nlattr *ifindex, struct nlattr *freq,
struct nlattr *type, struct nlattr *bw,
struct nlattr *cf1, struct nlattr *cf2,
{
struct i802_bss *bss;
union wpa_event_data data;
-@@ -600,6 +600,8 @@ static void mlme_event_ch_switch(struct
+@@ -745,6 +745,8 @@ static void mlme_event_ch_switch(struct
data.ch_switch.cf1 = nla_get_u32(cf1);
if (cf2)
data.ch_switch.cf2 = nla_get_u32(cf2);
if (finished)
bss->freq = data.ch_switch.freq;
-@@ -2686,6 +2688,7 @@ static void do_process_drv_event(struct
+@@ -3003,6 +3005,7 @@ static void do_process_drv_event(struct
tb[NL80211_ATTR_CHANNEL_WIDTH],
tb[NL80211_ATTR_CENTER_FREQ1],
tb[NL80211_ATTR_CENTER_FREQ2],
0);
break;
case NL80211_CMD_CH_SWITCH_NOTIFY:
-@@ -2696,6 +2699,7 @@ static void do_process_drv_event(struct
+@@ -3013,6 +3016,7 @@ static void do_process_drv_event(struct
tb[NL80211_ATTR_CHANNEL_WIDTH],
tb[NL80211_ATTR_CENTER_FREQ1],
tb[NL80211_ATTR_CENTER_FREQ2],
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
-@@ -226,6 +226,9 @@ endif
+@@ -220,6 +220,9 @@ endif
ifdef CONFIG_NO_CTRL_IFACE
CFLAGS += -DCONFIG_NO_CTRL_IFACE
else
else
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3370,6 +3370,7 @@ static int hostapd_ctrl_iface_receive_pr
+@@ -3507,6 +3507,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);
} else if (os_strcmp(buf, "MIB") == 0) {
reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
if (reply_len >= 0) {
-@@ -3411,6 +3412,7 @@ static int hostapd_ctrl_iface_receive_pr
+@@ -3548,6 +3549,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);
reply_len = -1;
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -952,6 +952,9 @@ ifdef CONFIG_FILS
+@@ -958,6 +958,9 @@ ifdef CONFIG_FILS
OBJS += ../src/ap/fils_hlp.o
endif
ifdef CONFIG_CTRL_IFACE
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
-@@ -2267,7 +2267,7 @@ static int wpa_supplicant_ctrl_iface_sta
+@@ -2307,7 +2307,7 @@ static int wpa_supplicant_ctrl_iface_sta
pos += ret;
}
if (wpa_s->ap_iface) {
pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
end - pos,
-@@ -10366,6 +10366,7 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -10883,6 +10883,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);
} else if (os_strcmp(buf, "MIB") == 0) {
reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
if (reply_len >= 0) {
-@@ -10378,6 +10379,7 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -10895,6 +10896,7 @@ char * wpa_supplicant_ctrl_iface_process
reply_size - reply_len);
#endif /* CONFIG_MACSEC */
}
} else if (os_strncmp(buf, "STATUS", 6) == 0) {
reply_len = wpa_supplicant_ctrl_iface_status(
wpa_s, buf + 6, reply, reply_size);
-@@ -10862,6 +10864,7 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -11383,6 +11385,7 @@ char * wpa_supplicant_ctrl_iface_process
reply_len = wpa_supplicant_ctrl_iface_bss(
wpa_s, buf + 4, reply, reply_size);
#ifdef CONFIG_AP
} 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) {
-@@ -10870,12 +10873,15 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -11391,12 +11394,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);
#ifdef CONFIG_P2P_MANAGER
static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
-@@ -806,12 +808,12 @@ int hostapd_ctrl_iface_status(struct hos
+@@ -807,12 +809,12 @@ int hostapd_ctrl_iface_status(struct hos
return len;
len += ret;
}
if (os_snprintf_error(buflen - len, ret))
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
-@@ -2711,6 +2711,7 @@ static const char * bool_txt(bool val)
+@@ -2712,6 +2712,7 @@ static const char * bool_txt(bool val)
return val ? "TRUE" : "FALSE";
}
int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
{
-@@ -2897,6 +2898,7 @@ int ieee802_1x_get_mib_sta(struct hostap
+@@ -2898,6 +2899,7 @@ int ieee802_1x_get_mib_sta(struct hostap
return len;
}
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
-@@ -4451,6 +4451,7 @@ static const char * wpa_bool_txt(int val
+@@ -4503,6 +4503,7 @@ static const char * wpa_bool_txt(int val
return val ? "TRUE" : "FALSE";
}
#define RSN_SUITE "%02x-%02x-%02x-%d"
#define RSN_SUITE_ARG(s) \
-@@ -4601,7 +4602,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
+@@ -4653,7 +4654,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
return len;
}
{
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
-@@ -2728,6 +2728,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
+@@ -2767,6 +2767,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
}
#define RSN_SUITE "%02x-%02x-%02x-%d"
#define RSN_SUITE_ARG(s) \
((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
-@@ -2809,6 +2811,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
+@@ -2848,6 +2850,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
return (int) len;
}
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
-@@ -1328,7 +1328,7 @@ int wpas_ap_wps_nfc_report_handover(stru
+@@ -1364,7 +1364,7 @@ int wpas_ap_wps_nfc_report_handover(stru
#endif /* CONFIG_WPS */
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
-@@ -2121,6 +2121,31 @@ u32 wpa_akm_to_suite(int akm)
+@@ -2444,6 +2444,31 @@ u32 wpa_akm_to_suite(int akm)
}
int wpa_compare_rsn_ie(int ft_initial_assoc,
const u8 *ie1, size_t ie1len,
const u8 *ie2, size_t ie2len)
-@@ -2128,8 +2153,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
+@@ -2451,8 +2476,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
if (ie1 == NULL || ie2 == NULL)
return -1;
#include "crypto/random.h"
#include "crypto/tls.h"
#include "common/version.h"
-@@ -692,7 +693,7 @@ int main(int argc, char *argv[])
+@@ -691,7 +692,7 @@ int main(int argc, char *argv[])
wpa_supplicant_event = hostapd_wpa_event;
wpa_supplicant_event_global = hostapd_wpa_event_global;
for (;;) {
if (c < 0)
break;
switch (c) {
-@@ -729,6 +730,8 @@ int main(int argc, char *argv[])
+@@ -728,6 +729,8 @@ int main(int argc, char *argv[])
break;
#endif /* CONFIG_DEBUG_LINUX_TRACING */
case 'v':
static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
-@@ -1532,13 +1528,10 @@ static const struct hostapd_cli_cmd host
+@@ -1579,13 +1575,10 @@ static const struct hostapd_cli_cmd host
{ "disassociate", hostapd_cli_cmd_disassociate,
hostapd_complete_stations,
"<addr> = disassociate a station" },
{ "wps_pin", hostapd_cli_cmd_wps_pin, NULL,
"<uuid> <pin> [timeout] [addr] = add WPS Enrollee PIN" },
{ "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL,
-@@ -1563,7 +1556,6 @@ static const struct hostapd_cli_cmd host
+@@ -1610,7 +1603,6 @@ static const struct hostapd_cli_cmd host
"<SSID> <auth> <encr> <key> = configure AP" },
{ "wps_get_status", hostapd_cli_cmd_wps_get_status, NULL,
"= show current WPS status" },
#include "common/defs.h"
#include "common/ieee802_11_defs.h"
#include "common/wpa_common.h"
-@@ -850,6 +851,9 @@ struct wpa_driver_associate_params {
+@@ -851,6 +852,9 @@ struct wpa_driver_associate_params {
* responsible for selecting with which BSS to associate. */
const u8 *bssid;
#include "config.h"
-@@ -2269,6 +2270,97 @@ static char * wpa_config_write_peerkey(c
+@@ -2321,6 +2322,97 @@ static char * wpa_config_write_peerkey(c
#endif /* NO_CONFIG_WRITE */
/* Helper macros for network block parser */
#ifdef OFFSET
-@@ -2552,6 +2644,8 @@ static const struct parse_data ssid_fiel
+@@ -2606,6 +2698,8 @@ static const struct parse_data ssid_fiel
{ INT(ap_max_inactivity) },
{ INT(dtim_period) },
{ INT(beacon_int) },
* macsec_policy - Determines the policy for MACsec secure session
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -3638,6 +3638,12 @@ static void wpas_start_assoc_cb(struct w
+@@ -3726,6 +3726,12 @@ static void wpas_start_assoc_cb(struct w
params.beacon_int = ssid->beacon_int;
else
params.beacon_int = wpa_s->conf->beacon_int;
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -5602,7 +5602,7 @@ static int wpa_driver_nl80211_ibss(struc
+@@ -5951,7 +5951,7 @@ static int wpa_driver_nl80211_ibss(struc
struct wpa_driver_associate_params *params)
{
struct nl_msg *msg;
int count = 0;
wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
-@@ -5629,6 +5629,37 @@ retry:
+@@ -5978,6 +5978,37 @@ retry:
nl80211_put_beacon_int(msg, params->beacon_int))
goto fail;
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -1549,6 +1549,7 @@ struct wpa_driver_mesh_join_params {
+@@ -1618,6 +1618,7 @@ struct wpa_driver_mesh_join_params {
#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
unsigned int flags;
bool handle_dfs;
struct wpa_driver_set_key_params {
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -10064,6 +10064,18 @@ static int nl80211_put_mesh_id(struct nl
+@@ -10466,6 +10466,18 @@ static int nl80211_put_mesh_id(struct nl
}
static int nl80211_put_mesh_config(struct nl_msg *msg,
struct wpa_driver_mesh_bss_params *params)
{
-@@ -10125,6 +10137,7 @@ static int nl80211_join_mesh(struct i802
+@@ -10527,6 +10539,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) ||
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -2407,11 +2407,13 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2457,11 +2457,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];
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
-@@ -1327,14 +1327,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS)
+@@ -1292,7 +1292,7 @@ hostapd_multi.a: $(OBJS)
@$(AR) cr $@ hostapd_multi.o $(OBJS)
- hostapd: $(BCHECK) $(OBJS)
+ hostapd: $(OBJS)
- $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
+ +$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
@$(E) " LD " $@
ifdef CONFIG_WPA_TRACE
- OBJS_c += ../src/utils/trace.o
- endif
+@@ -1303,7 +1303,7 @@ _OBJS_VAR := OBJS_c
+ include ../src/objs.mk
+
hostapd_cli: $(OBJS_c)
- $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
+ +$(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS)
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -1930,23 +1930,23 @@ wpa_supplicant_multi.a: .config $(BCHECK
+@@ -1921,31 +1921,31 @@ wpa_supplicant_multi.a: .config $(BCHECK
@$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
+ +$(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
@$(E) " LD " $@
+ _OBJS_VAR := OBJS_t
+ include ../src/objs.mk
eapol_test: $(OBJS_t)
- $(Q)$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS)
+ +$(Q)$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS)
@$(E) " LD " $@
+ _OBJS_VAR := OBJS_t2
+ include ../src/objs.mk
preauth_test: $(OBJS_t2)
- $(Q)$(LDO) $(LDFLAGS) -o preauth_test $(OBJS_t2) $(LIBS)
+ +$(Q)$(LDO) $(LDFLAGS) -o preauth_test $(OBJS_t2) $(LIBS)
@$(E) " LD " $@
+ _OBJS_VAR := OBJS_p
+ include ../src/objs.mk
wpa_passphrase: $(OBJS_p)
- $(Q)$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p) $(LIBS)
+ +$(Q)$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p) $(LIBS)
@$(E) " LD " $@
+ _OBJS_VAR := OBJS_c
+ include ../src/objs.mk
wpa_cli: $(OBJS_c)
- $(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c)
+ +$(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c)
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
-@@ -171,6 +171,11 @@ OBJS += ../src/common/hw_features_common
+@@ -165,6 +165,11 @@ OBJS += ../src/common/hw_features_common
OBJS += ../src/eapol_auth/eapol_auth_sm.o
int interface_added; /* virtual interface added for this BSS */
unsigned int started:1;
unsigned int disabled:1;
-@@ -606,6 +608,7 @@ hostapd_alloc_bss_data(struct hostapd_if
+@@ -610,6 +612,7 @@ hostapd_alloc_bss_data(struct hostapd_if
struct hostapd_bss_config *bss);
int hostapd_setup_interface(struct hostapd_iface *iface);
int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
struct hostapd_iface * hostapd_alloc_iface(void);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -395,6 +395,7 @@ void hostapd_free_hapd_data(struct hosta
+@@ -396,6 +396,7 @@ void hostapd_free_hapd_data(struct hosta
hapd->beacon_set_done = 0;
wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
accounting_deinit(hapd);
hostapd_deinit_wpa(hapd);
vlan_deinit(hapd);
-@@ -1417,6 +1418,8 @@ static int hostapd_setup_bss(struct host
+@@ -1422,6 +1423,8 @@ static int hostapd_setup_bss(struct host
if (hapd->driver && hapd->driver->set_operstate)
hapd->driver->set_operstate(hapd->drv_priv, 1);
return 0;
}
-@@ -1999,6 +2002,7 @@ static int hostapd_setup_interface_compl
+@@ -2007,6 +2010,7 @@ static int hostapd_setup_interface_compl
if (err)
goto fail;
wpa_printf(MSG_DEBUG, "Completing interface initialization");
if (iface->freq) {
#ifdef NEED_AP_MLME
-@@ -2196,6 +2200,7 @@ dfs_offload:
+@@ -2204,6 +2208,7 @@ dfs_offload:
fail:
wpa_printf(MSG_ERROR, "Interface initialization failed");
hostapd_set_state(iface, HAPD_IFACE_DISABLED);
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
#ifdef CONFIG_FST
-@@ -2671,6 +2676,7 @@ void hostapd_interface_deinit_free(struc
+@@ -2679,6 +2684,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;
__func__, driver, drv_priv);
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
-@@ -2327,13 +2327,18 @@ static void handle_auth(struct hostapd_d
+@@ -3544,13 +3544,18 @@ static void handle_auth(struct hostapd_d
u16 auth_alg, auth_transaction, status_code;
u16 resp = WLAN_STATUS_SUCCESS;
struct sta_info *sta = NULL;
if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
-@@ -2493,6 +2498,13 @@ static void handle_auth(struct hostapd_d
+@@ -3718,6 +3723,13 @@ static void handle_auth(struct hostapd_d
resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
goto fail;
}
if (res == HOSTAPD_ACL_PENDING)
return;
-@@ -4166,7 +4178,7 @@ static void handle_assoc(struct hostapd_
+@@ -5437,7 +5449,7 @@ static void handle_assoc(struct hostapd_
int resp = WLAN_STATUS_SUCCESS;
- u16 reply_res;
+ u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE;
const u8 *pos;
- int left, i;
+ int left, i, ubus_resp;
struct sta_info *sta;
u8 *tmp = NULL;
#ifdef CONFIG_FILS
-@@ -4379,6 +4391,11 @@ static void handle_assoc(struct hostapd_
+@@ -5650,6 +5662,11 @@ static void handle_assoc(struct hostapd_
left = res;
}
#endif /* CONFIG_FILS */
/* followed by SSID and Supported rates; and HT capabilities if 802.11n
* is used */
-@@ -4543,6 +4560,14 @@ static void handle_assoc(struct hostapd_
+@@ -5814,6 +5831,14 @@ static void handle_assoc(struct hostapd_
pos, left, rssi, omit_rsnxe);
os_free(tmp);
+ }
+
/*
- * Remove the station in case tranmission of a success response fails
+ * Remove the station in case transmission of a success response fails
* (the STA was added associated to the driver) or if the station was
-@@ -4570,6 +4595,7 @@ static void handle_disassoc(struct hosta
+@@ -5841,6 +5866,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));
sta = ap_get_sta(hapd, mgmt->sa);
if (sta == NULL) {
-@@ -4636,6 +4662,8 @@ static void handle_deauth(struct hostapd
- " reason_code=%d",
- MAC2STR(mgmt->sa), le_to_host16(mgmt->u.deauth.reason_code));
+@@ -5910,6 +5936,8 @@ static void handle_deauth(struct hostapd
+ /* Clear the PTKSA cache entries for PASN */
+ ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE);
+ hostapd_ubus_notify(hapd, "deauth", mgmt->sa);
+
wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying "
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
-@@ -814,6 +814,12 @@ void handle_probe_req(struct hostapd_dat
+@@ -823,6 +823,12 @@ void handle_probe_req(struct hostapd_dat
u16 csa_offs[2];
size_t csa_offs_len;
struct radius_sta rad_info;
+ .elems = &elems,
+ };
- if (len < IEEE80211_HDRLEN)
- return;
-@@ -996,6 +1002,12 @@ void handle_probe_req(struct hostapd_dat
+ if (hapd->iconf->rssi_ignore_probe_request && ssi_signal &&
+ ssi_signal < hapd->iconf->rssi_ignore_probe_request)
+@@ -1009,6 +1015,12 @@ void handle_probe_req(struct hostapd_dat
}
#endif /* CONFIG_P2P */
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
-@@ -119,6 +119,10 @@ int hostapd_notif_assoc(struct hostapd_d
+@@ -145,6 +145,10 @@ int hostapd_notif_assoc(struct hostapd_d
u16 reason = WLAN_REASON_UNSPECIFIED;
int status = WLAN_STATUS_SUCCESS;
const u8 *p2p_dev_addr = NULL;
if (addr == NULL) {
/*
-@@ -211,6 +215,12 @@ int hostapd_notif_assoc(struct hostapd_d
+@@ -237,6 +241,12 @@ int hostapd_notif_assoc(struct hostapd_d
goto fail;
}
wpabuf_free(sta->p2p_ie);
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
-@@ -424,6 +424,7 @@ void ap_handle_timer(void *eloop_ctx, vo
+@@ -459,6 +459,7 @@ void ap_handle_timer(void *eloop_ctx, vo
HOSTAPD_LEVEL_INFO, "deauthenticated due to "
"local deauth request");
ap_free_sta(hapd, sta);
return;
}
-@@ -579,6 +580,7 @@ skip_poll:
+@@ -614,6 +615,7 @@ skip_poll:
hapd, sta,
WLAN_REASON_PREV_AUTH_NOT_VALID);
ap_free_sta(hapd, sta);
break;
}
}
-@@ -1294,6 +1296,7 @@ void ap_sta_set_authorized(struct hostap
+@@ -1329,6 +1331,7 @@ void ap_sta_set_authorized(struct hostap
buf, ip_addr, keyid_buf);
} else {
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);
hapd->msg_ctx_parent != hapd->msg_ctx)
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
-@@ -259,6 +259,7 @@ static void hostapd_wpa_auth_psk_failure
+@@ -265,6 +265,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));
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -190,6 +190,12 @@ ifdef CONFIG_EAPOL_TEST
+@@ -179,6 +179,12 @@ ifdef CONFIG_EAPOL_TEST
CFLAGS += -Werror -DEAPOL_TEST
endif
ifdef CONFIG_CODE_COVERAGE
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
LIBS += -lgcov
-@@ -956,6 +962,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
+@@ -962,6 +968,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
CFLAGS += -DCONFIG_CTRL_IFACE_MIB
endif
OBJS += ../src/ap/ctrl_iface_ap.o
CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -6794,6 +6794,8 @@ struct wpa_supplicant * wpa_supplicant_a
+@@ -7015,6 +7015,8 @@ struct wpa_supplicant * wpa_supplicant_a
}
#endif /* CONFIG_P2P */
return wpa_s;
}
-@@ -6820,6 +6822,8 @@ int wpa_supplicant_remove_iface(struct w
+@@ -7041,6 +7043,8 @@ int wpa_supplicant_remove_iface(struct w
struct wpa_supplicant *parent = wpa_s->parent;
#endif /* CONFIG_MESH */
/* Remove interface from the global list of interfaces */
prev = global->ifaces;
if (prev == wpa_s) {
-@@ -7123,8 +7127,12 @@ int wpa_supplicant_run(struct wpa_global
+@@ -7344,8 +7348,12 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
-@@ -17,6 +17,7 @@
+@@ -19,6 +19,7 @@
#include "wps/wps_defs.h"
#include "config_ssid.h"
#include "wmm_ac.h"
extern const char *const wpa_supplicant_version;
extern const char *const wpa_supplicant_license;
-@@ -310,6 +311,8 @@ struct wpa_global {
+@@ -321,6 +322,8 @@ struct wpa_global {
#endif /* CONFIG_WIFI_DISPLAY */
struct psk_list_entry *add_psk; /* From group formation */
};
-@@ -520,6 +523,7 @@ struct wpa_supplicant {
+@@ -604,6 +607,7 @@ struct wpa_supplicant {
unsigned char own_addr[ETH_ALEN];
unsigned char perm_addr[ETH_ALEN];
char ifname[100];
--- a/hostapd/main.c
+++ b/hostapd/main.c
-@@ -896,6 +896,7 @@ int main(int argc, char *argv[])
+@@ -895,6 +895,7 @@ int main(int argc, char *argv[])
}
hostapd_global_ctrl_iface_init(&interfaces);
if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
wpa_printf(MSG_ERROR, "Failed to start eloop");
-@@ -905,6 +906,7 @@ int main(int argc, char *argv[])
+@@ -904,6 +905,7 @@ int main(int argc, char *argv[])
ret = 0;
out:
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -2501,6 +2501,8 @@ static int hostapd_config_fill(struct ho
+@@ -2453,6 +2453,8 @@ static int hostapd_config_fill(struct ho
bss->isolate = atoi(pos);
} else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
bss->ap_max_inactivity = atoi(pos);
} else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
bss->skip_inactivity_poll = atoi(pos);
} else if (os_strcmp(buf, "country_code") == 0) {
-@@ -3197,6 +3199,8 @@ static int hostapd_config_fill(struct ho
+@@ -3153,6 +3155,8 @@ static int hostapd_config_fill(struct ho
}
} else if (os_strcmp(buf, "acs_exclude_dfs") == 0) {
conf->acs_exclude_dfs = atoi(pos);
} else if (os_strcmp(buf, "channel") == 0) {
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
-@@ -780,6 +780,7 @@ void hostapd_config_free_bss(struct host
+@@ -791,6 +791,7 @@ void hostapd_config_free_bss(struct host
os_free(conf->radius_req_attr_sqlite);
os_free(conf->rsn_preauth_interfaces);
os_free(conf->ctrl_interface);
os_free(conf->ca_cert);
os_free(conf->server_cert);
os_free(conf->server_cert2);
-@@ -972,6 +973,7 @@ void hostapd_config_free(struct hostapd_
+@@ -987,6 +988,7 @@ void hostapd_config_free(struct hostapd_
for (i = 0; i < conf->num_bss; i++)
hostapd_config_free_bss(conf->bss[i]);
os_free(conf->basic_rates);
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -873,6 +873,7 @@ struct hostapd_bss_config {
- */
- u8 mka_psk_set;
- #endif /* CONFIG_MACSEC */
+@@ -896,6 +896,7 @@ struct hostapd_bss_config {
+
+ u8 ext_capa_mask[EXT_CAPA_MAX_LEN];
+ u8 ext_capa[EXT_CAPA_MAX_LEN];
+ char *config_id;
};
/**
-@@ -1064,6 +1065,7 @@ struct hostapd_config {
+@@ -1097,6 +1098,7 @@ struct hostapd_config {
unsigned int airtime_update_interval;
#define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1)
#endif /* CONFIG_AIRTIME_POLICY */
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -218,6 +218,10 @@ static int hostapd_iface_conf_changed(st
+@@ -219,6 +219,10 @@ static int hostapd_iface_conf_changed(st
{
size_t i;
if (newconf->num_bss != oldconf->num_bss)
return 1;
-@@ -231,7 +235,7 @@ static int hostapd_iface_conf_changed(st
+@@ -232,7 +236,7 @@ static int hostapd_iface_conf_changed(st
}
{
struct hapd_interfaces *interfaces = iface->interfaces;
struct hostapd_data *hapd = iface->bss[0];
-@@ -254,13 +258,16 @@ int hostapd_reload_config(struct hostapd
+@@ -255,13 +259,16 @@ int hostapd_reload_config(struct hostapd
if (newconf == NULL)
return -1;
wpa_printf(MSG_DEBUG,
"Configuration changes include interface/BSS modification - force full disable+enable sequence");
fname = os_strdup(iface->config_fname);
-@@ -285,6 +292,24 @@ int hostapd_reload_config(struct hostapd
+@@ -286,6 +293,24 @@ int hostapd_reload_config(struct hostapd
wpa_printf(MSG_ERROR,
"Failed to enable interface on config reload");
return res;
}
iface->conf = newconf;
-@@ -301,6 +326,12 @@ int hostapd_reload_config(struct hostapd
+@@ -302,6 +327,12 @@ int hostapd_reload_config(struct hostapd
for (j = 0; j < iface->num_bss; j++) {
hapd = iface->bss[j];
hapd->iconf = newconf;
hapd->conf = newconf->bss[j];
hostapd_reload_bss(hapd);
-@@ -2368,6 +2399,10 @@ hostapd_alloc_bss_data(struct hostapd_if
+@@ -2376,6 +2407,10 @@ hostapd_alloc_bss_data(struct hostapd_if
hapd->iconf = conf;
hapd->conf = bss;
hapd->iface = hapd_iface;
int interface_added; /* virtual interface added for this BSS */
unsigned int started:1;
unsigned int disabled:1;
-@@ -600,7 +601,7 @@ struct hostapd_iface {
+@@ -604,7 +605,7 @@ struct hostapd_iface {
int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
int (*cb)(struct hostapd_iface *iface,
void *ctx), void *ctx);
hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -4511,6 +4511,9 @@ static int wpa_driver_nl80211_set_ap(voi
+@@ -4820,6 +4820,9 @@ static int wpa_driver_nl80211_set_ap(voi
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
ret, strerror(-ret));
nl80211_set_bss(bss, params->cts_protect, params->preamble,
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -184,7 +184,7 @@ static int hostapd_ctrl_iface_update(str
+@@ -186,7 +186,7 @@ static int hostapd_ctrl_iface_update(str
iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
reload_opts = txt;
+++ /dev/null
-From 4683b72183c5435e16b905b1494f509aeb921d60 Mon Sep 17 00:00:00 2001
-From: David Bauer <mail@david-bauer.net>
-Date: Sat, 4 Jul 2020 10:12:21 +0200
-Subject: DFS: Enter DFS state if no available channel is found
-
-Previously hostapd would not stop transmitting when a DFS event was
-detected and no available channel to switch to was available.
-
-Disable and re-enable the interface to enter DFS state. This way, TX
-does not happen until the kernel notifies hostapd about the NOP
-expiring.
-
-Signed-off-by: David Bauer <mail@david-bauer.net>
----
- src/ap/dfs.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
---- a/src/ap/dfs.c
-+++ b/src/ap/dfs.c
-@@ -1088,8 +1088,16 @@ static int hostapd_dfs_start_channel_swi
- &oper_centr_freq_seg0_idx,
- &oper_centr_freq_seg1_idx,
- &skip_radar);
-- if (!channel)
-- return err;
-+ if (!channel) {
-+ /*
-+ * Toggle interface state to enter DFS state
-+ * until NOP is finished.
-+ */
-+ hostapd_disable_iface(iface);
-+ hostapd_enable_iface(iface);
-+ return 0;
-+ }
-+
- if (!skip_radar) {
- iface->freq = channel->freq;
- iface->conf->channel = channel->chan;
+++ /dev/null
-From 947272febe24a8f0ea828b5b2f35f13c3821901e Mon Sep 17 00:00:00 2001
-From: Jouni Malinen <jouni@codeaurora.org>
-Date: Mon, 9 Nov 2020 11:43:12 +0200
-Subject: [PATCH] P2P: Fix copying of secondary device types for P2P group
- client
-
-Parsing and copying of WPS secondary device types list was verifying
-that the contents is not too long for the internal maximum in the case
-of WPS messages, but similar validation was missing from the case of P2P
-group information which encodes this information in a different
-attribute. This could result in writing beyond the memory area assigned
-for these entries and corrupting memory within an instance of struct
-p2p_device. This could result in invalid operations and unexpected
-behavior when trying to free pointers from that corrupted memory.
-
-Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27269
-Fixes: e57ae6e19edf ("P2P: Keep track of secondary device types for peers")
-Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
----
- src/p2p/p2p.c | 2 ++
- 1 file changed, 2 insertions(+)
-
---- a/src/p2p/p2p.c
-+++ b/src/p2p/p2p.c
-@@ -453,6 +453,8 @@ static void p2p_copy_client_info(struct
- dev->info.config_methods = cli->config_methods;
- os_memcpy(dev->info.pri_dev_type, cli->pri_dev_type, 8);
- dev->info.wps_sec_dev_type_list_len = 8 * cli->num_sec_dev_types;
-+ if (dev->info.wps_sec_dev_type_list_len > WPS_SEC_DEV_TYPE_MAX_LEN)
-+ dev->info.wps_sec_dev_type_list_len = WPS_SEC_DEV_TYPE_MAX_LEN;
- os_memcpy(dev->info.wps_sec_dev_type_list, cli->sec_dev_types,
- dev->info.wps_sec_dev_type_list_len);
- }
+++ /dev/null
-From ef26fc19fa03f26437ea5b09b01d930eb1999b24 Mon Sep 17 00:00:00 2001
-From: Janusz Dziedzic <janusz.dziedzic@gmail.com>
-Date: Sun, 11 Oct 2020 21:01:52 +0200
-Subject: DFS: Allow switch to an available channel
-
-For EU, where preCAC is allowed, we should allow switch to DFS available
-channels, instead of restarting BSS.
-
-Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
----
- src/ap/dfs.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
---- a/src/ap/dfs.c
-+++ b/src/ap/dfs.c
-@@ -1366,12 +1366,16 @@ int hostapd_is_dfs_overlap(struct hostap
- if (!(chan->flag & HOSTAPD_CHAN_RADAR))
- continue;
-
-+ if ((chan->flag & HOSTAPD_CHAN_DFS_MASK) ==
-+ HOSTAPD_CHAN_DFS_AVAILABLE)
-+ continue;
-+
- if (center_freq - chan->freq < half_width &&
- chan->freq - center_freq < half_width)
- res++;
- }
-
-- wpa_printf(MSG_DEBUG, "DFS: (%d, %d): in range: %s",
-+ wpa_printf(MSG_DEBUG, "DFS CAC required: (%d, %d): in range: %s",
- center_freq - half_width, center_freq + half_width,
- res ? "yes" : "no");
-