]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Revert "nl80211: Skip interface down/up when setting MAC address"
authorHu Wang <quic_huw@quicinc.com>
Wed, 27 Mar 2024 05:53:34 +0000 (22:53 -0700)
committerJouni Malinen <j@w1.fi>
Wed, 27 Mar 2024 21:01:14 +0000 (23:01 +0200)
This reverts commit bffd2b39944330b0ffbaba62036a73d2c5e23bfb.

Revert this commit to fix a regression when setting up P2P Group Owner
on some old device.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/drivers/driver_nl80211.c

index 6666313dec7f1f58692890756cdfb1b077375a14..4949de5772a74a194bc8a3b8934e1900ee632fc5 100644 (file)
@@ -11871,15 +11871,6 @@ static int nl80211_set_mac_addr(void *priv, const u8 *addr)
        if (!addr)
                addr = drv->perm_addr;
 
-       /*
-        * Try to change the address first without setting the interface
-        * down and then fall back to DOWN/set addr/UP if the first
-        * attempt failed. This can reduce the interface setup time
-        * significantly with some drivers.
-        */
-       if (!linux_set_ifhwaddr(drv->global->ioctl_sock, bss->ifname, addr))
-               goto done;
-
        if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0) < 0)
                return -1;
 
@@ -11896,19 +11887,18 @@ static int nl80211_set_mac_addr(void *priv, const u8 *addr)
                return -1;
        }
 
-       if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1) < 0)
-       {
-               wpa_printf(MSG_DEBUG,
-                          "nl80211: Could not restore interface UP after set_mac_addr");
-       }
-
-done:
        wpa_printf(MSG_DEBUG, "nl80211: set_mac_addr for %s to " MACSTR,
                   bss->ifname, MAC2STR(addr));
        drv->addr_changed = new_addr;
        os_memcpy(bss->prev_addr, bss->addr, ETH_ALEN);
        os_memcpy(bss->addr, addr, ETH_ALEN);
 
+       if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1) < 0)
+       {
+               wpa_printf(MSG_DEBUG,
+                          "nl80211: Could not restore interface UP after set_mac_addr");
+       }
+
        return 0;
 }