]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Do not force interface down on deinit
authorJouni Malinen <j@w1.fi>
Sat, 9 Nov 2013 15:33:23 +0000 (17:33 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 9 Nov 2013 16:05:54 +0000 (18:05 +0200)
If wpa_supplicant or hostapd was started with the interface
already up, do not force interface down on deinit.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/drivers/driver_nl80211.c

index 852fb25df2ecc417b055b97d492051338d9443d9..90d04e48d71667615517554c3147279989b98d9a 100644 (file)
@@ -299,6 +299,7 @@ struct wpa_driver_nl80211_data {
        unsigned int allow_p2p_device:1;
        unsigned int hostapd:1;
        unsigned int start_mode_ap:1;
+       unsigned int start_iface_up:1;
 
        u64 remain_on_chan_cookie;
        u64 send_action_cookie;
@@ -3756,6 +3757,9 @@ static void * wpa_driver_nl80211_drv_init(void *ctx, const char *ifname,
                os_free(rcfg);
        }
 
+       if (linux_iface_up(drv->global->ioctl_sock, ifname) > 0)
+               drv->start_iface_up = 1;
+
        if (wpa_driver_nl80211_finish_drv_init(drv, set_addr, 1))
                goto failed;
 
@@ -4313,7 +4317,8 @@ static void wpa_driver_nl80211_deinit(struct i802_bss *bss)
 
        eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);
 
-       (void) i802_set_iface_flags(bss, 0);
+       if (!drv->start_iface_up)
+               (void) i802_set_iface_flags(bss, 0);
        if (drv->nlmode != NL80211_IFTYPE_P2P_DEVICE) {
                if (!drv->hostapd || !drv->start_mode_ap)
                        wpa_driver_nl80211_set_mode(bss,