mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-22 11:53:02 +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>
170 lines
5.5 KiB
Diff
170 lines
5.5 KiB
Diff
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
|
|
index 45b4d45..242179c 100644
|
|
--- a/hostapd/config_file.c
|
|
+++ b/hostapd/config_file.c
|
|
@@ -2444,6 +2444,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
|
|
conf->ieee80211d = atoi(pos);
|
|
} else if (os_strcmp(buf, "ieee80211h") == 0) {
|
|
conf->ieee80211h = atoi(pos);
|
|
+ } else if (os_strcmp(buf, "dfs_test_mode") == 0) {
|
|
+ conf->dfs_test_mode = atoi(pos);
|
|
} else if (os_strcmp(buf, "ieee8021x") == 0) {
|
|
bss->ieee802_1x = atoi(pos);
|
|
} else if (os_strcmp(buf, "eapol_version") == 0) {
|
|
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
|
|
index 02fd494..a0a21ab 100644
|
|
--- a/src/ap/ap_config.h
|
|
+++ b/src/ap/ap_config.h
|
|
@@ -1055,6 +1055,7 @@ struct hostapd_config {
|
|
int ieee80211d;
|
|
|
|
int ieee80211h; /* DFS */
|
|
+ int dfs_test_mode;
|
|
|
|
/*
|
|
* Local power constraint is an octet encoded as an unsigned integer in
|
|
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
|
|
index a19afb0..1cbca53 100644
|
|
--- a/src/ap/dfs.c
|
|
+++ b/src/ap/dfs.c
|
|
@@ -18,7 +18,8 @@
|
|
#include "drivers/driver.h"
|
|
#include "dfs.h"
|
|
#include "crypto/crypto.h"
|
|
-
|
|
+#include "beacon.h"
|
|
+#include "eloop.h"
|
|
|
|
enum dfs_channel_type {
|
|
DFS_ANY_CHANNEL,
|
|
@@ -1117,6 +1118,78 @@ hostapd_dfs_is_background_event(struct hostapd_iface *iface, int freq)
|
|
iface->radar_background.freq == freq;
|
|
}
|
|
|
|
+void hostapd_dfs_test_mode_csa_timeout(void *eloop_data, void *user_data)
|
|
+{
|
|
+ struct hostapd_data *hapd = eloop_data;
|
|
+
|
|
+ wpa_printf(MSG_INFO, "Stopping CSA in dfs test mode");
|
|
+ hostapd_cleanup_cs_params(hapd);
|
|
+ ieee802_11_set_beacon(hapd);
|
|
+}
|
|
+
|
|
+static int hostapd_dfs_testmode_set_beacon_csa(struct hostapd_iface *iface)
|
|
+{
|
|
+ struct hostapd_data *hapd = iface->bss[0];
|
|
+ struct csa_settings csa_settings;
|
|
+ int secondary_channel;
|
|
+ u8 vht_oper_centr_freq_seg0_idx;
|
|
+ u8 vht_oper_centr_freq_seg1_idx;
|
|
+ int err = 0;
|
|
+
|
|
+ eloop_cancel_timeout(hostapd_dfs_test_mode_csa_timeout, hapd, NULL);
|
|
+ secondary_channel = iface->conf->secondary_channel;
|
|
+ vht_oper_centr_freq_seg0_idx =
|
|
+ iface->conf->vht_oper_centr_freq_seg0_idx;
|
|
+ vht_oper_centr_freq_seg1_idx =
|
|
+ iface->conf->vht_oper_centr_freq_seg1_idx;
|
|
+
|
|
+ /* Setup CSA request */
|
|
+ os_memset(&csa_settings, 0, sizeof(csa_settings));
|
|
+ err = hostapd_set_freq_params(&csa_settings.freq_params,
|
|
+ iface->conf->hw_mode,
|
|
+ iface->freq,
|
|
+ iface->conf->channel,
|
|
+ iface->conf->enable_edmg,
|
|
+ iface->conf->edmg_channel,
|
|
+ iface->conf->ieee80211n,
|
|
+ iface->conf->ieee80211ac,
|
|
+ iface->conf->ieee80211ax,
|
|
+ iface->conf->ieee80211be,
|
|
+ secondary_channel,
|
|
+ hostapd_get_oper_chwidth(iface->conf),
|
|
+ vht_oper_centr_freq_seg0_idx,
|
|
+ vht_oper_centr_freq_seg1_idx,
|
|
+ iface->current_mode->vht_capab,
|
|
+ &iface->current_mode->he_capab[IEEE80211_MODE_AP],
|
|
+ &iface->current_mode->eht_capab[IEEE80211_MODE_AP]);
|
|
+
|
|
+ if (err) {
|
|
+ wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
|
|
+ goto fail;
|
|
+ }
|
|
+
|
|
+ if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) {
|
|
+ wpa_printf(MSG_INFO, "CSA is not supported");
|
|
+ hostapd_disable_iface(iface);
|
|
+ return -1;
|
|
+ }
|
|
+ hapd->cs_freq_params = csa_settings.freq_params;
|
|
+ hapd->cs_count = 3;
|
|
+ hapd->cs_block_tx = 1;
|
|
+ err = ieee802_11_set_beacon(hapd);
|
|
+ if (err)
|
|
+ goto fail;
|
|
+ wpa_printf(MSG_DEBUG, "CSA beacon configured for dfs mode, count %d",
|
|
+ hapd->cs_count);
|
|
+ hapd->csa_in_progress = 1;
|
|
+ eloop_register_timeout(HOSTAPD_DFS_TEST_MODE_CSA_DUR, 0,
|
|
+ hostapd_dfs_test_mode_csa_timeout, hapd, NULL);
|
|
+ return 0;
|
|
+
|
|
+fail:
|
|
+ hostapd_disable_iface(iface);
|
|
+ return err;
|
|
+}
|
|
|
|
static int
|
|
hostapd_dfs_start_channel_switch_background(struct hostapd_iface *iface)
|
|
@@ -1385,6 +1458,9 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
|
|
if (iface->dfs_domain == HOSTAPD_DFS_REGION_ETSI)
|
|
channel_type = DFS_ANY_CHANNEL;
|
|
|
|
+ if (iface->conf->dfs_test_mode)
|
|
+ return hostapd_dfs_testmode_set_beacon_csa(iface);
|
|
+
|
|
/* Perform channel switch/CSA */
|
|
channel = dfs_get_valid_channel(iface, &secondary_channel,
|
|
&oper_centr_freq_seg0_idx,
|
|
@@ -1456,6 +1532,12 @@ int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,
|
|
cf1, cf2, HOSTAPD_CHAN_DFS_UNAVAILABLE))
|
|
return 0;
|
|
|
|
+ if (iface->conf->dfs_test_mode) {
|
|
+ set_dfs_state(iface, freq, ht_enabled, chan_offset,
|
|
+ chan_width, cf1, cf2,
|
|
+ HOSTAPD_CHAN_DFS_AVAILABLE);
|
|
+ }
|
|
+
|
|
if (!hostapd_dfs_is_background_event(iface, freq)) {
|
|
/* Skip if reported radar event not overlapped our channels */
|
|
if (!dfs_are_channels_overlapped(iface, freq, chan_width,
|
|
diff --git a/src/ap/dfs.h b/src/ap/dfs.h
|
|
index 606c1b3..3a7c3e4 100644
|
|
--- a/src/ap/dfs.h
|
|
+++ b/src/ap/dfs.h
|
|
@@ -9,6 +9,11 @@
|
|
#ifndef DFS_H
|
|
#define DFS_H
|
|
|
|
+/* CSA beacon duration in seconds for dfs testing mode */
|
|
+#define HOSTAPD_DFS_TEST_MODE_CSA_DUR 1
|
|
+
|
|
+void hostapd_dfs_test_mode_csa_timeout(void *eloop_data, void *user_data);
|
|
+
|
|
int hostapd_handle_dfs(struct hostapd_iface *iface);
|
|
|
|
int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
|
|
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
|
|
index 0b7d2c1..ef3b730 100644
|
|
--- a/src/ap/hostapd.c
|
|
+++ b/src/ap/hostapd.c
|
|
@@ -3216,6 +3216,7 @@ int hostapd_disable_iface(struct hostapd_iface *hapd_iface)
|
|
hostapd_cleanup_cs_params(hapd_iface->bss[j]);
|
|
#endif /* NEED_AP_MLME */
|
|
|
|
+ eloop_cancel_timeout(hostapd_dfs_test_mode_csa_timeout, hapd_iface, NULL);
|
|
/* same as hostapd_interface_deinit without deinitializing ctrl-iface */
|
|
for (j = 0; j < hapd_iface->num_bss; j++) {
|
|
struct hostapd_data *hapd = hapd_iface->bss[j];
|