From b98933eafcbea8a0dd01806591a497904b64b5f0 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 30 Dec 2018 01:05:18 +0200 Subject: [PATCH] HS 2.0: DHCP broadcast-to-unicast conversion before address learning handle_dhcp() was first trying to learn the IP address of an associated STA before doing broadcast-to-unicast conversion. This could result in not converting some DHCPACK messages since the address learning part aborts processing by returning from the function in various cases. Reorder these operations to allow broadcast-to-unicast conversion to happen even if an associated STA entry is not updated based on a DHCPACK. Signed-off-by: Jouni Malinen --- src/ap/dhcp_snoop.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ap/dhcp_snoop.c b/src/ap/dhcp_snoop.c index 6d8c2f4be..ed37fc8fe 100644 --- a/src/ap/dhcp_snoop.c +++ b/src/ap/dhcp_snoop.c @@ -88,6 +88,15 @@ static void handle_dhcp(void *ctx, const u8 *src_addr, const u8 *buf, } } + if (hapd->conf->disable_dgaf && is_broadcast_ether_addr(buf)) { + for (sta = hapd->sta_list; sta; sta = sta->next) { + if (!(sta->flags & WLAN_STA_AUTHORIZED)) + continue; + x_snoop_mcast_to_ucast_convert_send(hapd, sta, + (u8 *) buf, len); + } + } + if (msgtype == DHCPACK) { if (b->your_ip == 0) return; @@ -124,15 +133,6 @@ static void handle_dhcp(void *ctx, const u8 *src_addr, const u8 *buf, } sta->ipaddr = b->your_ip; } - - if (hapd->conf->disable_dgaf && is_broadcast_ether_addr(buf)) { - for (sta = hapd->sta_list; sta; sta = sta->next) { - if (!(sta->flags & WLAN_STA_AUTHORIZED)) - continue; - x_snoop_mcast_to_ucast_convert_send(hapd, sta, - (u8 *) buf, len); - } - } }