]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Check both sec and usec values to see if MAC address was changed
authorJouni Malinen <j@w1.fi>
Sun, 18 Dec 2022 10:21:54 +0000 (12:21 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 18 Dec 2022 10:33:16 +0000 (12:33 +0200)
wpa_s->last_mac_addr_change.sec might be zero in the special case of UML
testing with time travel since it would be possible to complete the test
case steps within one second of the system start.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/wpa_supplicant.c

index 370668a30ee2b3b4ef52a3d9cf391f620b8e6a18..5bf1f542d10cda9394b89b77f7ef69480406390a 100644 (file)
@@ -2246,7 +2246,8 @@ int wpas_update_random_addr(struct wpa_supplicant *wpa_s, int style,
                        if (os_memcmp(wpa_s->own_addr, ssid->mac_value,
                                      ETH_ALEN) == 0)
                                return 0;
-               } else if (wpa_s->last_mac_addr_change.sec != 0 &&
+               } else if ((wpa_s->last_mac_addr_change.sec != 0 ||
+                           wpa_s->last_mac_addr_change.usec != 0) &&
                           !os_reltime_expired(
                                   &now,
                                   &wpa_s->last_mac_addr_change,