]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: DHCP broadcast-to-unicast conversion before address learning
authorJouni Malinen <j@w1.fi>
Sat, 29 Dec 2018 23:05:18 +0000 (01:05 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 29 Dec 2018 23:05:18 +0000 (01:05 +0200)
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 <j@w1.fi>
src/ap/dhcp_snoop.c

index 6d8c2f4be0da9263acf256f8631119774af538ef..ed37fc8fe96a0110a1b15451725cdf9976029804 100644 (file)
@@ -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);
-               }
-       }
 }