blob: 6e89adb22f5bcbec558327b0d9ff8c7de250dc5b [file] [log] [blame]
developer5cebe562022-10-08 00:32:24 +08001From c0fbe6aea8d2d3f8aee0fd5f17643d52e0469fa8 Mon Sep 17 00:00:00 2001
2From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Fri, 7 Oct 2022 22:56:59 +0800
4Subject: [PATCH 99920/99920] Fix the issue of AP and STA starting on DFS
5 channel concurrently
6
7Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
8---
9 src/ap/hostapd.c | 4 +++-
10 src/drivers/driver.h | 7 +++++++
11 src/drivers/driver_nl80211.c | 29 +++++++++++++++++++++++++++++
12 src/drivers/nl80211_copy.h | 1 +
13 4 files changed, 40 insertions(+), 1 deletion(-)
14
15diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
16index 5fc998e..ed1dfdb 100644
17--- a/src/ap/hostapd.c
18+++ b/src/ap/hostapd.c
19@@ -1463,7 +1463,9 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
20 return -1;
21 }
22
23- if (!conf->start_disabled && ieee802_11_set_beacon(hapd) < 0)
24+ if (conf->start_disabled)
25+ hapd->driver->start_disabled(hapd->drv_priv);
26+ else if (ieee802_11_set_beacon(hapd) < 0)
27 return -1;
28
29 if (flush_old_stations && !conf->start_disabled &&
30diff --git a/src/drivers/driver.h b/src/drivers/driver.h
31index 3286429..3e8824c 100644
32--- a/src/drivers/driver.h
33+++ b/src/drivers/driver.h
34@@ -4729,6 +4729,13 @@ struct wpa_driver_ops {
35 int (*ampdu_ctrl)(void *priv, u8 ampdu);
36 int (*amsdu_ctrl)(void *priv, u8 amsdu);
37 int (*aggregation_dump)(void *priv, u8 *aggr);
38+
39+ /**
40+ * start_disabled - set start_disabled to cfg80211
41+ * @priv: Private driver interface data
42+ *
43+ */
44+ int (*start_disabled)(void *priv);
45 };
46
47 /**
48diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
49index a06ac58..af064c0 100644
50--- a/src/drivers/driver_nl80211.c
51+++ b/src/drivers/driver_nl80211.c
52@@ -12812,6 +12812,34 @@ fail:
53 return -ENOBUFS;
54 }
55
56+static int nl80211_start_disabled(void *priv)
57+{
58+ struct i802_bss *bss = priv;
59+ struct wpa_driver_nl80211_data *drv = bss->drv;
60+ struct nl_msg *msg;
61+ struct nlattr *data;
62+ int ret;
63+
64+ msg = nl80211_bss_msg(bss, 0, NL80211_CMD_NEW_BEACON);
65+ if (!msg)
66+ goto fail;
67+
68+ if (nla_put_flag(msg, NL80211_ATTR_START_DISABLED))
69+ goto fail;
70+
71+ ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 1);
72+
73+ if (ret)
74+ wpa_printf(MSG_ERROR, "Failed to set start_disabled. ret=%d (%s)",
75+ ret, strerror(-ret));
76+
77+ return ret;
78+
79+fail:
80+ nlmsg_free(msg);
81+ return ret;
82+}
83+
84 const struct wpa_driver_ops wpa_driver_nl80211_ops = {
85 .name = "nl80211",
86 .desc = "Linux nl80211/cfg80211",
87@@ -12967,4 +12995,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
88 .ampdu_ctrl = nl80211_enable_ampdu,
89 .amsdu_ctrl = nl80211_enable_amsdu,
90 .aggregation_dump = nl80211_dump_aggregation,
91+ .start_disabled = nl80211_start_disabled,
92 };
93diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
94index c4bf3ad..4c86340 100644
95--- a/src/drivers/nl80211_copy.h
96+++ b/src/drivers/nl80211_copy.h
97@@ -3176,6 +3176,7 @@ enum nl80211_attrs {
98 NL80211_ATTR_EHT_CAPABILITY,
99
100 /* add attributes here, update the policy in nl80211.c */
101+ NL80211_ATTR_START_DISABLED = 999,
102
103 __NL80211_ATTR_AFTER_LAST,
104 NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
105--
1062.18.0
107