mirror of
https://github.com/FUjr/gl-infra-builder.git
synced 2025-12-16 09:10:02 +00:00
150 lines
5.6 KiB
Diff
150 lines
5.6 KiB
Diff
From 32f4a7b73b09964981bdbd672f7e0c982b87c99b Mon Sep 17 00:00:00 2001
|
|
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
|
|
Date: Thu, 3 Nov 2022 09:57:28 +0800
|
|
Subject: [PATCH] mac80211: support disable dfs cac dynamically
|
|
|
|
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
|
|
---
|
|
.../subsys/784-nl80211-radar-detect-hack.path | 40 +++++++++
|
|
...-support-disable-dfs-cac-dynamically.patch | 81 +++++++++++++++++++
|
|
2 files changed, 121 insertions(+)
|
|
create mode 100644 package/kernel/mac80211/patches/subsys/784-nl80211-radar-detect-hack.path
|
|
create mode 100644 package/network/services/hostapd/patches/800-support-disable-dfs-cac-dynamically.patch
|
|
|
|
diff --git a/package/kernel/mac80211/patches/subsys/784-nl80211-radar-detect-hack.path b/package/kernel/mac80211/patches/subsys/784-nl80211-radar-detect-hack.path
|
|
new file mode 100644
|
|
index 0000000000..7a5497f2ba
|
|
--- /dev/null
|
|
+++ b/package/kernel/mac80211/patches/subsys/784-nl80211-radar-detect-hack.path
|
|
@@ -0,0 +1,40 @@
|
|
+Index: backports-5.15.58-1/include/net/cfg80211.h
|
|
+===================================================================
|
|
+--- backports-5.15.58-1.orig/include/net/cfg80211.h
|
|
++++ backports-5.15.58-1/include/net/cfg80211.h
|
|
+@@ -5190,6 +5190,8 @@ struct wiphy {
|
|
+ u8 mbssid_max_interfaces;
|
|
+ u8 ema_max_profile_periodicity;
|
|
+
|
|
++ bool dfs_cac_disabled;
|
|
++
|
|
+ char priv[] __aligned(NETDEV_ALIGN);
|
|
+ };
|
|
+
|
|
+Index: backports-5.15.58-1/net/wireless/chan.c
|
|
+===================================================================
|
|
+--- backports-5.15.58-1.orig/net/wireless/chan.c
|
|
++++ backports-5.15.58-1/net/wireless/chan.c
|
|
+@@ -1218,6 +1218,11 @@ static bool _cfg80211_reg_can_beacon(str
|
|
+ prohibited_flags = IEEE80211_CHAN_DISABLED;
|
|
+ }
|
|
+
|
|
++ if (wiphy->dfs_cac_disabled) {
|
|
++ prohibited_flags = IEEE80211_CHAN_DISABLED;
|
|
++ cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE);
|
|
++ }
|
|
++
|
|
+ res = cfg80211_chandef_usable(wiphy, chandef, prohibited_flags);
|
|
+
|
|
+ trace_cfg80211_return_bool(res);
|
|
+Index: backports-5.15.58-1/net/wireless/debugfs.c
|
|
+===================================================================
|
|
+--- backports-5.15.58-1.orig/net/wireless/debugfs.c
|
|
++++ backports-5.15.58-1/net/wireless/debugfs.c
|
|
+@@ -107,4 +107,6 @@ void cfg80211_debugfs_rdev_add(struct cf
|
|
+ DEBUGFS_ADD(short_retry_limit);
|
|
+ DEBUGFS_ADD(long_retry_limit);
|
|
+ DEBUGFS_ADD(ht40allow_map);
|
|
++
|
|
++ debugfs_create_bool("dfs_cac_disabled", S_IRUSR | S_IWUSR, phyd, &rdev->wiphy.dfs_cac_disabled);
|
|
+ }
|
|
diff --git a/package/network/services/hostapd/patches/800-support-disable-dfs-cac-dynamically.patch b/package/network/services/hostapd/patches/800-support-disable-dfs-cac-dynamically.patch
|
|
new file mode 100644
|
|
index 0000000000..86227f1adc
|
|
--- /dev/null
|
|
+++ b/package/network/services/hostapd/patches/800-support-disable-dfs-cac-dynamically.patch
|
|
@@ -0,0 +1,81 @@
|
|
+Index: hostapd-2022-01-16-cff80b4f/src/ap/hostapd.c
|
|
+===================================================================
|
|
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/hostapd.c
|
|
++++ hostapd-2022-01-16-cff80b4f/src/ap/hostapd.c
|
|
+@@ -2099,6 +2099,9 @@ static int hostapd_setup_interface_compl
|
|
+ iface->conf->channel, iface->freq);
|
|
+
|
|
+ #ifdef NEED_AP_MLME
|
|
++ if (iface->interfaces->dfs_cac_disabled)
|
|
++ goto dfs_cac_disabled;
|
|
++
|
|
+ /* Handle DFS only if it is not offloaded to the driver */
|
|
+ if (!(iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)) {
|
|
+ /* Check DFS */
|
|
+@@ -2126,6 +2129,7 @@ static int hostapd_setup_interface_compl
|
|
+ /* Otherwise fall through. */
|
|
+ }
|
|
+ }
|
|
++dfs_cac_disabled:
|
|
+ #endif /* NEED_AP_MLME */
|
|
+
|
|
+ #ifdef CONFIG_MESH
|
|
+Index: hostapd-2022-01-16-cff80b4f/src/ap/hostapd.h
|
|
+===================================================================
|
|
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/hostapd.h
|
|
++++ hostapd-2022-01-16-cff80b4f/src/ap/hostapd.h
|
|
+@@ -82,6 +82,7 @@ struct hapd_interfaces {
|
|
+ unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN];
|
|
+ #endif /* CONFIG_CTRL_IFACE_UDP */
|
|
+ struct ubus_object ubus;
|
|
++ bool dfs_cac_disabled;
|
|
+ };
|
|
+
|
|
+ enum hostapd_chan_status {
|
|
+Index: hostapd-2022-01-16-cff80b4f/src/ap/ubus.c
|
|
+===================================================================
|
|
+--- hostapd-2022-01-16-cff80b4f.orig/src/ap/ubus.c
|
|
++++ hostapd-2022-01-16-cff80b4f/src/ap/ubus.c
|
|
+@@ -765,6 +765,34 @@ hostapd_config_remove(struct ubus_contex
|
|
+ return UBUS_STATUS_OK;
|
|
+ }
|
|
+
|
|
++enum {
|
|
++ DFS_CAC_DISABLE_VALUE,
|
|
++ __DFS_CAC_DISABLE_MAX
|
|
++};
|
|
++
|
|
++static const struct blobmsg_policy dfs_cac_disable_policy[__DFS_CAC_DISABLE_MAX] = {
|
|
++ [DFS_CAC_DISABLE_VALUE] = { "disabled", BLOBMSG_TYPE_BOOL },
|
|
++};
|
|
++
|
|
++static int
|
|
++hostapd_dfs_cac_disable(struct ubus_context *ctx, struct ubus_object *obj,
|
|
++ struct ubus_request_data *req, const char *method,
|
|
++ struct blob_attr *msg)
|
|
++{
|
|
++ struct hapd_interfaces *interfaces = get_hapd_interfaces_from_object(obj);
|
|
++ struct blob_attr *tb[__DFS_CAC_DISABLE_MAX];
|
|
++ char buf[128];
|
|
++
|
|
++ blobmsg_parse(dfs_cac_disable_policy, __DFS_CAC_DISABLE_MAX, tb, blob_data(msg), blob_len(msg));
|
|
++
|
|
++ if (!tb[DFS_CAC_DISABLE_VALUE])
|
|
++ return UBUS_STATUS_INVALID_ARGUMENT;
|
|
++
|
|
++ interfaces->dfs_cac_disabled = blobmsg_get_bool(tb[DFS_CAC_DISABLE_VALUE]);
|
|
++
|
|
++ return UBUS_STATUS_OK;
|
|
++}
|
|
++
|
|
+ enum {
|
|
+ CSA_FREQ,
|
|
+ CSA_BCN_COUNT,
|
|
+@@ -1802,6 +1830,7 @@ void hostapd_ubus_remove_vlan(struct hos
|
|
+ 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),
|
|
++ UBUS_METHOD("dfs_cac_disable", hostapd_dfs_cac_disable, dfs_cac_disable_policy),
|
|
+ };
|
|
+
|
|
+ static struct ubus_object_type daemon_object_type =
|
|
--
|
|
2.25.1
|
|
|