openwrt/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch
Ivan Pavlov 395afc4c58 hostapd: update to 2.11 release tag
Release 2.11 has been quite a few new features and fixes since the 2.10
release. The following ChangeLog entries highlight some of the main
changes:

* Wi-Fi Easy Connect
  - add support for DPP release 3
  - allow Configurator parameters to be provided during config exchange
* HE/IEEE 802.11ax/Wi-Fi 6
  - various fixes
* EHT/IEEE 802.11be/Wi-Fi 7
  - add preliminary support
* SAE: add support for fetching the password from a RADIUS server
* support OpenSSL 3.0 API changes
* support background radar detection and CAC with some additional
  drivers
* support RADIUS ACL/PSK check during 4-way handshake (wpa_psk_radius=3)
* EAP-SIM/AKA: support IMSI privacy
* improve 4-way handshake operations
  - use Secure=1 in message 3 during PTK rekeying

...and many more

Remove upstreamed patches:
  023-ndisc_snoop-call-dl_list_del-before-freeing-ipv6-add.patch
  030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch
  040-mesh-allow-processing-authentication-frames-in-block.patch
  181-driver_nl80211-update-drv-ifindex-on-removing-the-fi.patch
  182-nl80211-move-nl80211_put_freq_params-call-outside-of.patch
  183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch
  210-build-de-duplicate-_DIRS-before-calling-mkdir.patch
  253-qos_map_set_without_interworking.patch
  751-qos_map_ignore_when_unsupported.patch
  800-SAE-Check-for-invalid-Rejected-Groups-element-length.patch
  801-SAE-Check-for-invalid-Rejected-Groups-element-length.patch
  802-SAE-Reject-invalid-Rejected-Groups-element-in-the-pa.patch

Other patches has been updated.

Signed-off-by: Ivan Pavlov <AuthorReflex@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16338
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-09-16 10:32:43 +02:00

82 lines
2.6 KiB
Diff

From fc8ea40f6130ac18d9c66797de2cf1d5af55d496 Mon Sep 17 00:00:00 2001
From: Markus Theil <markus.theil@tu-ilmenau.de>
Date: Tue, 30 Jun 2020 14:19:07 +0200
Subject: [PATCH 19/19] 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 <markus.theil@tu-ilmenau.de>
---
src/ap/dfs.c | 20 +++++++++++++++++++-
src/drivers/driver_nl80211.c | 4 ++++
2 files changed, 23 insertions(+), 1 deletion(-)
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -18,6 +18,7 @@
#include "ap_drv_ops.h"
#include "drivers/driver.h"
#include "dfs.h"
+#include "crypto/crypto.h"
enum dfs_channel_type {
@@ -527,9 +528,14 @@ dfs_get_valid_channel(struct hostapd_ifa
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;
@@ -549,8 +555,20 @@ dfs_get_valid_channel(struct hostapd_ifa
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;
wpa_printf(MSG_DEBUG, "DFS: Picked random entry from the list: %d/%d",
chan_idx, num_available_chandefs);
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11306,6 +11306,10 @@ static int nl80211_switch_channel(void *
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)