From 2a50fe7307d9cc86632ca6a9262381ac8018c6ca Mon Sep 17 00:00:00 2001 From: Aloka Dixit Date: Sun, 20 Sep 2020 23:44:04 -0700 Subject: [PATCH] AP: Remove unnecessary nl80211 messages Hostapd should send FILS discovery and unsolicited broadcast probe response related nl80211 message only if the packet interval is set to a non-zero value. Sending these messages without such checks is resulting in memory shortage causing failure to bring up more interfaces per radio using multiple BSSID. This patch fixes this issue and adds debug messages. Signed-off-by: Aloka Dixit --- src/ap/beacon.c | 7 ++++++- src/drivers/driver_nl80211.c | 23 +++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 3094979907c3..668d9094e28d 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1149,6 +1149,10 @@ static u8 *hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd, if (!is_6ghz_op_class(hapd->iconf->op_class)) return NULL; + if (hapd->iconf->multiple_bssid && + hapd != hostapd_get_primary_bss(hapd)) + return NULL; + params->unsol_bcast_probe_resp_interval = hapd->conf->unsol_bcast_probe_resp_interval; @@ -1408,7 +1412,8 @@ static u8 * hostapd_gen_fils_discovery(struct hostapd_data *hapd, u32 *len) static u8 * hostapd_fils_discovery(struct hostapd_data *hapd, struct wpa_driver_ap_params *params) { - if (hapd->iconf->multiple_bssid && hapd != hapd->iface->bss[0]) + if (hapd->iconf->multiple_bssid && + hapd != hostapd_get_primary_bss(hapd)) return NULL; #define VALID_INTERVAL(x,y) { x = (x > y) ? y : x; } diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 8b8435b2fbfd..f2aa2a434b21 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4701,15 +4701,26 @@ static int wpa_driver_nl80211_set_ap(void *priv, goto fail; } - ret = nl80211_unsol_bcast_probe_resp(bss, msg, params); - if (ret < 0) - goto fail; + if (params->unsol_bcast_probe_resp_interval) { + wpa_printf(MSG_DEBUG, + "nl80211: unsolicited probe response interval=%u\n", + params->unsol_bcast_probe_resp_interval); + ret = nl80211_unsol_bcast_probe_resp(bss, msg, params); + if (ret < 0) + goto fail; + } #endif /* CONFIG_IEEE80211AX */ #ifdef CONFIG_FILS - ret = nl80211_fils_discovery(bss, msg, params); - if (ret < 0) - goto fail; + if (params->fils_discovery_max_int) { + wpa_printf(MSG_DEBUG, + "nl80211: FILS discovery maximum interval=%u, minimum interval=%u\n", + params->fils_discovery_max_int, + params->fils_discovery_min_int); + ret = nl80211_fils_discovery(bss, msg, params); + if (ret < 0) + goto fail; + } #endif /* CONFIG_FILS */ if (params->multiple_bssid_count) { -- 2.25.0