From 4d379be4a99d09abe43be9f5a233424bfc5cc43a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 9 Mar 2019 12:51:34 +0200 Subject: [PATCH] Clarify AP mode Action frame handling Include only one of hostapd_mgmt_rx() and hostapd_action_rx() functions in the build. Previously, NEED_AP_MLME builds (i.e., cases where hostapd AP MLME implementation is included) included both of these functions and both were tried in sequence. In addition to being difficult to understand, that could result in unexpected behavior if hostapd_mgmt_rx() rejected a frame and return 0 to allow hostapd_action_rx() to attempt to process the frame. All the operations included in hostapd_action_rx() are supposed to be available through the hostapd_mgmt_rx() call in handle_action() and those should result in the exact same Category/Action-based handler function to be called in the end. As such, this should not result in different behavior. And if there is a difference, that would be pointing at a hidden bug that would need to be fixed anyway. Furthermore, builds without NEED_AP_MLME would not have any difference in behavior or contents of the binary either. Signed-off-by: Jouni Malinen --- src/ap/drv_callbacks.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 4a9ce3b97..cf01854e1 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -1073,6 +1073,7 @@ fail: } +#ifndef NEED_AP_MLME static void hostapd_action_rx(struct hostapd_data *hapd, struct rx_mgmt *drv_mgmt) { @@ -1145,6 +1146,7 @@ static void hostapd_action_rx(struct hostapd_data *hapd, } #endif /* CONFIG_DPP */ } +#endif /* NEED_AP_MLME */ #ifdef NEED_AP_MLME @@ -1606,10 +1608,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, if (!data->rx_mgmt.frame) break; #ifdef NEED_AP_MLME - if (hostapd_mgmt_rx(hapd, &data->rx_mgmt) > 0) - break; -#endif /* NEED_AP_MLME */ + hostapd_mgmt_rx(hapd, &data->rx_mgmt); +#else /* NEED_AP_MLME */ hostapd_action_rx(hapd, &data->rx_mgmt); +#endif /* NEED_AP_MLME */ break; case EVENT_RX_PROBE_REQ: if (data->rx_probe_req.sa == NULL ||