]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Clean up l2_packet_get_own_addr() call
authorJouni Malinen <j@w1.fi>
Sun, 19 Apr 2020 13:15:18 +0000 (16:15 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 19 Apr 2020 13:50:56 +0000 (16:50 +0300)
There is no need for this to be outside the if block that is used to
check whether l2_packet is used for the interface.

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

index 1941efa90b5541c80441ef5bfee696a9d25e6123..5703319d245f1aa2d438d32b00d19ab9d67399c2 100644 (file)
@@ -4785,17 +4785,18 @@ int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s)
                                                L2_PACKET_FILTER_PKTTYPE))
                        wpa_dbg(wpa_s, MSG_DEBUG,
                                "Failed to attach pkt_type filter");
+
+               if (l2_packet_get_own_addr(wpa_s->l2, wpa_s->own_addr)) {
+                       wpa_msg(wpa_s, MSG_ERROR,
+                               "Failed to get own L2 address");
+                       return -1;
+               }
        } else {
                const u8 *addr = wpa_drv_get_mac_addr(wpa_s);
                if (addr)
                        os_memcpy(wpa_s->own_addr, addr, ETH_ALEN);
        }
 
-       if (wpa_s->l2 && l2_packet_get_own_addr(wpa_s->l2, wpa_s->own_addr)) {
-               wpa_msg(wpa_s, MSG_ERROR, "Failed to get own L2 address");
-               return -1;
-       }
-
        wpa_sm_set_own_addr(wpa_s->wpa, wpa_s->own_addr);
        wpas_wps_update_mac_addr(wpa_s);