Browse Source

nl80211: Do not force interface down on deinit

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>
Jouni Malinen 11 years ago
parent
commit
146fa9b38f
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/drivers/driver_nl80211.c

+ 6 - 1
src/drivers/driver_nl80211.c

@@ -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,