diff --git a/recipes-connectivity/hostapd/files/0001-Add-build-artifact-build_features.h-to-gitignore.patch b/recipes-connectivity/hostapd/files/0001-Add-build-artifact-build_features.h-to-gitignore.patch index 100bb9f..1b830b2 100644 --- a/recipes-connectivity/hostapd/files/0001-Add-build-artifact-build_features.h-to-gitignore.patch +++ b/recipes-connectivity/hostapd/files/0001-Add-build-artifact-build_features.h-to-gitignore.patch @@ -1,4 +1,4 @@ -From 1410d96b1ffefbf4ba3dfb3d432db7c9558a8386 Mon Sep 17 00:00:00 2001 +From 8f5d84d19c5a022157d62a34c320d478f7e7ab8c Mon Sep 17 00:00:00 2001 From: Moritz Rosenthal Date: Sat, 29 Feb 2020 21:13:42 +0100 Subject: [PATCH] Add build artifact build_features.h to gitignore diff --git a/recipes-connectivity/hostapd/files/0002-Use-environment-variable-EXTRA_CFLAGS.patch b/recipes-connectivity/hostapd/files/0002-Use-environment-variable-EXTRA_CFLAGS.patch index f97c4f0..a339f3e 100644 --- a/recipes-connectivity/hostapd/files/0002-Use-environment-variable-EXTRA_CFLAGS.patch +++ b/recipes-connectivity/hostapd/files/0002-Use-environment-variable-EXTRA_CFLAGS.patch @@ -1,4 +1,4 @@ -From 919318e4abd51df15dd4d5769ed2d0ad6981e87b Mon Sep 17 00:00:00 2001 +From dd38a7c5dd2222573e267767831f0cdfcbc272df Mon Sep 17 00:00:00 2001 From: Moritz Rosenthal Date: Sat, 29 Feb 2020 21:17:05 +0100 Subject: [PATCH] Use environment variable EXTRA_CFLAGS diff --git a/recipes-connectivity/hostapd/files/001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch b/recipes-connectivity/hostapd/files/001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch new file mode 100644 index 0000000..944556d --- /dev/null +++ b/recipes-connectivity/hostapd/files/001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch @@ -0,0 +1,203 @@ +From c8d6b2cde0d37ef0fe5a888f5eaf8bf6d02973ad Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:17 +0200 +Subject: [PATCH] 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 +Signed-off-by: Markus Theil + +--- + src/ap/dfs.c | 8 ++++---- + wpa_supplicant/ap.c | 40 +++++++++++++++++++++++----------------- + wpa_supplicant/mesh.c | 24 ------------------------ + 3 files changed, 27 insertions(+), 45 deletions(-) + +diff --git a/src/ap/dfs.c b/src/ap/dfs.c +index 3c078b9cb..f62da49a7 100644 +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -1028,7 +1028,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) + 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_switch(struct hostapd_iface *iface) + "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_switch(struct hostapd_iface *iface) + 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, +diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c +index 624168205..5b75821a2 100644 +--- a/wpa_supplicant/ap.c ++++ b/wpa_supplicant/ap.c +@@ -52,6 +52,7 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s, + #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_supplicant *wpa_s, + + /* 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_supplicant *wpa_s, + * 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_supplicant *wpa_s, + 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_supplicant *wpa_s, + 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; + } + } + +diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c +index c085466b1..8cacf28e1 100644 +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -333,30 +333,6 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, + 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) { + /* diff --git a/recipes-connectivity/hostapd/files/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch b/recipes-connectivity/hostapd/files/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch new file mode 100644 index 0000000..3294fca --- /dev/null +++ b/recipes-connectivity/hostapd/files/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch @@ -0,0 +1,130 @@ +From f212c6af4de6d0a779b6b131905f5f0c0f4ebd8f Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:18 +0200 +Subject: [PATCH] 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. + +In consequence, remove mesh coex test, which contradicts this change. + +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 + +--- + tests/hwsim/test_wpas_mesh.py | 50 ------------------------------------------- + wpa_supplicant/mesh.c | 25 ++++++++++++++++++++-- + 2 files changed, 23 insertions(+), 52 deletions(-) + +diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py +index 3c918184f..bc07f5e25 100644 +--- a/tests/hwsim/test_wpas_mesh.py ++++ b/tests/hwsim/test_wpas_mesh.py +@@ -933,56 +933,6 @@ def _test_wpas_mesh_open_5ghz(dev, apdev): + dev[0].dump_monitor() + dev[1].dump_monitor() + +-def test_wpas_mesh_open_5ghz_coex(dev, apdev): +- """Mesh network on 5 GHz band and 20/40 coex change""" +- try: +- _test_wpas_mesh_open_5ghz_coex(dev, apdev) +- finally: +- dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname) +- dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname) +- set_world_reg(apdev0=apdev[0], dev0=dev[0]) +- dev[0].flush_scan_cache() +- dev[1].flush_scan_cache() +- +-def _test_wpas_mesh_open_5ghz_coex(dev, apdev): +- check_mesh_support(dev[0]) +- subprocess.call(['iw', 'reg', 'set', 'US']) +- +- # Start a 20 MHz BSS on channel 40 that would be the secondary channel of +- # HT40+ mesh on channel 36. +- params = {"ssid": "test-ht40", +- "hw_mode": "a", +- "channel": "40", +- "country_code": "US"} +- hapd = hostapd.add_ap(apdev[0], params) +- bssid = hapd.own_addr() +- +- for i in range(2): +- for j in range(5): +- ev = dev[i].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=5) +- if ev is None: +- raise Exception("No regdom change event") +- if "alpha2=US" in ev: +- break +- dev[i].scan_for_bss(bssid, freq=5200) +- add_open_mesh_network(dev[i], freq="5180") +- +- check_mesh_joined_connected(dev) +- +- freq = dev[0].get_status_field("freq") +- if freq != "5200": +- raise Exception("Unexpected STATUS freq=" + freq) +- sig = dev[0].request("SIGNAL_POLL").splitlines() +- if "FREQUENCY=5200" not in sig: +- raise Exception("Unexpected SIGNAL_POLL output: " + str(sig)) +- +- hapd.disable() +- dev[0].mesh_group_remove() +- dev[1].mesh_group_remove() +- check_mesh_group_removed(dev[0]) +- check_mesh_group_removed(dev[1]) +- dev[0].dump_monitor() +- dev[1].dump_monitor() + + def test_wpas_mesh_open_ht40(dev, apdev): + """Mesh and HT40 support difference""" +diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c +index 8cacf28e1..941c95cfd 100644 +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -363,6 +363,29 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, + 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 +397,6 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, + return -1; + } + +- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); +- + return 0; + out_free: + wpa_supplicant_mesh_deinit(wpa_s); diff --git a/recipes-connectivity/hostapd/files/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch b/recipes-connectivity/hostapd/files/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch new file mode 100644 index 0000000..6daeaa9 --- /dev/null +++ b/recipes-connectivity/hostapd/files/003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch @@ -0,0 +1,104 @@ +From be06b10b0a20f8de769d8b0ea983eaf94e0aefbc Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:19 +0200 +Subject: [PATCH] wpa_supplicant: handle HT40 and mode downgrade in AP mode + +This patch adds 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 11b if 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 + +--- + wpa_supplicant/ap.c | 49 ++++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 40 insertions(+), 9 deletions(-) + +diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c +index 5b75821a2..156c1aab1 100644 +--- a/wpa_supplicant/ap.c ++++ b/wpa_supplicant/ap.c +@@ -134,6 +134,23 @@ 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 +164,6 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, + 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 +172,27 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, + */ + 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 drop to 11b if driver does not support 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 +217,13 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, + 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 && diff --git a/recipes-connectivity/hostapd/files/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch b/recipes-connectivity/hostapd/files/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch new file mode 100644 index 0000000..1265934 --- /dev/null +++ b/recipes-connectivity/hostapd/files/004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch @@ -0,0 +1,65 @@ +From 356b59ecd1db87a74248dab97034c39ff5fa316a Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:20 +0200 +Subject: [PATCH] wpa_supplicant: fix frequency config for non p2p vht/he cases + +Fix compile 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 + +--- + wpa_supplicant/ap.c | 23 +++++++++++++---------- + 1 file changed, 13 insertions(+), 10 deletions(-) + +diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c +index 156c1aab1..2ec656255 100644 +--- a/wpa_supplicant/ap.c ++++ b/wpa_supplicant/ap.c +@@ -52,8 +52,8 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s, + #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,27 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s, + 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 (!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)); ++ ++ 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); ++ } ++ ++ 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); diff --git a/recipes-connectivity/hostapd/files/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch b/recipes-connectivity/hostapd/files/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch new file mode 100644 index 0000000..cf91b2f --- /dev/null +++ b/recipes-connectivity/hostapd/files/005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch @@ -0,0 +1,28 @@ +From a154b97c65c8b22755e326863770b498617148a9 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:21 +0200 +Subject: [PATCH] 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 + +--- + wpa_supplicant/config.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c +index a9726e2d6..58c53cdb3 100644 +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -3036,6 +3036,8 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid) + 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; diff --git a/recipes-connectivity/hostapd/files/006-hw_features-better-debug-messages-for-some-error-cas.patch b/recipes-connectivity/hostapd/files/006-hw_features-better-debug-messages-for-some-error-cas.patch new file mode 100644 index 0000000..18a63b1 --- /dev/null +++ b/recipes-connectivity/hostapd/files/006-hw_features-better-debug-messages-for-some-error-cas.patch @@ -0,0 +1,86 @@ +From 0464c6d1f8b205ca7d3a2f8b2dc5f81cc88c861b Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:22 +0200 +Subject: [PATCH] hw_features: better debug messages for some error cases + +Signed-off-by: Markus Theil + +--- + src/common/hw_features_common.c | 29 ++++++++++++++++++++++------- + 1 file changed, 22 insertions(+), 7 deletions(-) + +diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c +index f6c67a375..3de8eb9cf 100644 +--- a/src/common/hw_features_common.c ++++ b/src/common/hw_features_common.c +@@ -540,13 +540,18 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, + 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 (=%i) and center freq 1 (=%i) 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 +560,10 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, + 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 +589,22 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, + 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 +618,10 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, + 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; + } + diff --git a/recipes-connectivity/hostapd/files/007-dfs-use-helper-functions-for-vht-he-parameters.patch b/recipes-connectivity/hostapd/files/007-dfs-use-helper-functions-for-vht-he-parameters.patch new file mode 100644 index 0000000..ed4573d --- /dev/null +++ b/recipes-connectivity/hostapd/files/007-dfs-use-helper-functions-for-vht-he-parameters.patch @@ -0,0 +1,30 @@ +From 1111a73ca0b0f7e8ed08faf4fa317502bbc2d062 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 13:53:23 +0200 +Subject: [PATCH] dfs: use helper functions for vht/he parameters + +Signed-off-by: Markus Theil + +--- + src/ap/dfs.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/ap/dfs.c b/src/ap/dfs.c +index f62da49a7..2c914baa2 100644 +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -955,10 +955,12 @@ dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel, + if (*skip_radar) { + *skip_radar = 0; + } else { +- if (iface->conf->vht_oper_chwidth == CHANWIDTH_USE_HT) ++ int 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); + } + } + diff --git a/recipes-connectivity/hostapd/files/007-mesh-apply-channel-attributes-before-running-Mesh.patch b/recipes-connectivity/hostapd/files/007-mesh-apply-channel-attributes-before-running-Mesh.patch deleted file mode 100644 index acebb3d..0000000 --- a/recipes-connectivity/hostapd/files/007-mesh-apply-channel-attributes-before-running-Mesh.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 912990afa5f72947d5e2cfc21e88e5288a1116d6 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:40 -0700 -Subject: [PATCH] mesh: Apply channel attributes before setup interface - -This helps mesh interface initialization with correct channel -parameters. - -Signed-off-by: Peter Oh - ---- - wpa_supplicant/mesh.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c -index 36ff2df89..98b041380 100644 ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -249,7 +249,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, - struct mesh_conf *mconf; - int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 }; - int rate_len; -- int frequency; -+ int frequency, saved_freq; - - if (!wpa_s->conf->user_mpm) { - /* not much for us to do here */ -@@ -386,6 +386,13 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, - conf->basic_rates[rate_len] = -1; - } - -+ /* Handle pri/sec switch frequency within AP configuration parameter -+ * generation without changing the stored network profile in the end. */ -+ saved_freq = ssid->frequency; -+ ssid->frequency = frequency; -+ wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); -+ ssid->frequency = saved_freq; -+ - if (wpa_drv_init_mesh(wpa_s)) { - wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); - return -1; -@@ -397,8 +404,6 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, - return -1; - } - -- wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); -- - return 0; - out_free: - wpa_supplicant_mesh_deinit(wpa_s); diff --git a/recipes-connectivity/hostapd/files/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch b/recipes-connectivity/hostapd/files/008-mesh-use-setup-completion-callback-to-complete-mesh-.patch similarity index 57% rename from recipes-connectivity/hostapd/files/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch rename to recipes-connectivity/hostapd/files/008-mesh-use-setup-completion-callback-to-complete-mesh-.patch index b630f40..849f062 100644 --- a/recipes-connectivity/hostapd/files/004-mesh-use-setup-completion-callback-to-complete-mesh-.patch +++ b/recipes-connectivity/hostapd/files/008-mesh-use-setup-completion-callback-to-complete-mesh-.patch @@ -1,6 +1,6 @@ -From be22439f78de79cfbaa12c56f28d1f46bfe46eb3 Mon Sep 17 00:00:00 2001 +From d6ef413782540a3d20d1ffb871dd7c8138b001af Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:38 -0700 +Date: Tue, 30 Jun 2020 14:18:56 +0200 Subject: [PATCH] mesh: use setup completion callback to complete mesh join mesh join function is the last function to be called during @@ -16,19 +16,18 @@ The callback will be called by hostapd_setup_interface_complete_sync. There is possiblity that completing mesh init fails, so add error handle codes. -Signed-off-by: Peter Oh Signed-off-by: Peter Oh --- src/ap/hostapd.c | 11 ++++++++++- - wpa_supplicant/mesh.c | 13 +++++++------ - 2 files changed, 17 insertions(+), 7 deletions(-) + wpa_supplicant/mesh.c | 12 ++++++++++-- + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c -index bf1975fbd..c85563353 100644 +index b37f49f9a..04aebe31a 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -423,6 +423,8 @@ static void hostapd_free_hapd_data(struct hostapd_data *hapd) +@@ -434,6 +434,8 @@ static void hostapd_free_hapd_data(struct hostapd_data *hapd) #ifdef CONFIG_MESH wpabuf_free(hapd->mesh_pending_auth); hapd->mesh_pending_auth = NULL; @@ -37,12 +36,12 @@ index bf1975fbd..c85563353 100644 #endif /* CONFIG_MESH */ hostapd_clean_rrm(hapd); -@@ -2049,6 +2051,13 @@ dfs_offload: +@@ -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) { ++ if (delay_apply_cfg && iface->mconf == NULL) { + wpa_printf(MSG_ERROR, "Error while completing mesh init"); + goto fail; + } @@ -51,66 +50,50 @@ index bf1975fbd..c85563353 100644 wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", iface->bss[0]->conf->iface); if (iface->interfaces && iface->interfaces->terminate_on_error > 0) -@@ -2192,7 +2201,7 @@ int hostapd_setup_interface(struct hostapd_iface *iface) +@@ -2299,7 +2308,7 @@ int hostapd_setup_interface(struct hostapd_iface *iface) 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"); ++ iface->conf ? iface->conf->bss[0]->iface : "N/A"); return -1; } diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c -index 7354c1b79..4099cbe29 100644 +index 941c95cfd..1453bdc01 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -190,8 +190,9 @@ static int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s) +@@ -193,7 +193,6 @@ static int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s) + return !wpa_s->mesh_rsn ? -1 : 0; } - --static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) -+static void wpas_mesh_complete_cb(void *ctx) - { -+ struct wpa_supplicant *wpa_s = ctx; - struct hostapd_iface *ifmsh = wpa_s->ifmsh; - struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; - struct wpa_ssid *ssid = wpa_s->current_ssid; -@@ -200,7 +201,7 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) - if (!params || !ssid || !ifmsh) { - wpa_printf(MSG_ERROR, "mesh: %s called without active mesh", - __func__); -- return -1; -+ return; - } - - if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && -@@ -209,7 +210,7 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) - "mesh: RSN initialization failed - deinit mesh"); - wpa_supplicant_mesh_deinit(wpa_s); - wpa_drv_leave_mesh(wpa_s); -- return -1; -+ return; - } - - if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) { -@@ -235,8 +236,6 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) - - if (!ret) - wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); - -- return ret; + static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) + { + struct hostapd_iface *ifmsh = wpa_s->ifmsh; +@@ -244,6 +243,13 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) } -@@ -263,6 +262,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, ++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 +273,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, 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; - ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss, -@@ -280,6 +280,8 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, +@@ -285,6 +292,8 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, bss->drv_priv = wpa_s->drv_priv; bss->iface = ifmsh; bss->mesh_sta_free_cb = mesh_mpm_free_sta; @@ -119,7 +102,7 @@ index 7354c1b79..4099cbe29 100644 frequency = ssid->frequency; if (frequency != freq->freq && frequency == freq->freq + freq->sec_channel_offset * 20) { -@@ -521,7 +523,6 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, +@@ -523,7 +532,6 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, goto out; } diff --git a/recipes-connectivity/hostapd/files/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch b/recipes-connectivity/hostapd/files/009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch similarity index 81% rename from recipes-connectivity/hostapd/files/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch rename to recipes-connectivity/hostapd/files/009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch index 0e29f76..56c948b 100644 --- a/recipes-connectivity/hostapd/files/005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch +++ b/recipes-connectivity/hostapd/files/009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch @@ -1,6 +1,6 @@ -From ca681f3655d80bd3cc3a2876847992bd6c6ddf35 Mon Sep 17 00:00:00 2001 +From 9b1c3fe0c25e34cde263048705413b20e01c9cf0 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:41 -0700 +Date: Tue, 30 Jun 2020 14:18:57 +0200 Subject: [PATCH] mesh: update ssid->frequency as pri/sec channel switch ssid->frequency is one of variables used to gets channel @@ -16,10 +16,10 @@ Signed-off-by: Peter Oh 1 file changed, 1 insertion(+) diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c -index 4099cbe29..3cb2b2c38 100644 +index 1453bdc01..778541bc0 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -287,6 +287,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, +@@ -299,6 +299,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, frequency == freq->freq + freq->sec_channel_offset * 20) { wpa_printf(MSG_DEBUG, "mesh: pri/sec channels switched"); frequency = freq->freq; diff --git a/recipes-connectivity/hostapd/files/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch b/recipes-connectivity/hostapd/files/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch similarity index 74% rename from recipes-connectivity/hostapd/files/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch rename to recipes-connectivity/hostapd/files/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch index f6e72f0..77893b6 100644 --- a/recipes-connectivity/hostapd/files/011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch +++ b/recipes-connectivity/hostapd/files/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch @@ -1,6 +1,6 @@ -From 6d8777f93943b633580ce25b4ce46cab9f226e41 Mon Sep 17 00:00:00 2001 +From 5faeb01ac83cf6fcb7a335c0df1b6e04683c5d40 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:45 -0700 +Date: Tue, 30 Jun 2020 14:18:58 +0200 Subject: [PATCH] mesh: Allow DFS channels to be selected if dfs is enabled Note: DFS is assumed to be usable if a country code has been set @@ -9,23 +9,23 @@ Signed-off-by: Benjamin Berg Signed-off-by: Peter Oh --- - wpa_supplicant/wpa_supplicant.c | 24 ++++++++++++++++++------ - 1 file changed, 18 insertions(+), 6 deletions(-) + wpa_supplicant/wpa_supplicant.c | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c -index 911d79d17..578f274a9 100644 +index f5a4c360b..79273db5d 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2153,6 +2153,8 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, - struct hostapd_freq_params vht_freq; +@@ -2349,6 +2349,8 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, int chwidth, seg0, seg1; u32 vht_caps = 0; + int is_24ghz; + int dfs_enabled = wpa_s->conf->country[0] && -+ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); ++ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); freq->freq = ssid->frequency; -@@ -2232,8 +2234,11 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, +@@ -2436,8 +2438,11 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, return; /* Check primary channel flags */ @@ -38,7 +38,7 @@ index 911d79d17..578f274a9 100644 freq->channel = pri_chan->chan; -@@ -2264,8 +2269,11 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, +@@ -2470,8 +2475,11 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, return; /* Check secondary channel flags */ @@ -51,7 +51,7 @@ index 911d79d17..578f274a9 100644 if (ht40 == -1) { if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) -@@ -2356,8 +2364,11 @@ skip_ht40: +@@ -2564,8 +2572,11 @@ skip_ht40: return; /* Back to HT configuration if channel not usable */ @@ -64,7 +64,7 @@ index 911d79d17..578f274a9 100644 } chwidth = CHANWIDTH_80MHZ; -@@ -2377,10 +2388,11 @@ skip_ht40: +@@ -2585,10 +2596,12 @@ skip_ht40: if (!chan) continue; @@ -73,7 +73,8 @@ index 911d79d17..578f274a9 100644 - HOSTAPD_CHAN_RADAR)) + if (chan->flag & HOSTAPD_CHAN_DISABLED) continue; -+ if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) ++ if (chan->flag & (HOSTAPD_CHAN_RADAR | ++ HOSTAPD_CHAN_NO_IR)) + if (!dfs_enabled) + continue; diff --git a/recipes-connectivity/hostapd/files/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch b/recipes-connectivity/hostapd/files/011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch similarity index 63% rename from recipes-connectivity/hostapd/files/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch rename to recipes-connectivity/hostapd/files/011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch index 2ac7040..ce7871e 100644 --- a/recipes-connectivity/hostapd/files/015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch +++ b/recipes-connectivity/hostapd/files/011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch @@ -1,6 +1,6 @@ -From 548e8ebd050dfc96c43315c0b5ed82225ea9ebf4 Mon Sep 17 00:00:00 2001 +From 3e1edb5f0673e87eaa68a45678578046dde10f0f Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:46 -0700 +Date: Tue, 30 Jun 2020 14:18:59 +0200 Subject: [PATCH] mesh: do not set offchanok on DFS channels in non-ETSI mac80211 does not allow mgmt tx to use off channel on @@ -13,25 +13,26 @@ in non-ETSI. Signed-off-by: Peter Oh --- - src/drivers/driver_nl80211.c | 21 ++++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) + src/drivers/driver_nl80211.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c -index 6764ba9df..858cf599a 100644 +index 72189da24..6a612a4cb 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -7462,6 +7462,10 @@ static int wpa_driver_nl80211_send_action(struct i802_bss *bss, +@@ -7788,7 +7788,11 @@ static int wpa_driver_nl80211_send_action(struct i802_bss *bss, int ret = -1; u8 *buf; struct ieee80211_hdr *hdr; + struct hostapd_hw_modes *modes; -+ int i, offchanok = 1; + int offchanok = 1; + u16 num_modes, flags; + u8 dfs_domain; ++ int i; - wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, " - "freq=%u MHz wait=%d ms no_cck=%d)", -@@ -7486,6 +7490,21 @@ static int wpa_driver_nl80211_send_action(struct i802_bss *bss, + if (is_ap_interface(drv->nlmode) && (int) freq == bss->freq && + bss->beacon_set) +@@ -7817,6 +7821,21 @@ static int wpa_driver_nl80211_send_action(struct i802_bss *bss, os_memset(bss->rand_addr, 0, ETH_ALEN); } @@ -53,12 +54,3 @@ index 6764ba9df..858cf599a 100644 if (is_ap_interface(drv->nlmode) && (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || (int) freq == bss->freq || drv->device_ap_sme || -@@ -7497,7 +7516,7 @@ static int wpa_driver_nl80211_send_action(struct i802_bss *bss, - ret = nl80211_send_frame_cmd(bss, freq, wait_time, buf, - 24 + data_len, - &drv->send_action_cookie, -- no_cck, 0, 1, NULL, 0); -+ no_cck, 0, offchanok, NULL, 0); - - os_free(buf); - return ret; diff --git a/recipes-connectivity/hostapd/files/016-mesh-fix-channel-switch-error-during-CAC.patch b/recipes-connectivity/hostapd/files/012-mesh-fix-channel-switch-error-during-CAC.patch similarity index 73% rename from recipes-connectivity/hostapd/files/016-mesh-fix-channel-switch-error-during-CAC.patch rename to recipes-connectivity/hostapd/files/012-mesh-fix-channel-switch-error-during-CAC.patch index 571f922..fc783db 100644 --- a/recipes-connectivity/hostapd/files/016-mesh-fix-channel-switch-error-during-CAC.patch +++ b/recipes-connectivity/hostapd/files/012-mesh-fix-channel-switch-error-during-CAC.patch @@ -1,6 +1,6 @@ -From f3a877c8961ba1e8955fa0323fdc209d630563db Mon Sep 17 00:00:00 2001 +From 278b1ab4385b56609b1c5a811d3a570756fb2ca6 Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:47 -0700 +Date: Tue, 30 Jun 2020 14:19:00 +0200 Subject: [PATCH] mesh: fix channel switch error during CAC Mesh interface has used its channel parameters that configured @@ -12,11 +12,11 @@ when channel's been changed from initial one. Signed-off-by: Peter Oh --- - wpa_supplicant/mesh.c | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) + wpa_supplicant/mesh.c | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c -index f4b62a8fd..bfc7c7a39 100644 +index 778541bc0..15c285812 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -13,6 +13,7 @@ @@ -27,8 +27,8 @@ index f4b62a8fd..bfc7c7a39 100644 #include "ap/sta_info.h" #include "ap/hostapd.h" #include "ap/ieee802_11.h" -@@ -204,6 +205,32 @@ static void wpas_mesh_complete_cb(void *ctx) - return; +@@ -206,6 +207,39 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) + return -1; } + /* @@ -38,10 +38,17 @@ index f4b62a8fd..bfc7c7a39 100644 + if (ifmsh->freq != params->freq.freq) { + wpa_s->assoc_freq = ifmsh->freq; + ssid->frequency = ifmsh->freq; ++ 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, @@ -49,11 +56,11 @@ index f4b62a8fd..bfc7c7a39 100644 + 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->current_mode->vht_capab, -+ &ifmsh->current_mode->he_capab[IEEE80211_MODE_AP])) { ++ ifmsh->conf->vht_capab, ++ he_capab)) { + wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); + wpa_supplicant_mesh_deinit(wpa_s); -+ return; ++ return -1; + } + } + diff --git a/recipes-connectivity/hostapd/files/013-mesh-do-not-allow-pri-sec-channel-switch.patch b/recipes-connectivity/hostapd/files/013-mesh-do-not-allow-pri-sec-channel-switch.patch deleted file mode 100644 index 04169ad..0000000 --- a/recipes-connectivity/hostapd/files/013-mesh-do-not-allow-pri-sec-channel-switch.patch +++ /dev/null @@ -1,32 +0,0 @@ -From d9b002241024bcbfeb4d5adf413ff712bc0aa978 Mon Sep 17 00:00:00 2001 -From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:48 -0700 -Subject: [PATCH] mesh: don't allow pri/sec channel switch - -This limitation isn't backed by standard, but it is known that -mesh doesn't have capability to handle 20/40 coex change in -current implementation and it will not able to establish -PLINK when channel switch between primary and secondary happens. - -Since it's unknown when we will have the implementation of handling -20/40 coex change for mesh, it'd better to avoid them from happening -until standard based implementation is introduced. - -Signed-off-by: Peter Oh - ---- - wpa_supplicant/mesh.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c -index 98b041380..f4b62a8fd 100644 ---- a/wpa_supplicant/mesh.c -+++ b/wpa_supplicant/mesh.c -@@ -386,6 +386,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, - conf->basic_rates[rate_len] = -1; - } - -+ conf->no_pri_sec_switch = 1; - /* Handle pri/sec switch frequency within AP configuration parameter - * generation without changing the stored network profile in the end. */ - saved_freq = ssid->frequency; diff --git a/recipes-connectivity/hostapd/files/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch b/recipes-connectivity/hostapd/files/013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch similarity index 76% rename from recipes-connectivity/hostapd/files/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch rename to recipes-connectivity/hostapd/files/013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch index cf5fbb7..cf2d288 100644 --- a/recipes-connectivity/hostapd/files/006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch +++ b/recipes-connectivity/hostapd/files/013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch @@ -1,6 +1,6 @@ -From 8db674b0500f4e7daa2771fceac8fdff162ae0b6 Mon Sep 17 00:00:00 2001 +From b82a67a4ac91e8146ba10456e178a91c547becde Mon Sep 17 00:00:00 2001 From: Peter Oh -Date: Mon, 27 Aug 2018 14:28:49 -0700 +Date: Tue, 30 Jun 2020 14:19:01 +0200 Subject: [PATCH] mesh: inform kernel driver DFS handler in userspace NL80211_ATTR_HANDLE_DFS is required by kerenel space @@ -16,22 +16,22 @@ Signed-off-by: Peter Oh 3 files changed, 5 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h -index 2a8459ae3..3c92fb76c 100644 +index 350c1cb57..49a580077 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1477,6 +1477,7 @@ struct wpa_driver_mesh_join_params { +@@ -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; + u8 handle_dfs; }; - /** + struct wpa_driver_set_key_params { diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c -index 0a356eefd..6764ba9df 100644 +index 6a612a4cb..b218af226 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9624,6 +9624,9 @@ static int nl80211_join_mesh(struct i802_bss *bss, +@@ -10070,6 +10070,9 @@ static int nl80211_join_mesh(struct i802_bss *bss, wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags); @@ -42,10 +42,10 @@ index 0a356eefd..6764ba9df 100644 if (!container) goto fail; diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c -index 3cb2b2c38..36ff2df89 100644 +index 15c285812..c350e762b 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -309,6 +309,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, +@@ -355,6 +355,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, conf->country[0] = wpa_s->conf->country[0]; conf->country[1] = wpa_s->conf->country[1]; conf->country[2] = ' '; diff --git a/recipes-connectivity/hostapd/files/014-mesh-fixes-for-mesh-init-deinit.patch b/recipes-connectivity/hostapd/files/014-mesh-fixes-for-mesh-init-deinit.patch new file mode 100644 index 0000000..561d6e7 --- /dev/null +++ b/recipes-connectivity/hostapd/files/014-mesh-fixes-for-mesh-init-deinit.patch @@ -0,0 +1,165 @@ +From fc6bdc02c7db6fd409c099bdb18d919fb9e8248e Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:02 +0200 +Subject: [PATCH] mesh: fixes 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 + +--- + wpa_supplicant/mesh.c | 32 ++++++++++++++++++++------------ + wpa_supplicant/mesh.h | 6 ++++-- + wpa_supplicant/wpa_supplicant.c | 8 ++------ + 3 files changed, 26 insertions(+), 20 deletions(-) + +diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c +index c350e762b..5eb2a29d5 100644 +--- 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(struct wpa_supplicant *wpa_s, + } + + /* 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); ++ } + } + + +@@ -244,8 +246,7 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) + 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; + } + +@@ -270,9 +271,15 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) + /* 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; + } + +@@ -563,7 +570,7 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, + 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; + } +@@ -573,14 +580,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) +diff --git a/wpa_supplicant/mesh.h b/wpa_supplicant/mesh.h +index 7317083c9..a429e5e27 100644 +--- 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, +diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c +index 79273db5d..91ad7819b 100644 +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -2225,10 +2225,6 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, + 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(struct wpa_supplicant *wpa_s, + 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(struct wpa_supplicant *wpa_s, + + #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 */ diff --git a/recipes-connectivity/hostapd/files/015-mesh-fix-DFS-deinit-init.patch b/recipes-connectivity/hostapd/files/015-mesh-fix-DFS-deinit-init.patch new file mode 100644 index 0000000..90e3599 --- /dev/null +++ b/recipes-connectivity/hostapd/files/015-mesh-fix-DFS-deinit-init.patch @@ -0,0 +1,271 @@ +From d9d21373d053fa62d459a09e68ed66cfdc95c1a4 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:03 +0200 +Subject: [PATCH] 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 + +--- + src/ap/dfs.c | 2 +- + src/ap/hostapd.c | 17 ++++++++-- + src/ap/hostapd.h | 6 ++++ + wpa_supplicant/mesh.c | 90 ++++++++++++++++++++++++++++++++++++++++++++------- + 4 files changed, 100 insertions(+), 15 deletions(-) + +diff --git a/src/ap/dfs.c b/src/ap/dfs.c +index 2c914baa2..25dad3482 100644 +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -1112,7 +1112,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) + oper_centr_freq_seg0_idx, + oper_centr_freq_seg1_idx, + cmode->vht_capab, +- &cmode->he_capab[IEEE80211_MODE_AP]); ++ &cmode->he_capab[iface->conf->hw_mode]); + + if (err) { + wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params"); +diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c +index 04aebe31a..1579ae7fe 100644 +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -354,7 +354,7 @@ static int hostapd_broadcast_wep_set(struct hostapd_data *hapd) + #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 hostapd_iface *iface) + } + + +-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(struct hostapd_data *hapd, u16 reason) + } + + +-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,13 @@ int hostapd_enable_iface(struct hostapd_iface *hapd_iface) + { + size_t j; + ++ if (hapd_iface == NULL) ++ return -1; ++ ++ if (hapd_iface->enable_iface_cb != NULL) { ++ 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 +2758,10 @@ int hostapd_disable_iface(struct hostapd_iface *hapd_iface) + if (hapd_iface == NULL) + return -1; + ++ if (hapd_iface->disable_iface_cb != NULL) { ++ 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); +diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h +index b70d13fba..4ce31416d 100644 +--- 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(struct hostapd_iface *iface); + 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); +diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c +index 5eb2a29d5..81abc5c40 100644 +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -28,15 +28,20 @@ + #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); + } + +@@ -237,7 +242,7 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) + ifmsh->conf->vht_capab, + 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; + } + } +@@ -246,7 +251,7 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) + 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; + } + +@@ -291,6 +296,67 @@ static void wpas_mesh_complete_cb(void *arg) + } + + ++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; ++ int 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 ctrl-iface */ ++ 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) +@@ -318,6 +384,8 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, + 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) +@@ -451,7 +519,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, + + return 0; + out_free: +- wpa_supplicant_mesh_deinit(wpa_s); ++ wpa_supplicant_mesh_deinit(wpa_s, true); + return -ENOMEM; + } + +@@ -499,7 +567,7 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, + 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; +@@ -588,7 +656,7 @@ int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s, bool need_deinit) + + /* 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) diff --git a/recipes-connectivity/hostapd/files/016-tests-DFS-test-for-wpa_supplicant-mesh.patch b/recipes-connectivity/hostapd/files/016-tests-DFS-test-for-wpa_supplicant-mesh.patch new file mode 100644 index 0000000..ab18978 --- /dev/null +++ b/recipes-connectivity/hostapd/files/016-tests-DFS-test-for-wpa_supplicant-mesh.patch @@ -0,0 +1,97 @@ +From 2347a0e409fb37bfe301dbc4de2a4a49ff8a9bdc Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:04 +0200 +Subject: [PATCH] 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 + +--- + tests/hwsim/test_wpas_mesh.py | 56 +++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 54 insertions(+), 2 deletions(-) + +diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py +index bc07f5e25..0dcca03e0 100644 +--- 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_started=False, beacon_int=0): + 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]) diff --git a/recipes-connectivity/hostapd/files/017-mesh-fix-mesh_oom-test.patch b/recipes-connectivity/hostapd/files/017-mesh-fix-mesh_oom-test.patch new file mode 100644 index 0000000..485263f --- /dev/null +++ b/recipes-connectivity/hostapd/files/017-mesh-fix-mesh_oom-test.patch @@ -0,0 +1,27 @@ +From a12ca1d46960736e0a15bc1b07cdfef08aab4b9e Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:05 +0200 +Subject: [PATCH] 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 + +--- + wpa_supplicant/mesh.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c +index 81abc5c40..f98e6b883 100644 +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -218,7 +218,7 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) + * inspect if channel's been changed since initialized. + * i.e. DFS radar detection + */ +- if (ifmsh->freq != params->freq.freq) { ++ if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) { + wpa_s->assoc_freq = ifmsh->freq; + ssid->frequency = ifmsh->freq; + struct he_capabilities *he_capab = NULL; diff --git a/recipes-connectivity/hostapd/files/018-mesh-move-mesh-freq-setting-to-own-function.patch b/recipes-connectivity/hostapd/files/018-mesh-move-mesh-freq-setting-to-own-function.patch new file mode 100644 index 0000000..3f95d19 --- /dev/null +++ b/recipes-connectivity/hostapd/files/018-mesh-move-mesh-freq-setting-to-own-function.patch @@ -0,0 +1,96 @@ +From 2615253ba66cf55405b0a18f784d82f5993d71d0 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:06 +0200 +Subject: [PATCH] mesh: move mesh freq setting to own function + +Signed-off-by: Markus Theil + +--- + wpa_supplicant/mesh.c | 59 +++++++++++++++++++++++++++++++-------------------- + 1 file changed, 36 insertions(+), 23 deletions(-) + +diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c +index f98e6b883..f3788bf36 100644 +--- a/wpa_supplicant/mesh.c ++++ b/wpa_supplicant/mesh.c +@@ -201,6 +201,40 @@ static int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s) + return !wpa_s->mesh_rsn ? -1 : 0; + } + ++ ++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; +@@ -221,30 +255,8 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) + if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) { + wpa_s->assoc_freq = ifmsh->freq; + ssid->frequency = ifmsh->freq; +- 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); ++ if (wpas_mesh_update_freq_params(wpa_s) != 0) + return -1; +- } + } + + if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && +@@ -518,6 +530,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, + } + + return 0; ++ + out_free: + wpa_supplicant_mesh_deinit(wpa_s, true); + return -ENOMEM; diff --git a/recipes-connectivity/hostapd/files/019-mesh-use-deterministic-channel-on-channel-switch.patch b/recipes-connectivity/hostapd/files/019-mesh-use-deterministic-channel-on-channel-switch.patch new file mode 100644 index 0000000..f9eaf0e --- /dev/null +++ b/recipes-connectivity/hostapd/files/019-mesh-use-deterministic-channel-on-channel-switch.patch @@ -0,0 +1,86 @@ +From d3c3fd410b1821b8ffd6179e6937f79bb8212166 Mon Sep 17 00:00:00 2001 +From: Markus Theil +Date: Tue, 30 Jun 2020 14:19:07 +0200 +Subject: [PATCH] mesh: use deterministic channel on channel switch + +This patch uses a deterministic channel on DFS channel switch +in mesh networks. Otherwise, when switching to a usable but not +available channel, no CSA can be sent and a random channel is choosen +without notification of other nodes. It is then quite likely, that +the mesh network gets disconnected. + +Fix this by using a deterministic number, based on the sha256 hash +of the mesh ID, in order to use at least a different number in each +mesh network. + +Signed-off-by: Markus Theil + +--- + src/ap/dfs.c | 20 +++++++++++++++++++- + src/drivers/driver_nl80211.c | 4 ++++ + 2 files changed, 23 insertions(+), 1 deletion(-) + +diff --git a/src/ap/dfs.c b/src/ap/dfs.c +index 25dad3482..8f3630bf8 100644 +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -17,6 +17,7 @@ + #include "ap_drv_ops.h" + #include "drivers/driver.h" + #include "dfs.h" ++#include "crypto/crypto.h" + + + static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1) +@@ -480,9 +481,14 @@ dfs_get_valid_channel(struct hostapd_iface *iface, + int num_available_chandefs; + int chan_idx, chan_idx2; + int sec_chan_idx_80p80 = -1; ++ bool is_mesh = false; + int i; + u32 _rand; + ++#ifdef CONFIG_MESH ++ is_mesh = iface->mconf; ++#endif ++ + wpa_printf(MSG_DEBUG, "DFS: Selecting random channel"); + *secondary_channel = 0; + *oper_centr_freq_seg0_idx = 0; +@@ -502,8 +508,20 @@ dfs_get_valid_channel(struct hostapd_iface *iface, + if (num_available_chandefs == 0) + return NULL; + +- if (os_get_random((u8 *) &_rand, sizeof(_rand)) < 0) ++ /* try to use deterministic channel in mesh, so that both sides ++ * have a chance to switch to the same channel */ ++ if (is_mesh) { ++#ifdef CONFIG_MESH ++ u64 hash[4]; ++ const u8 *meshid[1] = { &iface->mconf->meshid[0] }; ++ const size_t meshid_len = iface->mconf->meshid_len; ++ ++ sha256_vector(1, meshid, &meshid_len, (u8 *)&hash[0]); ++ _rand = hash[0] + hash[1] + hash[2] + hash[3]; ++#endif ++ } else if (os_get_random((u8 *) &_rand, sizeof(_rand)) < 0) + return NULL; ++ + chan_idx = _rand % num_available_chandefs; + dfs_find_channel(iface, &chan, chan_idx, skip_radar); + if (!chan) { +diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c +index b218af226..3f691b21b 100644 +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -9473,6 +9473,10 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings) + if (ret) + goto error; + ++ if (drv->nlmode == NL80211_IFTYPE_MESH_POINT) { ++ nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS); ++ } ++ + /* beacon_csa params */ + beacon_csa = nla_nest_start(msg, NL80211_ATTR_CSA_IES); + if (!beacon_csa) diff --git a/recipes-connectivity/hostapd/files/020-ignore-4addr-mode-enabling-error.patch b/recipes-connectivity/hostapd/files/020-ignore-4addr-mode-enabling-error.patch new file mode 100644 index 0000000..925a17a --- /dev/null +++ b/recipes-connectivity/hostapd/files/020-ignore-4addr-mode-enabling-error.patch @@ -0,0 +1,76 @@ +From 925c078d8f80fb387fcd5f05661e407c1935b4a8 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 13 Feb 2021 23:59:28 +0200 +Subject: [PATCH] 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 + +--- + src/drivers/driver_nl80211.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c +index 3f691b21b..7101c9db6 100644 +--- 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_msg *msg, void *arg) + 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 i802_bss *bss) + } + + ++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) + { +@@ -11508,6 +11526,11 @@ static int nl80211_set_4addr_mode(void *priv, const char *bridge_ifname, + + 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) diff --git a/recipes-connectivity/hostapd/files/018-mesh-make-forwarding-configurable.patch b/recipes-connectivity/hostapd/files/050-mesh-make-forwarding-configurable.patch similarity index 84% rename from recipes-connectivity/hostapd/files/018-mesh-make-forwarding-configurable.patch rename to recipes-connectivity/hostapd/files/050-mesh-make-forwarding-configurable.patch index 304572c..e8053c5 100644 --- a/recipes-connectivity/hostapd/files/018-mesh-make-forwarding-configurable.patch +++ b/recipes-connectivity/hostapd/files/050-mesh-make-forwarding-configurable.patch @@ -1,4 +1,4 @@ -From f3e8469b1fdbf953191a90100d8da18355caf7cb Mon Sep 17 00:00:00 2001 +From ec4f65913d8e4f439660243a7cccaaf632ea3a79 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 18 Apr 2018 19:24:31 +0200 Subject: [PATCH] mesh: make forwarding configurable @@ -23,7 +23,7 @@ Signed-off-by: Daniel Golle 10 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h -index ea581a822..cfe59d4b4 100644 +index 4c2e60095..745689b7d 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -51,6 +51,7 @@ struct mesh_conf { @@ -34,7 +34,7 @@ index ea581a822..cfe59d4b4 100644 }; #define MAX_STA_COUNT 2007 -@@ -666,6 +667,7 @@ struct hostapd_bss_config { +@@ -701,6 +702,7 @@ struct hostapd_bss_config { #define MESH_ENABLED BIT(0) int mesh; @@ -43,10 +43,10 @@ index ea581a822..cfe59d4b4 100644 u8 radio_measurements[RRM_CAPABILITIES_IE_LEN]; diff --git a/src/drivers/driver.h b/src/drivers/driver.h -index 3c92fb76c..d73ff62c0 100644 +index 49a580077..f4186211d 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1450,6 +1450,7 @@ struct wpa_driver_mesh_bss_params { +@@ -1515,6 +1515,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 @@ -54,7 +54,7 @@ index 3c92fb76c..d73ff62c0 100644 /* * TODO: Other mesh configuration parameters would go here. * See NL80211_MESHCONF_* for all the mesh config parameters. -@@ -1459,6 +1460,7 @@ struct wpa_driver_mesh_bss_params { +@@ -1524,6 +1525,7 @@ struct wpa_driver_mesh_bss_params { int peer_link_timeout; int max_peer_links; int rssi_threshold; @@ -63,10 +63,10 @@ index 3c92fb76c..d73ff62c0 100644 }; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c -index 858cf599a..2930b01b4 100644 +index 7101c9db6..77db47ca7 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9592,6 +9592,9 @@ static int nl80211_put_mesh_config(struct nl_msg *msg, +@@ -10041,6 +10041,9 @@ static int nl80211_put_mesh_config(struct nl_msg *msg, if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, params->auto_plinks)) || @@ -77,10 +77,10 @@ index 858cf599a..2930b01b4 100644 nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, params->max_peer_links)) || diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c -index 7a62f96d6..07ed344e4 100644 +index 58c53cdb3..3a8ae8ef6 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2307,6 +2307,7 @@ static const struct parse_data ssid_fields[] = { +@@ -2473,6 +2473,7 @@ static const struct parse_data ssid_fields[] = { #ifdef CONFIG_MESH { INT_RANGE(mode, 0, 5) }, { INT_RANGE(no_auto_peer, 0, 1) }, @@ -88,7 +88,7 @@ index 7a62f96d6..07ed344e4 100644 { INT_RANGE(mesh_rssi_threshold, -255, 1) }, #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, -@@ -2869,6 +2870,7 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid) +@@ -3049,6 +3050,7 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid) ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; @@ -96,7 +96,7 @@ index 7a62f96d6..07ed344e4 100644 ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; #endif /* CONFIG_MESH */ #ifdef CONFIG_HT_OVERRIDES -@@ -4089,6 +4091,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface, +@@ -4276,6 +4278,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface, config->user_mpm = DEFAULT_USER_MPM; config->max_peer_links = DEFAULT_MAX_PEER_LINKS; config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; @@ -104,7 +104,7 @@ index 7a62f96d6..07ed344e4 100644 config->dot11RSNASAERetransPeriod = DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; config->fast_reauth = DEFAULT_FAST_REAUTH; -@@ -4726,6 +4729,7 @@ static const struct global_parse_data global_fields[] = { +@@ -4914,6 +4917,7 @@ static const struct global_parse_data global_fields[] = { { INT(user_mpm), 0 }, { INT_RANGE(max_peer_links, 0, 255), 0 }, { INT(mesh_max_inactivity), 0 }, @@ -113,7 +113,7 @@ index 7a62f96d6..07ed344e4 100644 #endif /* CONFIG_MESH */ { INT(disable_scan_offload), 0 }, diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h -index 6a297ecfe..11e3fc62a 100644 +index 2d4cb1b8f..596a63b4b 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -18,6 +18,7 @@ @@ -124,7 +124,7 @@ index 6a297ecfe..11e3fc62a 100644 /* * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, * but use 1000 ms in practice to avoid issues on low power CPUs. -@@ -1327,6 +1328,14 @@ struct wpa_config { +@@ -1351,6 +1352,14 @@ struct wpa_config { int mesh_max_inactivity; /** @@ -140,18 +140,18 @@ index 6a297ecfe..11e3fc62a 100644 * * This timeout value is used in mesh STA to retransmit diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c -index 77c326df5..7050a1ae6 100644 +index 1ca254813..ecebf508d 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c -@@ -829,6 +829,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) +@@ -866,6 +866,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) #endif /* IEEE8021X_EAPOL */ INT(mode); INT(no_auto_peer); + INT(mesh_fwding); INT(frequency); - INT(fixed_freq); - #ifdef CONFIG_ACS -@@ -1472,6 +1473,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) + INT(enable_edmg); + INT(edmg_channel); +@@ -1527,6 +1528,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) fprintf(f, "mesh_max_inactivity=%d\n", config->mesh_max_inactivity); @@ -162,10 +162,10 @@ index 77c326df5..7050a1ae6 100644 DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD) fprintf(f, "dot11RSNASAERetransPeriod=%d\n", diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h -index d5c5c00a9..a052390ad 100644 +index 2c08c0218..074576188 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -516,6 +516,11 @@ struct wpa_ssid { +@@ -546,6 +546,11 @@ struct wpa_ssid { int dot11MeshConfirmTimeout; /* msec */ int dot11MeshHoldingTimeout; /* msec */ @@ -178,10 +178,10 @@ index d5c5c00a9..a052390ad 100644 int ht40; diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c -index bfc7c7a39..fa39e60bb 100644 +index f3788bf36..278e4b585 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -126,6 +126,7 @@ static struct mesh_conf * mesh_config_create(struct wpa_supplicant *wpa_s, +@@ -137,6 +137,7 @@ static struct mesh_conf * mesh_config_create(struct wpa_supplicant *wpa_s, conf->mesh_cc_id = 0; conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; @@ -189,7 +189,7 @@ index bfc7c7a39..fa39e60bb 100644 conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries; conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout; conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout; -@@ -328,6 +329,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, +@@ -434,6 +435,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, bss->conf->start_disabled = 1; bss->conf->mesh = MESH_ENABLED; bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; @@ -197,7 +197,7 @@ index bfc7c7a39..fa39e60bb 100644 if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { -@@ -549,6 +551,10 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, +@@ -647,6 +649,10 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, } params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; @@ -209,10 +209,10 @@ index bfc7c7a39..fa39e60bb 100644 wpa_s->mesh_params = params; if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c -index 4a163b6eb..0b65b84a8 100644 +index ea62abf5b..b0bfc6ba8 100644 --- a/wpa_supplicant/mesh_mpm.c +++ b/wpa_supplicant/mesh_mpm.c -@@ -305,9 +305,9 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s, +@@ -303,9 +303,9 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s, info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1; /* TODO: Add Connected to Mesh Gate/AS subfields */ wpabuf_put_u8(buf, info); @@ -225,10 +225,10 @@ index 4a163b6eb..0b65b84a8 100644 /* IE: Mesh ID */ wpabuf_put_u8(buf, WLAN_EID_MESH_ID); diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf -index 1159bdcdc..6dc6ef89b 100644 +index 125083414..4326af74b 100644 --- a/wpa_supplicant/wpa_supplicant.conf +++ b/wpa_supplicant/wpa_supplicant.conf -@@ -153,6 +153,9 @@ ap_scan=1 +@@ -150,6 +150,9 @@ ap_scan=1 # This timeout value is used in mesh STA to clean up inactive stations. #mesh_max_inactivity=300 diff --git a/recipes-connectivity/hostapd/files/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch b/recipes-connectivity/hostapd/files/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch deleted file mode 100644 index 871b9a6..0000000 --- a/recipes-connectivity/hostapd/files/051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 72c752918b70221382c73a7b152b1515ac500543 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Tue, 12 Feb 2019 14:22:43 +0100 -Subject: [PATCH] wpa_supplicant: fix race condition in mesh mpm new peer - handling - -When wpa_supplicant receives another new peer event before the first one -has been processed, it tries to add a station to the driver a second time -(which fails) and then tears down the station entry until another event -comes in. -Fix this by only adding a station to the driver if it didn't exist already. - -Signed-off-by: Felix Fietkau - ---- - wpa_supplicant/mesh_mpm.c | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c -index 0b65b84a8..46144df09 100644 ---- a/wpa_supplicant/mesh_mpm.c -+++ b/wpa_supplicant/mesh_mpm.c -@@ -710,11 +710,12 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s, - } - - sta = ap_get_sta(data, addr); -- if (!sta) { -- sta = ap_sta_add(data, addr); -- if (!sta) -- return NULL; -- } -+ if (sta) -+ return NULL; -+ -+ sta = ap_sta_add(data, addr); -+ if (!sta) -+ return NULL; - - /* Set WMM by default since Mesh STAs are QoS STAs */ - sta->flags |= WLAN_STA_WMM; diff --git a/recipes-connectivity/hostapd/files/060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch b/recipes-connectivity/hostapd/files/060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch new file mode 100644 index 0000000..289431e --- /dev/null +++ b/recipes-connectivity/hostapd/files/060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch @@ -0,0 +1,48 @@ +From 4e71552d6cbd0109e8b21caf7ff5f807de5e5487 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +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 + +--- + src/p2p/p2p_pd.c | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c +index 3994ec03f..05fd59349 100644 +--- a/src/p2p/p2p_pd.c ++++ b/src/p2p/p2p_pd.c +@@ -595,14 +595,12 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa, + 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); diff --git a/recipes-connectivity/hostapd/files/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch b/recipes-connectivity/hostapd/files/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch deleted file mode 100644 index 96153de..0000000 --- a/recipes-connectivity/hostapd/files/067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 992ca79a51cc0f300a100795a124b8263fea7852 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Thu, 29 Aug 2019 11:52:04 +0300 -Subject: [PATCH] AP: Silently ignore management frame from unexpected source - address - -Do not process any received Management frames with unexpected/invalid SA -so that we do not add any state for unexpected STA addresses or end up -sending out frames to unexpected destination. This prevents unexpected -sequences where an unprotected frame might end up causing the AP to send -out a response to another device and that other device processing the -unexpected response. - -In particular, this prevents some potential denial of service cases -where the unexpected response frame from the AP might result in a -connected station dropping its association. - -Signed-off-by: Jouni Malinen - ---- - src/ap/drv_callbacks.c | 13 +++++++++++++ - src/ap/ieee802_11.c | 12 ++++++++++++ - 2 files changed, 25 insertions(+) - -diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c -index 31587685f..34ca379ed 100644 ---- a/src/ap/drv_callbacks.c -+++ b/src/ap/drv_callbacks.c -@@ -131,6 +131,19 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, - "hostapd_notif_assoc: Skip event with no address"); - return -1; - } -+ -+ if (is_multicast_ether_addr(addr) || -+ is_zero_ether_addr(addr) || -+ os_memcmp(addr, hapd->own_addr, ETH_ALEN) == 0) { -+ /* Do not process any frames with unexpected/invalid SA so that -+ * we do not add any state for unexpected STA addresses or end -+ * up sending out frames to unexpected destination. */ -+ wpa_printf(MSG_DEBUG, "%s: Invalid SA=" MACSTR -+ " in received indication - ignore this indication silently", -+ __func__, MAC2STR(addr)); -+ return 0; -+ } -+ - random_add_randomness(addr, ETH_ALEN); - - hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211, -diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c -index c85a28db4..e7065372e 100644 ---- a/src/ap/ieee802_11.c -+++ b/src/ap/ieee802_11.c -@@ -4626,6 +4626,18 @@ int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len, - fc = le_to_host16(mgmt->frame_control); - stype = WLAN_FC_GET_STYPE(fc); - -+ if (is_multicast_ether_addr(mgmt->sa) || -+ is_zero_ether_addr(mgmt->sa) || -+ os_memcmp(mgmt->sa, hapd->own_addr, ETH_ALEN) == 0) { -+ /* Do not process any frames with unexpected/invalid SA so that -+ * we do not add any state for unexpected STA addresses or end -+ * up sending out frames to unexpected destination. */ -+ wpa_printf(MSG_DEBUG, "MGMT: Invalid SA=" MACSTR -+ " in received frame - ignore this frame silently", -+ MAC2STR(mgmt->sa)); -+ return 0; -+ } -+ - if (stype == WLAN_FC_STYPE_BEACON) { - handle_beacon(hapd, mgmt, len, fi); - return 1; diff --git a/recipes-connectivity/hostapd/files/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch b/recipes-connectivity/hostapd/files/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch deleted file mode 100644 index 02c3809..0000000 --- a/recipes-connectivity/hostapd/files/070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 2e1c4caa71155fdf53ed8acb18d5b3e3cfd69660 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Thu, 23 Jan 2020 13:50:47 +0100 -Subject: [PATCH] driver_nl80211: fix WMM queue mapping for regulatory limit - -nl80211 uses a different queue mapping from hostap, so AC indexes need to -be converted. - -Signed-off-by: Felix Fietkau - ---- - src/drivers/driver_nl80211_capa.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c -index 8318b10ab..0d35b13b5 100644 ---- a/src/drivers/driver_nl80211_capa.c -+++ b/src/drivers/driver_nl80211_capa.c -@@ -1403,6 +1403,12 @@ static void phy_info_freq(struct hostapd_hw_modes *mode, - [NL80211_WMMR_AIFSN] = { .type = NLA_U8 }, - [NL80211_WMMR_TXOP] = { .type = NLA_U16 }, - }; -+ static const u8 wmm_map[4] = { -+ [NL80211_AC_BE] = WMM_AC_BE, -+ [NL80211_AC_BK] = WMM_AC_BK, -+ [NL80211_AC_VI] = WMM_AC_VI, -+ [NL80211_AC_VO] = WMM_AC_VO, -+ }; - struct nlattr *nl_wmm; - struct nlattr *tb_wmm[NL80211_WMMR_MAX + 1]; - int rem_wmm, ac, count = 0; -@@ -1424,12 +1430,13 @@ static void phy_info_freq(struct hostapd_hw_modes *mode, - return; - } - ac = nl_wmm->nla_type; -- if (ac < 0 || ac >= WMM_AC_NUM) { -+ if (ac >= ARRAY_SIZE(wmm_map)) { - wpa_printf(MSG_DEBUG, - "nl80211: Invalid AC value %d", ac); - return; - } - -+ ac = wmm_map[ac]; - chan->wmm_rules[ac].min_cwmin = - nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]); - chan->wmm_rules[ac].min_cwmax = diff --git a/recipes-connectivity/hostapd/files/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch b/recipes-connectivity/hostapd/files/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch deleted file mode 100644 index 11c7391..0000000 --- a/recipes-connectivity/hostapd/files/071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 55835a231c505b049b83977e8023eb8d7ea9d4e1 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Thu, 23 Jan 2020 14:10:20 +0100 -Subject: [PATCH] driver_nl80211: fix regulatory limits for wmm cwmin/cwmax - values - -The internal WMM AC parameters use just the exponent of the CW value, while -nl80211 reports the full CW value. -This led to completely bogus CWmin/CWmax values in the WMM IE when a regulatory -limit was present. Fix this by converting the value to the exponent before -passing it on - -Signed-off-by: Felix Fietkau - ---- - src/drivers/driver_nl80211_capa.c | 16 ++++++++++++++-- - 1 file changed, 14 insertions(+), 2 deletions(-) - -diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c -index 0d35b13b5..0defd6c7b 100644 ---- a/src/drivers/driver_nl80211_capa.c -+++ b/src/drivers/driver_nl80211_capa.c -@@ -1336,6 +1336,18 @@ static void phy_info_vht_capa(struct hostapd_hw_modes *mode, - } - } - -+static inline int cw2ecw(unsigned int cw) -+{ -+ int bit; -+ -+ if (cw == 0) -+ return 0; -+ -+ for (bit = 1; cw != 1; bit++) -+ cw >>= 1; -+ -+ return bit; -+} - - static void phy_info_freq(struct hostapd_hw_modes *mode, - struct hostapd_channel_data *chan, -@@ -1438,9 +1450,9 @@ static void phy_info_freq(struct hostapd_hw_modes *mode, - - ac = wmm_map[ac]; - chan->wmm_rules[ac].min_cwmin = -- nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN]); -+ cw2ecw(nla_get_u16(tb_wmm[NL80211_WMMR_CW_MIN])); - chan->wmm_rules[ac].min_cwmax = -- nla_get_u16(tb_wmm[NL80211_WMMR_CW_MAX]); -+ cw2ecw(nla_get_u16(tb_wmm[NL80211_WMMR_CW_MAX])); - chan->wmm_rules[ac].min_aifs = - nla_get_u8(tb_wmm[NL80211_WMMR_AIFSN]); - chan->wmm_rules[ac].max_txop = diff --git a/recipes-connectivity/hostapd/files/090-wolfssl-fix-crypto_bignum_sum.patch b/recipes-connectivity/hostapd/files/090-wolfssl-fix-crypto_bignum_sum.patch deleted file mode 100644 index 55816ff..0000000 --- a/recipes-connectivity/hostapd/files/090-wolfssl-fix-crypto_bignum_sum.patch +++ /dev/null @@ -1,29 +0,0 @@ -From de5ea86978634ecc7d936a170dd1d368fd4ed31b Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Mon, 14 Oct 2019 19:27:47 +0300 -Subject: [PATCH] wolfSSL: Fix crypto_bignum_sub() - -The initial crypto wrapper implementation for wolfSSL seems to have -included a copy-paste error in crypto_bignum_sub() implementation that -was identical to crypto_bignum_add() while mp_sub() should have been -used instead of mp_add(). - -Signed-off-by: Jouni Malinen - ---- - src/crypto/crypto_wolfssl.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/crypto/crypto_wolfssl.c b/src/crypto/crypto_wolfssl.c -index 4cedab436..960caf32a 100644 ---- a/src/crypto/crypto_wolfssl.c -+++ b/src/crypto/crypto_wolfssl.c -@@ -1151,7 +1151,7 @@ int crypto_bignum_sub(const struct crypto_bignum *a, - if (TEST_FAIL()) - return -1; - -- return mp_add((mp_int *) a, (mp_int *) b, -+ return mp_sub((mp_int *) a, (mp_int *) b, - (mp_int *) r) == MP_OKAY ? 0 : -1; - } - diff --git a/recipes-connectivity/hostapd/files/100-daemonize_fix.patch b/recipes-connectivity/hostapd/files/100-daemonize_fix.patch index 7ab6fee..e7864b6 100644 --- a/recipes-connectivity/hostapd/files/100-daemonize_fix.patch +++ b/recipes-connectivity/hostapd/files/100-daemonize_fix.patch @@ -1,13 +1,13 @@ -From 344ed019cfedec05e6fdb4b6059354b090155f6f Mon Sep 17 00:00:00 2001 +From 6f63b0f6359f63a733da2baac2b920337f3e7d78 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- src/utils/os_unix.c | 68 ++++++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c -index 800c50772..6231974cf 100644 +index 6f0c17756..1376416c3 100644 --- a/src/utils/os_unix.c +++ b/src/utils/os_unix.c @@ -10,6 +10,7 @@ @@ -18,7 +18,7 @@ index 800c50772..6231974cf 100644 #ifdef ANDROID #include -@@ -182,59 +183,46 @@ int os_gmtime(os_time_t t, struct os_tm *tm) +@@ -188,59 +189,46 @@ int os_gmtime(os_time_t t, struct os_tm *tm) return 0; } diff --git a/recipes-connectivity/hostapd/files/110-notify-mgmt-frames.patch b/recipes-connectivity/hostapd/files/110-notify-mgmt-frames.patch new file mode 100644 index 0000000..4639207 --- /dev/null +++ b/recipes-connectivity/hostapd/files/110-notify-mgmt-frames.patch @@ -0,0 +1,127 @@ +From de6a3ac0846f213f1aab60774d350808e71aa210 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +Date: Thu, 26 Nov 2020 09:27:40 +0100 +Subject: [PATCH] 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 'AP_MGMT_FRAME_RECEIVED'. + +Note that to avoid completely flooding the ctrl_iface, not all +management frames are included (e.g. beacons are excluded). + +Signed-off-by: Raphaël Mélotte + +--- + hostapd/config_file.c | 2 ++ + hostapd/hostapd.conf | 4 ++++ + src/ap/ap_config.h | 2 ++ + src/ap/ieee802_11.c | 25 +++++++++++++++++++++++++ + src/common/wpa_ctrl.h | 3 +++ + 5 files changed, 36 insertions(+) + +diff --git a/hostapd/config_file.c b/hostapd/config_file.c +index dac0e8054..42d01825c 100644 +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -4456,6 +4456,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, + 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) { ++ conf->notify_mgmt_frames = atoi(pos); + #ifdef CONFIG_DPP + } else if (os_strcmp(buf, "dpp_name") == 0) { + os_free(bss->dpp_name); +diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf +index 2b0f762e5..e31885545 100644 +--- 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 management frames: ++# Default: 0 (disabled) ++#notify_mgmt_frames=0 ++ + ##### IEEE 802.11n related configuration ###################################### + + # ieee80211n: Whether IEEE 802.11n (HT) is enabled +diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h +index 745689b7d..5dc6caf24 100644 +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -1060,6 +1060,8 @@ struct hostapd_config { + unsigned int airtime_update_interval; + #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1) + #endif /* CONFIG_AIRTIME_POLICY */ ++ ++ u8 notify_mgmt_frames; + }; + + +diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c +index 8b994d6a5..7346c6f0c 100644 +--- a/src/ap/ieee802_11.c ++++ b/src/ap/ieee802_11.c +@@ -4878,6 +4878,28 @@ static int handle_action(struct hostapd_data *hapd, + return 1; + } + ++/** ++ * 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 IEEE 802.11 header) ++ * @len: length of frame data in octets ++ * ++ * Notify the control interface of any 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 +@@ -4969,6 +4991,9 @@ int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len, + if (hapd->iconf->track_sta_max_num) + sta_track_add(hapd->iface, mgmt->sa, ssi_signal); + ++ if (hapd->iconf->notify_mgmt_frames) ++ notify_mgmt_frame(hapd, buf, len); ++ + switch (stype) { + case WLAN_FC_STYPE_AUTH: + wpa_printf(MSG_DEBUG, "mgmt::auth"); +diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h +index 488e4addc..3cdacc72d 100644 +--- a/src/common/wpa_ctrl.h ++++ b/src/common/wpa_ctrl.h +@@ -396,6 +396,9 @@ extern "C" { + #define BIT(x) (1U << (x)) + #endif + ++/* Event triggered for received management frame */ ++#define AP_MGMT_FRAME_RECEIVED "AP-MGMT-FRAME-RECEIVED " ++ + /* BSS command information masks */ + + #define WPA_BSS_MASK_ALL 0xFFFDFFFF diff --git a/recipes-connectivity/hostapd/files/110-wolfssl-compile-fix.patch b/recipes-connectivity/hostapd/files/110-wolfssl-compile-fix.patch new file mode 100644 index 0000000..efebefd --- /dev/null +++ b/recipes-connectivity/hostapd/files/110-wolfssl-compile-fix.patch @@ -0,0 +1,20 @@ +From 345b72c78078996f326c0a5b2a96c5d14b18945b Mon Sep 17 00:00:00 2001 +From: OpenEmbedded +Date: Tue, 23 Mar 2021 15:10:37 +0000 + +--- + src/crypto/tls_wolfssl.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/crypto/tls_wolfssl.c b/src/crypto/tls_wolfssl.c +index 11e658220..bd0f4a5ac 100644 +--- a/src/crypto/tls_wolfssl.c ++++ b/src/crypto/tls_wolfssl.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #if defined(EAP_FAST) || defined(EAP_FAST_DYNAMIC) || defined(EAP_SERVER_FAST) + #define HAVE_AESGCM diff --git a/recipes-connectivity/hostapd/files/120-reconfigure-wps-credentials.patch b/recipes-connectivity/hostapd/files/120-reconfigure-wps-credentials.patch new file mode 100644 index 0000000..1572c13 --- /dev/null +++ b/recipes-connectivity/hostapd/files/120-reconfigure-wps-credentials.patch @@ -0,0 +1,185 @@ +From 54f01438360f2fe735801eefa4519461b63aefd3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +Date: Wed, 9 Dec 2020 19:55:53 +0100 +Subject: [PATCH] wps: reconfigure credentials on 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 + +--- + src/ap/wps_hostapd.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++-- + src/wps/wps.h | 6 ++++ + src/wps/wps_registrar.c | 29 +++++++++++++++++ + 3 files changed, 118 insertions(+), 3 deletions(-) + +diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c +index dc8aa8f65..ff942a67b 100644 +--- a/src/ap/wps_hostapd.c ++++ b/src/ap/wps_hostapd.c +@@ -1375,6 +1375,43 @@ static void hostapd_wps_nfc_clear(struct wps_context *wps) + #endif /* CONFIG_WPS_NFC */ + } + ++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 = -1; ++ ++ if ((conf->multi_ap & FRONTHAUL_BSS) && ++ conf->multi_ap_backhaul_ssid.ssid_len) { ++ 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 == NULL) ++ 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 == NULL) ++ 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) + { +@@ -1409,11 +1446,54 @@ void hostapd_update_wps(struct hostapd_data *hapd) + hapd->wps->upc = hapd->conf->upc; + #endif /* CONFIG_WPS_UPNP */ + +- hostapd_wps_set_vendor_ext(hapd, hapd->wps); +- hostapd_wps_set_application_ext(hapd, hapd->wps); ++ struct wps_context *wps = hapd->wps; ++ struct hostapd_bss_config *conf = hapd->conf; ++ ++ 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 == NULL) ++ 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 == NULL) ++ 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 == NULL) ++ 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); + + if (hapd->conf->wps_state) +- wps_registrar_update_ie(hapd->wps->registrar); ++ wps_registrar_update_ie(wps->registrar); + else + hostapd_deinit_wps(hapd); + } +diff --git a/src/wps/wps.h b/src/wps/wps.h +index 93888b011..110e3ea52 100644 +--- a/src/wps/wps.h ++++ b/src/wps/wps.h +@@ -938,6 +938,12 @@ struct wpabuf * wps_build_nfc_handover_sel_p2p(struct wps_context *ctx, + struct wpabuf *nfc_dh_pubkey, + struct wpabuf *nfc_dev_pw); + ++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); ++ + /* ndef.c */ + struct wpabuf * ndef_parse_wifi(const struct wpabuf *buf); + struct wpabuf * ndef_build_wifi(const struct wpabuf *buf); +diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c +index 9e1ee36da..d6b27be28 100644 +--- a/src/wps/wps_registrar.c ++++ b/src/wps/wps_registrar.c +@@ -3669,6 +3669,35 @@ int wps_registrar_config_ap(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) ++{ ++ if (multi_ap_backhaul_ssid != NULL) { ++ 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 != NULL) { ++ 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 == NULL) ++ 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, diff --git a/recipes-connectivity/hostapd/files/200-multicall.patch b/recipes-connectivity/hostapd/files/200-multicall.patch index 4137ab9..80f2e2d 100644 --- a/recipes-connectivity/hostapd/files/200-multicall.patch +++ b/recipes-connectivity/hostapd/files/200-multicall.patch @@ -1,6 +1,6 @@ -From 424e215228221cd61f574b4b40cb77e0666d9d37 Mon Sep 17 00:00:00 2001 +From 2ed1d7803b1be7691153a0a0710655eeb307ed75 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/Makefile | 26 ++++++++++++++++++++++---- @@ -16,10 +16,10 @@ Date: Tue, 28 Jan 2020 15:14:35 +0100 10 files changed, 94 insertions(+), 17 deletions(-) diff --git a/hostapd/Makefile b/hostapd/Makefile -index 2a6bd7ac8..da8f9bc9b 100644 +index 1400002a9..dae9cd119 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils) +@@ -31,6 +31,7 @@ CFLAGS += -I$(abspath ../src/utils) export BINDIR ?= /usr/local/bin/ -include .config @@ -27,7 +27,7 @@ index 2a6bd7ac8..da8f9bc9b 100644 ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository -@@ -198,7 +199,8 @@ endif +@@ -204,7 +205,8 @@ endif ifdef CONFIG_NO_VLAN CFLAGS += -DCONFIG_NO_VLAN @@ -37,7 +37,7 @@ index 2a6bd7ac8..da8f9bc9b 100644 OBJS += ../src/ap/vlan_init.o OBJS += ../src/ap/vlan_ifconfig.o OBJS += ../src/ap/vlan.o -@@ -366,10 +368,14 @@ CFLAGS += -DCONFIG_MBO +@@ -354,10 +356,14 @@ CFLAGS += -DCONFIG_MBO OBJS += ../src/ap/mbo_ap.o endif @@ -55,7 +55,7 @@ index 2a6bd7ac8..da8f9bc9b 100644 LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -1316,6 +1322,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)/,$(ALL)) +@@ -1311,6 +1317,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)/,$(ALL)) BCHECK=../src/drivers/build.hostapd @@ -68,9 +68,9 @@ index 2a6bd7ac8..da8f9bc9b 100644 hostapd: $(BCHECK) $(OBJS) $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) @$(E) " LD " $@ -@@ -1358,6 +1370,12 @@ ifeq ($(CONFIG_TLS), linux) - HOBJS += ../src/crypto/crypto_linux.o - endif +@@ -1374,6 +1386,12 @@ SOBJS += ../src/crypto/sha256-kdf.o + SOBJS += ../src/crypto/sha384-kdf.o + SOBJS += ../src/crypto/sha512-kdf.o +dump_cflags: + @printf "%s " "$(CFLAGS)" @@ -82,10 +82,10 @@ index 2a6bd7ac8..da8f9bc9b 100644 $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n) @$(E) " LD " $@ diff --git a/hostapd/main.c b/hostapd/main.c -index 08896ffe2..90424d5bd 100644 +index 353b20a80..2bebdfe86 100644 --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -592,6 +592,11 @@ fail: +@@ -590,6 +590,11 @@ fail: return -1; } @@ -97,7 +97,7 @@ index 08896ffe2..90424d5bd 100644 #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -682,6 +687,8 @@ int main(int argc, char *argv[]) +@@ -684,6 +689,8 @@ int main(int argc, char *argv[]) return -1; #endif /* CONFIG_DPP */ @@ -107,10 +107,10 @@ index 08896ffe2..90424d5bd 100644 c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:"); if (c < 0) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c -index 34ca379ed..366cfc08a 100644 +index 36678e7a3..52ac8f5a0 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -1669,8 +1669,8 @@ err: +@@ -1789,8 +1789,8 @@ err: #endif /* CONFIG_OWE */ @@ -121,7 +121,7 @@ index 34ca379ed..366cfc08a 100644 { struct hostapd_data *hapd = ctx; #ifndef CONFIG_NO_STDOUT_DEBUG -@@ -1915,7 +1915,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, +@@ -2035,7 +2035,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, } @@ -131,10 +131,10 @@ index 34ca379ed..366cfc08a 100644 { struct hapd_interfaces *interfaces = ctx; diff --git a/src/drivers/driver.h b/src/drivers/driver.h -index d73ff62c0..f35e3fdad 100644 +index f4186211d..9f5ded44e 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5657,8 +5657,8 @@ union wpa_event_data { +@@ -5886,8 +5886,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -145,7 +145,7 @@ index d73ff62c0..f35e3fdad 100644 /** * wpa_supplicant_event_global - Report a driver event for wpa_supplicant -@@ -5670,7 +5670,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, +@@ -5899,7 +5899,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, * Same as wpa_supplicant_event(), but we search for the interface in * wpa_global. */ @@ -170,7 +170,7 @@ index e95df6ddb..9071da3cf 100644 const struct wpa_driver_ops *const wpa_drivers[] = { diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile -index f1384d5fa..3d05870bd 100644 +index 09ac7a493..d5caf23a3 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src) @@ -181,7 +181,7 @@ index f1384d5fa..3d05870bd 100644 ifndef CONFIG_NO_GITVER # Add VERSION_STR postfix for builds from a git repository -@@ -363,7 +364,9 @@ endif +@@ -369,7 +370,9 @@ endif ifdef CONFIG_IBSS_RSN NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_IBSS_RSN @@ -191,7 +191,7 @@ index f1384d5fa..3d05870bd 100644 OBJS += ibss_rsn.o endif -@@ -892,6 +895,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS +@@ -890,6 +893,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS LIBS += -ldl -rdynamic endif @@ -202,7 +202,7 @@ index f1384d5fa..3d05870bd 100644 endif ifdef CONFIG_AP -@@ -899,9 +906,11 @@ NEED_EAP_COMMON=y +@@ -897,9 +904,11 @@ NEED_EAP_COMMON=y NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_AP OBJS += ap.o @@ -214,7 +214,7 @@ index f1384d5fa..3d05870bd 100644 OBJS += ../src/ap/hostapd.o OBJS += ../src/ap/wpa_auth_glue.o OBJS += ../src/ap/utils.o -@@ -983,6 +992,12 @@ endif +@@ -979,6 +988,12 @@ endif ifdef CONFIG_HS20 OBJS += ../src/ap/hs20.o endif @@ -227,7 +227,7 @@ index f1384d5fa..3d05870bd 100644 endif ifdef CONFIG_MBO -@@ -991,7 +1006,9 @@ CFLAGS += -DCONFIG_MBO +@@ -987,7 +1002,9 @@ CFLAGS += -DCONFIG_MBO endif ifdef NEED_RSN_AUTHENTICATOR @@ -237,7 +237,7 @@ index f1384d5fa..3d05870bd 100644 NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -1899,6 +1916,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -1897,6 +1914,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config @@ -250,7 +250,7 @@ index f1384d5fa..3d05870bd 100644 wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -1999,6 +2022,12 @@ endif +@@ -1997,6 +2020,12 @@ endif $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ @$(E) " sed" $< @@ -264,7 +264,7 @@ index f1384d5fa..3d05870bd 100644 mv -f $< $@ wpa_cli.exe: wpa_cli diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c -index 524724f19..fe18dfd73 100644 +index 9f69736b7..0284cbf61 100644 --- a/wpa_supplicant/eapol_test.c +++ b/wpa_supplicant/eapol_test.c @@ -30,7 +30,12 @@ @@ -301,10 +301,10 @@ index 524724f19..fe18dfd73 100644 os_memset(&eapol_test, 0, sizeof(eapol_test)); diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c -index 87dad0811..067f76b48 100644 +index 86eef1b81..af91bae4e 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4184,8 +4184,8 @@ static void wpas_event_assoc_reject(struct wpa_supplicant *wpa_s, +@@ -4579,8 +4579,8 @@ static void wpas_event_unprot_beacon(struct wpa_supplicant *wpa_s, } @@ -315,7 +315,7 @@ index 87dad0811..067f76b48 100644 { struct wpa_supplicant *wpa_s = ctx; int resched; -@@ -4967,7 +4967,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, +@@ -5398,7 +5398,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, } @@ -325,10 +325,10 @@ index 87dad0811..067f76b48 100644 { struct wpa_supplicant *wpa_s; diff --git a/wpa_supplicant/wpa_priv.c b/wpa_supplicant/wpa_priv.c -index b3ad45eca..55630a5c7 100644 +index c5d716869..63fc87332 100644 --- a/wpa_supplicant/wpa_priv.c +++ b/wpa_supplicant/wpa_priv.c -@@ -1031,8 +1031,8 @@ static void wpa_priv_send_ft_response(struct wpa_priv_interface *iface, +@@ -1038,8 +1038,8 @@ static void wpa_priv_send_ft_response(struct wpa_priv_interface *iface, } @@ -339,7 +339,7 @@ index b3ad45eca..55630a5c7 100644 { struct wpa_priv_interface *iface = ctx; -@@ -1095,7 +1095,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, +@@ -1102,7 +1102,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, } @@ -348,7 +348,7 @@ index b3ad45eca..55630a5c7 100644 union wpa_event_data *data) { struct wpa_priv_global *global = ctx; -@@ -1207,6 +1207,8 @@ int main(int argc, char *argv[]) +@@ -1215,6 +1215,8 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; @@ -358,10 +358,10 @@ index b3ad45eca..55630a5c7 100644 os_memset(&global, 0, sizeof(global)); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c -index 578f274a9..4f95917c6 100644 +index 91ad7819b..a470b62e4 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -6096,7 +6096,6 @@ struct wpa_interface * wpa_supplicant_match_iface(struct wpa_global *global, +@@ -6594,7 +6594,6 @@ struct wpa_interface * wpa_supplicant_match_iface(struct wpa_global *global, return NULL; } @@ -369,7 +369,7 @@ index 578f274a9..4f95917c6 100644 /** * wpa_supplicant_match_existing - Match existing interfaces * @global: Pointer to global data from wpa_supplicant_init() -@@ -6133,6 +6132,11 @@ static int wpa_supplicant_match_existing(struct wpa_global *global) +@@ -6631,6 +6630,11 @@ static int wpa_supplicant_match_existing(struct wpa_global *global) #endif /* CONFIG_MATCH_IFACE */ @@ -381,7 +381,7 @@ index 578f274a9..4f95917c6 100644 /** * wpa_supplicant_add_iface - Add a new network interface -@@ -6389,6 +6393,8 @@ struct wpa_global * wpa_supplicant_init(struct wpa_params *params) +@@ -6887,6 +6891,8 @@ struct wpa_global * wpa_supplicant_init(struct wpa_params *params) #ifndef CONFIG_NO_WPA_MSG wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ diff --git a/recipes-connectivity/hostapd/files/300-noscan.patch b/recipes-connectivity/hostapd/files/300-noscan.patch index d46c781..a979fd4 100644 --- a/recipes-connectivity/hostapd/files/300-noscan.patch +++ b/recipes-connectivity/hostapd/files/300-noscan.patch @@ -1,6 +1,6 @@ -From e8bf6ea2fbcbcff612b6adf93cb5fcdf86f0c4a0 Mon Sep 17 00:00:00 2001 +From 45937c19978783a74fc629465ff710a2821413bd Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/config_file.c | 4 ++++ @@ -10,13 +10,13 @@ Date: Tue, 28 Jan 2020 15:14:35 +0100 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hostapd/config_file.c b/hostapd/config_file.c -index e09e6e141..625104831 100644 +index 42d01825c..ce0c62152 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3411,6 +3411,10 @@ static int hostapd_config_fill(struct hostapd_config *conf, +@@ -3493,6 +3493,10 @@ static int hostapd_config_fill(struct hostapd_config *conf, + if (bss->ocv && !bss->ieee80211w) bss->ieee80211w = 1; #endif /* CONFIG_OCV */ - #ifdef CONFIG_IEEE80211N + } else if (os_strcmp(buf, "noscan") == 0) { + conf->noscan = atoi(pos); + } else if (os_strcmp(buf, "ht_coex") == 0) { @@ -25,10 +25,10 @@ index e09e6e141..625104831 100644 conf->ieee80211n = atoi(pos); } else if (os_strcmp(buf, "ht_capab") == 0) { diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h -index cfe59d4b4..826030666 100644 +index 5dc6caf24..319e8c108 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -934,6 +934,8 @@ struct hostapd_config { +@@ -984,6 +984,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; @@ -38,10 +38,10 @@ index cfe59d4b4..826030666 100644 int secondary_channel; int no_pri_sec_switch; diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c -index c1f19e26b..993f0d035 100644 +index f6e69030d..63bd11db3 100644 --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c -@@ -477,7 +477,8 @@ static int ieee80211n_check_40mhz(struct hostapd_iface *iface) +@@ -500,7 +500,8 @@ static int ieee80211n_check_40mhz(struct hostapd_iface *iface) int ret; /* Check that HT40 is used and PRI / SEC switch is allowed */ @@ -52,10 +52,10 @@ index c1f19e26b..993f0d035 100644 hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c -index 214855dcc..3697ca331 100644 +index 59ecbdce7..ebe2e5acd 100644 --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -252,6 +252,9 @@ void hostapd_2040_coex_action(struct hostapd_data *hapd, +@@ -230,6 +230,9 @@ void hostapd_2040_coex_action(struct hostapd_data *hapd, return; } @@ -65,7 +65,7 @@ index 214855dcc..3697ca331 100644 if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) { wpa_printf(MSG_DEBUG, "Ignore too short 20/40 BSS Coexistence Management frame"); -@@ -412,6 +415,9 @@ void ht40_intolerant_add(struct hostapd_iface *iface, struct sta_info *sta) +@@ -390,6 +393,9 @@ void ht40_intolerant_add(struct hostapd_iface *iface, struct sta_info *sta) if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) return; diff --git a/recipes-connectivity/hostapd/files/301-mesh-noscan.patch b/recipes-connectivity/hostapd/files/301-mesh-noscan.patch index 08f89f2..0fe6d48 100644 --- a/recipes-connectivity/hostapd/files/301-mesh-noscan.patch +++ b/recipes-connectivity/hostapd/files/301-mesh-noscan.patch @@ -1,6 +1,6 @@ -From e22b3c8a6ed6f4dec3700fd5bb6b719888d91d91 Mon Sep 17 00:00:00 2001 +From 59042778abdb2eddffbf69268efb2dbef8f78f74 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- wpa_supplicant/config.c | 1 + @@ -11,10 +11,10 @@ Date: Tue, 28 Jan 2020 15:14:35 +0100 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c -index 07ed344e4..eaabaa88d 100644 +index 3a8ae8ef6..61a5e1c60 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -2312,6 +2312,7 @@ static const struct parse_data ssid_fields[] = { +@@ -2478,6 +2478,7 @@ static const struct parse_data ssid_fields[] = { #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, #endif /* CONFIG_MESH */ @@ -23,22 +23,22 @@ index 07ed344e4..eaabaa88d 100644 { INT_RANGE(disabled, 0, 2) }, { STR(id_str) }, diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c -index 7050a1ae6..f4a397fe3 100644 +index ecebf508d..c271cea9f 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c -@@ -829,6 +829,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) +@@ -866,6 +866,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) #endif /* IEEE8021X_EAPOL */ INT(mode); INT(no_auto_peer); + INT(noscan); INT(mesh_fwding); INT(frequency); - INT(fixed_freq); + INT(enable_edmg); diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h -index a052390ad..401c22cec 100644 +index 074576188..2e205c08a 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -918,6 +918,8 @@ struct wpa_ssid { +@@ -971,6 +971,8 @@ struct wpa_ssid { */ int no_auto_peer; @@ -48,23 +48,23 @@ index a052390ad..401c22cec 100644 * mesh_rssi_threshold - Set mesh parameter mesh_rssi_threshold (dBm) * diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c -index fa39e60bb..6f54ff764 100644 +index 278e4b585..e46435c66 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -361,6 +361,8 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, +@@ -467,6 +467,8 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, frequency); goto out_free; } + if (ssid->noscan) + conf->noscan = 1; - if (ssid->ht40) - conf->secondary_channel = ssid->ht40; - if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) { + + if (ssid->mesh_basic_rates == NULL) { + /* diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c -index 4f95917c6..70161d272 100644 +index a470b62e4..b5b7e2874 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2143,12 +2143,12 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, +@@ -2334,12 +2334,12 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, int ieee80211_mode = wpas_mode_to_ieee80211_mode(ssid->mode); enum hostapd_hw_mode hw_mode; struct hostapd_hw_modes *mode = NULL; @@ -79,8 +79,8 @@ index 4f95917c6..70161d272 100644 unsigned int j, k; struct hostapd_freq_params vht_freq; int chwidth, seg0, seg1; -@@ -2221,7 +2221,7 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, - return; +@@ -2421,7 +2421,7 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, + #endif /* CONFIG_HE_OVERRIDES */ /* Setup higher BW only for 5 GHz */ - if (mode->mode != HOSTAPD_MODE_IEEE80211A) diff --git a/recipes-connectivity/hostapd/files/310-rescan_immediately.patch b/recipes-connectivity/hostapd/files/310-rescan_immediately.patch index c5e3071..1aca3ca 100644 --- a/recipes-connectivity/hostapd/files/310-rescan_immediately.patch +++ b/recipes-connectivity/hostapd/files/310-rescan_immediately.patch @@ -1,16 +1,16 @@ -From 9836c7637ca362ab893b3f5f12ec123daf36ef37 Mon Sep 17 00:00:00 2001 +From 62c26c79f50999302fbbd39118451d69bd482a7c Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- wpa_supplicant/wpa_supplicant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c -index 70161d272..92ddbe458 100644 +index b5b7e2874..d0f730ab4 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -4474,7 +4474,7 @@ wpa_supplicant_alloc(struct wpa_supplicant *parent) +@@ -4949,7 +4949,7 @@ wpa_supplicant_alloc(struct wpa_supplicant *parent) if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/recipes-connectivity/hostapd/files/320-optional_rfkill.patch b/recipes-connectivity/hostapd/files/320-optional_rfkill.patch index ced574a..d39fc57 100644 --- a/recipes-connectivity/hostapd/files/320-optional_rfkill.patch +++ b/recipes-connectivity/hostapd/files/320-optional_rfkill.patch @@ -1,6 +1,6 @@ -From c029de2c61fbc74f39362bdcfe46bf39cde33b17 Mon Sep 17 00:00:00 2001 +From 605b686b4a4eb2b091c79b8e0290f2899cc0cebd Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- src/drivers/drivers.mak | 4 +--- @@ -8,7 +8,7 @@ Date: Tue, 28 Jan 2020 15:14:35 +0100 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/drivers/drivers.mak b/src/drivers/drivers.mak -index 442c59cf4..da17ccc51 100644 +index 55a98ef86..3900f04b9 100644 --- a/src/drivers/drivers.mak +++ b/src/drivers/drivers.mak @@ -50,7 +50,6 @@ NEED_SME=y @@ -35,7 +35,7 @@ index 442c59cf4..da17ccc51 100644 endif ifdef NEED_NETLINK -@@ -146,6 +143,7 @@ endif +@@ -142,6 +139,7 @@ endif ifdef NEED_RFKILL DRV_OBJS += ../src/drivers/rfkill.o diff --git a/recipes-connectivity/hostapd/files/330-nl80211_fix_set_freq.patch b/recipes-connectivity/hostapd/files/330-nl80211_fix_set_freq.patch index 2813fe8..44ffc55 100644 --- a/recipes-connectivity/hostapd/files/330-nl80211_fix_set_freq.patch +++ b/recipes-connectivity/hostapd/files/330-nl80211_fix_set_freq.patch @@ -1,16 +1,16 @@ -From ea5e8082aadcdbf23397cdb3dbd1b1f8aeff78d2 Mon Sep 17 00:00:00 2001 +From 3234ba3f7b82868de03131e61363b21b6152c8d8 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- src/drivers/driver_nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c -index 2930b01b4..d0f79ca4b 100644 +index 77db47ca7..6255d7956 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4431,7 +4431,7 @@ static int nl80211_set_channel(struct i802_bss *bss, +@@ -4664,7 +4664,7 @@ static int nl80211_set_channel(struct i802_bss *bss, freq->freq, freq->ht_enabled, freq->vht_enabled, freq->he_enabled, freq->bandwidth, freq->center_freq1, freq->center_freq2); diff --git a/recipes-connectivity/hostapd/files/340-reload_freq_change.patch b/recipes-connectivity/hostapd/files/340-reload_freq_change.patch index 6e33d1d..152c8ff 100644 --- a/recipes-connectivity/hostapd/files/340-reload_freq_change.patch +++ b/recipes-connectivity/hostapd/files/340-reload_freq_change.patch @@ -1,22 +1,24 @@ -From ad010c95defeaded858c4d37004911a7cb31f199 Mon Sep 17 00:00:00 2001 +From 573db8335f27160dca96b2ac1f7f008a5aac15b2 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- - src/ap/hostapd.c | 47 ++++++++++++++++++++++++++++++++--------------- - 1 file changed, 32 insertions(+), 15 deletions(-) + src/ap/hostapd.c | 49 ++++++++++++++++++++++++++++++++++--------------- + 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c -index c85563353..9227a1f01 100644 +index 1579ae7fe..3629f54ad 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -108,6 +108,26 @@ static void hostapd_reload_bss(struct hostapd_data *hapd) +@@ -114,6 +114,28 @@ static void hostapd_reload_bss(struct hostapd_data *hapd) #endif /* CONFIG_NO_RADIUS */ ssid = &hapd->conf->ssid; + + hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq, + hapd->iconf->channel, ++ hapd->iconf->enable_edmg, ++ hapd->iconf->edmg_channel, + hapd->iconf->ieee80211n, + hapd->iconf->ieee80211ac, + hapd->iconf->ieee80211ax, @@ -37,7 +39,7 @@ index c85563353..9227a1f01 100644 if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && ssid->wpa_passphrase_set && ssid->wpa_passphrase) { /* -@@ -205,6 +225,7 @@ int hostapd_reload_config(struct hostapd_iface *iface) +@@ -215,6 +237,7 @@ int hostapd_reload_config(struct hostapd_iface *iface) struct hostapd_data *hapd = iface->bss[0]; struct hostapd_config *newconf, *oldconf; size_t j; @@ -45,7 +47,7 @@ index c85563353..9227a1f01 100644 if (iface->config_fname == NULL) { /* Only in-memory config in use - assume it has been updated */ -@@ -255,24 +276,20 @@ int hostapd_reload_config(struct hostapd_iface *iface) +@@ -265,24 +288,20 @@ int hostapd_reload_config(struct hostapd_iface *iface) } iface->conf = newconf; diff --git a/recipes-connectivity/hostapd/files/341-mesh-ctrl-iface-channel-switch.patch b/recipes-connectivity/hostapd/files/341-mesh-ctrl-iface-channel-switch.patch index b95c70d..8228944 100644 --- a/recipes-connectivity/hostapd/files/341-mesh-ctrl-iface-channel-switch.patch +++ b/recipes-connectivity/hostapd/files/341-mesh-ctrl-iface-channel-switch.patch @@ -1,16 +1,16 @@ -From 24c05db1628be8bfbdb0caf70acf3e86e943becc Mon Sep 17 00:00:00 2001 +From 4e7d50b450dc603f19697c7de7c4d21b09489477 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- wpa_supplicant/ap.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c -index 4e3c2814d..5af4be230 100644 +index 2ec656255..0871c9b27 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1378,15 +1378,35 @@ int ap_switch_channel(struct wpa_supplicant *wpa_s, +@@ -1466,15 +1466,35 @@ int ap_switch_channel(struct wpa_supplicant *wpa_s, #ifdef CONFIG_CTRL_IFACE diff --git a/recipes-connectivity/hostapd/files/350-nl80211_del_beacon_bss.patch b/recipes-connectivity/hostapd/files/350-nl80211_del_beacon_bss.patch index 998b2c8..b4be472 100644 --- a/recipes-connectivity/hostapd/files/350-nl80211_del_beacon_bss.patch +++ b/recipes-connectivity/hostapd/files/350-nl80211_del_beacon_bss.patch @@ -1,16 +1,16 @@ -From c2031863a036db040f11a21b7093afb4e2322b91 Mon Sep 17 00:00:00 2001 +From e2b91f89250c5702aab0a51f7d7ae87164f23117 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- src/drivers/driver_nl80211.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c -index d0f79ca4b..0cdcca66f 100644 +index 6255d7956..6267819a7 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -2721,10 +2721,15 @@ static int wpa_driver_nl80211_del_beacon(struct i802_bss *bss) +@@ -2806,10 +2806,15 @@ static int wpa_driver_nl80211_del_beacon(struct i802_bss *bss) struct nl_msg *msg; struct wpa_driver_nl80211_data *drv = bss->drv; @@ -28,7 +28,7 @@ index d0f79ca4b..0cdcca66f 100644 return send_and_recv_msgs(drv, msg, NULL, NULL); } -@@ -5042,7 +5047,7 @@ static void nl80211_teardown_ap(struct i802_bss *bss) +@@ -5279,7 +5284,7 @@ static void nl80211_teardown_ap(struct i802_bss *bss) nl80211_mgmt_unsubscribe(bss, "AP teardown"); nl80211_put_wiphy_data_ap(bss); @@ -37,7 +37,7 @@ index d0f79ca4b..0cdcca66f 100644 } -@@ -7353,8 +7358,6 @@ static int wpa_driver_nl80211_if_remove(struct i802_bss *bss, +@@ -7697,8 +7702,6 @@ static int wpa_driver_nl80211_if_remove(struct i802_bss *bss, } else { wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context"); nl80211_teardown_ap(bss); @@ -46,7 +46,7 @@ index d0f79ca4b..0cdcca66f 100644 nl80211_destroy_bss(bss); if (!bss->added_if) i802_set_iface_flags(bss, 0); -@@ -7744,7 +7747,6 @@ static int wpa_driver_nl80211_deinit_ap(void *priv) +@@ -8092,7 +8095,6 @@ static int wpa_driver_nl80211_deinit_ap(void *priv) if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); @@ -54,7 +54,7 @@ index d0f79ca4b..0cdcca66f 100644 /* * If the P2P GO interface was dynamically added, then it is -@@ -7764,7 +7766,6 @@ static int wpa_driver_nl80211_stop_ap(void *priv) +@@ -8112,7 +8114,6 @@ static int wpa_driver_nl80211_stop_ap(void *priv) if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(bss); diff --git a/recipes-connectivity/hostapd/files/360-ctrl_iface_reload.patch b/recipes-connectivity/hostapd/files/360-ctrl_iface_reload.patch index 9a330ed..348a64e 100644 --- a/recipes-connectivity/hostapd/files/360-ctrl_iface_reload.patch +++ b/recipes-connectivity/hostapd/files/360-ctrl_iface_reload.patch @@ -1,6 +1,6 @@ -From 4301f343aad50fc07a271d1bca6ec265089c607e Mon Sep 17 00:00:00 2001 +From 17dfbd08ba654de9a83727a20b24dadcdc7e48e8 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/ctrl_iface.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -8,10 +8,10 @@ Date: Tue, 28 Jan 2020 15:14:35 +0100 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c -index 0f6dfa13d..35c00bd0d 100644 +index b470c5643..2a077209f 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -60,6 +60,7 @@ +@@ -65,6 +65,7 @@ #include "fst/fst_ctrl_iface.h" #include "config_file.h" #include "ctrl_iface.h" @@ -19,7 +19,7 @@ index 0f6dfa13d..35c00bd0d 100644 #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256 -@@ -78,6 +79,7 @@ static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level, +@@ -80,6 +81,7 @@ static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level, enum wpa_msg_type type, const char *buf, size_t len); @@ -27,7 +27,7 @@ index 0f6dfa13d..35c00bd0d 100644 static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd, struct sockaddr_storage *from, -@@ -129,6 +131,61 @@ static int hostapd_ctrl_iface_new_sta(struct hostapd_data *hapd, +@@ -131,6 +133,61 @@ static int hostapd_ctrl_iface_new_sta(struct hostapd_data *hapd, return 0; } @@ -87,9 +87,9 @@ index 0f6dfa13d..35c00bd0d 100644 + iface->interfaces->config_read_cb = config_read_cb; +} - #ifdef CONFIG_IEEE80211W #ifdef NEED_AP_MLME -@@ -3195,6 +3252,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, + static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, +@@ -3546,6 +3603,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, reply_size); @@ -99,10 +99,10 @@ index 0f6dfa13d..35c00bd0d 100644 ieee802_1x_erp_flush(hapd); #ifdef RADIUS_SERVER diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c -index 2c4953d8b..1135e8151 100644 +index ef53a8254..b3abf7eca 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c -@@ -874,7 +874,13 @@ int hostapd_parse_csa_settings(const char *pos, +@@ -917,7 +917,13 @@ int hostapd_parse_csa_settings(const char *pos, int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd) { diff --git a/recipes-connectivity/hostapd/files/370-ap_sta_support.patch b/recipes-connectivity/hostapd/files/370-ap_sta_support.patch index e4b2aaf..5389ae0 100644 --- a/recipes-connectivity/hostapd/files/370-ap_sta_support.patch +++ b/recipes-connectivity/hostapd/files/370-ap_sta_support.patch @@ -1,6 +1,6 @@ -From 58cace2f15271782798fa574d27fd4a57b64729b Mon Sep 17 00:00:00 2001 +From 45243d01250613d2fd90b0ff0a4b5de8e50a2b92 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/ctrl_iface.c | 5 +++ @@ -10,19 +10,19 @@ Date: Tue, 28 Jan 2020 15:14:35 +0100 wpa_supplicant/Makefile | 6 ++++ wpa_supplicant/bss.c | 14 ++++++++ wpa_supplicant/bss.h | 4 +++ - wpa_supplicant/events.c | 58 ++++++++++++++++++++++++++++++- + wpa_supplicant/events.c | 58 +++++++++++++++++++++++++++++++- wpa_supplicant/main.c | 8 +++-- - wpa_supplicant/wpa_supplicant.c | 70 ++++++++++++++++++++++++++++++++++++++ + wpa_supplicant/wpa_supplicant.c | 69 ++++++++++++++++++++++++++++++++++++++ wpa_supplicant/wpa_supplicant_i.h | 7 ++++ - 11 files changed, 176 insertions(+), 9 deletions(-) + 11 files changed, 175 insertions(+), 9 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c -index 35c00bd0d..cc4f64226 100644 +index 2a077209f..ea2577f50 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -2408,6 +2408,11 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface, - if (ret) - return ret; +@@ -2712,6 +2712,11 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface, + return 0; + } + if (os_strstr(pos, " auto-ht")) { + settings.freq_params.ht_enabled = iface->conf->ieee80211n; @@ -33,10 +33,10 @@ index 35c00bd0d..cc4f64226 100644 /* Save CHAN_SWITCH VHT config */ diff --git a/src/ap/beacon.c b/src/ap/beacon.c -index a51b94960..5039fc0e7 100644 +index 22e672c8d..2c5859933 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -1403,11 +1403,6 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd) +@@ -1468,11 +1468,6 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd) struct wpabuf *beacon, *proberesp, *assocresp; int res, ret = -1; @@ -49,10 +49,10 @@ index a51b94960..5039fc0e7 100644 if (ieee802_11_build_ap_params(hapd, ¶ms) < 0) diff --git a/src/drivers/driver.h b/src/drivers/driver.h -index f35e3fdad..a383af19f 100644 +index 9f5ded44e..0f565cb56 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -5478,6 +5478,7 @@ union wpa_event_data { +@@ -5690,6 +5690,7 @@ union wpa_event_data { /** * struct ch_switch @@ -60,7 +60,7 @@ index f35e3fdad..a383af19f 100644 * @freq: Frequency of new channel in MHz * @ht_enabled: Whether this is an HT channel * @ch_offset: Secondary channel offset -@@ -5486,6 +5487,7 @@ union wpa_event_data { +@@ -5698,6 +5699,7 @@ union wpa_event_data { * @cf2: Center frequency 2 */ struct ch_switch { @@ -69,10 +69,10 @@ index f35e3fdad..a383af19f 100644 int ht_enabled; int ch_offset; diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c -index 7c1633066..f074e7ba5 100644 +index 6a2de1f3c..013e4268e 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c -@@ -536,7 +536,7 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv, +@@ -541,7 +541,7 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv, struct nlattr *ifindex, struct nlattr *freq, struct nlattr *type, struct nlattr *bw, struct nlattr *cf1, struct nlattr *cf2, @@ -81,7 +81,7 @@ index 7c1633066..f074e7ba5 100644 { struct i802_bss *bss; union wpa_event_data data; -@@ -595,6 +595,8 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv, +@@ -600,6 +600,8 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv, data.ch_switch.cf1 = nla_get_u32(cf1); if (cf2) data.ch_switch.cf2 = nla_get_u32(cf2); @@ -90,7 +90,7 @@ index 7c1633066..f074e7ba5 100644 if (finished) bss->freq = data.ch_switch.freq; -@@ -2544,6 +2546,7 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd, +@@ -2686,6 +2688,7 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd, tb[NL80211_ATTR_CHANNEL_WIDTH], tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], @@ -98,7 +98,7 @@ index 7c1633066..f074e7ba5 100644 0); break; case NL80211_CMD_CH_SWITCH_NOTIFY: -@@ -2554,6 +2557,7 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd, +@@ -2696,6 +2699,7 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd, tb[NL80211_ATTR_CHANNEL_WIDTH], tb[NL80211_ATTR_CENTER_FREQ1], tb[NL80211_ATTR_CENTER_FREQ2], @@ -107,7 +107,7 @@ index 7c1633066..f074e7ba5 100644 break; case NL80211_CMD_DISCONNECT: diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile -index 3d05870bd..d8e42fe2f 100644 +index d5caf23a3..547e9b64b 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS) @@ -121,7 +121,7 @@ index 3d05870bd..d8e42fe2f 100644 -include .config -include $(if $(MULTICALL),../hostapd/.config) -@@ -116,6 +120,8 @@ OBJS_c += ../src/utils/common.o +@@ -118,6 +122,8 @@ OBJS_c += ../src/utils/common.o OBJS_c += ../src/common/cli.o OBJS += wmm_ac.o @@ -131,7 +131,7 @@ index 3d05870bd..d8e42fe2f 100644 ifdef CONFIG_NATIVE_WINDOWS CONFIG_OS=win32 diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c -index 441529cb0..e5dd06a80 100644 +index 127f43e5e..d0f5058a5 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -11,6 +11,7 @@ @@ -170,10 +170,10 @@ index 441529cb0..e5dd06a80 100644 } diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h -index 3ce8cd3f4..50c498612 100644 +index 071676174..e1c48b1a5 100644 --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h -@@ -82,6 +82,10 @@ struct wpa_bss { +@@ -83,6 +83,10 @@ struct wpa_bss { u8 ssid[SSID_MAX_LEN]; /** Length of SSID */ size_t ssid_len; @@ -185,10 +185,10 @@ index 3ce8cd3f4..50c498612 100644 int freq; /** Beacon interval in TUs (host byte order) */ diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c -index 067f76b48..7891f1ba1 100644 +index af91bae4e..e3b1f8343 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -4184,6 +4184,60 @@ static void wpas_event_assoc_reject(struct wpa_supplicant *wpa_s, +@@ -4579,6 +4579,60 @@ static void wpas_event_unprot_beacon(struct wpa_supplicant *wpa_s, } @@ -249,7 +249,7 @@ index 067f76b48..7891f1ba1 100644 void supplicant_event(void *ctx, enum wpa_event_type event, union wpa_event_data *data) { -@@ -4485,8 +4539,10 @@ void supplicant_event(void *ctx, enum wpa_event_type event, +@@ -4881,8 +4935,10 @@ void supplicant_event(void *ctx, enum wpa_event_type event, channel_width_to_string(data->ch_switch.ch_width), data->ch_switch.cf1, data->ch_switch.cf2); @@ -302,12 +302,12 @@ index 51a8a0298..669f5b0b6 100644 iface->ifname = optarg; break; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c -index 92ddbe458..c91a5ab10 100644 +index d0f730ab4..25b5340a8 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -127,6 +127,55 @@ static void wpas_update_fils_connect_params(struct wpa_supplicant *wpa_s); - #endif /* CONFIG_FILS && IEEE8021X_EAPOL */ - +@@ -129,6 +129,54 @@ static void wpas_update_fils_connect_params(struct wpa_supplicant *wpa_s); + static void wpas_update_owe_connect_params(struct wpa_supplicant *wpa_s); + #endif /* CONFIG_OWE */ +static int hostapd_stop(struct wpa_supplicant *wpa_s) +{ @@ -357,11 +357,10 @@ index 92ddbe458..c91a5ab10 100644 + } + return 0; +} -+ + + #ifdef CONFIG_WEP /* Configure default/group WEP keys for static WEP */ - int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) - { -@@ -940,12 +989,16 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, +@@ -991,6 +1039,8 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, sme_sched_obss_scan(wpa_s, 1); @@ -369,8 +368,9 @@ index 92ddbe458..c91a5ab10 100644 + hostapd_reload(wpa_s, wpa_s->current_bss); #if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL) if (!fils_hlp_sent && ssid && ssid->eap.erp) - wpas_update_fils_connect_params(wpa_s); - #endif /* CONFIG_FILS && IEEE8021X_EAPOL */ + update_fils_connect_params = true; +@@ -1001,6 +1051,8 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, + #endif /* CONFIG_OWE */ } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || state == WPA_ASSOCIATED) { + if (wpa_s->hostapd) @@ -378,16 +378,16 @@ index 92ddbe458..c91a5ab10 100644 wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -2038,6 +2091,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, - wpa_ssid_txt(ssid->ssid, ssid->ssid_len), - ssid->id); - wpas_notify_mesh_group_started(wpa_s, ssid); +@@ -2225,6 +2277,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, + return; + } + wpa_s->current_bss = bss; + if (wpa_s->hostapd) + hostapd_reload(wpa_s, wpa_s->current_bss); #else /* CONFIG_MESH */ wpa_msg(wpa_s, MSG_ERROR, "mesh mode support not included in the build"); -@@ -5716,6 +5771,16 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, +@@ -6207,6 +6261,16 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, sizeof(wpa_s->bridge_ifname)); } @@ -402,9 +402,9 @@ index 92ddbe458..c91a5ab10 100644 + } + /* RSNA Supplicant Key Management - INITIALIZE */ - eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); - eapol_sm_notify_portValid(wpa_s->eapol, FALSE); -@@ -6043,6 +6108,11 @@ static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s, + 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(struct wpa_supplicant *wpa_s, if (terminate) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); @@ -417,10 +417,10 @@ index 92ddbe458..c91a5ab10 100644 wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface); wpa_s->ctrl_iface = NULL; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h -index 8a4bdf8cb..f89dd6059 100644 +index 28867f04e..9b60dfc42 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h -@@ -101,6 +101,11 @@ struct wpa_interface { +@@ -104,6 +104,11 @@ struct wpa_interface { const char *ifname; /** @@ -432,7 +432,7 @@ index 8a4bdf8cb..f89dd6059 100644 * bridge_ifname - Optional bridge interface name * * If the driver interface (ifname) is included in a Linux bridge -@@ -516,6 +521,8 @@ struct wpa_supplicant { +@@ -530,6 +535,8 @@ struct wpa_supplicant { #endif /* CONFIG_CTRL_IFACE_BINDER */ char bridge_ifname[16]; diff --git a/recipes-connectivity/hostapd/files/380-disable_ctrl_iface_mib.patch b/recipes-connectivity/hostapd/files/380-disable_ctrl_iface_mib.patch index b1f70e7..dccfd16 100644 --- a/recipes-connectivity/hostapd/files/380-disable_ctrl_iface_mib.patch +++ b/recipes-connectivity/hostapd/files/380-disable_ctrl_iface_mib.patch @@ -1,6 +1,6 @@ -From f890ab993069f8737125bcf24d99f441759e7b63 Mon Sep 17 00:00:00 2001 +From 8d08dd5ef716f86676eb4ef7c4c401010c44ef01 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/Makefile | 3 +++ @@ -15,10 +15,10 @@ Date: Tue, 28 Jan 2020 15:14:35 +0100 9 files changed, 27 insertions(+), 5 deletions(-) diff --git a/hostapd/Makefile b/hostapd/Makefile -index da8f9bc9b..94ffc1a66 100644 +index dae9cd119..abd2acdc9 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -220,6 +220,9 @@ endif +@@ -226,6 +226,9 @@ endif ifdef CONFIG_NO_CTRL_IFACE CFLAGS += -DCONFIG_NO_CTRL_IFACE else @@ -29,10 +29,10 @@ index da8f9bc9b..94ffc1a66 100644 CFLAGS += -DCONFIG_CTRL_IFACE_UDP else diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c -index cc4f64226..ef24ebb74 100644 +index ea2577f50..13d7aba60 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -3020,6 +3020,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, +@@ -3370,6 +3370,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -40,7 +40,7 @@ index cc4f64226..ef24ebb74 100644 } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -3061,6 +3062,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, +@@ -3411,6 +3412,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -49,7 +49,7 @@ index cc4f64226..ef24ebb74 100644 if (hostapd_ctrl_iface_attach(hapd, from, fromlen, NULL)) reply_len = -1; diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c -index 1135e8151..a1000e34a 100644 +index b3abf7eca..dc7c6c35d 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -25,6 +25,7 @@ @@ -60,7 +60,7 @@ index 1135e8151..a1000e34a 100644 static size_t hostapd_write_ht_mcs_bitmask(char *buf, size_t buflen, size_t curr_len, const u8 *mcs_set) -@@ -423,6 +424,7 @@ int hostapd_ctrl_iface_sta_next(struct hostapd_data *hapd, const char *txtaddr, +@@ -451,6 +452,7 @@ int hostapd_ctrl_iface_sta_next(struct hostapd_data *hapd, const char *txtaddr, return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen); } @@ -68,7 +68,7 @@ index 1135e8151..a1000e34a 100644 #ifdef CONFIG_P2P_MANAGER static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, -@@ -763,12 +765,12 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, +@@ -806,12 +808,12 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, return len; len += ret; } @@ -84,10 +84,10 @@ index 1135e8151..a1000e34a 100644 ret = os_snprintf(buf + len, buflen - len, "supported_rates="); if (os_snprintf_error(buflen - len, ret)) diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c -index e0614710f..292cd4bc8 100644 +index ee095f618..9ee99cff3 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2706,6 +2706,7 @@ static const char * bool_txt(Boolean val) +@@ -2711,6 +2711,7 @@ static const char * bool_txt(bool val) return val ? "TRUE" : "FALSE"; } @@ -95,7 +95,7 @@ index e0614710f..292cd4bc8 100644 int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -2892,6 +2893,7 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, +@@ -2897,6 +2898,7 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, return len; } @@ -104,10 +104,10 @@ index e0614710f..292cd4bc8 100644 #ifdef CONFIG_HS20 static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx) diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c -index c56077001..cb6595f2c 100644 +index 9e6c0cad3..c43cfed78 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c -@@ -4116,6 +4116,7 @@ static const char * wpa_bool_txt(int val) +@@ -4451,6 +4451,7 @@ static const char * wpa_bool_txt(int val) return val ? "TRUE" : "FALSE"; } @@ -115,7 +115,7 @@ index c56077001..cb6595f2c 100644 #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -4264,7 +4265,7 @@ int wpa_get_mib_sta(struct wpa_state_machine *sm, char *buf, size_t buflen) +@@ -4601,7 +4602,7 @@ int wpa_get_mib_sta(struct wpa_state_machine *sm, char *buf, size_t buflen) return len; } @@ -125,10 +125,10 @@ index c56077001..cb6595f2c 100644 void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth) { diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c -index c929e8194..39dcecd17 100644 +index 0ae73e8f3..316fd461d 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -2502,6 +2502,8 @@ static u32 wpa_key_mgmt_suite(struct wpa_sm *sm) +@@ -2728,6 +2728,8 @@ static u32 wpa_key_mgmt_suite(struct wpa_sm *sm) } @@ -137,7 +137,7 @@ index c929e8194..39dcecd17 100644 #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -2585,6 +2587,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, char *buf, size_t buflen) +@@ -2809,6 +2811,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, char *buf, size_t buflen) return (int) len; } @@ -146,10 +146,10 @@ index c929e8194..39dcecd17 100644 diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile -index d8e42fe2f..3ee2d6eff 100644 +index 547e9b64b..16ea58f4a 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -957,6 +957,9 @@ ifdef CONFIG_FILS +@@ -952,6 +952,9 @@ ifdef CONFIG_FILS OBJS += ../src/ap/fils_hlp.o endif ifdef CONFIG_CTRL_IFACE @@ -160,10 +160,10 @@ index d8e42fe2f..3ee2d6eff 100644 endif diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c -index 5af4be230..5b30c3e3d 100644 +index 0871c9b27..c67f41c3a 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -1236,7 +1236,7 @@ int wpas_ap_wps_nfc_report_handover(struct wpa_supplicant *wpa_s, +@@ -1324,7 +1324,7 @@ int wpas_ap_wps_nfc_report_handover(struct wpa_supplicant *wpa_s, #endif /* CONFIG_WPS */ @@ -173,10 +173,10 @@ index 5af4be230..5b30c3e3d 100644 int ap_ctrl_iface_sta_first(struct wpa_supplicant *wpa_s, char *buf, size_t buflen) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c -index 8efc08d4d..a328b877b 100644 +index 298f3c442..4e07a4336 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -2144,7 +2144,7 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s, +@@ -2267,7 +2267,7 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s, pos += ret; } @@ -185,7 +185,7 @@ index 8efc08d4d..a328b877b 100644 if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -9962,6 +9962,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, +@@ -10366,6 +10366,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, reply_len = -1; } else if (os_strncmp(buf, "NOTE ", 5) == 0) { wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); @@ -193,7 +193,7 @@ index 8efc08d4d..a328b877b 100644 } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -9974,6 +9975,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, +@@ -10378,6 +10379,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, reply_size - reply_len); #endif /* CONFIG_MACSEC */ } @@ -201,7 +201,7 @@ index 8efc08d4d..a328b877b 100644 } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -10458,6 +10460,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, +@@ -10862,6 +10864,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -209,7 +209,7 @@ index 8efc08d4d..a328b877b 100644 } 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) { -@@ -10466,12 +10469,15 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, +@@ -10870,12 +10873,15 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, reply_size); diff --git a/recipes-connectivity/hostapd/files/381-hostapd_cli_UNKNOWN-COMMAND.patch b/recipes-connectivity/hostapd/files/381-hostapd_cli_UNKNOWN-COMMAND.patch index 4872a20..ff1f6ed 100644 --- a/recipes-connectivity/hostapd/files/381-hostapd_cli_UNKNOWN-COMMAND.patch +++ b/recipes-connectivity/hostapd/files/381-hostapd_cli_UNKNOWN-COMMAND.patch @@ -1,16 +1,16 @@ -From c4df803ed65c86cd50fb462ed81d58bd57ae781e Mon Sep 17 00:00:00 2001 +From 1417df0236f3b7e509bc2087f9603c92e3f4653e Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/hostapd_cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c -index 046024390..14d3fd9f0 100644 +index 440664e9b..10f44d4ce 100644 --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -743,7 +743,7 @@ static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, const char *cmd, +@@ -744,7 +744,7 @@ static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, const char *cmd, } buf[len] = '\0'; diff --git a/recipes-connectivity/hostapd/files/390-wpa_ie_cap_workaround.patch b/recipes-connectivity/hostapd/files/390-wpa_ie_cap_workaround.patch index ba769db..f67cbb5 100644 --- a/recipes-connectivity/hostapd/files/390-wpa_ie_cap_workaround.patch +++ b/recipes-connectivity/hostapd/files/390-wpa_ie_cap_workaround.patch @@ -1,16 +1,16 @@ -From 8dd311e8023bbceda50d21698f795f2e654bd038 Mon Sep 17 00:00:00 2001 +From bf2d36c1e43219c8b322d947aee360c0b0f27791 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- src/common/wpa_common.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c -index 64e5c5f4c..da1a148b9 100644 +index 82a5a174f..2fd743cc8 100644 --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c -@@ -2089,6 +2089,31 @@ u32 wpa_akm_to_suite(int akm) +@@ -2121,6 +2121,31 @@ u32 wpa_akm_to_suite(int akm) } @@ -42,7 +42,7 @@ index 64e5c5f4c..da1a148b9 100644 int wpa_compare_rsn_ie(int ft_initial_assoc, const u8 *ie1, size_t ie1len, const u8 *ie2, size_t ie2len) -@@ -2096,8 +2121,19 @@ int wpa_compare_rsn_ie(int ft_initial_assoc, +@@ -2128,8 +2153,19 @@ int wpa_compare_rsn_ie(int ft_initial_assoc, if (ie1 == NULL || ie2 == NULL) return -1; diff --git a/recipes-connectivity/hostapd/files/400-wps_single_auth_enc_type.patch b/recipes-connectivity/hostapd/files/400-wps_single_auth_enc_type.patch index 3ce4bb3..1352ed2 100644 --- a/recipes-connectivity/hostapd/files/400-wps_single_auth_enc_type.patch +++ b/recipes-connectivity/hostapd/files/400-wps_single_auth_enc_type.patch @@ -1,32 +1,33 @@ -From aa9509512105dc95a3091696d7305900d701be03 Mon Sep 17 00:00:00 2001 +From 2b64e885c82997a8abe3d0ea767a3e1137f50a29 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- src/ap/wps_hostapd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c -index 6161cdbdb..4a0302043 100644 +index ff942a67b..18925f0c3 100644 --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c -@@ -346,8 +346,7 @@ static int hapd_wps_reconfig_in_memory(struct hostapd_data *hapd, +@@ -394,9 +394,8 @@ static int hapd_wps_reconfig_in_memory(struct hostapd_data *hapd, bss->wpa_pairwise |= WPA_CIPHER_GCMP; else bss->wpa_pairwise |= WPA_CIPHER_CCMP; - } + #ifndef CONFIG_NO_TKIP - if (cred->encr_type & WPS_ENCR_TKIP) + } else if (cred->encr_type & WPS_ENCR_TKIP) bss->wpa_pairwise |= WPA_CIPHER_TKIP; + #endif /* CONFIG_NO_TKIP */ bss->rsn_pairwise = bss->wpa_pairwise; - bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa, -@@ -1108,8 +1107,7 @@ int hostapd_init_wps(struct hostapd_data *hapd, +@@ -1178,8 +1177,7 @@ int hostapd_init_wps(struct hostapd_data *hapd, WPA_CIPHER_GCMP_256)) { wps->encr_types |= WPS_ENCR_AES; wps->encr_types_rsn |= WPS_ENCR_AES; - } - if (conf->rsn_pairwise & WPA_CIPHER_TKIP) { + } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) { - wps->encr_types |= WPS_ENCR_TKIP; - wps->encr_types_rsn |= WPS_ENCR_TKIP; - } + #ifdef CONFIG_NO_TKIP + wpa_printf(MSG_INFO, "WPS: TKIP not supported"); + goto fail; diff --git a/recipes-connectivity/hostapd/files/410-limit_debug_messages.patch b/recipes-connectivity/hostapd/files/410-limit_debug_messages.patch index a9e9c9a..937521b 100644 --- a/recipes-connectivity/hostapd/files/410-limit_debug_messages.patch +++ b/recipes-connectivity/hostapd/files/410-limit_debug_messages.patch @@ -1,14 +1,14 @@ -From 7b5795055ae75d37753933b2cc7b5b10185fc70a Mon Sep 17 00:00:00 2001 +From d7da847c66bbd576a924e6bf777813203f2b87c1 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- - src/utils/wpa_debug.c | 40 ++++++----------------------- + src/utils/wpa_debug.c | 36 ++++----------------------- src/utils/wpa_debug.h | 69 ++++++++++++++++++++++++++++++++++++++++++++------- - 2 files changed, 67 insertions(+), 42 deletions(-) + 2 files changed, 65 insertions(+), 40 deletions(-) diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c -index c336e5389..334f22d72 100644 +index a338a2039..a887d60b3 100644 --- a/src/utils/wpa_debug.c +++ b/src/utils/wpa_debug.c @@ -206,7 +206,7 @@ void wpa_debug_close_linux_tracing(void) @@ -20,41 +20,37 @@ index c336e5389..334f22d72 100644 { va_list ap; -@@ -253,8 +253,8 @@ void wpa_printf(int level, const char *fmt, ...) +@@ -255,7 +255,7 @@ void wpa_printf(int level, const char *fmt, ...) } -static void _wpa_hexdump(int level, const char *title, const u8 *buf, -- size_t len, int show) +void _wpa_hexdump(int level, const char *title, const u8 *buf, -+ size_t len, int show) + size_t len, int show, int only_syslog) { size_t i; - -@@ -380,20 +380,8 @@ static void _wpa_hexdump(int level, const char *title, const u8 *buf, +@@ -382,19 +382,7 @@ static void _wpa_hexdump(int level, const char *title, const u8 *buf, #endif /* CONFIG_ANDROID_LOG */ } -void wpa_hexdump(int level, const char *title, const void *buf, size_t len) -{ -- _wpa_hexdump(level, title, buf, len, 1); +- _wpa_hexdump(level, title, buf, len, 1, 0); -} - - -void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len) -{ -- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); +- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys, 0); -} - - -static void _wpa_hexdump_ascii(int level, const char *title, const void *buf, -- size_t len, int show) +void _wpa_hexdump_ascii(int level, const char *title, const void *buf, -+ size_t len, int show) + size_t len, int show) { size_t i, llen; - const u8 *pos = buf; -@@ -506,20 +494,6 @@ static void _wpa_hexdump_ascii(int level, const char *title, const void *buf, +@@ -507,20 +495,6 @@ file_done: } @@ -75,7 +71,7 @@ index c336e5389..334f22d72 100644 #ifdef CONFIG_DEBUG_FILE static char *last_path = NULL; #endif /* CONFIG_DEBUG_FILE */ -@@ -635,7 +609,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_get_ifname_func func) +@@ -636,7 +610,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_get_ifname_func func) } @@ -84,7 +80,7 @@ index c336e5389..334f22d72 100644 { va_list ap; char *buf; -@@ -673,7 +647,7 @@ void wpa_msg(void *ctx, int level, const char *fmt, ...) +@@ -674,7 +648,7 @@ void wpa_msg(void *ctx, int level, const char *fmt, ...) } @@ -94,16 +90,16 @@ index c336e5389..334f22d72 100644 va_list ap; char *buf; diff --git a/src/utils/wpa_debug.h b/src/utils/wpa_debug.h -index 1fe0b7db7..8a685a164 100644 +index c6d5cc647..824538b41 100644 --- a/src/utils/wpa_debug.h +++ b/src/utils/wpa_debug.h -@@ -52,6 +52,17 @@ int wpa_debug_reopen_file(void); +@@ -50,6 +50,17 @@ int wpa_debug_reopen_file(void); void wpa_debug_close_file(void); void wpa_debug_setup_stdout(void); +/* internal */ +void _wpa_hexdump(int level, const char *title, const u8 *buf, -+ size_t len, int show); ++ size_t len, int show, int only_syslog); +void _wpa_hexdump_ascii(int level, const char *title, const void *buf, + size_t len, int show); +extern int wpa_debug_show_keys; @@ -115,7 +111,7 @@ index 1fe0b7db7..8a685a164 100644 /** * wpa_debug_printf_timestamp - Print timestamp for debug output * -@@ -72,9 +83,15 @@ void wpa_debug_print_timestamp(void); +@@ -70,9 +81,15 @@ void wpa_debug_print_timestamp(void); * * Note: New line '\n' is added to the end of the text when printing to stdout. */ @@ -132,7 +128,7 @@ index 1fe0b7db7..8a685a164 100644 /** * wpa_hexdump - conditional hex dump * @level: priority level (MSG_*) of the message -@@ -86,7 +103,13 @@ PRINTF_FORMAT(2, 3); +@@ -84,7 +101,13 @@ PRINTF_FORMAT(2, 3); * output may be directed to stdout, stderr, and/or syslog based on * configuration. The contents of buf is printed out has hex dump. */ @@ -142,12 +138,12 @@ index 1fe0b7db7..8a685a164 100644 + if (level < CONFIG_MSG_MIN_PRIORITY) + return; + -+ _wpa_hexdump(level, title, buf, len, 1); ++ _wpa_hexdump(level, title, buf, len, 1, 1); +} static inline void wpa_hexdump_buf(int level, const char *title, const struct wpabuf *buf) -@@ -108,7 +131,13 @@ static inline void wpa_hexdump_buf(int level, const char *title, +@@ -106,7 +129,13 @@ static inline void wpa_hexdump_buf(int level, const char *title, * like wpa_hexdump(), but by default, does not include secret keys (passwords, * etc.) in debug output. */ @@ -157,12 +153,12 @@ index 1fe0b7db7..8a685a164 100644 + if (level < CONFIG_MSG_MIN_PRIORITY) + return; + -+ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); ++ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys, 1); +} static inline void wpa_hexdump_buf_key(int level, const char *title, const struct wpabuf *buf) -@@ -130,8 +159,14 @@ static inline void wpa_hexdump_buf_key(int level, const char *title, +@@ -128,8 +157,14 @@ static inline void wpa_hexdump_buf_key(int level, const char *title, * the hex numbers and ASCII characters (for printable range) are shown. 16 * bytes per line will be shown. */ @@ -179,7 +175,7 @@ index 1fe0b7db7..8a685a164 100644 /** * wpa_hexdump_ascii_key - conditional hex dump, hide keys -@@ -147,8 +182,14 @@ void wpa_hexdump_ascii(int level, const char *title, const void *buf, +@@ -145,8 +180,14 @@ void wpa_hexdump_ascii(int level, const char *title, const void *buf, * bytes per line will be shown. This works like wpa_hexdump_ascii(), but by * default, does not include secret keys (passwords, etc.) in debug output. */ @@ -196,7 +192,7 @@ index 1fe0b7db7..8a685a164 100644 /* * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce -@@ -185,7 +226,12 @@ void wpa_hexdump_ascii_key(int level, const char *title, const void *buf, +@@ -183,7 +224,12 @@ void wpa_hexdump_ascii_key(int level, const char *title, const void *buf, * * Note: New line '\n' is added to the end of the text when printing to stdout. */ @@ -210,7 +206,7 @@ index 1fe0b7db7..8a685a164 100644 /** * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors -@@ -199,8 +245,13 @@ void wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); +@@ -197,8 +243,13 @@ void wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); * attached ctrl_iface monitors. In other words, it can be used for frequent * events that do not need to be sent to syslog. */ diff --git a/recipes-connectivity/hostapd/files/420-indicate-features.patch b/recipes-connectivity/hostapd/files/420-indicate-features.patch index cd0963f..143b31e 100644 --- a/recipes-connectivity/hostapd/files/420-indicate-features.patch +++ b/recipes-connectivity/hostapd/files/420-indicate-features.patch @@ -1,6 +1,6 @@ -From d2c20f1a0dd228fcfaa36bb9fdd1e38148e7b145 Mon Sep 17 00:00:00 2001 +From f9f005742a0182819f1f1e737a1abf671d4b4a5a Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/main.c | 5 ++++- @@ -8,7 +8,7 @@ Date: Tue, 28 Jan 2020 15:14:35 +0100 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/hostapd/main.c b/hostapd/main.c -index 90424d5bd..4b537f35a 100644 +index 2bebdfe86..4f7d5184d 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -15,6 +15,7 @@ @@ -19,7 +19,7 @@ index 90424d5bd..4b537f35a 100644 #include "crypto/random.h" #include "crypto/tls.h" #include "common/version.h" -@@ -690,7 +691,7 @@ int main(int argc, char *argv[]) +@@ -692,7 +693,7 @@ int main(int argc, char *argv[]) wpa_supplicant_event = hostapd_wpa_event; wpa_supplicant_event_global = hostapd_wpa_event_global; for (;;) { @@ -28,7 +28,7 @@ index 90424d5bd..4b537f35a 100644 if (c < 0) break; switch (c) { -@@ -727,6 +728,8 @@ int main(int argc, char *argv[]) +@@ -729,6 +730,8 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_DEBUG_LINUX_TRACING */ case 'v': diff --git a/recipes-connectivity/hostapd/files/430-hostapd_cli_ifdef.patch b/recipes-connectivity/hostapd/files/430-hostapd_cli_ifdef.patch index f266864..2be3c5f 100644 --- a/recipes-connectivity/hostapd/files/430-hostapd_cli_ifdef.patch +++ b/recipes-connectivity/hostapd/files/430-hostapd_cli_ifdef.patch @@ -1,16 +1,16 @@ -From 0c14b6a7fc8ebce22da7e09d9e2761ccabcc58b8 Mon Sep 17 00:00:00 2001 +From ad299f46a1a3e710901696888e05cbe8d6bd03bf Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/hostapd_cli.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c -index 14d3fd9f0..7ede2bdb7 100644 +index 10f44d4ce..24abfe33b 100644 --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c -@@ -385,7 +385,6 @@ static int hostapd_cli_cmd_disassociate(struct wpa_ctrl *ctrl, int argc, +@@ -388,7 +388,6 @@ static int hostapd_cli_cmd_disassociate(struct wpa_ctrl *ctrl, int argc, } @@ -18,23 +18,23 @@ index 14d3fd9f0..7ede2bdb7 100644 static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -398,7 +397,6 @@ static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc, +@@ -401,7 +400,6 @@ static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc, os_snprintf(buf, sizeof(buf), "SIGNATURE %s", argv[0]); return wpa_ctrl_command(ctrl, buf); } -#endif /* CONFIG_TAXONOMY */ - #ifdef CONFIG_IEEE80211W -@@ -417,7 +415,6 @@ static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc, - #endif /* CONFIG_IEEE80211W */ + static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc, +@@ -418,7 +416,6 @@ static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc, + } -#ifdef CONFIG_WPS static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, char *argv[]) { -@@ -643,7 +640,6 @@ static int hostapd_cli_cmd_wps_config(struct wpa_ctrl *ctrl, int argc, +@@ -644,7 +641,6 @@ static int hostapd_cli_cmd_wps_config(struct wpa_ctrl *ctrl, int argc, ssid_hex, argv[1]); return wpa_ctrl_command(ctrl, buf); } @@ -42,7 +42,7 @@ index 14d3fd9f0..7ede2bdb7 100644 static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, -@@ -1538,15 +1534,12 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = { +@@ -1532,13 +1528,10 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = { { "disassociate", hostapd_cli_cmd_disassociate, hostapd_complete_stations, " = disassociate a station" }, @@ -50,15 +50,13 @@ index 14d3fd9f0..7ede2bdb7 100644 { "signature", hostapd_cli_cmd_signature, hostapd_complete_stations, " = get taxonomy signature for a station" }, -#endif /* CONFIG_TAXONOMY */ - #ifdef CONFIG_IEEE80211W { "sa_query", hostapd_cli_cmd_sa_query, hostapd_complete_stations, " = send SA Query to a station" }, - #endif /* CONFIG_IEEE80211W */ -#ifdef CONFIG_WPS { "wps_pin", hostapd_cli_cmd_wps_pin, NULL, " [timeout] [addr] = add WPS Enrollee PIN" }, { "wps_check_pin", hostapd_cli_cmd_wps_check_pin, NULL, -@@ -1571,7 +1564,6 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = { +@@ -1563,7 +1556,6 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = { " = configure AP" }, { "wps_get_status", hostapd_cli_cmd_wps_get_status, NULL, "= show current WPS status" }, diff --git a/recipes-connectivity/hostapd/files/431-wpa_cli_ifdef.patch b/recipes-connectivity/hostapd/files/431-wpa_cli_ifdef.patch index 46eb1d6..1cdcaa1 100644 --- a/recipes-connectivity/hostapd/files/431-wpa_cli_ifdef.patch +++ b/recipes-connectivity/hostapd/files/431-wpa_cli_ifdef.patch @@ -1,13 +1,13 @@ -From 263d0dc826ac847d2bea23d0c13ebf7ffdf81e87 Mon Sep 17 00:00:00 2001 +From aa0514e3ed13059846e7e3fcbefe2df8992bb6bc Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- wpa_supplicant/wpa_cli.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c -index 43ac42720..5e134b0e0 100644 +index f5b02f662..f70c42f0c 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -26,6 +26,15 @@ diff --git a/recipes-connectivity/hostapd/files/432-missing-typedef.patch b/recipes-connectivity/hostapd/files/432-missing-typedef.patch index 3981d49..aa2e262 100644 --- a/recipes-connectivity/hostapd/files/432-missing-typedef.patch +++ b/recipes-connectivity/hostapd/files/432-missing-typedef.patch @@ -1,6 +1,6 @@ -From 17a3b7768255699d9fe7d3099d0ed83dc8dc9089 Mon Sep 17 00:00:00 2001 +From e2b9aa2d8a8326dba7b42c48069700d22d8be256 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- src/drivers/linux_wext.h | 1 + diff --git a/recipes-connectivity/hostapd/files/450-scan_wait.patch b/recipes-connectivity/hostapd/files/450-scan_wait.patch index 8f9e0cc..63d8f35 100644 --- a/recipes-connectivity/hostapd/files/450-scan_wait.patch +++ b/recipes-connectivity/hostapd/files/450-scan_wait.patch @@ -1,13 +1,13 @@ -From d32de242fcf209a7de6aa4cd29fcf8f838e0c520 Mon Sep 17 00:00:00 2001 +From cd5afa9d5b7c24a72965d57e37c308ab80f333b6 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/main.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/hostapd/main.c b/hostapd/main.c -index 4b537f35a..f9b29aa88 100644 +index 4f7d5184d..9b44f4d41 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -39,6 +39,8 @@ struct hapd_global { @@ -19,7 +19,7 @@ index 4b537f35a..f9b29aa88 100644 #ifndef CONFIG_NO_HOSTAPD_LOGGER -@@ -149,6 +151,14 @@ static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, +@@ -146,6 +148,14 @@ static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, } #endif /* CONFIG_NO_HOSTAPD_LOGGER */ @@ -34,7 +34,7 @@ index 4b537f35a..f9b29aa88 100644 /** * hostapd_driver_init - Preparate driver interface -@@ -167,6 +177,8 @@ static int hostapd_driver_init(struct hostapd_iface *iface) +@@ -164,6 +174,8 @@ static int hostapd_driver_init(struct hostapd_iface *iface) return -1; } @@ -43,7 +43,7 @@ index 4b537f35a..f9b29aa88 100644 /* Initialize the driver interface */ if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5])) b = NULL; -@@ -407,8 +419,6 @@ static void hostapd_global_deinit(const char *pid_file, int eloop_initialized) +@@ -404,8 +416,6 @@ static void hostapd_global_deinit(const char *pid_file, int eloop_initialized) #endif /* CONFIG_NATIVE_WINDOWS */ eap_server_unregister_methods(); @@ -52,7 +52,7 @@ index 4b537f35a..f9b29aa88 100644 } -@@ -434,18 +444,6 @@ static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize, +@@ -431,18 +441,6 @@ static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize, } #endif /* EAP_SERVER_TNC */ @@ -71,7 +71,7 @@ index 4b537f35a..f9b29aa88 100644 eloop_run(); return 0; -@@ -647,8 +645,7 @@ int main(int argc, char *argv[]) +@@ -645,8 +643,7 @@ int main(int argc, char *argv[]) struct hapd_interfaces interfaces; int ret = 1; size_t i, j; diff --git a/recipes-connectivity/hostapd/files/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/recipes-connectivity/hostapd/files/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index 725d9ee..7372bb7 100644 --- a/recipes-connectivity/hostapd/files/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/recipes-connectivity/hostapd/files/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -1,4 +1,4 @@ -From 10040581346e2465c4f446c9dd006d29ff9cbd7a Mon Sep 17 00:00:00 2001 +From 4edea7c948212283defa9b7685daa7a5a37535d2 Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Sun, 3 Jun 2012 18:22:56 +0200 Subject: [PATCH] wpa_supplicant: add new config params to be used with the @@ -14,7 +14,7 @@ Signed-hostap: Antonio Quartulli 4 files changed, 109 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h -index a383af19f..e7a2d8b64 100644 +index 0f565cb56..6e3bd2230 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -19,6 +19,7 @@ @@ -25,7 +25,7 @@ index a383af19f..e7a2d8b64 100644 #include "common/defs.h" #include "common/ieee802_11_defs.h" #include "common/wpa_common.h" -@@ -819,6 +820,9 @@ struct wpa_driver_associate_params { +@@ -850,6 +851,9 @@ struct wpa_driver_associate_params { * responsible for selecting with which BSS to associate. */ const u8 *bssid; @@ -36,10 +36,10 @@ index a383af19f..e7a2d8b64 100644 * bssid_hint - BSSID of a proposed AP * diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c -index eaabaa88d..2bb91280c 100644 +index 61a5e1c60..69c2eb03b 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c -@@ -17,6 +17,7 @@ +@@ -18,6 +18,7 @@ #include "eap_peer/eap.h" #include "p2p/p2p.h" #include "fst/fst.h" @@ -47,7 +47,7 @@ index eaabaa88d..2bb91280c 100644 #include "config.h" -@@ -2130,6 +2131,97 @@ static char * wpa_config_write_peerkey(const struct parse_data *data, +@@ -2269,6 +2270,97 @@ static char * wpa_config_write_peerkey(const struct parse_data *data, #endif /* NO_CONFIG_WRITE */ @@ -145,7 +145,7 @@ index eaabaa88d..2bb91280c 100644 /* Helper macros for network block parser */ #ifdef OFFSET -@@ -2382,6 +2474,8 @@ static const struct parse_data ssid_fields[] = { +@@ -2552,6 +2644,8 @@ static const struct parse_data ssid_fields[] = { { INT(ap_max_inactivity) }, { INT(dtim_period) }, { INT(beacon_int) }, @@ -155,7 +155,7 @@ index eaabaa88d..2bb91280c 100644 { INT_RANGE(macsec_policy, 0, 1) }, { INT_RANGE(macsec_integ_only, 0, 1) }, diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h -index 401c22cec..ce2aeb5bf 100644 +index 2e205c08a..f1a1893c8 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -10,8 +10,10 @@ @@ -169,7 +169,7 @@ index 401c22cec..ce2aeb5bf 100644 #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) -@@ -790,6 +792,9 @@ struct wpa_ssid { +@@ -843,6 +845,9 @@ struct wpa_ssid { */ void *parent_cred; @@ -180,14 +180,14 @@ index 401c22cec..ce2aeb5bf 100644 /** * macsec_policy - Determines the policy for MACsec secure session diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c -index c91a5ab10..a2d0dbcc2 100644 +index 25b5340a8..44f6b90b4 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3266,6 +3266,12 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) +@@ -3638,6 +3638,12 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; -+ i = 0; ++ int i = 0; + while (i < WLAN_SUPP_RATES_MAX) { + params.rates[i] = ssid->rates[i]; + i++; @@ -195,4 +195,4 @@ index c91a5ab10..a2d0dbcc2 100644 + params.mcast_rate = ssid->mcast_rate; } - params.pairwise_suite = cipher_pairwise; + if (bss && ssid->enable_edmg) diff --git a/recipes-connectivity/hostapd/files/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/recipes-connectivity/hostapd/files/461-driver_nl80211-use-new-parameters-during-ibss-join.patch index fdc8f38..a54adee 100644 --- a/recipes-connectivity/hostapd/files/461-driver_nl80211-use-new-parameters-during-ibss-join.patch +++ b/recipes-connectivity/hostapd/files/461-driver_nl80211-use-new-parameters-during-ibss-join.patch @@ -1,4 +1,4 @@ -From 6ff2943d91e4c6ed209284eb02d5d8dbe258070e Mon Sep 17 00:00:00 2001 +From 89676e86a2719b0a9991d69bd46a1c6e8cb995bf Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Sun, 3 Jun 2012 18:42:25 +0200 Subject: [PATCH] driver_nl80211: use new parameters during ibss join @@ -10,10 +10,10 @@ Signed-hostap: Antonio Quartulli 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c -index 0cdcca66f..b0c71d242 100644 +index 6267819a7..7f87b8482 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -5323,7 +5323,7 @@ static int wpa_driver_nl80211_ibss(struct wpa_driver_nl80211_data *drv, +@@ -5602,7 +5602,7 @@ static int wpa_driver_nl80211_ibss(struct wpa_driver_nl80211_data *drv, struct wpa_driver_associate_params *params) { struct nl_msg *msg; @@ -22,7 +22,7 @@ index 0cdcca66f..b0c71d242 100644 int count = 0; wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); -@@ -5350,6 +5350,37 @@ retry: +@@ -5629,6 +5629,37 @@ retry: nl80211_put_beacon_int(msg, params->beacon_int)) goto fail; diff --git a/recipes-connectivity/hostapd/files/463-add-mcast_rate-to-11s.patch b/recipes-connectivity/hostapd/files/463-add-mcast_rate-to-11s.patch index 9db8670..57a67cc 100644 --- a/recipes-connectivity/hostapd/files/463-add-mcast_rate-to-11s.patch +++ b/recipes-connectivity/hostapd/files/463-add-mcast_rate-to-11s.patch @@ -1,4 +1,4 @@ -From ea7e69a3eece261a1a74797e340fd366006fb1d2 Mon Sep 17 00:00:00 2001 +From 8a960028810582f9ae32dc1e6e7d37cbc33b6fd7 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 11 May 2017 08:21:45 +0200 Subject: [PATCH] set mcast_rate in mesh mode @@ -25,22 +25,22 @@ Tested-by: Simon Wunderlich 3 files changed, 15 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h -index e7a2d8b64..32f093f0f 100644 +index 6e3bd2230..05ec9c23e 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1484,6 +1484,7 @@ struct wpa_driver_mesh_join_params { +@@ -1549,6 +1549,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; u8 handle_dfs; + int mcast_rate; }; - /** + struct wpa_driver_set_key_params { diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c -index b0c71d242..9b28a398e 100644 +index 7f87b8482..948f3c6fa 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -9612,6 +9612,18 @@ static int nl80211_put_mesh_id(struct nl_msg *msg, const u8 *mesh_id, +@@ -10061,6 +10061,18 @@ static int nl80211_put_mesh_id(struct nl_msg *msg, const u8 *mesh_id, } @@ -59,7 +59,7 @@ index b0c71d242..9b28a398e 100644 static int nl80211_put_mesh_config(struct nl_msg *msg, struct wpa_driver_mesh_bss_params *params) { -@@ -9673,6 +9685,7 @@ static int nl80211_join_mesh(struct i802_bss *bss, +@@ -10122,6 +10134,7 @@ static int nl80211_join_mesh(struct i802_bss *bss, 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) || @@ -68,10 +68,10 @@ index b0c71d242..9b28a398e 100644 goto fail; diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c -index 6f54ff764..8b98f040c 100644 +index e46435c66..a81a97d12 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c -@@ -494,6 +494,7 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, +@@ -592,6 +592,7 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, params->meshid = ssid->ssid; params->meshid_len = ssid->ssid_len; diff --git a/recipes-connectivity/hostapd/files/464-fix-mesh-obss-check.patch b/recipes-connectivity/hostapd/files/464-fix-mesh-obss-check.patch index d2e77d9..4e59c43 100644 --- a/recipes-connectivity/hostapd/files/464-fix-mesh-obss-check.patch +++ b/recipes-connectivity/hostapd/files/464-fix-mesh-obss-check.patch @@ -1,16 +1,16 @@ -From 090886c1b5dab18114042b8e40bfdb95c3ec1bb6 Mon Sep 17 00:00:00 2001 +From 5b5baca0e74062b5642c23c44cad656b3d2a1ee9 Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- wpa_supplicant/wpa_supplicant.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c -index a2d0dbcc2..09313bc94 100644 +index 44f6b90b4..74bdb6ea1 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2216,11 +2216,13 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, +@@ -2407,11 +2407,13 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, for (j = 0; j < wpa_s->last_scan_res_used; j++) { struct wpa_bss *bss = wpa_s->last_scan_res[j]; diff --git a/recipes-connectivity/hostapd/files/470-survey_data_fallback.patch b/recipes-connectivity/hostapd/files/470-survey_data_fallback.patch index 44f731e..6a6c38a 100644 --- a/recipes-connectivity/hostapd/files/470-survey_data_fallback.patch +++ b/recipes-connectivity/hostapd/files/470-survey_data_fallback.patch @@ -1,16 +1,16 @@ -From d0f0639468a04677e537a0bba481cebb46fc419c Mon Sep 17 00:00:00 2001 +From 89e0430eb616f09848a1811f1e40781c869c71fc Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- src/ap/acs.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/ap/acs.c b/src/ap/acs.c -index 11178a1f0..05b280459 100644 +index aa2ceb0d1..4993865b0 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c -@@ -293,18 +293,12 @@ static void acs_fail(struct hostapd_iface *iface) +@@ -302,18 +302,12 @@ static void acs_fail(struct hostapd_iface *iface) static long double acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf) { @@ -30,7 +30,7 @@ index 11178a1f0..05b280459 100644 total = survey->channel_time; -@@ -406,20 +400,19 @@ static int acs_usable_vht160_chan(const struct hostapd_channel_data *chan) +@@ -415,20 +409,19 @@ static int acs_usable_vht160_chan(const struct hostapd_channel_data *chan) static int acs_survey_is_sufficient(struct freq_survey *survey) { if (!(survey->filled & SURVEY_HAS_NF)) { diff --git a/recipes-connectivity/hostapd/files/500-lto-jobserver-support.patch b/recipes-connectivity/hostapd/files/500-lto-jobserver-support.patch index 301c488..74835f3 100644 --- a/recipes-connectivity/hostapd/files/500-lto-jobserver-support.patch +++ b/recipes-connectivity/hostapd/files/500-lto-jobserver-support.patch @@ -1,6 +1,6 @@ -From 860424f37dbbb730f6f086ec3bfe0245b335be47 Mon Sep 17 00:00:00 2001 +From 413d20ed2ea266a86ec468705b7a3cba3a79666e Mon Sep 17 00:00:00 2001 From: Patrick Walther -Date: Tue, 28 Jan 2020 15:14:35 +0100 +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/Makefile | 4 ++-- @@ -8,10 +8,10 @@ Date: Tue, 28 Jan 2020 15:14:35 +0100 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hostapd/Makefile b/hostapd/Makefile -index 94ffc1a66..637af7e4b 100644 +index abd2acdc9..3f62d6844 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -1332,14 +1332,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS) +@@ -1327,14 +1327,14 @@ hostapd_multi.a: $(BCHECK) $(OBJS) @$(AR) cr $@ hostapd_multi.o $(OBJS) hostapd: $(BCHECK) $(OBJS) @@ -29,10 +29,10 @@ index 94ffc1a66..637af7e4b 100644 NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile -index 3ee2d6eff..c4a66a0ad 100644 +index 16ea58f4a..238e31b0c 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -1932,23 +1932,23 @@ wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs) +@@ -1930,23 +1930,23 @@ wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs) @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) diff --git a/recipes-connectivity/hostapd/files/599-wpa_supplicant-fix-warnings.patch b/recipes-connectivity/hostapd/files/599-wpa_supplicant-fix-warnings.patch index d8efc9a..3260184 100644 --- a/recipes-connectivity/hostapd/files/599-wpa_supplicant-fix-warnings.patch +++ b/recipes-connectivity/hostapd/files/599-wpa_supplicant-fix-warnings.patch @@ -1,13 +1,13 @@ -From 12642c366d7043664153440940e2ed649150342f Mon Sep 17 00:00:00 2001 -From: OpenEmbedded -Date: Thu, 14 May 2020 19:48:53 +0000 +From a3e2b1f84e2a1bcf72fcc1b516296f9bce4616d5 Mon Sep 17 00:00:00 2001 +From: Patrick Walther +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- wpa_supplicant/wps_supplicant.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wpa_supplicant/wps_supplicant.h b/wpa_supplicant/wps_supplicant.h -index 0fbc85174..b7affc103 100644 +index c55936cee..52fb13bc1 100644 --- a/wpa_supplicant/wps_supplicant.h +++ b/wpa_supplicant/wps_supplicant.h @@ -9,6 +9,7 @@ diff --git a/recipes-connectivity/hostapd/files/700-wifi-reload.patch b/recipes-connectivity/hostapd/files/700-wifi-reload.patch index 3e85e2b..0b6526e 100644 --- a/recipes-connectivity/hostapd/files/700-wifi-reload.patch +++ b/recipes-connectivity/hostapd/files/700-wifi-reload.patch @@ -1,6 +1,6 @@ -From 8e5a25f2c0bdda989ac910a209b13b583d84e7a4 Mon Sep 17 00:00:00 2001 -From: OpenEmbedded -Date: Thu, 14 May 2020 19:48:53 +0000 +From 2e8209abe6fc9bd4e716596b9e82938e70cfba00 Mon Sep 17 00:00:00 2001 +From: Patrick Walther +Date: Fri, 24 Jul 2020 14:41:09 +0200 --- hostapd/config_file.c | 4 ++++ @@ -8,17 +8,17 @@ Date: Thu, 14 May 2020 19:48:53 +0000 hostapd/main.c | 2 +- src/ap/ap_config.c | 2 ++ src/ap/ap_config.h | 2 ++ - src/ap/hostapd.c | 39 ++++++++++++++++++++++++++++++++++++--- + src/ap/hostapd.c | 41 ++++++++++++++++++++++++++++++++++++++--- src/ap/hostapd.h | 5 +++-- src/ap/wps_hostapd.c | 2 +- src/drivers/driver_nl80211.c | 3 +++ - 9 files changed, 53 insertions(+), 8 deletions(-) + 9 files changed, 55 insertions(+), 8 deletions(-) diff --git a/hostapd/config_file.c b/hostapd/config_file.c -index 625104831..7ca790402 100644 +index ce0c62152..1631546d0 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2470,6 +2470,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, +@@ -2501,6 +2501,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, bss->isolate = atoi(pos); } else if (os_strcmp(buf, "ap_max_inactivity") == 0) { bss->ap_max_inactivity = atoi(pos); @@ -27,20 +27,20 @@ index 625104831..7ca790402 100644 } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) { bss->skip_inactivity_poll = atoi(pos); } else if (os_strcmp(buf, "country_code") == 0) { -@@ -3131,6 +3133,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, +@@ -3197,6 +3199,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, } } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) { conf->acs_exclude_dfs = atoi(pos); + } else if (os_strcmp(buf, "radio_config_id") == 0) { + conf->config_id = os_strdup(pos); + } else if (os_strcmp(buf, "op_class") == 0) { + conf->op_class = atoi(pos); } else if (os_strcmp(buf, "channel") == 0) { - if (os_strcmp(pos, "acs_survey") == 0) { - #ifndef CONFIG_ACS diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c -index ef24ebb74..880dec290 100644 +index 13d7aba60..5b7f075b7 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -182,7 +182,7 @@ static int hostapd_ctrl_iface_update(struct hostapd_data *hapd, char *txt) +@@ -184,7 +184,7 @@ static int hostapd_ctrl_iface_update(struct hostapd_data *hapd, char *txt) iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read; reload_opts = txt; @@ -50,10 +50,10 @@ index ef24ebb74..880dec290 100644 iface->interfaces->config_read_cb = config_read_cb; } diff --git a/hostapd/main.c b/hostapd/main.c -index f9b29aa88..6295cd258 100644 +index 9b44f4d41..62ee5642e 100644 --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -320,7 +320,7 @@ static void handle_term(int sig, void *signal_ctx) +@@ -317,7 +317,7 @@ static void handle_term(int sig, void *signal_ctx) static int handle_reload_iface(struct hostapd_iface *iface, void *ctx) { @@ -63,10 +63,10 @@ index f9b29aa88..6295cd258 100644 "file - continuing with old."); } diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c -index 90348e1dd..d732095be 100644 +index 1c6b4a00e..602c0068f 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c -@@ -698,6 +698,7 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf) +@@ -780,6 +780,7 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf) os_free(conf->radius_req_attr_sqlite); os_free(conf->rsn_preauth_interfaces); os_free(conf->ctrl_interface); @@ -74,7 +74,7 @@ index 90348e1dd..d732095be 100644 os_free(conf->ca_cert); os_free(conf->server_cert); os_free(conf->server_cert2); -@@ -881,6 +882,7 @@ void hostapd_config_free(struct hostapd_config *conf) +@@ -972,6 +973,7 @@ void hostapd_config_free(struct hostapd_config *conf) for (i = 0; i < conf->num_bss; i++) hostapd_config_free_bss(conf->bss[i]); @@ -83,10 +83,10 @@ index 90348e1dd..d732095be 100644 os_free(conf->supported_rates); os_free(conf->basic_rates); diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h -index 826030666..f27c51e80 100644 +index 319e8c108..37ace8fb9 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -829,6 +829,7 @@ struct hostapd_bss_config { +@@ -871,6 +871,7 @@ struct hostapd_bss_config { */ u8 mka_psk_set; #endif /* CONFIG_MACSEC */ @@ -94,19 +94,19 @@ index 826030666..f27c51e80 100644 }; /** -@@ -1012,6 +1013,7 @@ struct hostapd_config { +@@ -1062,6 +1063,7 @@ struct hostapd_config { unsigned int airtime_update_interval; #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1) #endif /* CONFIG_AIRTIME_POLICY */ + char *config_id; + + u8 notify_mgmt_frames; }; - - diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c -index 9227a1f01..847f7058b 100644 +index 3629f54ad..5b23208f6 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -206,6 +206,10 @@ static int hostapd_iface_conf_changed(struct hostapd_config *newconf, +@@ -218,6 +218,10 @@ static int hostapd_iface_conf_changed(struct hostapd_config *newconf, { size_t i; @@ -117,7 +117,7 @@ index 9227a1f01..847f7058b 100644 if (newconf->num_bss != oldconf->num_bss) return 1; -@@ -219,7 +223,7 @@ static int hostapd_iface_conf_changed(struct hostapd_config *newconf, +@@ -231,7 +235,7 @@ static int hostapd_iface_conf_changed(struct hostapd_config *newconf, } @@ -126,7 +126,7 @@ index 9227a1f01..847f7058b 100644 { struct hapd_interfaces *interfaces = iface->interfaces; struct hostapd_data *hapd = iface->bss[0]; -@@ -242,13 +246,16 @@ int hostapd_reload_config(struct hostapd_iface *iface) +@@ -254,13 +258,16 @@ int hostapd_reload_config(struct hostapd_iface *iface) if (newconf == NULL) return -1; @@ -145,7 +145,7 @@ index 9227a1f01..847f7058b 100644 wpa_printf(MSG_DEBUG, "Configuration changes include interface/BSS modification - force full disable+enable sequence"); fname = os_strdup(iface->config_fname); -@@ -273,6 +280,22 @@ int hostapd_reload_config(struct hostapd_iface *iface) +@@ -285,6 +292,24 @@ int hostapd_reload_config(struct hostapd_iface *iface) wpa_printf(MSG_ERROR, "Failed to enable interface on config reload"); return res; @@ -155,20 +155,22 @@ index 9227a1f01..847f7058b 100644 + if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) { + hostapd_flush_old_stations(iface->bss[j], + WLAN_REASON_PREV_AUTH_NOT_VALID); ++#ifdef CONFIG_WEP + hostapd_broadcast_wep_clear(iface->bss[j]); ++#endif + +#ifndef CONFIG_NO_RADIUS + /* TODO: update dynamic data based on changed configuration + * items (e.g., open/close sockets, etc.) */ + radius_client_flush(iface->bss[j]->radius, 0); +#endif /* CONFIG_NO_RADIUS */ -+ wpa_printf(MSG_INFO, "bss %d changed", j); ++ wpa_printf(MSG_INFO, "bss %zu changed", j); + } + } } iface->conf = newconf; -@@ -289,6 +312,12 @@ int hostapd_reload_config(struct hostapd_iface *iface) +@@ -301,6 +326,12 @@ int hostapd_reload_config(struct hostapd_iface *iface) for (j = 0; j < iface->num_bss; j++) { hapd = iface->bss[j]; @@ -181,7 +183,7 @@ index 9227a1f01..847f7058b 100644 hapd->iconf = newconf; hapd->conf = newconf->bss[j]; hostapd_reload_bss(hapd); -@@ -2252,6 +2281,10 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, +@@ -2361,6 +2392,10 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, hapd->iconf = conf; hapd->conf = bss; hapd->iface = hapd_iface; @@ -193,10 +195,10 @@ index 9227a1f01..847f7058b 100644 hapd->driver = conf->driver; hapd->ctrl_sock = -1; diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h -index 518c7f10b..7cbd5fd46 100644 +index 4ce31416d..8412ec226 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -41,7 +41,7 @@ struct mesh_conf; +@@ -45,7 +45,7 @@ struct mesh_conf; struct hostapd_iface; struct hapd_interfaces { @@ -205,7 +207,7 @@ index 518c7f10b..7cbd5fd46 100644 struct hostapd_config * (*config_read_cb)(const char *config_fname); int (*ctrl_iface_init)(struct hostapd_data *hapd); void (*ctrl_iface_deinit)(struct hostapd_data *hapd); -@@ -145,6 +145,7 @@ struct hostapd_data { +@@ -154,6 +154,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -213,7 +215,7 @@ index 518c7f10b..7cbd5fd46 100644 int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; -@@ -572,7 +573,7 @@ struct hostapd_iface { +@@ -598,7 +599,7 @@ struct hostapd_iface { int hostapd_for_each_interface(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); @@ -223,10 +225,10 @@ index 518c7f10b..7cbd5fd46 100644 struct hostapd_data * hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c -index 4a0302043..2c0038c1a 100644 +index 18925f0c3..e71960569 100644 --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c -@@ -275,7 +275,7 @@ static void wps_reload_config(void *eloop_data, void *user_ctx) +@@ -315,7 +315,7 @@ static void wps_reload_config(void *eloop_data, void *user_ctx) wpa_printf(MSG_DEBUG, "WPS: Reload configuration data"); if (iface->interfaces == NULL || @@ -236,10 +238,10 @@ index 4a0302043..2c0038c1a 100644 "configuration"); } diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c -index 9b28a398e..bef4ed32d 100644 +index 948f3c6fa..ffeb116ef 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4295,6 +4295,9 @@ static int wpa_driver_nl80211_set_ap(void *priv, +@@ -4511,6 +4511,9 @@ static int wpa_driver_nl80211_set_ap(void *priv, if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", ret, strerror(-ret)); diff --git a/recipes-connectivity/hostapd/files/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch b/recipes-connectivity/hostapd/files/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch new file mode 100644 index 0000000..6c37a14 --- /dev/null +++ b/recipes-connectivity/hostapd/files/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch @@ -0,0 +1,40 @@ +From 45e2411ad553ed6a89fb2c4f9058e27de91c689d Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Fri, 3 Jul 2020 23:00:34 +0200 +Subject: [PATCH] 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 + +--- + src/ap/dfs.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/ap/dfs.c b/src/ap/dfs.c +index 8f3630bf8..54a61b0a7 100644 +--- a/src/ap/dfs.c ++++ b/src/ap/dfs.c +@@ -1086,8 +1086,15 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) + &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; diff --git a/recipes-connectivity/hostapd/files/800-usleep.patch b/recipes-connectivity/hostapd/files/800-usleep.patch deleted file mode 100644 index 0b35da6..0000000 --- a/recipes-connectivity/hostapd/files/800-usleep.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 52f53957d41082597fbdfc5b8d79ee72d85cea36 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Sat, 24 Aug 2019 15:01:16 -0700 -Subject: [PATCH] os_sleep: Use nanosleep for POSIX versions 2008 and higher - -uClibc-ng optionally disabled deprecated POSIX functions like usleep, -causing compilation failures. This switches to nanosleep while retaining -support for older libcs that do not support nanosleep. - -Signed-off-by: Rosen Penev - ---- - src/utils/os_internal.c | 6 ++++++ - src/utils/os_unix.c | 6 ++++++ - 2 files changed, 12 insertions(+) - -diff --git a/src/utils/os_internal.c b/src/utils/os_internal.c -index 474c8a372..feade6ee6 100644 ---- a/src/utils/os_internal.c -+++ b/src/utils/os_internal.c -@@ -25,10 +25,16 @@ - - void os_sleep(os_time_t sec, os_time_t usec) - { -+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) -+ const struct timespec req = { sec, usec * 1000 }; -+ -+ nanosleep(&req, NULL); -+#else - if (sec) - sleep(sec); - if (usec) - usleep(usec); -+#endif - } - - -diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c -index 6231974cf..c0a1cceb1 100644 ---- a/src/utils/os_unix.c -+++ b/src/utils/os_unix.c -@@ -50,10 +50,16 @@ struct os_alloc_trace { - - void os_sleep(os_time_t sec, os_time_t usec) - { -+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) -+ const struct timespec req = { sec, usec * 1000 }; -+ -+ nanosleep(&req, NULL); -+#else - if (sec) - sleep(sec); - if (usec) - usleep(usec); -+#endif - } - - diff --git a/recipes-connectivity/hostapd/files/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch b/recipes-connectivity/hostapd/files/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch new file mode 100644 index 0000000..58c202d --- /dev/null +++ b/recipes-connectivity/hostapd/files/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch @@ -0,0 +1,36 @@ +From a753b7dad5275637b214a7de5c8de451586f7050 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +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 + +--- + src/p2p/p2p.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c +index b7a5eae35..498ff54f8 100644 +--- a/src/p2p/p2p.c ++++ b/src/p2p/p2p.c +@@ -453,6 +453,8 @@ static void p2p_copy_client_info(struct p2p_device *dev, + 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); + } diff --git a/recipes-connectivity/hostapd/files/912-iapp-integration.patch b/recipes-connectivity/hostapd/files/912-iapp-integration.patch new file mode 100644 index 0000000..697f403 --- /dev/null +++ b/recipes-connectivity/hostapd/files/912-iapp-integration.patch @@ -0,0 +1,865 @@ +From 59998a2c8a98b390ed94fef09ca657d9c755bd58 Mon Sep 17 00:00:00 2001 +From: Patrick Walther +Date: Tue, 23 Mar 2021 16:00:24 +0100 +Subject: [PATCH] commit 61e4fb918e299376d4f0a53485b74560f168eb52 + + Revert "Remove IAPP functionality from hostapd" + + This reverts commit 018edec9b2bd3db20605117c32ff79c1e625c432. + +--- + hostapd/Android.mk | 5 + + hostapd/Makefile | 5 + + hostapd/android.config | 3 + + hostapd/config_file.c | 3 +- + hostapd/defconfig | 3 + + hostapd/hostapd.conf | 6 + + hostapd/main.c | 3 + + src/ap/Makefile | 2 + + src/ap/ap_config.h | 4 + + src/ap/hostapd.c | 14 + + src/ap/hostapd.h | 2 + + src/ap/iapp.c | 542 ++++++++++++++++++++++++++++++ + src/ap/iapp.h | 39 +++ + src/utils/wpa_debug.h | 1 + + tests/build/build-hostapd-internal.config | 1 + + tests/hwsim/example-hostapd.config | 1 + + 16 files changed, 633 insertions(+), 1 deletion(-) + create mode 100644 src/ap/iapp.c + create mode 100644 src/ap/iapp.h + +diff --git a/hostapd/Android.mk b/hostapd/Android.mk +index 6cfbe5c22..bb96db8c0 100644 +--- a/hostapd/Android.mk ++++ b/hostapd/Android.mk +@@ -206,6 +206,11 @@ endif + + L_CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX + ++ifdef CONFIG_IAPP ++L_CFLAGS += -DCONFIG_IAPP ++OBJS += src/ap/iapp.c ++endif ++ + ifdef CONFIG_RSN_PREAUTH + L_CFLAGS += -DCONFIG_RSN_PREAUTH + CONFIG_L2_PACKET=y +diff --git a/hostapd/Makefile b/hostapd/Makefile +index 3f62d6844..e227a8807 100644 +--- a/hostapd/Makefile ++++ b/hostapd/Makefile +@@ -259,6 +259,11 @@ ifndef CONFIG_NO_CTRL_IFACE + CFLAGS += -DCONFIG_CTRL_IFACE + endif + ++ifdef CONFIG_IAPP ++CFLAGS += -DCONFIG_IAPP ++OBJS += ../src/ap/iapp.o ++endif ++ + ifdef CONFIG_RSN_PREAUTH + CFLAGS += -DCONFIG_RSN_PREAUTH + CONFIG_L2_PACKET=y +diff --git a/hostapd/android.config b/hostapd/android.config +index 94a9bb47b..eada5b2f6 100644 +--- a/hostapd/android.config ++++ b/hostapd/android.config +@@ -38,6 +38,9 @@ CONFIG_DRIVER_NL80211_QCA=y + # Driver interface for no driver (e.g., RADIUS server only) + #CONFIG_DRIVER_NONE=y + ++# IEEE 802.11F/IAPP ++#CONFIG_IAPP=y ++ + # WPA2/IEEE 802.11i RSN pre-authentication + #CONFIG_RSN_PREAUTH=y + +diff --git a/hostapd/config_file.c b/hostapd/config_file.c +index 1631546d0..9ae56ffff 100644 +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -2756,7 +2756,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, + bss->eapol_key_index_workaround = atoi(pos); + #ifdef CONFIG_IAPP + } else if (os_strcmp(buf, "iapp_interface") == 0) { +- wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used"); ++ bss->ieee802_11f = 1; ++ os_strlcpy(bss->iapp_iface, pos, sizeof(bss->iapp_iface)); + #endif /* CONFIG_IAPP */ + } else if (os_strcmp(buf, "own_ip_addr") == 0) { + if (hostapd_parse_ip_addr(pos, &bss->own_ip_addr)) { +diff --git a/hostapd/defconfig b/hostapd/defconfig +index 64f03bd84..45dee2135 100644 +--- a/hostapd/defconfig ++++ b/hostapd/defconfig +@@ -44,6 +44,9 @@ CONFIG_LIBNL32=y + # Driver interface for no driver (e.g., RADIUS server only) + #CONFIG_DRIVER_NONE=y + ++# IEEE 802.11F/IAPP ++CONFIG_IAPP=y ++ + # WPA2/IEEE 802.11i RSN pre-authentication + CONFIG_RSN_PREAUTH=y + +diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf +index e31885545..fcf568b5e 100644 +--- a/hostapd/hostapd.conf ++++ b/hostapd/hostapd.conf +@@ -41,6 +41,7 @@ interface=wlan0 + # bit 2 (4) = RADIUS + # bit 3 (8) = WPA + # bit 4 (16) = driver interface ++# bit 5 (32) = IAPP + # bit 6 (64) = MLME + # + # Levels (minimum value for logged events): +@@ -1276,6 +1277,11 @@ eap_server=0 + # Whether to enable ERP on the EAP server. + #eap_server_erp=1 + ++##### IEEE 802.11f - Inter-Access Point Protocol (IAPP) ####################### ++ ++# Interface to be used for IAPP broadcast packets ++#iapp_interface=eth0 ++ + + ##### RADIUS client configuration ############################################# + # for IEEE 802.1X with external Authentication Server, IEEE 802.11 +diff --git a/hostapd/main.c b/hostapd/main.c +index 62ee5642e..609b453cb 100644 +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -84,6 +84,9 @@ static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, + case HOSTAPD_MODULE_DRIVER: + module_str = "DRIVER"; + break; ++ case HOSTAPD_MODULE_IAPP: ++ module_str = "IAPP"; ++ break; + case HOSTAPD_MODULE_MLME: + module_str = "MLME"; + break; +diff --git a/src/ap/Makefile b/src/ap/Makefile +index 54e48a0dd..bd3f33b77 100644 +--- a/src/ap/Makefile ++++ b/src/ap/Makefile +@@ -18,6 +18,7 @@ CFLAGS += -DCONFIG_IEEE80211R_AP + CFLAGS += -DCONFIG_WPS + CFLAGS += -DCONFIG_PROXYARP + CFLAGS += -DCONFIG_IPV6 ++CFLAGS += -DCONFIG_IAPP + CFLAGS += -DCONFIG_AIRTIME_POLICY + + LIB_OBJS= \ +@@ -40,6 +41,7 @@ LIB_OBJS= \ + hostapd.o \ + hs20.o \ + hw_features.o \ ++ iapp.o \ + ieee802_11_auth.o \ + ieee802_11.o \ + ieee802_11_ht.o \ +diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h +index 37ace8fb9..f7b509325 100644 +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -339,6 +339,10 @@ struct hostapd_bss_config { + int erp_send_reauth_start; + char *erp_domain; + ++ int ieee802_11f; /* use IEEE 802.11f (IAPP) */ ++ char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast ++ * frames */ ++ + enum macaddr_acl { + ACCEPT_UNLESS_DENIED = 0, + DENY_UNLESS_ACCEPTED = 1, +diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c +index 5b23208f6..ebc0488d0 100644 +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -29,6 +29,7 @@ + #include "accounting.h" + #include "ap_list.h" + #include "beacon.h" ++#include "iapp.h" + #include "ieee802_1x.h" + #include "ieee802_11_auth.h" + #include "vlan_init.h" +@@ -426,6 +427,8 @@ void hostapd_free_hapd_data(struct hostapd_data *hapd) + hapd->beacon_set_done = 0; + + wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); ++ iapp_deinit(hapd->iapp); ++ hapd->iapp = NULL; + accounting_deinit(hapd); + hostapd_deinit_wpa(hapd); + vlan_deinit(hapd); +@@ -1380,6 +1383,13 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) + return -1; + } + ++ if (conf->ieee802_11f && ++ (hapd->iapp = iapp_init(hapd, conf->iapp_iface)) == NULL) { ++ wpa_printf(MSG_ERROR, "IEEE 802.11F (IAPP) initialization " ++ "failed."); ++ return -1; ++ } ++ + #ifdef CONFIG_INTERWORKING + if (gas_serv_init(hapd)) { + wpa_printf(MSG_ERROR, "GAS server initialization failed"); +@@ -3238,6 +3248,10 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, + ap_sta_clear_disconnect_timeouts(hapd, sta); + sta->post_csa_sa_query = 0; + ++ /* IEEE 802.11F (IAPP) */ ++ if (hapd->conf->ieee802_11f) ++ iapp_new_station(hapd->iapp, sta); ++ + #ifdef CONFIG_P2P + if (sta->p2p_ie == NULL && !sta->no_p2p_set) { + sta->no_p2p_set = 1; +diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h +index 8412ec226..6f844348f 100644 +--- a/src/ap/hostapd.h ++++ b/src/ap/hostapd.h +@@ -189,6 +189,8 @@ struct hostapd_data { + u64 acct_session_id; + struct radius_das_data *radius_das; + ++ struct iapp_data *iapp; ++ + struct hostapd_cached_radius_acl *acl_cache; + struct hostapd_acl_query_data *acl_queries; + +diff --git a/src/ap/iapp.c b/src/ap/iapp.c +new file mode 100644 +index 000000000..2556da30c +--- /dev/null ++++ b/src/ap/iapp.c +@@ -0,0 +1,542 @@ ++/* ++ * hostapd / IEEE 802.11F-2003 Inter-Access Point Protocol (IAPP) ++ * Copyright (c) 2002-2007, Jouni Malinen ++ * ++ * This software may be distributed under the terms of the BSD license. ++ * See README for more details. ++ * ++ * Note: IEEE 802.11F-2003 was a experimental use specification. It has expired ++ * and IEEE has withdrawn it. In other words, it is likely better to look at ++ * using some other mechanism for AP-to-AP communication than extending the ++ * implementation here. ++ */ ++ ++/* TODO: ++ * Level 1: no administrative or security support ++ * (e.g., static BSSID to IP address mapping in each AP) ++ * Level 2: support for dynamic mapping of BSSID to IP address ++ * Level 3: support for encryption and authentication of IAPP messages ++ * - add support for MOVE-notify and MOVE-response (this requires support for ++ * finding out IP address for previous AP using RADIUS) ++ * - add support for Send- and ACK-Security-Block to speedup IEEE 802.1X during ++ * reassociation to another AP ++ * - implement counters etc. for IAPP MIB ++ * - verify endianness of fields in IAPP messages; are they big-endian as ++ * used here? ++ * - RADIUS connection for AP registration and BSSID to IP address mapping ++ * - TCP connection for IAPP MOVE, CACHE ++ * - broadcast ESP for IAPP ADD-notify ++ * - ESP for IAPP MOVE messages ++ * - security block sending/processing ++ * - IEEE 802.11 context transfer ++ */ ++ ++#include "utils/includes.h" ++#include ++#include ++#include ++ ++#include "utils/common.h" ++#include "utils/eloop.h" ++#include "common/ieee802_11_defs.h" ++#include "hostapd.h" ++#include "ap_config.h" ++#include "ieee802_11.h" ++#include "sta_info.h" ++#include "iapp.h" ++ ++ ++#define IAPP_MULTICAST "224.0.1.178" ++#define IAPP_UDP_PORT 3517 ++#define IAPP_TCP_PORT 3517 ++ ++struct iapp_hdr { ++ u8 version; ++ u8 command; ++ be16 identifier; ++ be16 length; ++ /* followed by length-6 octets of data */ ++} __attribute__ ((packed)); ++ ++#define IAPP_VERSION 0 ++ ++enum IAPP_COMMAND { ++ IAPP_CMD_ADD_notify = 0, ++ IAPP_CMD_MOVE_notify = 1, ++ IAPP_CMD_MOVE_response = 2, ++ IAPP_CMD_Send_Security_Block = 3, ++ IAPP_CMD_ACK_Security_Block = 4, ++ IAPP_CMD_CACHE_notify = 5, ++ IAPP_CMD_CACHE_response = 6, ++}; ++ ++ ++/* ADD-notify - multicast UDP on the local LAN */ ++struct iapp_add_notify { ++ u8 addr_len; /* ETH_ALEN */ ++ u8 reserved; ++ u8 mac_addr[ETH_ALEN]; ++ be16 seq_num; ++} __attribute__ ((packed)); ++ ++ ++/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ ++struct iapp_layer2_update { ++ u8 da[ETH_ALEN]; /* broadcast */ ++ u8 sa[ETH_ALEN]; /* STA addr */ ++ be16 len; /* 6 */ ++ u8 dsap; /* null DSAP address */ ++ u8 ssap; /* null SSAP address, CR=Response */ ++ u8 control; ++ u8 xid_info[3]; ++} __attribute__ ((packed)); ++ ++ ++/* MOVE-notify - unicast TCP */ ++struct iapp_move_notify { ++ u8 addr_len; /* ETH_ALEN */ ++ u8 reserved; ++ u8 mac_addr[ETH_ALEN]; ++ u16 seq_num; ++ u16 ctx_block_len; ++ /* followed by ctx_block_len bytes */ ++} __attribute__ ((packed)); ++ ++ ++/* MOVE-response - unicast TCP */ ++struct iapp_move_response { ++ u8 addr_len; /* ETH_ALEN */ ++ u8 status; ++ u8 mac_addr[ETH_ALEN]; ++ u16 seq_num; ++ u16 ctx_block_len; ++ /* followed by ctx_block_len bytes */ ++} __attribute__ ((packed)); ++ ++enum { ++ IAPP_MOVE_SUCCESSFUL = 0, ++ IAPP_MOVE_DENIED = 1, ++ IAPP_MOVE_STALE_MOVE = 2, ++}; ++ ++ ++/* CACHE-notify */ ++struct iapp_cache_notify { ++ u8 addr_len; /* ETH_ALEN */ ++ u8 reserved; ++ u8 mac_addr[ETH_ALEN]; ++ u16 seq_num; ++ u8 current_ap[ETH_ALEN]; ++ u16 ctx_block_len; ++ /* ctx_block_len bytes of context block followed by 16-bit context ++ * timeout */ ++} __attribute__ ((packed)); ++ ++ ++/* CACHE-response - unicast TCP */ ++struct iapp_cache_response { ++ u8 addr_len; /* ETH_ALEN */ ++ u8 status; ++ u8 mac_addr[ETH_ALEN]; ++ u16 seq_num; ++} __attribute__ ((packed)); ++ ++enum { ++ IAPP_CACHE_SUCCESSFUL = 0, ++ IAPP_CACHE_STALE_CACHE = 1, ++}; ++ ++ ++/* Send-Security-Block - unicast TCP */ ++struct iapp_send_security_block { ++ u8 iv[8]; ++ u16 sec_block_len; ++ /* followed by sec_block_len bytes of security block */ ++} __attribute__ ((packed)); ++ ++ ++/* ACK-Security-Block - unicast TCP */ ++struct iapp_ack_security_block { ++ u8 iv[8]; ++ u8 new_ap_ack_authenticator[48]; ++} __attribute__ ((packed)); ++ ++ ++struct iapp_data { ++ struct hostapd_data *hapd; ++ u16 identifier; /* next IAPP identifier */ ++ struct in_addr own, multicast; ++ int udp_sock; ++ int packet_sock; ++}; ++ ++ ++static void iapp_send_add(struct iapp_data *iapp, u8 *mac_addr, u16 seq_num) ++{ ++ char buf[128]; ++ struct iapp_hdr *hdr; ++ struct iapp_add_notify *add; ++ struct sockaddr_in addr; ++ ++ /* Send IAPP ADD-notify to remove possible association from other APs ++ */ ++ ++ hdr = (struct iapp_hdr *) buf; ++ hdr->version = IAPP_VERSION; ++ hdr->command = IAPP_CMD_ADD_notify; ++ hdr->identifier = host_to_be16(iapp->identifier++); ++ hdr->length = host_to_be16(sizeof(*hdr) + sizeof(*add)); ++ ++ add = (struct iapp_add_notify *) (hdr + 1); ++ add->addr_len = ETH_ALEN; ++ add->reserved = 0; ++ os_memcpy(add->mac_addr, mac_addr, ETH_ALEN); ++ ++ add->seq_num = host_to_be16(seq_num); ++ ++ os_memset(&addr, 0, sizeof(addr)); ++ addr.sin_family = AF_INET; ++ addr.sin_addr.s_addr = iapp->multicast.s_addr; ++ addr.sin_port = htons(IAPP_UDP_PORT); ++ if (sendto(iapp->udp_sock, buf, (char *) (add + 1) - buf, 0, ++ (struct sockaddr *) &addr, sizeof(addr)) < 0) ++ wpa_printf(MSG_INFO, "sendto[IAPP-ADD]: %s", strerror(errno)); ++} ++ ++ ++static void iapp_send_layer2_update(struct iapp_data *iapp, u8 *addr) ++{ ++ struct iapp_layer2_update msg; ++ ++ /* Send Level 2 Update Frame to update forwarding tables in layer 2 ++ * bridge devices */ ++ ++ /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) ++ * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ ++ ++ os_memset(msg.da, 0xff, ETH_ALEN); ++ os_memcpy(msg.sa, addr, ETH_ALEN); ++ msg.len = host_to_be16(6); ++ msg.dsap = 0; /* NULL DSAP address */ ++ msg.ssap = 0x01; /* NULL SSAP address, CR Bit: Response */ ++ msg.control = 0xaf; /* XID response lsb.1111F101. ++ * F=0 (no poll command; unsolicited frame) */ ++ msg.xid_info[0] = 0x81; /* XID format identifier */ ++ msg.xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ ++ msg.xid_info[2] = 1 << 1; /* XID sender's receive window size (RW) ++ * FIX: what is correct RW with 802.11? */ ++ ++ if (send(iapp->packet_sock, &msg, sizeof(msg), 0) < 0) ++ wpa_printf(MSG_INFO, "send[L2 Update]: %s", strerror(errno)); ++} ++ ++ ++/** ++ * iapp_new_station - IAPP processing for a new STA ++ * @iapp: IAPP data ++ * @sta: The associated station ++ */ ++void iapp_new_station(struct iapp_data *iapp, struct sta_info *sta) ++{ ++ u16 seq = 0; /* TODO */ ++ ++ if (iapp == NULL) ++ return; ++ ++ /* IAPP-ADD.request(MAC Address, Sequence Number, Timeout) */ ++ hostapd_logger(iapp->hapd, sta->addr, HOSTAPD_MODULE_IAPP, ++ HOSTAPD_LEVEL_DEBUG, "IAPP-ADD.request(seq=%d)", seq); ++ iapp_send_layer2_update(iapp, sta->addr); ++ iapp_send_add(iapp, sta->addr, seq); ++ ++ /* TODO: If this was reassociation: ++ * IAPP-MOVE.request(MAC Address, Sequence Number, Old AP, ++ * Context Block, Timeout) ++ * TODO: Send IAPP-MOVE to the old AP; Map Old AP BSSID to ++ * IP address */ ++} ++ ++ ++static void iapp_process_add_notify(struct iapp_data *iapp, ++ struct sockaddr_in *from, ++ struct iapp_hdr *hdr, int len) ++{ ++ struct iapp_add_notify *add = (struct iapp_add_notify *) (hdr + 1); ++ struct sta_info *sta; ++ ++ if (len != sizeof(*add)) { ++ wpa_printf(MSG_INFO, "Invalid IAPP-ADD packet length %d (expected %lu)", ++ len, (unsigned long) sizeof(*add)); ++ return; ++ } ++ ++ sta = ap_get_sta(iapp->hapd, add->mac_addr); ++ ++ /* IAPP-ADD.indication(MAC Address, Sequence Number) */ ++ hostapd_logger(iapp->hapd, add->mac_addr, HOSTAPD_MODULE_IAPP, ++ HOSTAPD_LEVEL_INFO, ++ "Received IAPP ADD-notify (seq# %d) from %s:%d%s", ++ be_to_host16(add->seq_num), ++ inet_ntoa(from->sin_addr), ntohs(from->sin_port), ++ sta ? "" : " (STA not found)"); ++ ++ if (!sta) ++ return; ++ ++ /* TODO: could use seq_num to try to determine whether last association ++ * to this AP is newer than the one advertised in IAPP-ADD. Although, ++ * this is not really a reliable verification. */ ++ ++ hostapd_logger(iapp->hapd, add->mac_addr, HOSTAPD_MODULE_IAPP, ++ HOSTAPD_LEVEL_DEBUG, ++ "Removing STA due to IAPP ADD-notify"); ++ ap_sta_disconnect(iapp->hapd, sta, NULL, 0); ++} ++ ++ ++/** ++ * iapp_receive_udp - Process IAPP UDP frames ++ * @sock: File descriptor for the socket ++ * @eloop_ctx: IAPP data (struct iapp_data *) ++ * @sock_ctx: Not used ++ */ ++static void iapp_receive_udp(int sock, void *eloop_ctx, void *sock_ctx) ++{ ++ struct iapp_data *iapp = eloop_ctx; ++ int len, hlen; ++ unsigned char buf[128]; ++ struct sockaddr_in from; ++ socklen_t fromlen; ++ struct iapp_hdr *hdr; ++ ++ /* Handle incoming IAPP frames (over UDP/IP) */ ++ ++ fromlen = sizeof(from); ++ len = recvfrom(iapp->udp_sock, buf, sizeof(buf), 0, ++ (struct sockaddr *) &from, &fromlen); ++ if (len < 0) { ++ wpa_printf(MSG_INFO, "iapp_receive_udp - recvfrom: %s", ++ strerror(errno)); ++ return; ++ } ++ ++ if (from.sin_addr.s_addr == iapp->own.s_addr) ++ return; /* ignore own IAPP messages */ ++ ++ hostapd_logger(iapp->hapd, NULL, HOSTAPD_MODULE_IAPP, ++ HOSTAPD_LEVEL_DEBUG, ++ "Received %d byte IAPP frame from %s%s\n", ++ len, inet_ntoa(from.sin_addr), ++ len < (int) sizeof(*hdr) ? " (too short)" : ""); ++ ++ if (len < (int) sizeof(*hdr)) ++ return; ++ ++ hdr = (struct iapp_hdr *) buf; ++ hlen = be_to_host16(hdr->length); ++ hostapd_logger(iapp->hapd, NULL, HOSTAPD_MODULE_IAPP, ++ HOSTAPD_LEVEL_DEBUG, ++ "RX: version=%d command=%d id=%d len=%d\n", ++ hdr->version, hdr->command, ++ be_to_host16(hdr->identifier), hlen); ++ if (hdr->version != IAPP_VERSION) { ++ wpa_printf(MSG_INFO, "Dropping IAPP frame with unknown version %d", ++ hdr->version); ++ return; ++ } ++ if (hlen > len) { ++ wpa_printf(MSG_INFO, "Underflow IAPP frame (hlen=%d len=%d)", ++ hlen, len); ++ return; ++ } ++ if (hlen < len) { ++ wpa_printf(MSG_INFO, "Ignoring %d extra bytes from IAPP frame", ++ len - hlen); ++ len = hlen; ++ } ++ ++ switch (hdr->command) { ++ case IAPP_CMD_ADD_notify: ++ iapp_process_add_notify(iapp, &from, hdr, len - sizeof(*hdr)); ++ break; ++ case IAPP_CMD_MOVE_notify: ++ /* TODO: MOVE is using TCP; so move this to TCP handler once it ++ * is implemented.. */ ++ /* IAPP-MOVE.indication(MAC Address, New BSSID, ++ * Sequence Number, AP Address, Context Block) */ ++ /* TODO: process */ ++ break; ++ default: ++ wpa_printf(MSG_INFO, "Unknown IAPP command %d", hdr->command); ++ break; ++ } ++} ++ ++ ++struct iapp_data * iapp_init(struct hostapd_data *hapd, const char *iface) ++{ ++ struct ifreq ifr; ++ struct sockaddr_ll addr; ++ int ifindex; ++ struct sockaddr_in *paddr, uaddr; ++ struct iapp_data *iapp; ++ struct ip_mreqn mreq; ++ int reuseaddr = 1; ++ ++ iapp = os_zalloc(sizeof(*iapp)); ++ if (iapp == NULL) ++ return NULL; ++ iapp->hapd = hapd; ++ iapp->udp_sock = iapp->packet_sock = -1; ++ ++ /* TODO: ++ * open socket for sending and receiving IAPP frames over TCP ++ */ ++ ++ iapp->udp_sock = socket(PF_INET, SOCK_DGRAM, 0); ++ if (iapp->udp_sock < 0) { ++ wpa_printf(MSG_INFO, "iapp_init - socket[PF_INET,SOCK_DGRAM]: %s", ++ strerror(errno)); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ ++ os_memset(&ifr, 0, sizeof(ifr)); ++ os_strlcpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)); ++ if (ioctl(iapp->udp_sock, SIOCGIFINDEX, &ifr) != 0) { ++ wpa_printf(MSG_INFO, "iapp_init - ioctl(SIOCGIFINDEX): %s", ++ strerror(errno)); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ ifindex = ifr.ifr_ifindex; ++ ++ if (ioctl(iapp->udp_sock, SIOCGIFADDR, &ifr) != 0) { ++ wpa_printf(MSG_INFO, "iapp_init - ioctl(SIOCGIFADDR): %s", ++ strerror(errno)); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ paddr = (struct sockaddr_in *) &ifr.ifr_addr; ++ if (paddr->sin_family != AF_INET) { ++ wpa_printf(MSG_INFO, "IAPP: Invalid address family %i (SIOCGIFADDR)", ++ paddr->sin_family); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ iapp->own.s_addr = paddr->sin_addr.s_addr; ++ ++ if (ioctl(iapp->udp_sock, SIOCGIFBRDADDR, &ifr) != 0) { ++ wpa_printf(MSG_INFO, "iapp_init - ioctl(SIOCGIFBRDADDR): %s", ++ strerror(errno)); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ paddr = (struct sockaddr_in *) &ifr.ifr_addr; ++ if (paddr->sin_family != AF_INET) { ++ wpa_printf(MSG_INFO, "Invalid address family %i (SIOCGIFBRDADDR)", ++ paddr->sin_family); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ inet_aton(IAPP_MULTICAST, &iapp->multicast); ++ ++ os_memset(&uaddr, 0, sizeof(uaddr)); ++ uaddr.sin_family = AF_INET; ++ uaddr.sin_port = htons(IAPP_UDP_PORT); ++ ++ if (setsockopt(iapp->udp_sock, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, ++ sizeof(reuseaddr)) < 0) { ++ wpa_printf(MSG_INFO, ++ "iapp_init - setsockopt[UDP,SO_REUSEADDR]: %s", ++ strerror(errno)); ++ /* ++ * Ignore this and try to continue. This is fine for single ++ * BSS cases, but may fail if multiple BSSes enable IAPP. ++ */ ++ } ++ ++ if (bind(iapp->udp_sock, (struct sockaddr *) &uaddr, ++ sizeof(uaddr)) < 0) { ++ wpa_printf(MSG_INFO, "iapp_init - bind[UDP]: %s", ++ strerror(errno)); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ ++ os_memset(&mreq, 0, sizeof(mreq)); ++ mreq.imr_multiaddr = iapp->multicast; ++ mreq.imr_address.s_addr = INADDR_ANY; ++ mreq.imr_ifindex = 0; ++ if (setsockopt(iapp->udp_sock, SOL_IP, IP_ADD_MEMBERSHIP, &mreq, ++ sizeof(mreq)) < 0) { ++ wpa_printf(MSG_INFO, "iapp_init - setsockopt[UDP,IP_ADD_MEMBERSHIP]: %s", ++ strerror(errno)); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ ++ iapp->packet_sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); ++ if (iapp->packet_sock < 0) { ++ wpa_printf(MSG_INFO, "iapp_init - socket[PF_PACKET,SOCK_RAW]: %s", ++ strerror(errno)); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ ++ os_memset(&addr, 0, sizeof(addr)); ++ addr.sll_family = AF_PACKET; ++ addr.sll_ifindex = ifindex; ++ if (bind(iapp->packet_sock, (struct sockaddr *) &addr, ++ sizeof(addr)) < 0) { ++ wpa_printf(MSG_INFO, "iapp_init - bind[PACKET]: %s", ++ strerror(errno)); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ ++ if (eloop_register_read_sock(iapp->udp_sock, iapp_receive_udp, ++ iapp, NULL)) { ++ wpa_printf(MSG_INFO, "Could not register read socket for IAPP"); ++ iapp_deinit(iapp); ++ return NULL; ++ } ++ ++ wpa_printf(MSG_INFO, "IEEE 802.11F (IAPP) using interface %s", iface); ++ ++ /* TODO: For levels 2 and 3: send RADIUS Initiate-Request, receive ++ * RADIUS Initiate-Accept or Initiate-Reject. IAPP port should actually ++ * be openned only after receiving Initiate-Accept. If Initiate-Reject ++ * is received, IAPP is not started. */ ++ ++ return iapp; ++} ++ ++ ++void iapp_deinit(struct iapp_data *iapp) ++{ ++ struct ip_mreqn mreq; ++ ++ if (iapp == NULL) ++ return; ++ ++ if (iapp->udp_sock >= 0) { ++ os_memset(&mreq, 0, sizeof(mreq)); ++ mreq.imr_multiaddr = iapp->multicast; ++ mreq.imr_address.s_addr = INADDR_ANY; ++ mreq.imr_ifindex = 0; ++ if (setsockopt(iapp->udp_sock, SOL_IP, IP_DROP_MEMBERSHIP, ++ &mreq, sizeof(mreq)) < 0) { ++ wpa_printf(MSG_INFO, "iapp_deinit - setsockopt[UDP,IP_DEL_MEMBERSHIP]: %s", ++ strerror(errno)); ++ } ++ ++ eloop_unregister_read_sock(iapp->udp_sock); ++ close(iapp->udp_sock); ++ } ++ if (iapp->packet_sock >= 0) { ++ eloop_unregister_read_sock(iapp->packet_sock); ++ close(iapp->packet_sock); ++ } ++ os_free(iapp); ++} +diff --git a/src/ap/iapp.h b/src/ap/iapp.h +new file mode 100644 +index 000000000..c22118342 +--- /dev/null ++++ b/src/ap/iapp.h +@@ -0,0 +1,39 @@ ++/* ++ * hostapd / IEEE 802.11F-2003 Inter-Access Point Protocol (IAPP) ++ * Copyright (c) 2002-2005, Jouni Malinen ++ * ++ * This software may be distributed under the terms of the BSD license. ++ * See README for more details. ++ */ ++ ++#ifndef IAPP_H ++#define IAPP_H ++ ++struct iapp_data; ++ ++#ifdef CONFIG_IAPP ++ ++void iapp_new_station(struct iapp_data *iapp, struct sta_info *sta); ++struct iapp_data * iapp_init(struct hostapd_data *hapd, const char *iface); ++void iapp_deinit(struct iapp_data *iapp); ++ ++#else /* CONFIG_IAPP */ ++ ++static inline void iapp_new_station(struct iapp_data *iapp, ++ struct sta_info *sta) ++{ ++} ++ ++static inline struct iapp_data * iapp_init(struct hostapd_data *hapd, ++ const char *iface) ++{ ++ return NULL; ++} ++ ++static inline void iapp_deinit(struct iapp_data *iapp) ++{ ++} ++ ++#endif /* CONFIG_IAPP */ ++ ++#endif /* IAPP_H */ +diff --git a/src/utils/wpa_debug.h b/src/utils/wpa_debug.h +index 824538b41..498b35291 100644 +--- a/src/utils/wpa_debug.h ++++ b/src/utils/wpa_debug.h +@@ -354,6 +354,7 @@ void hostapd_logger_register_cb(hostapd_logger_cb_func func); + #define HOSTAPD_MODULE_RADIUS 0x00000004 + #define HOSTAPD_MODULE_WPA 0x00000008 + #define HOSTAPD_MODULE_DRIVER 0x00000010 ++#define HOSTAPD_MODULE_IAPP 0x00000020 + #define HOSTAPD_MODULE_MLME 0x00000040 + + enum hostapd_logger_level { +diff --git a/tests/build/build-hostapd-internal.config b/tests/build/build-hostapd-internal.config +index 421977eed..0fc1c2511 100644 +--- a/tests/build/build-hostapd-internal.config ++++ b/tests/build/build-hostapd-internal.config +@@ -79,6 +79,7 @@ CONFIG_MBO=y + CONFIG_CODE_COVERAGE=y + CFLAGS += -O0 -Wsign-compare + ++CONFIG_IAPP=y + CONFIG_TAXONOMY=y + #CONFIG_FILS=y + #CONFIG_FILS_SK_PFS=y +diff --git a/tests/hwsim/example-hostapd.config b/tests/hwsim/example-hostapd.config +index 972d35c75..8b68b5471 100644 +--- a/tests/hwsim/example-hostapd.config ++++ b/tests/hwsim/example-hostapd.config +@@ -105,6 +105,7 @@ CONFIG_SUITEB=y + #LIBS_c += -fsanitize=undefined + CONFIG_MBO=y + ++CONFIG_IAPP=y + CONFIG_TAXONOMY=y + CONFIG_FILS=y + CONFIG_FILS_SK_PFS=y diff --git a/recipes-connectivity/hostapd/files/913-iapp-improvements.patch b/recipes-connectivity/hostapd/files/913-iapp-improvements.patch index 23e50d3..06e5de7 100644 --- a/recipes-connectivity/hostapd/files/913-iapp-improvements.patch +++ b/recipes-connectivity/hostapd/files/913-iapp-improvements.patch @@ -1,16 +1,17 @@ -From b1f03e0b2257ce0e32a0a55a75b1e89e121550ce Mon Sep 17 00:00:00 2001 +From ad70cdb2e4caa58b7f90fc56e7ed3cb36f663c0d Mon Sep 17 00:00:00 2001 From: Patrick Walther Date: Tue, 28 Jan 2020 15:14:35 +0100 +Subject: [PATCH] ADD: add wpa_supplicant and hostapd to meta layer --- src/ap/hostapd.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c -index ca282aad3..096e9751e 100644 +index ebc0488d0..4cfa7d840 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -1347,10 +1347,9 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) +@@ -1384,10 +1384,9 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) } if (conf->ieee802_11f && @@ -24,8 +25,8 @@ index ca282aad3..096e9751e 100644 } #ifdef CONFIG_INTERWORKING -@@ -3141,8 +3140,19 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, - ap_sta_clear_disconnect_timeouts(hapd, sta); +@@ -3249,8 +3248,19 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, + sta->post_csa_sa_query = 0; /* IEEE 802.11F (IAPP) */ - if (hapd->conf->ieee802_11f) diff --git a/recipes-connectivity/hostapd/files/914-wlan-acs-srd-channels.patch b/recipes-connectivity/hostapd/files/914-wlan-acs-srd-channels.patch index a17204c..0ae4808 100644 --- a/recipes-connectivity/hostapd/files/914-wlan-acs-srd-channels.patch +++ b/recipes-connectivity/hostapd/files/914-wlan-acs-srd-channels.patch @@ -20,15 +20,39 @@ index 0defd6c7b..698b7f329 100644 if (tb_freq[NL80211_FREQUENCY_ATTR_NO_10MHZ]) chan->allowed_bw &= ~HOSTAPD_CHAN_WIDTH_10; -diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h -index 6f09d1500..52413aabb 100644 --- a/src/drivers/nl80211_copy.h +++ b/src/drivers/nl80211_copy.h -@@ -3530,6 +3530,7 @@ enum nl80211_frequency_attr { - NL80211_FREQUENCY_ATTR_NO_20MHZ, +@@ -3682,6 +3682,19 @@ enum nl80211_wmm_rule { + * (see &enum nl80211_wmm_rule) + * @NL80211_FREQUENCY_ATTR_NO_HE: HE operation is not allowed on this channel + * in current regulatory domain. ++ * @NL80211_FREQUENCY_ATTR_OFFSET: frequency offset in KHz ++ * @NL80211_FREQUENCY_ATTR_1MHZ: 1 MHz operation is allowed ++ * on this channel in current regulatory domain. ++ * @NL80211_FREQUENCY_ATTR_2MHZ: 2 MHz operation is allowed ++ * on this channel in current regulatory domain. ++ * @NL80211_FREQUENCY_ATTR_4MHZ: 4 MHz operation is allowed ++ * on this channel in current regulatory domain. ++ * @NL80211_FREQUENCY_ATTR_8MHZ: 8 MHz operation is allowed ++ * on this channel in current regulatory domain. ++ * @NL80211_FREQUENCY_ATTR_16MHZ: 16 MHz operation is allowed ++ * on this channel in current regulatory domain. ++ * @NL80211_FREQUENCY_ATTR_SRD_CHANNEL: short range devices mode ++ * on this channel in current regulatory domain. + * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number + * currently defined + * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use +@@ -3712,6 +3725,13 @@ enum nl80211_frequency_attr { NL80211_FREQUENCY_ATTR_NO_10MHZ, NL80211_FREQUENCY_ATTR_WMM, -+ NL80211_FREQUENCY_ATTR_SRD_CHANNEL, + NL80211_FREQUENCY_ATTR_NO_HE, ++ NL80211_FREQUENCY_ATTR_OFFSET, ++ NL80211_FREQUENCY_ATTR_1MHZ, ++ NL80211_FREQUENCY_ATTR_2MHZ, ++ NL80211_FREQUENCY_ATTR_4MHZ, ++ NL80211_FREQUENCY_ATTR_8MHZ, ++ NL80211_FREQUENCY_ATTR_16MHZ, ++ NL80211_FREQUENCY_ATTR_SRD_CHANNEL, /* keep last */ __NL80211_FREQUENCY_ATTR_AFTER_LAST, diff --git a/recipes-connectivity/hostapd/files/src/ap/ubus.c b/recipes-connectivity/hostapd/files/src/ap/ubus.c index 3375ac4..d03b848 100644 --- a/recipes-connectivity/hostapd/files/src/ap/ubus.c +++ b/recipes-connectivity/hostapd/files/src/ap/ubus.c @@ -26,12 +26,16 @@ static struct ubus_context *ctx; static struct blob_buf b; static int ctx_ref; +static inline struct hapd_interfaces *get_hapd_interfaces_from_object(struct ubus_object *obj) +{ + return container_of(obj, struct hapd_interfaces, ubus); +} + static inline struct hostapd_data *get_hapd_from_object(struct ubus_object *obj) { return container_of(obj, struct hostapd_data, ubus.obj); } - struct ubus_banned_client { struct avl_node avl; u8 addr[ETH_ALEN]; @@ -104,6 +108,54 @@ void hostapd_ubus_free_iface(struct hostapd_iface *iface) return; } +static void hostapd_notify_ubus(struct ubus_object *obj, char *bssname, char *event) +{ + char *event_type; + + if (!ctx || !obj) + return; + + if (asprintf(&event_type, "bss.%s", event) < 0) + return; + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "name", bssname); + ubus_notify(ctx, obj, event_type, b.head, -1); + free(event_type); +} + +static void hostapd_send_procd_event(char *bssname, char *event) +{ + char *name, *s; + uint32_t id; + void *v; + + if (!ctx || ubus_lookup_id(ctx, "service", &id)) + return; + + if (asprintf(&name, "hostapd.%s.%s", bssname, event) < 0) + return; + + blob_buf_init(&b, 0); + + s = blobmsg_alloc_string_buffer(&b, "type", strlen(name) + 1); + sprintf(s, "%s", name); + blobmsg_add_string_buffer(&b); + + v = blobmsg_open_table(&b, "data"); + blobmsg_close_table(&b, v); + + ubus_invoke(ctx, id, "event", b.head, NULL, NULL, 1000); + + free(name); +} + +static void hostapd_send_shared_event(struct ubus_object *obj, char *bssname, char *event) +{ + hostapd_send_procd_event(bssname, event); + hostapd_notify_ubus(obj, bssname, event); +} + static void hostapd_bss_del_ban(void *eloop_data, void *user_ctx) { @@ -142,12 +194,94 @@ hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time) eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd); } +static int +hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + int ret = hostapd_reload_config(hapd->iface, 1); + + hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "reload"); + return ret; +} + + +static void +hostapd_parse_vht_map_blobmsg(uint16_t map) +{ + char label[4]; + int16_t val; + int i; + + for (i = 0; i < 8; i++) { + snprintf(label, 4, "%dss", i + 1); + + val = (map & (BIT(1) | BIT(0))) + 7; + blobmsg_add_u16(&b, label, val == 10 ? -1 : val); + map = map >> 2; + } +} + +static void +hostapd_parse_vht_capab_blobmsg(struct ieee80211_vht_capabilities *vhtc) +{ + void *supported_mcs; + void *map; + int i; + + static const struct { + const char *name; + uint32_t flag; + } vht_capas[] = { + { "su_beamformee", VHT_CAP_SU_BEAMFORMEE_CAPABLE }, + { "mu_beamformee", VHT_CAP_MU_BEAMFORMEE_CAPABLE }, + }; + + for (i = 0; i < ARRAY_SIZE(vht_capas); i++) + blobmsg_add_u8(&b, vht_capas[i].name, + !!(vhtc->vht_capabilities_info & vht_capas[i].flag)); + + supported_mcs = blobmsg_open_table(&b, "mcs_map"); + + /* RX map */ + map = blobmsg_open_table(&b, "rx"); + hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.rx_map)); + blobmsg_close_table(&b, map); + + /* TX map */ + map = blobmsg_open_table(&b, "tx"); + hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.tx_map)); + blobmsg_close_table(&b, map); + + blobmsg_close_table(&b, supported_mcs); +} + +static void +hostapd_parse_capab_blobmsg(struct sta_info *sta) +{ + void *r, *v; + + v = blobmsg_open_table(&b, "capabilities"); + + if (sta->vht_capabilities) { + r = blobmsg_open_table(&b, "vht"); + hostapd_parse_vht_capab_blobmsg(sta->vht_capabilities); + blobmsg_close_table(&b, r); + } + + /* ToDo: Add HT / HE capability parsing */ + + blobmsg_close_table(&b, v); +} + static int hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg) { struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct hostap_sta_driver_data sta_driver_data; struct sta_info *sta; void *list, *c; char mac_buf[20]; @@ -190,6 +324,31 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, if (retrieve_sta_taxonomy(hapd, sta, r, 1024) > 0) blobmsg_add_string_buffer(&b); #endif + + /* Driver information */ + if (hostapd_drv_read_sta_data(hapd, &sta_driver_data, sta->addr) >= 0) { + r = blobmsg_open_table(&b, "bytes"); + blobmsg_add_u64(&b, "rx", sta_driver_data.rx_bytes); + blobmsg_add_u64(&b, "tx", sta_driver_data.tx_bytes); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "airtime"); + blobmsg_add_u64(&b, "rx", sta_driver_data.rx_airtime); + blobmsg_add_u64(&b, "tx", sta_driver_data.tx_airtime); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "packets"); + blobmsg_add_u32(&b, "rx", sta_driver_data.rx_packets); + blobmsg_add_u32(&b, "tx", sta_driver_data.tx_packets); + blobmsg_close_table(&b, r); + r = blobmsg_open_table(&b, "rate"); + /* Rate in kbits */ + blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100); + blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100); + blobmsg_close_table(&b, r); + blobmsg_add_u32(&b, "signal", sta_driver_data.signal); + } + + hostapd_parse_capab_blobmsg(sta); + blobmsg_close_table(&b, c); } blobmsg_close_array(&b, list); @@ -213,6 +372,45 @@ hostapd_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +static int +hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + void *airtime_table, *dfs_table; + struct os_reltime now; + char phy_name[17]; + char mac_buf[20]; + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state)); + blobmsg_add_u32(&b, "freq", hapd->iface->freq); + + snprintf(phy_name, 17, "%s", hapd->iface->phy); + blobmsg_add_string(&b, "phy", phy_name); + + /* Airtime */ + airtime_table = blobmsg_open_table(&b, "airtime"); + blobmsg_add_u64(&b, "time", hapd->iface->last_channel_time); + blobmsg_add_u64(&b, "time_busy", hapd->iface->last_channel_time_busy); + blobmsg_add_u16(&b, "utilization", hapd->iface->channel_utilization); + blobmsg_close_table(&b, airtime_table); + + /* DFS */ + dfs_table = blobmsg_open_table(&b, "dfs"); + blobmsg_add_u32(&b, "cac_seconds", hapd->iface->dfs_cac_ms / 1000); + blobmsg_add_u8(&b, "cac_active", !!(hapd->iface->cac_started)); + os_reltime_age(&hapd->iface->dfs_cac_start, &now); + blobmsg_add_u32(&b, "cac_seconds_left", + hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0); + blobmsg_close_table(&b, dfs_table); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + enum { NOTIFY_RESPONSE, __NOTIFY_MAX @@ -331,6 +529,7 @@ hostapd_bss_list_bans(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +#ifdef CONFIG_WPS static int hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, @@ -347,6 +546,53 @@ hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj, return 0; } + +static const char * pbc_status_enum_str(enum pbc_status status) +{ + switch (status) { + case WPS_PBC_STATUS_DISABLE: + return "Disabled"; + case WPS_PBC_STATUS_ACTIVE: + return "Active"; + case WPS_PBC_STATUS_TIMEOUT: + return "Timed-out"; + case WPS_PBC_STATUS_OVERLAP: + return "Overlap"; + default: + return "Unknown"; + } +} + +static int +hostapd_bss_wps_status(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + int rc; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + blob_buf_init(&b, 0); + + blobmsg_add_string(&b, "pbc_status", pbc_status_enum_str(hapd->wps_stats.pbc_status)); + blobmsg_add_string(&b, "last_wps_result", + (hapd->wps_stats.status == WPS_STATUS_SUCCESS ? + "Success": + (hapd->wps_stats.status == WPS_STATUS_FAILURE ? + "Failed" : "None"))); + + /* If status == Failure - Add possible Reasons */ + if(hapd->wps_stats.status == WPS_STATUS_FAILURE && + hapd->wps_stats.failure_reason > 0) + blobmsg_add_string(&b, "reason", wps_ei_str(hapd->wps_stats.failure_reason)); + + if (hapd->wps_stats.status) + blobmsg_printf(&b, "peer_address", MACSTR, MAC2STR(hapd->wps_stats.peer_addr)); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + static int hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, @@ -362,6 +608,7 @@ hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +#endif /* CONFIG_WPS */ static int hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj, @@ -379,6 +626,74 @@ hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +enum { + CONFIG_IFACE, + CONFIG_FILE, + __CONFIG_MAX +}; + +static const struct blobmsg_policy config_add_policy[__CONFIG_MAX] = { + [CONFIG_IFACE] = { "iface", BLOBMSG_TYPE_STRING }, + [CONFIG_FILE] = { "config", BLOBMSG_TYPE_STRING }, +}; + +static int +hostapd_config_add(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__CONFIG_MAX]; + struct hapd_interfaces *interfaces = get_hapd_interfaces_from_object(obj); + char buf[128]; + + blobmsg_parse(config_add_policy, __CONFIG_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[CONFIG_FILE] || !tb[CONFIG_IFACE]) + return UBUS_STATUS_INVALID_ARGUMENT; + + snprintf(buf, sizeof(buf), "bss_config=%s:%s", + blobmsg_get_string(tb[CONFIG_IFACE]), + blobmsg_get_string(tb[CONFIG_FILE])); + + if (hostapd_add_iface(interfaces, buf)) + return UBUS_STATUS_INVALID_ARGUMENT; + + blob_buf_init(&b, 0); + blobmsg_add_u32(&b, "pid", getpid()); + ubus_send_reply(ctx, req, b.head); + + return UBUS_STATUS_OK; +} + +enum { + CONFIG_REM_IFACE, + __CONFIG_REM_MAX +}; + +static const struct blobmsg_policy config_remove_policy[__CONFIG_REM_MAX] = { + [CONFIG_REM_IFACE] = { "iface", BLOBMSG_TYPE_STRING }, +}; + +static int +hostapd_config_remove(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__CONFIG_REM_MAX]; + struct hapd_interfaces *interfaces = get_hapd_interfaces_from_object(obj); + char buf[128]; + + blobmsg_parse(config_remove_policy, __CONFIG_REM_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[CONFIG_REM_IFACE]) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (hostapd_remove_iface(interfaces, blobmsg_get_string(tb[CONFIG_REM_IFACE]))) + return UBUS_STATUS_INVALID_ARGUMENT; + + return UBUS_STATUS_OK; +} + enum { CSA_FREQ, CSA_BCN_COUNT, @@ -546,7 +861,7 @@ __hostapd_bss_mgmt_enable_f(struct hostapd_data *hapd, int flag) bss->radio_measurements[0] |= WLAN_RRM_CAPS_NEIGHBOR_REPORT; - hostapd_set_own_neighbor_report(hapd); + hostapd_neighbor_set_own_report(hapd); return true; case BSS_MGMT_EN_BEACON: flags = WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE | @@ -722,7 +1037,6 @@ hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj, struct blob_attr *tb_l[__NR_SET_LIST_MAX]; struct blob_attr *tb[ARRAY_SIZE(nr_e_policy)]; struct blob_attr *cur; - int ret = 0; int rem; hostapd_rrm_nr_enable(hapd); @@ -736,32 +1050,47 @@ hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj, struct wpa_ssid_value ssid; struct wpabuf *data; u8 bssid[ETH_ALEN]; - char *s; + char *s, *nr_s; blobmsg_parse_array(nr_e_policy, ARRAY_SIZE(nr_e_policy), tb, blobmsg_data(cur), blobmsg_data_len(cur)); if (!tb[0] || !tb[1] || !tb[2]) goto invalid; - s = blobmsg_get_string(tb[0]); - if (hwaddr_aton(s, bssid)) - goto invalid; - - s = blobmsg_get_string(tb[1]); - ssid.ssid_len = strlen(s); - if (ssid.ssid_len > sizeof(ssid.ssid)) - goto invalid; - - memcpy(&ssid, s, ssid.ssid_len); - data = wpabuf_parse_bin(blobmsg_get_string(tb[2])); + /* Neighbor Report binary */ + nr_s = blobmsg_get_string(tb[2]); + data = wpabuf_parse_bin(nr_s); if (!data) goto invalid; + /* BSSID */ + s = blobmsg_get_string(tb[0]); + if (strlen(s) == 0) { + /* Copy BSSID from neighbor report */ + if (hwaddr_compact_aton(nr_s, bssid)) + goto invalid; + } else if (hwaddr_aton(s, bssid)) { + goto invalid; + } + + /* SSID */ + s = blobmsg_get_string(tb[1]); + if (strlen(s) == 0) { + /* Copy SSID from hostapd BSS conf */ + memcpy(&ssid, &hapd->conf->ssid, sizeof(ssid)); + } else { + ssid.ssid_len = strlen(s); + if (ssid.ssid_len > sizeof(ssid.ssid)) + goto invalid; + + memcpy(&ssid, s, ssid.ssid_len); + } + hostapd_neighbor_set(hapd, bssid, &ssid, data, NULL, NULL, 0); wpabuf_free(data); continue; invalid: - ret = UBUS_STATUS_INVALID_ARGUMENT; + return UBUS_STATUS_INVALID_ARGUMENT; } return 0; @@ -860,6 +1189,7 @@ enum { WNM_DISASSOC_ADDR, WNM_DISASSOC_DURATION, WNM_DISASSOC_NEIGHBORS, + WNM_DISASSOC_ABRIDGED, __WNM_DISASSOC_MAX, }; @@ -867,6 +1197,7 @@ static const struct blobmsg_policy wnm_disassoc_policy[__WNM_DISASSOC_MAX] = { [WNM_DISASSOC_ADDR] = { "addr", BLOBMSG_TYPE_STRING }, [WNM_DISASSOC_DURATION] { "duration", BLOBMSG_TYPE_INT32 }, [WNM_DISASSOC_NEIGHBORS] { "neighbors", BLOBMSG_TYPE_ARRAY }, + [WNM_DISASSOC_ABRIDGED] { "abridged", BLOBMSG_TYPE_BOOL }, }; static int @@ -940,7 +1271,10 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj, if (nr) req_mode |= WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED; - if (wnm_send_bss_tm_req(hapd, sta, req_mode, duration, 0, NULL, + if (tb[WNM_DISASSOC_ABRIDGED] && blobmsg_get_bool(tb[WNM_DISASSOC_ABRIDGED])) + req_mode |= WNM_BSS_TM_REQ_ABRIDGED; + + if (wnm_send_bss_tm_req(hapd, sta, req_mode, duration, duration, NULL, NULL, nr, nr_len, NULL, 0)) return UBUS_STATUS_UNKNOWN_ERROR; @@ -949,11 +1283,16 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj, #endif static const struct ubus_method bss_methods[] = { + UBUS_METHOD_NOARG("reload", hostapd_bss_reload), UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), + UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status), UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans), +#ifdef CONFIG_WPS UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start), + UBUS_METHOD_NOARG("wps_status", hostapd_bss_wps_status), UBUS_METHOD_NOARG("wps_cancel", hostapd_bss_wps_cancel), +#endif UBUS_METHOD_NOARG("update_beacon", hostapd_bss_update_beacon), UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features), #ifdef NEED_AP_MLME @@ -1003,6 +1342,8 @@ void hostapd_ubus_add_bss(struct hostapd_data *hapd) obj->n_methods = bss_object_type.n_methods; ret = ubus_add_object(ctx, obj); hostapd_ubus_ref_inc(); + + hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "add"); } void hostapd_ubus_free_bss(struct hostapd_data *hapd) @@ -1010,6 +1351,49 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd) struct ubus_object *obj = &hapd->ubus.obj; char *name = (char *) obj->name; + if (!ctx) + return; + + hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "remove"); + + if (obj->id) { + ubus_remove_object(ctx, obj); + hostapd_ubus_ref_dec(); + } + + free(name); +} + +static const struct ubus_method daemon_methods[] = { + UBUS_METHOD("config_add", hostapd_config_add, config_add_policy), + UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy), +}; + +static struct ubus_object_type daemon_object_type = + UBUS_OBJECT_TYPE("hostapd", daemon_methods); + +void hostapd_ubus_add(struct hapd_interfaces *interfaces) +{ + struct ubus_object *obj = &interfaces->ubus; + int ret; + + if (!hostapd_ubus_init()) + return; + + obj->name = strdup("hostapd"); + + obj->type = &daemon_object_type; + obj->methods = daemon_object_type.methods; + obj->n_methods = daemon_object_type.n_methods; + ret = ubus_add_object(ctx, obj); + hostapd_ubus_ref_inc(); +} + +void hostapd_ubus_free(struct hapd_interfaces *interfaces) +{ + struct ubus_object *obj = &interfaces->ubus; + char *name = (char *) obj->name; + if (!ctx) return; @@ -1065,8 +1449,8 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req blobmsg_add_macaddr(&b, "address", addr); if (req->mgmt_frame) blobmsg_add_macaddr(&b, "target", req->mgmt_frame->da); - if (req->frame_info) - blobmsg_add_u32(&b, "signal", req->frame_info->ssi_signal); + if (req->ssi_signal) + blobmsg_add_u32(&b, "signal", req->ssi_signal); blobmsg_add_u32(&b, "freq", hapd->iface->freq); if (req->elems) { @@ -1079,7 +1463,7 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req ht_capabilities = (struct ieee80211_ht_capabilities*) req->elems->ht_capabilities; ht_cap = blobmsg_open_table(&b, "ht_capabilities"); blobmsg_add_u16(&b, "ht_capabilities_info", ht_capabilities->ht_capabilities_info); - ht_cap_mcs_set = blobmsg_open_table(&b, "supported_mcs_set"); + ht_cap_mcs_set = blobmsg_open_table(&b, "supported_mcs_set"); blobmsg_add_u16(&b, "a_mpdu_params", ht_capabilities->a_mpdu_params); blobmsg_add_u16(&b, "ht_extended_capabilities", ht_capabilities->ht_extended_capabilities); blobmsg_add_u32(&b, "tx_bf_capability_info", ht_capabilities->tx_bf_capability_info); @@ -1090,7 +1474,7 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req } blobmsg_close_array(&b, mcs_set); blobmsg_close_table(&b, ht_cap_mcs_set); - blobmsg_close_table(&b, ht_cap); + blobmsg_close_table(&b, ht_cap); } if(req->elems->vht_capabilities) { @@ -1140,3 +1524,29 @@ void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 * ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); } + +void hostapd_ubus_notify_beacon_report( + struct hostapd_data *hapd, const u8 *addr, u8 token, u8 rep_mode, + struct rrm_measurement_beacon_report *rep, size_t len) +{ + if (!hapd->ubus.obj.has_subscribers) + return; + + if (!addr || !rep) + return; + + blob_buf_init(&b, 0); + blobmsg_add_macaddr(&b, "address", addr); + blobmsg_add_u16(&b, "op-class", rep->op_class); + blobmsg_add_u16(&b, "channel", rep->channel); + blobmsg_add_u64(&b, "start-time", rep->start_time); + blobmsg_add_u16(&b, "duration", rep->duration); + blobmsg_add_u16(&b, "report-info", rep->report_info); + blobmsg_add_u16(&b, "rcpi", rep->rcpi); + blobmsg_add_u16(&b, "rsni", rep->rsni); + blobmsg_add_macaddr(&b, "bssid", rep->bssid); + blobmsg_add_u16(&b, "antenna-id", rep->antenna_id); + blobmsg_add_u16(&b, "parent-tsf", rep->parent_tsf); + + ubus_notify(ctx, &hapd->ubus.obj, "beacon-report", b.head, -1); +} diff --git a/recipes-connectivity/hostapd/files/src/ap/ubus.h b/recipes-connectivity/hostapd/files/src/ap/ubus.h index 185af5a..e160173 100644 --- a/recipes-connectivity/hostapd/files/src/ap/ubus.h +++ b/recipes-connectivity/hostapd/files/src/ap/ubus.h @@ -19,12 +19,14 @@ struct hostapd_ubus_request { enum hostapd_ubus_event_type type; const struct ieee80211_mgmt *mgmt_frame; const struct ieee802_11_elems *elems; - const struct hostapd_frame_info *frame_info; + int ssi_signal; /* dBm */ const u8 *addr; }; struct hostapd_iface; struct hostapd_data; +struct hapd_interfaces; +struct rrm_measurement_beacon_report; #ifdef UBUS_SUPPORT @@ -44,6 +46,13 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd); int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac); +void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, + const u8 *addr, u8 token, u8 rep_mode, + struct rrm_measurement_beacon_report *rep, + size_t len); + +void hostapd_ubus_add(struct hapd_interfaces *interfaces); +void hostapd_ubus_free(struct hapd_interfaces *interfaces); #else @@ -73,6 +82,22 @@ static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct ho static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac) { } + +static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, + const u8 *addr, u8 token, + u8 rep_mode, + struct rrm_measurement_beacon_report *rep, + size_t len) +{ +} + +static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces) +{ +} + +static inline void hostapd_ubus_free(struct hapd_interfaces *interfaces) +{ +} #endif #endif diff --git a/recipes-connectivity/hostapd/files/src/utils/build_features.h b/recipes-connectivity/hostapd/files/src/utils/build_features.h index abebecb..c7fccad 100644 --- a/recipes-connectivity/hostapd/files/src/utils/build_features.h +++ b/recipes-connectivity/hostapd/files/src/utils/build_features.h @@ -15,14 +15,16 @@ static inline int has_feature(const char *feat) if (!strcmp(feat, "11ac")) return 1; #endif +#ifdef CONFIG_IEEE80211AX + if (!strcmp(feat, "11ax")) + return 1; +#endif #ifdef CONFIG_IEEE80211R if (!strcmp(feat, "11r")) return 1; #endif -#ifdef CONFIG_IEEE80211W if (!strcmp(feat, "11w")) return 1; -#endif #ifdef CONFIG_ACS if (!strcmp(feat, "acs")) return 1; @@ -38,6 +40,18 @@ static inline int has_feature(const char *feat) #ifdef CONFIG_SUITEB192 if (!strcmp(feat, "suiteb192")) return 1; +#endif +#ifdef CONFIG_WEP + if (!strcmp(feat, "wep")) + return 1; +#endif +#ifdef CONFIG_HS20 + if (!strcmp(feat, "hs20")) + return 1; +#endif +#ifdef CONFIG_WPS + if (!strcmp(feat, "wps")) + return 1; #endif return 0; } diff --git a/recipes-connectivity/hostapd/hostapd.inc b/recipes-connectivity/hostapd/hostapd.inc index 7b9cfae..016eed7 100644 --- a/recipes-connectivity/hostapd/hostapd.inc +++ b/recipes-connectivity/hostapd/hostapd.inc @@ -15,21 +15,37 @@ inherit pkgconfig PACKAGECONFIG = "openssl" SRC_URI = "git://w1.fi/hostap.git;protocol=http \ - file://004-mesh-use-setup-completion-callback-to-complete-mesh-.patch \ - file://005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch \ - file://006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch \ - file://007-mesh-apply-channel-attributes-before-running-Mesh.patch \ - file://011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch \ - file://013-mesh-do-not-allow-pri-sec-channel-switch.patch \ - file://015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch \ - file://016-mesh-fix-channel-switch-error-during-CAC.patch \ - file://018-mesh-make-forwarding-configurable.patch \ - file://051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch \ - file://067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch \ - file://070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch \ - file://071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch \ - file://090-wolfssl-fix-crypto_bignum_sum.patch \ + file://wpa_supplicant-full.config \ + file://hostapd-full.config \ + file://src/utils/build_features.h \ + file://0001-Add-build-artifact-build_features.h-to-gitignore.patch \ + file://0002-Use-environment-variable-EXTRA_CFLAGS.patch \ + file://001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch \ + file://002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch \ + file://003-wpa_supplicant-handle-HT40-and-mode-downgrade-in-AP-.patch \ + file://004-wpa_supplicant-fix-frequency-config-for-non-p2p-vht-.patch \ + file://005-wpa_supplicant-enable-vht-and-he-in-default-config-p.patch \ + file://006-hw_features-better-debug-messages-for-some-error-cas.patch \ + file://007-dfs-use-helper-functions-for-vht-he-parameters.patch \ + file://008-mesh-use-setup-completion-callback-to-complete-mesh-.patch \ + file://009-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch \ + file://010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch \ + file://011-mesh-do-not-set-offchanok-on-DFS-channels-in-non-ETS.patch \ + file://012-mesh-fix-channel-switch-error-during-CAC.patch \ + file://013-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch \ + file://014-mesh-fixes-for-mesh-init-deinit.patch \ + file://015-mesh-fix-DFS-deinit-init.patch \ + file://016-tests-DFS-test-for-wpa_supplicant-mesh.patch \ + file://017-mesh-fix-mesh_oom-test.patch \ + file://018-mesh-move-mesh-freq-setting-to-own-function.patch \ + file://019-mesh-use-deterministic-channel-on-channel-switch.patch \ + file://020-ignore-4addr-mode-enabling-error.patch \ + file://050-mesh-make-forwarding-configurable.patch \ + file://060-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch \ file://100-daemonize_fix.patch \ + file://110-notify-mgmt-frames.patch \ + file://110-wolfssl-compile-fix.patch \ + file://120-reconfigure-wps-credentials.patch \ file://200-multicall.patch \ file://300-noscan.patch \ file://301-mesh-noscan.patch \ @@ -59,17 +75,14 @@ SRC_URI = "git://w1.fi/hostap.git;protocol=http \ file://500-lto-jobserver-support.patch \ file://599-wpa_supplicant-fix-warnings.patch \ file://700-wifi-reload.patch \ - file://800-usleep.patch \ - file://914-wlan-acs-srd-channels.patch \ + file://800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch \ + file://801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch \ + file://912-iapp-integration.patch \ file://913-iapp-improvements.patch \ - file://src/utils/build_features.h \ - file://0001-Add-build-artifact-build_features.h-to-gitignore.patch \ - file://0002-Use-environment-variable-EXTRA_CFLAGS.patch \ - file://wpa_supplicant-full.config \ - file://hostapd-full.config \ + file://914-wlan-acs-srd-channels.patch \ " -SRCREV = "ca8c2bd28ad53f431d6ee60ef754e98cfdb4c17b" +SRCREV = "5a8b366233f5585e68a4ffbb604fbb4a848eb325" SRC_URI[md5sum] = "a68538fb62766f40f890125026c42c10" SRC_URI[sha256sum] = "9d9f1c60afa5324ee17219bd3ec61c1a6fa4043b4187da9bb44e59025d3ed31d" diff --git a/recipes-connectivity/hostapd/hostapd_2.9.bb b/recipes-connectivity/hostapd/hostapd_2.10.bb similarity index 100% rename from recipes-connectivity/hostapd/hostapd_2.9.bb rename to recipes-connectivity/hostapd/hostapd_2.10.bb diff --git a/recipes-connectivity/hostapd/wpa-supplicant_2.9.bb b/recipes-connectivity/hostapd/wpa-supplicant_2.10.bb similarity index 100% rename from recipes-connectivity/hostapd/wpa-supplicant_2.9.bb rename to recipes-connectivity/hostapd/wpa-supplicant_2.10.bb