From 4834c6869d555108b0d5673265f987c0cdad80d6 Mon Sep 17 00:00:00 2001 From: Jinglin Wang Date: Fri, 13 Dec 2019 16:30:27 +0800 Subject: [PATCH] FT: Fix hostapd_wpa_auth_oui_iter() iteration for multicast packets When using FT wildcard feature, the inter-AP protocol will send broadcast messages to discover related APs. For example, 12/6 16:24:43 FT: Send PMK-R1 pull request to remote R0KH address ff:ff:ff:ff:ff:ff 12/6 16:24:43 FT: Send out sequence number request to ff:ff:ff:ff:ff:ff If you have multiple interfaces/BSSs in a single hostapd process, hostapd_wpa_auth_oui_iter() returned 1 after the first interface was processed. Iteration in for_each_interface() will be stopped since it gets a non-zero return value from hostapd_wpa_auth_oui_iter(). Even worse, the packet will not be sent to ethernet because for_each_interface() returns non-zero value. hostapd_wpa_auth_send_oui() will then return data_len immediately. To prevent this, hostapd_wpa_auth_oui_iter() should not return 1 after any successful transmission to other interfaces, if the dst_addr of packet is a multicast address. Signed-off-by: Jinglin Wang Signed-off-by: MinHong Wang --- src/ap/wpa_auth_glue.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ap/wpa_auth_glue.c b/src/ap/wpa_auth_glue.c index 7fb0923e4..49728a307 100644 --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c @@ -748,7 +748,11 @@ static int hostapd_wpa_auth_oui_iter(struct hostapd_iface *iface, void *ctx) hostapd_oui_deliver_later, hapd, NULL); - return 1; + /* If dst_addr is a multicast address, do not return any + * non-zero value here. Otherwise, the iteration of + * for_each_interface() will be stopped. */ + if (!is_multicast_ether_addr(idata->dst_addr)) + return 1; } return 0;