mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-21 11:22:50 +00:00
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
Signed-off-by: John Crispin <john@phrozen.org>
269 lines
8.9 KiB
Diff
269 lines
8.9 KiB
Diff
From 00cada639346750210160441c00b5e953aa57d40 Mon Sep 17 00:00:00 2001
|
|
From: Hari Chandrakanthan <quic_haric@quicinc.com>
|
|
Date: Mon, 11 Jul 2022 22:30:27 +0530
|
|
Subject: [PATCH] hostapd : add support to disable channel switch during radar
|
|
detection
|
|
|
|
A new config disable_csa_dfs is added.
|
|
When the above config is enabled, the usual channel switch during
|
|
radar detection is skipped.
|
|
|
|
Rather hostapd/wpa_supplicant waits for 500ms for the user to do
|
|
the manual channel switch using hostapd_cli/wpa_cli.
|
|
|
|
If no channel switch or channel set is issued within 500ms,
|
|
the interface is disabled.
|
|
|
|
sample channel switch that disables the radar handling timer :
|
|
wpa_cli -i wlan2 chan_switch 5 5745 center_freq1=5775 sec_channel_offset=1
|
|
bandwidth=80 vht ht he
|
|
hostapd_cli -i wlan3 chan_switch 5 5745 center_freq1=5775 sec_channel_offset=1
|
|
bandwidth=80 vht ht he
|
|
|
|
sample set channel cmd that disables the radar handling timer:
|
|
hostapd_cli -i wlan0 set channel 100
|
|
wpa_cli -i wlan1 set_network 0 frequency 5500
|
|
|
|
Signed-off-by: Hari Chandrakanthan <quic_haric@quicinc.com>
|
|
Signed-off-by: Shivani Tambatkar <quic_stambatk@quicinc.com>
|
|
---
|
|
hostapd/config_file.c | 2 ++
|
|
hostapd/ctrl_iface.c | 14 ++++++++++++++
|
|
hostapd/hostapd.conf | 4 ++++
|
|
src/ap/ap_config.h | 1 +
|
|
src/ap/dfs.c | 22 ++++++++++++++++++++--
|
|
src/ap/dfs.h | 4 +++-
|
|
wpa_supplicant/ap.c | 12 +++++++++++-
|
|
wpa_supplicant/config.c | 2 ++
|
|
wpa_supplicant/config.h | 1 +
|
|
wpa_supplicant/ctrl_iface.c | 12 +++++++++++-
|
|
wpa_supplicant/mesh.c | 2 ++
|
|
wpa_supplicant/wpa_supplicant.conf | 4 ++++
|
|
12 files changed, 75 insertions(+), 5 deletions(-)
|
|
|
|
--- a/hostapd/config_file.c
|
|
+++ b/hostapd/config_file.c
|
|
@@ -4806,6 +4806,8 @@ static int hostapd_config_fill(struct ho
|
|
}
|
|
|
|
#endif /* CONFIG_IEEE80211BE */
|
|
+ } else if (os_strcmp(buf, "disable_csa_dfs") == 0) {
|
|
+ conf->disable_csa_dfs = atoi(pos);
|
|
} else {
|
|
wpa_printf(MSG_ERROR,
|
|
"Line %d: unknown configuration item '%s'",
|
|
--- a/hostapd/ctrl_iface.c
|
|
+++ b/hostapd/ctrl_iface.c
|
|
@@ -1348,6 +1348,13 @@ static int hostapd_ctrl_iface_set(struct
|
|
} else if (os_strcasecmp(cmd, "setband") == 0) {
|
|
ret = hostapd_ctrl_iface_set_band(hapd, value);
|
|
} else {
|
|
+ if (hapd->iface->conf->disable_csa_dfs &&
|
|
+ ((os_strcmp(cmd, "channel") == 0) &&
|
|
+ ((os_strcmp(value, "acs_survey") != 0) &&
|
|
+ (atoi(value) != 0)))) {
|
|
+ eloop_cancel_timeout(hostapd_dfs_radar_handling_timeout,
|
|
+ hapd->iface, NULL);
|
|
+ }
|
|
ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value);
|
|
if (ret)
|
|
return ret;
|
|
@@ -2859,6 +2866,12 @@ static int hostapd_ctrl_iface_chan_switc
|
|
return -1;
|
|
}
|
|
|
|
+ if (iface->conf->disable_csa_dfs == 1) {
|
|
+ wpa_printf(MSG_DEBUG, "chanswitch interface %s : cancel radar handling timer",
|
|
+ iface->conf->bss[0]->iface);
|
|
+ eloop_cancel_timeout(hostapd_dfs_radar_handling_timeout, iface, NULL);
|
|
+ }
|
|
+
|
|
settings.freq_params.channel = chan;
|
|
|
|
wpa_printf(MSG_DEBUG,
|
|
@@ -2880,6 +2893,12 @@ static int hostapd_ctrl_iface_chan_switc
|
|
settings.freq_params.he_enabled = iface->conf->ieee80211ax;
|
|
}
|
|
|
|
+ if (iface->conf->disable_csa_dfs == 1) {
|
|
+ wpa_printf(MSG_DEBUG, "chanswitch interface %s : cancel radar handling timer",
|
|
+ iface->conf->bss[0]->iface);
|
|
+ eloop_cancel_timeout(hostapd_dfs_radar_handling_timeout, iface, NULL);
|
|
+ }
|
|
+
|
|
for (i = 0; i < iface->num_bss; i++) {
|
|
|
|
/* Save CHAN_SWITCH VHT, HE, and EHT config */
|
|
--- a/hostapd/hostapd.conf
|
|
+++ b/hostapd/hostapd.conf
|
|
@@ -239,6 +239,10 @@ channel=1
|
|
# (default 0, i.e., not constraint)
|
|
#min_tx_power=20
|
|
|
|
+# disable_csa_dfs option can be used to skip the channel switch in hostapd
|
|
+# during radar detection
|
|
+#disable_csa_dfs=1
|
|
+
|
|
# Beacon interval in kus (1.024 ms) (default: 100; range 15..65535)
|
|
beacon_int=100
|
|
|
|
--- a/src/ap/ap_config.h
|
|
+++ b/src/ap/ap_config.h
|
|
@@ -1205,6 +1205,7 @@ struct hostapd_config {
|
|
u8 ru_punct_ofdma;
|
|
u8 ru_punct_acs_threshold;
|
|
int enable_320mhz_bw;
|
|
+ int disable_csa_dfs;
|
|
|
|
enum mbssid {
|
|
MBSSID_DISABLED = 0,
|
|
--- a/src/ap/dfs.c
|
|
+++ b/src/ap/dfs.c
|
|
@@ -1228,6 +1228,17 @@ void hostapd_dfs_test_mode_csa_timeout(v
|
|
ieee802_11_set_beacon(hapd);
|
|
}
|
|
|
|
+void hostapd_dfs_radar_handling_timeout(void *eloop_data, void *user_data)
|
|
+{
|
|
+ struct hostapd_iface *iface = eloop_data;
|
|
+
|
|
+ wpa_printf(MSG_INFO, "Disabling interface %s since no channel"
|
|
+ " switch is initiated within radar handling timeout",
|
|
+ iface->conf->bss[0]->iface);
|
|
+
|
|
+ hostapd_disable_iface(iface);
|
|
+}
|
|
+
|
|
static int hostapd_dfs_testmode_set_beacon_csa(struct hostapd_iface *iface)
|
|
{
|
|
struct hostapd_data *hapd = iface->bss[0];
|
|
@@ -1657,8 +1668,15 @@ int hostapd_dfs_radar_detected(struct ho
|
|
}
|
|
|
|
if (hostapd_dfs_background_start_channel_switch(iface, freq)) {
|
|
- /* Radar detected while operating, switch the channel. */
|
|
- return hostapd_dfs_start_channel_switch(iface);
|
|
+ if (!iface->conf->disable_csa_dfs) {
|
|
+ /* Radar detected while operating, switch the channel. */
|
|
+ return hostapd_dfs_start_channel_switch(iface);
|
|
+ } else if (!eloop_is_timeout_registered(hostapd_dfs_radar_handling_timeout,
|
|
+ iface, NULL)) {
|
|
+ eloop_register_timeout(0, HAPD_DFS_RADAR_CH_SWITCH_WAIT_DUR,
|
|
+ hostapd_dfs_radar_handling_timeout,
|
|
+ iface, NULL);
|
|
+ }
|
|
}
|
|
|
|
return 0;
|
|
--- a/src/ap/dfs.h
|
|
+++ b/src/ap/dfs.h
|
|
@@ -11,6 +11,8 @@
|
|
|
|
/* CSA beacon duration in seconds for dfs testing mode */
|
|
#define HOSTAPD_DFS_TEST_MODE_CSA_DUR 1
|
|
+/* Wait duration between radar detection and channel switch*/
|
|
+#define HAPD_DFS_RADAR_CH_SWITCH_WAIT_DUR 500000
|
|
|
|
void hostapd_dfs_test_mode_csa_timeout(void *eloop_data, void *user_data);
|
|
|
|
@@ -37,5 +39,5 @@ int hostapd_dfs_start_cac(struct hostapd
|
|
int hostapd_handle_dfs_offload(struct hostapd_iface *iface);
|
|
int hostapd_is_dfs_overlap(struct hostapd_iface *iface, enum chan_width width,
|
|
int center_freq);
|
|
-
|
|
+void hostapd_dfs_radar_handling_timeout(void *eloop_data, void *user_data);
|
|
#endif /* DFS_H */
|
|
--- a/wpa_supplicant/ap.c
|
|
+++ b/wpa_supplicant/ap.c
|
|
@@ -1848,7 +1848,17 @@ static int __ap_ctrl_iface_chanswitch(st
|
|
int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos)
|
|
{
|
|
struct csa_settings settings;
|
|
- int ret = hostapd_parse_csa_settings(pos, &settings);
|
|
+ int ret;
|
|
+
|
|
+ if (wpa_s->ifmsh && wpa_s->ifmsh->conf->disable_csa_dfs == 1) {
|
|
+ wpa_printf(MSG_DEBUG, "wpa chanswitch interface %s :"
|
|
+ " cancelling radar handling timeout",
|
|
+ wpa_s->ifmsh->conf->bss[0]->iface);
|
|
+ eloop_cancel_timeout(hostapd_dfs_radar_handling_timeout,
|
|
+ wpa_s->ifmsh, NULL);
|
|
+ }
|
|
+
|
|
+ ret = hostapd_parse_csa_settings(pos, &settings);
|
|
|
|
if (!(wpa_s->ap_iface && wpa_s->ap_iface->bss[0]) &&
|
|
!(wpa_s->ifmsh && wpa_s->ifmsh->bss[0]))
|
|
--- a/wpa_supplicant/config.c
|
|
+++ b/wpa_supplicant/config.c
|
|
@@ -5609,6 +5609,7 @@ static const struct global_parse_data gl
|
|
#endif /* CONFIG_PASN */
|
|
{ INT_RANGE(he_6ghz_reg_client_type, 1, 2),
|
|
CFG_CHANGED_HE_6GHZ_CLIENT_TYPE},
|
|
+ { INT_RANGE(disable_csa_dfs, 0, 1), 0 },
|
|
};
|
|
|
|
#undef FUNC
|
|
--- a/wpa_supplicant/config.h
|
|
+++ b/wpa_supplicant/config.h
|
|
@@ -1782,6 +1782,7 @@ struct wpa_config {
|
|
* 2 = SUBORDINATE CLIENT
|
|
*/
|
|
u8 he_6ghz_reg_client_type;
|
|
+ int disable_csa_dfs;
|
|
};
|
|
|
|
|
|
--- a/wpa_supplicant/ctrl_iface.c
|
|
+++ b/wpa_supplicant/ctrl_iface.c
|
|
@@ -58,6 +58,7 @@
|
|
#include "mesh.h"
|
|
#include "dpp_supplicant.h"
|
|
#include "sme.h"
|
|
+#include "ap/dfs.h"
|
|
|
|
#ifdef __NetBSD__
|
|
#include <net/if_ether.h>
|
|
@@ -3657,7 +3658,16 @@ static int wpa_supplicant_ctrl_iface_set
|
|
id, name);
|
|
wpa_hexdump_ascii_key(MSG_DEBUG, "CTRL_IFACE: value",
|
|
(u8 *) value, os_strlen(value));
|
|
-
|
|
+#ifdef NEED_AP_MLME
|
|
+ if ((os_strcmp(name, "frequency") == 0) &&
|
|
+ (wpa_s->ifmsh && wpa_s->ifmsh->conf->disable_csa_dfs == 1)) {
|
|
+ wpa_printf(MSG_DEBUG, "wpa interface %s :"
|
|
+ " cancelling radar handling timeout",
|
|
+ wpa_s->ifmsh->conf->bss[0]->iface);
|
|
+ eloop_cancel_timeout(hostapd_dfs_radar_handling_timeout,
|
|
+ wpa_s->ifmsh, NULL);
|
|
+ }
|
|
+#endif
|
|
ssid = wpa_config_get_network(wpa_s->conf, id);
|
|
if (ssid == NULL) {
|
|
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find network "
|
|
--- a/wpa_supplicant/mesh.c
|
|
+++ b/wpa_supplicant/mesh.c
|
|
@@ -556,6 +556,8 @@ static int wpa_supplicant_mesh_init(stru
|
|
conf->basic_rates[rate_len] = -1;
|
|
}
|
|
|
|
+ ifmsh->conf->disable_csa_dfs = wpa_s->conf->disable_csa_dfs;
|
|
+
|
|
/* 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
|
|
--- a/wpa_supplicant/wpa_supplicant.conf
|
|
+++ b/wpa_supplicant/wpa_supplicant.conf
|
|
@@ -1761,6 +1761,10 @@ fast_reauth=1
|
|
#Set 1 to enable 160MHz in Mesh mode
|
|
#enable_160mhz_bw=1
|
|
|
|
+# disable_csa_dfs option can be used to skip the channel switch in wpa_supplicant
|
|
+# during radar detection
|
|
+#disable_csa_dfs=1
|
|
+
|
|
# This value is used to configure the channel bonding feature.
|
|
# Default value is 0.
|
|
# Relevant only if enable_edmg is true
|