Add an option to remove RRM and supported operating class indication

Removing radio measurements and supported operating class indication
might be needed to reduce binary size for a memory constrained system
that does not need more advanced features. However, removing these is
not recommended since they can help the AP manage the network and STA
steering.

By default this functionality is enabled.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit is contained in:
Chaitanya Tata 2023-11-28 00:33:58 +05:30 committed by Jouni Malinen
parent 4b80ad1194
commit 6ed8eba00d
12 changed files with 64 additions and 6 deletions

View file

@ -557,7 +557,9 @@ void hostapd_free_hapd_data(struct hostapd_data *hapd)
hapd->setup_complete_cb = NULL; hapd->setup_complete_cb = NULL;
#endif /* CONFIG_MESH */ #endif /* CONFIG_MESH */
#ifndef CONFIG_NO_RRM
hostapd_clean_rrm(hapd); hostapd_clean_rrm(hapd);
#endif /* CONFIG_NO_RRM */
fils_hlp_deinit(hapd); fils_hlp_deinit(hapd);
#ifdef CONFIG_OCV #ifdef CONFIG_OCV

View file

@ -6067,9 +6067,11 @@ static int handle_action(struct hostapd_data *hapd,
return 1; return 1;
} }
break; break;
#ifndef CONFIG_NO_RRM
case WLAN_ACTION_RADIO_MEASUREMENT: case WLAN_ACTION_RADIO_MEASUREMENT:
hostapd_handle_radio_measurement(hapd, (const u8 *) mgmt, len); hostapd_handle_radio_measurement(hapd, (const u8 *) mgmt, len);
return 1; return 1;
#endif /* CONFIG_NO_RRM */
} }
hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
@ -6674,7 +6676,9 @@ static void handle_action_cb(struct hostapd_data *hapd,
size_t len, int ok) size_t len, int ok)
{ {
struct sta_info *sta; struct sta_info *sta;
#ifndef CONFIG_NO_RRM
const struct rrm_measurement_report_element *report; const struct rrm_measurement_report_element *report;
#endif /* CONFIG_NO_RRM */
#ifdef CONFIG_DPP #ifdef CONFIG_DPP
if (len >= IEEE80211_HDRLEN + 6 && if (len >= IEEE80211_HDRLEN + 6 &&
@ -6728,6 +6732,7 @@ static void handle_action_cb(struct hostapd_data *hapd,
} }
#endif /* CONFIG_HS20 */ #endif /* CONFIG_HS20 */
#ifndef CONFIG_NO_RRM
if (len < 24 + 5 + sizeof(*report)) if (len < 24 + 5 + sizeof(*report))
return; return;
report = (const struct rrm_measurement_report_element *) report = (const struct rrm_measurement_report_element *)
@ -6738,6 +6743,7 @@ static void handle_action_cb(struct hostapd_data *hapd,
report->len >= 3 && report->len >= 3 &&
report->type == MEASURE_TYPE_BEACON) report->type == MEASURE_TYPE_BEACON)
hostapd_rrm_beacon_req_tx_status(hapd, mgmt, len, ok); hostapd_rrm_beacon_req_tx_status(hapd, mgmt, len, ok);
#endif /* CONFIG_NO_RRM */
} }

View file

@ -101,8 +101,6 @@ OBJS += src/utils/bitfield.c
OBJS += src/utils/ip_addr.c OBJS += src/utils/ip_addr.c
OBJS += src/utils/crc32.c OBJS += src/utils/crc32.c
OBJS += wmm_ac.c OBJS += wmm_ac.c
OBJS += op_classes.c
OBJS += rrm.c
OBJS += twt.c OBJS += twt.c
OBJS += robust_av.c OBJS += robust_av.c
OBJS_p = wpa_passphrase.c OBJS_p = wpa_passphrase.c
@ -423,6 +421,16 @@ ifdef CONFIG_NO_TKIP
L_CFLAGS += -DCONFIG_NO_TKIP L_CFLAGS += -DCONFIG_NO_TKIP
endif endif
ifdef CONFIG_NO_RRM
L_CFLAGS += -DCONFIG_NO_RRM
else
OBJS += rrm.c
ifdef CONFIG_AP
OBJS += src/ap/rrm.c
endif
OBJS += op_classes.c
endif
include $(LOCAL_PATH)/src/drivers/drivers.mk include $(LOCAL_PATH)/src/drivers/drivers.mk
@ -906,7 +914,6 @@ OBJS += src/ap/beacon.c
OBJS += src/ap/bss_load.c OBJS += src/ap/bss_load.c
OBJS += src/ap/eap_user_db.c OBJS += src/ap/eap_user_db.c
OBJS += src/ap/neighbor_db.c OBJS += src/ap/neighbor_db.c
OBJS += src/ap/rrm.c
OBJS += src/ap/ieee802_11_ht.c OBJS += src/ap/ieee802_11_ht.c
ifdef CONFIG_IEEE80211AC ifdef CONFIG_IEEE80211AC
OBJS += src/ap/ieee802_11_vht.c OBJS += src/ap/ieee802_11_vht.c

