| From c0fbe6aea8d2d3f8aee0fd5f17643d52e0469fa8 Mon Sep 17 00:00:00 2001 |
| From: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| Date: Fri, 7 Oct 2022 22:56:59 +0800 |
| Subject: [PATCH 99920/99920] Fix the issue of AP and STA starting on DFS |
| channel concurrently |
| |
| Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| --- |
| src/ap/hostapd.c | 4 +++- |
| src/drivers/driver.h | 7 +++++++ |
| src/drivers/driver_nl80211.c | 29 +++++++++++++++++++++++++++++ |
| src/drivers/nl80211_copy.h | 1 + |
| 4 files changed, 40 insertions(+), 1 deletion(-) |
| |
| diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c |
| index 5fc998e..ed1dfdb 100644 |
| --- a/src/ap/hostapd.c |
| +++ b/src/ap/hostapd.c |
| @@ -1463,7 +1463,9 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) |
| return -1; |
| } |
| |
| - if (!conf->start_disabled && ieee802_11_set_beacon(hapd) < 0) |
| + if (conf->start_disabled) |
| + hapd->driver->start_disabled(hapd->drv_priv); |
| + else if (ieee802_11_set_beacon(hapd) < 0) |
| return -1; |
| |
| if (flush_old_stations && !conf->start_disabled && |
| diff --git a/src/drivers/driver.h b/src/drivers/driver.h |
| index 3286429..3e8824c 100644 |
| --- a/src/drivers/driver.h |
| +++ b/src/drivers/driver.h |
| @@ -4729,6 +4729,13 @@ struct wpa_driver_ops { |
| int (*ampdu_ctrl)(void *priv, u8 ampdu); |
| int (*amsdu_ctrl)(void *priv, u8 amsdu); |
| int (*aggregation_dump)(void *priv, u8 *aggr); |
| + |
| + /** |
| + * start_disabled - set start_disabled to cfg80211 |
| + * @priv: Private driver interface data |
| + * |
| + */ |
| + int (*start_disabled)(void *priv); |
| }; |
| |
| /** |
| diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c |
| index a06ac58..af064c0 100644 |
| --- a/src/drivers/driver_nl80211.c |
| +++ b/src/drivers/driver_nl80211.c |
| @@ -12812,6 +12812,34 @@ fail: |
| return -ENOBUFS; |
| } |
| |
| +static int nl80211_start_disabled(void *priv) |
| +{ |
| + struct i802_bss *bss = priv; |
| + struct wpa_driver_nl80211_data *drv = bss->drv; |
| + struct nl_msg *msg; |
| + struct nlattr *data; |
| + int ret; |
| + |
| + msg = nl80211_bss_msg(bss, 0, NL80211_CMD_NEW_BEACON); |
| + if (!msg) |
| + goto fail; |
| + |
| + if (nla_put_flag(msg, NL80211_ATTR_START_DISABLED)) |
| + goto fail; |
| + |
| + ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 1); |
| + |
| + if (ret) |
| + wpa_printf(MSG_ERROR, "Failed to set start_disabled. ret=%d (%s)", |
| + ret, strerror(-ret)); |
| + |
| + return ret; |
| + |
| +fail: |
| + nlmsg_free(msg); |
| + return ret; |
| +} |
| + |
| const struct wpa_driver_ops wpa_driver_nl80211_ops = { |
| .name = "nl80211", |
| .desc = "Linux nl80211/cfg80211", |
| @@ -12967,4 +12995,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = { |
| .ampdu_ctrl = nl80211_enable_ampdu, |
| .amsdu_ctrl = nl80211_enable_amsdu, |
| .aggregation_dump = nl80211_dump_aggregation, |
| + .start_disabled = nl80211_start_disabled, |
| }; |
| diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h |
| index c4bf3ad..4c86340 100644 |
| --- a/src/drivers/nl80211_copy.h |
| +++ b/src/drivers/nl80211_copy.h |
| @@ -3176,6 +3176,7 @@ enum nl80211_attrs { |
| NL80211_ATTR_EHT_CAPABILITY, |
| |
| /* add attributes here, update the policy in nl80211.c */ |
| + NL80211_ATTR_START_DISABLED = 999, |
| |
| __NL80211_ATTR_AFTER_LAST, |
| NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST, |
| -- |
| 2.18.0 |
| |