nl80211: AP MLD: Parse link ID to determine the BSS for radar event

Link ID is more accurate to specify the BSS for a radar event in some
corner cases, e.g., when there is a radar detection event and the driver
then switches to another DFS channel. There will then be two events
coming from the driver (CAC start and channel switch complete). In case
the CAC-start event comes first, hostapd still stores the previous
frequency and cannot find the correct link by calling
nl80211_get_mld_link_by_freq() with the new frequency.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
This commit is contained in:
Chenming Huang 2024-03-21 07:09:45 +05:30 committed by Jouni Malinen
parent 216cfd708d
commit 32261721e1

View file

@ -2461,7 +2461,10 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv,
data.dfs_event.freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]); data.dfs_event.freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]);
event_type = nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT]); event_type = nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT]);
if (data.dfs_event.freq) { if (tb[NL80211_ATTR_MLO_LINK_ID]) {
data.dfs_event.link_id =
nla_get_u8(tb[NL80211_ATTR_MLO_LINK_ID]);
} else if (data.dfs_event.freq) {
data.dfs_event.link_id = data.dfs_event.link_id =
nl80211_get_link_id_by_freq(drv->first_bss, nl80211_get_link_id_by_freq(drv->first_bss,
data.dfs_event.freq); data.dfs_event.freq);
@ -2848,7 +2851,10 @@ static void qca_nl80211_dfs_offload_radar_event(
data.dfs_event.freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]); data.dfs_event.freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]);
data.dfs_event.link_id = NL80211_DRV_LINK_ID_NA; data.dfs_event.link_id = NL80211_DRV_LINK_ID_NA;
if (data.dfs_event.freq) { if (tb[NL80211_ATTR_MLO_LINK_ID]) {
data.dfs_event.link_id =
nla_get_u8(tb[NL80211_ATTR_MLO_LINK_ID]);
} else if (data.dfs_event.freq) {
data.dfs_event.link_id = data.dfs_event.link_id =
nl80211_get_link_id_by_freq(drv->first_bss, nl80211_get_link_id_by_freq(drv->first_bss,
data.dfs_event.freq); data.dfs_event.freq);