View file

@ -111,8 +111,6 @@ OBJS += ../src/utils/wpabuf.o
OBJS += ../src/utils/bitfield.o OBJS += ../src/utils/bitfield.o
OBJS += ../src/utils/ip_addr.o OBJS += ../src/utils/ip_addr.o
OBJS += ../src/utils/crc32.o OBJS += ../src/utils/crc32.o
OBJS += op_classes.o
OBJS += rrm.o
OBJS += twt.o OBJS += twt.o
OBJS += robust_av.o OBJS += robust_av.o
OBJS_p = wpa_passphrase.o OBJS_p = wpa_passphrase.o
@ -473,6 +471,16 @@ ifdef CONFIG_NO_LOAD_DYNAMIC_EAP
CFLAGS += -DCONFIG_NO_LOAD_DYNAMIC_EAP CFLAGS += -DCONFIG_NO_LOAD_DYNAMIC_EAP
endif endif
ifdef CONFIG_NO_RRM
CFLAGS += -DCONFIG_NO_RRM
else
OBJS += rrm.o
ifdef CONFIG_AP
OBJS += ../src/ap/rrm.o
endif
OBJS += op_classes.o
endif
include ../src/drivers/drivers.mak include ../src/drivers/drivers.mak
ifdef CONFIG_AP ifdef CONFIG_AP
OBJS_d += $(DRV_BOTH_OBJS) OBJS_d += $(DRV_BOTH_OBJS)
@ -979,7 +987,6 @@ OBJS += ../src/ap/beacon.o
OBJS += ../src/ap/bss_load.o OBJS += ../src/ap/bss_load.o
OBJS += ../src/ap/eap_user_db.o OBJS += ../src/ap/eap_user_db.o
OBJS += ../src/ap/neighbor_db.o OBJS += ../src/ap/neighbor_db.o
OBJS += ../src/ap/rrm.o
OBJS += ../src/ap/ieee802_11_ht.o OBJS += ../src/ap/ieee802_11_ht.o
ifdef CONFIG_IEEE80211AC ifdef CONFIG_IEEE80211AC
OBJS += ../src/ap/ieee802_11_vht.o OBJS += ../src/ap/ieee802_11_vht.o

View file

@ -542,4 +542,9 @@ CONFIG_WIFI_DISPLAY=y
# be completely removed in a future release. # be completely removed in a future release.
CONFIG_WEP=y CONFIG_WEP=y
# Disable support for Radio Measurement (IEEE 802.11k) and supported operating
# class indication. Removing these is not recommended since they can help the
# AP manage the network and STA steering.
#CONFIG_NO_RRM=y
include $(wildcard $(LOCAL_PATH)/android_config_*.inc) include $(wildcard $(LOCAL_PATH)/android_config_*.inc)

View file

