]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Set interface address even if using old interface
authorJouni Malinen <j@w1.fi>
Tue, 25 Mar 2014 23:17:29 +0000 (01:17 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 26 Mar 2014 14:33:03 +0000 (16:33 +0200)
If an existing interface is allowed to be used, its address better be
updated to match the requested one.

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

index 1d504a39dc6a75f49921f726cf7a86c8b747ebdd..bc4b7e316488ec8f6883f4daf7e65fe49b8c5964 100644 (file)
@@ -7660,6 +7660,16 @@ static int nl80211_create_iface(struct wpa_driver_nl80211_data *drv,
                if (use_existing) {
                        wpa_printf(MSG_DEBUG, "nl80211: Continue using existing interface %s",
                                   ifname);
+                       if (addr && iftype != NL80211_IFTYPE_MONITOR &&
+                           linux_set_ifhwaddr(drv->global->ioctl_sock, ifname,
+                                              addr) < 0 &&
+                           (linux_set_iface_flags(drv->global->ioctl_sock,
+                                                  ifname, 0) < 0 ||
+                            linux_set_ifhwaddr(drv->global->ioctl_sock, ifname,
+                                               addr) < 0 ||
+                            linux_set_iface_flags(drv->global->ioctl_sock,
+                                                  ifname, 1) < 0))
+                                       return -1;
                        return -ENFILE;
                }
                wpa_printf(MSG_INFO, "Try to remove and re-create %s", ifname);