From 40fb10843b4125101f5341c402ee4602dee19206 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Singh Date: Tue, 10 Oct 2023 15:12:25 +0530 Subject: [PATCH] hostapd: remove redundant put_freq call in set_ap Currently wpa_driver_nl80211_set_ap() calls nl80211_put_freq_params() two times if AP is a MLD AP. It calls one while putting MLO link ID and other in the normal flow if frequency info is present. Calling two times is not required. Hence, add code changes to call it via the normal flow only and if the AP is MLD AP, add MLO link ID as well. Signed-off-by: Aditya Kumar Singh --- src/drivers/driver_nl80211.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -5068,20 +5068,6 @@ static int wpa_driver_nl80211_set_ap(voi nla_put_u32(msg, NL80211_ATTR_BEACON_TX_MODE, params->beacon_tx_mode))) goto fail; - if (params->mld_ap) { - wpa_printf(MSG_DEBUG, "nl80211: link_id=%u", - params->mld_link_id); - - if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, - params->mld_link_id) || - (params->freq && - nl80211_put_freq_params(msg, params->freq) < 0)) - goto fail; - - nl80211_link_set_freq(bss, params->mld_link_id, - params->freq->freq); - } - if (params->proberesp && params->proberesp_len) { wpa_hexdump(MSG_DEBUG, "nl80211: proberesp (offload)", params->proberesp, params->proberesp_len); @@ -5307,6 +5293,19 @@ static int wpa_driver_nl80211_set_ap(voi if (params->freq && nl80211_put_freq_params(msg, params->freq) < 0) goto fail; + if (params->mld_ap) { + wpa_printf(MSG_DEBUG, "nl80211: link_id=%u", + params->mld_link_id); + + if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, + params->mld_link_id)) + goto fail; + + if (params->freq) + nl80211_link_set_freq(bss, params->mld_link_id, + params->freq->freq); + } + if (params->freq && params->freq->he_enabled) { struct nlattr *bss_color;