@ -10505,6 +10505,8 @@ static int wpas_ctrl_vendor_elem_remove(struct wpa_supplicant *wpa_s, char *cmd)
} }
#ifndef CONFIG_NO_RRM
static void wpas_ctrl_neighbor_rep_cb(void *ctx, struct wpabuf *neighbor_rep) static void wpas_ctrl_neighbor_rep_cb(void *ctx, struct wpabuf *neighbor_rep)
{ {
struct wpa_supplicant *wpa_s = ctx; struct wpa_supplicant *wpa_s = ctx;
@ -10648,6 +10650,8 @@ static int wpas_ctrl_iface_send_neighbor_rep(struct wpa_supplicant *wpa_s,
return ret; return ret;
} }
#endif /* CONFIG_NO_RRM */
static int wpas_ctrl_iface_erp_flush(struct wpa_supplicant *wpa_s) static int wpas_ctrl_iface_erp_flush(struct wpa_supplicant *wpa_s)
{ {
@ -12873,9 +12877,11 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
} else if (os_strncmp(buf, "VENDOR_ELEM_REMOVE ", 19) == 0) { } else if (os_strncmp(buf, "VENDOR_ELEM_REMOVE ", 19) == 0) {
if (wpas_ctrl_vendor_elem_remove(wpa_s, buf + 19) < 0) if (wpas_ctrl_vendor_elem_remove(wpa_s, buf + 19) < 0)
reply_len = -1; reply_len = -1;
#ifndef CONFIG_NO_RRM
} else if (os_strncmp(buf, "NEIGHBOR_REP_REQUEST", 20) == 0) { } else if (os_strncmp(buf, "NEIGHBOR_REP_REQUEST", 20) == 0) {
if (wpas_ctrl_iface_send_neighbor_rep(wpa_s, buf + 20)) if (wpas_ctrl_iface_send_neighbor_rep(wpa_s, buf + 20))
reply_len = -1; reply_len = -1;
#endif /* CONFIG_NO_RRM */
} else if (os_strcmp(buf, "ERP_FLUSH") == 0) { } else if (os_strcmp(buf, "ERP_FLUSH") == 0) {
wpas_ctrl_iface_erp_flush(wpa_s); wpas_ctrl_iface_erp_flush(wpa_s);
} else if (os_strncmp(buf, "MAC_RAND_SCAN ", 14) == 0) { } else if (os_strncmp(buf, "MAC_RAND_SCAN ", 14) == 0) {

View file

@ -671,3 +671,8 @@ CONFIG_DPP2=y
# design is still subject to change. As such, this should not yet be enabled in # design is still subject to change. As such, this should not yet be enabled in
# production use. # production use.
#CONFIG_PASN=y #CONFIG_PASN=y
# Disable support for Radio Measurement (IEEE 802.11k) and supported operating
# class indication. Removing these is not recommended since they can help the
# AP manage the network and STA steering.
#CONFIG_NO_RRM=y

View file

@ -1915,7 +1915,11 @@ static void wpas_dpp_start_gas_client(struct wpa_supplicant *wpa_s)
offchannel_send_action_done(wpa_s); offchannel_send_action_done(wpa_s);
wpas_dpp_listen_stop(wpa_s); wpas_dpp_listen_stop(wpa_s);
#ifdef CONFIG_NO_RRM
supp_op_classes = NULL;
#else /* CONFIG_NO_RRM */
supp_op_classes = wpas_supp_op_classes(wpa_s); supp_op_classes = wpas_supp_op_classes(wpa_s);
#endif /* CONFIG_NO_RRM */
buf = dpp_build_conf_req_helper(auth, wpa_s->conf->dpp_name, buf = dpp_build_conf_req_helper(auth, wpa_s->conf->dpp_name,
wpa_s->dpp_netrole, wpa_s->dpp_netrole,
wpa_s->conf->dpp_mud_url, wpa_s->conf->dpp_mud_url,

View file

@ -382,7 +382,9 @@ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
wpa_s->key_mgmt = 0; wpa_s->key_mgmt = 0;
wpa_s->allowed_key_mgmts = 0; wpa_s->allowed_key_mgmts = 0;
#ifndef CONFIG_NO_RRM
wpas_rrm_reset(wpa_s); wpas_rrm_reset(wpa_s);
#endif /* CONFIG_NO_RRM */
wpa_s->wnmsleep_used = 0; wpa_s->wnmsleep_used = 0;
wnm_clear_coloc_intf_reporting(wpa_s); wnm_clear_coloc_intf_reporting(wpa_s);
wpa_s->disable_mbo_oce = 0; wpa_s->disable_mbo_oce = 0;
@ -2470,9 +2472,11 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
if (sme_proc_obss_scan(wpa_s) > 0) if (sme_proc_obss_scan(wpa_s) > 0)
goto scan_work_done; goto scan_work_done;
#ifndef CONFIG_NO_RRM
if (own_request && data && if (own_request && data &&
wpas_beacon_rep_scan_process(wpa_s, scan_res, &data->scan_info) > 0) wpas_beacon_rep_scan_process(wpa_s, scan_res, &data->scan_info) > 0)
goto scan_work_done; goto scan_work_done;
#endif /* CONFIG_NO_RRM */
if (ml_link_probe_scan(wpa_s)) if (ml_link_probe_scan(wpa_s))
goto scan_work_done; goto scan_work_done;
@ -5294,6 +5298,7 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s,
} }
#endif /* CONFIG_INTERWORKING */ #endif /* CONFIG_INTERWORKING */
#ifndef CONFIG_NO_RRM
if (category == WLAN_ACTION_RADIO_MEASUREMENT && if (category == WLAN_ACTION_RADIO_MEASUREMENT &&
payload[0] == WLAN_RRM_RADIO_MEASUREMENT_REQUEST) { payload[0] == WLAN_RRM_RADIO_MEASUREMENT_REQUEST) {
wpas_rrm_handle_radio_measurement_request(wpa_s, mgmt->sa, wpas_rrm_handle_radio_measurement_request(wpa_s, mgmt->sa,
@ -5316,6 +5321,7 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s,
rssi); rssi);
return; return;
} }
#endif /* CONFIG_NO_RRM */
#ifdef CONFIG_FST #ifdef CONFIG_FST
if (mgmt->u.action.category == WLAN_ACTION_FST && wpa_s->fst) { if (mgmt->u.action.category == WLAN_ACTION_FST && wpa_s->fst) {

View file

@ -261,8 +261,10 @@ static void wpas_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
wpa_s->scan_res_handler = NULL; wpa_s->scan_res_handler = NULL;
} }
#ifndef CONFIG_NO_RRM
if (wpa_s->beacon_rep_data.token) if (wpa_s->beacon_rep_data.token)
wpas_rrm_refuse_request(wpa_s); wpas_rrm_refuse_request(wpa_s);
#endif /* CONFIG_NO_RRM */
return; return;
} }

View file

@ -874,10 +874,12 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
sme_auth_handle_rrm(wpa_s, bss); sme_auth_handle_rrm(wpa_s, bss);
#ifndef CONFIG_NO_RRM
wpa_s->sme.assoc_req_ie_len += wpas_supp_op_class_ie( wpa_s->sme.assoc_req_ie_len += wpas_supp_op_class_ie(
wpa_s, ssid, bss, wpa_s, ssid, bss,
wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len,
sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len); sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len);
#endif /* CONFIG_NO_RRM */
if (params.p2p) if (params.p2p)
wpa_drv_get_ext_capa(wpa_s, WPA_IF_P2P_CLIENT); wpa_drv_get_ext_capa(wpa_s, WPA_IF_P2P_CLIENT);

View file

@ -715,7 +715,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
wpabuf_free(wpa_s->lci); wpabuf_free(wpa_s->lci);
wpa_s->lci = NULL; wpa_s->lci = NULL;
#ifndef CONFIG_NO_RRM
wpas_clear_beacon_rep_data(wpa_s); wpas_clear_beacon_rep_data(wpa_s);
#endif /* CONFIG_NO_RRM */
#ifdef CONFIG_PMKSA_CACHE_EXTERNAL #ifdef CONFIG_PMKSA_CACHE_EXTERNAL
#ifdef CONFIG_MESH #ifdef CONFIG_MESH
@ -3499,12 +3501,14 @@ static u8 * wpas_populate_assoc_ies(
os_memset(wpa_s->p2p_ip_addr_info, 0, sizeof(wpa_s->p2p_ip_addr_info)); os_memset(wpa_s->p2p_ip_addr_info, 0, sizeof(wpa_s->p2p_ip_addr_info));
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
#ifndef CONFIG_NO_RRM
if (bss) { if (bss) {
wpa_ie_len += wpas_supp_op_class_ie(wpa_s, ssid, bss, wpa_ie_len += wpas_supp_op_class_ie(wpa_s, ssid, bss,
wpa_ie + wpa_ie_len, wpa_ie + wpa_ie_len,
max_wpa_ie_len - max_wpa_ie_len -
wpa_ie_len); wpa_ie_len);
} }
#endif /* CONFIG_NO_RRM */
/* /*
* Workaround: Add Extended Capabilities element only if the AP * Workaround: Add Extended Capabilities element only if the AP
@ -7352,7 +7356,9 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
if (wpas_init_ext_pw(wpa_s) < 0) if (wpas_init_ext_pw(wpa_s) < 0)
return -1; return -1;
#ifndef CONFIG_NO_RRM
wpas_rrm_reset(wpa_s); wpas_rrm_reset(wpa_s);
#endif /* CONFIG_NO_RRM */
wpas_sched_scan_plans_set(wpa_s, wpa_s->conf->sched_scan_plans); wpas_sched_scan_plans_set(wpa_s, wpa_s->conf->sched_scan_plans);