hostapd-2.0/src/drivers/driver_nl80211.c
static void wpa_driver_nl80211_deinit(void *priv)
{
	struct i802_bss *bss = priv;
	struct wpa_driver_nl80211_data *drv = bss->drv;

	bss->in_deinit = 1;
	if (drv->data_tx_status)
		eloop_unregister_read_sock(drv->eapol_tx_sock);
	if (drv->eapol_tx_sock >= 0)
		close(drv->eapol_tx_sock);

	if (bss->nl_preq)
		wpa_driver_nl80211_probe_req_report(bss, 0);
	if (bss->added_if_into_bridge) {
		if (linux_br_del_if(drv->global->ioctl_sock, bss->brname,
				    bss->ifname) < 0)
			wpa_printf(MSG_INFO, "nl80211: Failed to remove "
				   "interface %s from bridge %s: %s",
				   bss->ifname, bss->brname, strerror(errno));
	}
	if (bss->added_bridge) {
		if (linux_br_del(drv->global->ioctl_sock, bss->brname) < 0)
			wpa_printf(MSG_INFO, "nl80211: Failed to remove "
				   "bridge %s: %s",
				   bss->brname, strerror(errno));
	}

	nl80211_remove_monitor_interface(drv);

	if (is_ap_interface(drv->nlmode))
		wpa_driver_nl80211_del_beacon(drv);

#ifdef HOSTAPD
	if (drv->last_freq_ht) {
		/* Clear HT flags from the driver */
		struct hostapd_freq_params freq;
		os_memset(&freq, 0, sizeof(freq));
		freq.freq = drv->last_freq;
		i802_set_freq(priv, &freq);
	}

	if (drv->eapol_sock >= 0) {
		eloop_unregister_read_sock(drv->eapol_sock);
		close(drv->eapol_sock);
	}

	if (drv->if_indices != drv->default_if_indices)
		os_free(drv->if_indices);
#endif /* HOSTAPD */

	if (drv->disabled_11b_rates)
		nl80211_disable_11b_rates(drv, drv->ifindex, 0);

	netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, 0,
			       IF_OPER_UP);
	rfkill_deinit(drv->rfkill);

	eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);

	(void) linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0);
	wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION);
	nl80211_mgmt_unsubscribe(bss, "deinit");

	nl_cb_put(drv->nl_cb);

	nl80211_destroy_bss(&drv->first_bss);

	os_free(drv->filter_ssids);

	os_free(drv->auth_ie);

	if (drv->in_interface_list)
		dl_list_del(&drv->list);

	os_free(drv);
}
/**
 * wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface
 * @priv: Pointer to private nl80211 data from wpa_driver_nl80211_init()
 *
 * Shut down driver interface and processing of driver events. Free
 * private data buffer if one was allocated in wpa_driver_nl80211_init().
 */
Deinitialize nl80211 driver interface
@priv: Pointer to private nl80211 data from wpa_driver_nl80211_init()

Shut down driver interface and processing of driver events. Free
private data buffer if one was allocated in wpa_driver_nl80211_init().
Deinitialize nl80211 driver interface @priv : Pointer to private nl80211 data from wpa_driver_nl80211_init () Shut down driver interface and processing of driver events . Free private data buffer if one was allocated in wpa_driver_nl80211_init () .
static void wpa_driver_nl80211_deinit(void *priv)
{
	struct i802_bss *bss = priv;
	struct wpa_driver_nl80211_data *drv = bss->drv;
	bss->in_deinit = 1;
	if (drv->data_tx_status)
		eloop_unregister_read_sock(drv->eapol_tx_sock);
	if (drv->eapol_tx_sock >= 0)
		close(drv->eapol_tx_sock);
	if (bss->nl_preq)
		wpa_driver_nl80211_probe_req_report(bss, 0);
	if (bss->added_if_into_bridge) {
		if (linux_br_del_if(drv->global->ioctl_sock, bss->brname,
				    bss->ifname) < 0)
			wpa_printf(MSG_INFO, "nl80211: Failed to remove "
				   "interface %s from bridge %s: %s",
				   bss->ifname, bss->brname, strerror(errno));
	}
	if (bss->added_bridge) {
		if (linux_br_del(drv->global->ioctl_sock, bss->brname) < 0)
			wpa_printf(MSG_INFO, "nl80211: Failed to remove "
				   "bridge %s: %s",
				   bss->brname, strerror(errno));
	}
	nl80211_remove_monitor_interface(drv);
	if (is_ap_interface(drv->nlmode))
		wpa_driver_nl80211_del_beacon(drv);
#ifdef HOSTAPD
	if (drv->last_freq_ht) {
		struct hostapd_freq_params freq;
		os_memset(&freq, 0, sizeof(freq));
		freq.freq = drv->last_freq;
		i802_set_freq(priv, &freq);
	}
	if (drv->eapol_sock >= 0) {
		eloop_unregister_read_sock(drv->eapol_sock);
		close(drv->eapol_sock);
	}
	if (drv->if_indices != drv->default_if_indices)
		os_free(drv->if_indices);
#endif 
	if (drv->disabled_11b_rates)
		nl80211_disable_11b_rates(drv, drv->ifindex, 0);
	netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, 0,
			       IF_OPER_UP);
	rfkill_deinit(drv->rfkill);
	eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);
	(void) linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0);
	wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION);
	nl80211_mgmt_unsubscribe(bss, "deinit");
	nl_cb_put(drv->nl_cb);
	nl80211_destroy_bss(&drv->first_bss);
	os_free(drv->filter_ssids);
	os_free(drv->auth_ie);
	if (drv->in_interface_list)
		dl_list_del(&drv->list);
	os_free(drv);
}
static void wpa_driver_nl80211_deinit ( void * priv ) { struct i802_bss * bss = priv ; struct wpa_driver_nl80211_data * drv = bss -> drv ; bss -> in_deinit = 1 ; if ( drv -> data_tx_status ) eloop_unregister_read_sock ( drv -> eapol_tx_sock ) ; if ( drv -> eapol_tx_sock >= 0 ) close ( drv -> eapol_tx_sock ) ; if ( bss -> nl_preq ) wpa_driver_nl80211_probe_req_report ( bss , 0 ) ; if ( bss -> added_if_into_bridge ) { if ( linux_br_del_if ( drv -> global -> ioctl_sock , bss -> brname , bss -> ifname ) < 0 ) wpa_printf ( MSG_INFO , " " " " , bss -> ifname , bss -> brname , strerror ( errno ) ) ; } if ( bss -> added_bridge ) { if ( linux_br_del ( drv -> global -> ioctl_sock , bss -> brname ) < 0 ) wpa_printf ( MSG_INFO , " " " " , bss -> brname , strerror ( errno ) ) ; } nl80211_remove_monitor_interface ( drv ) ; if ( is_ap_interface ( drv -> nlmode ) ) wpa_driver_nl80211_del_beacon ( drv ) ; #ifdef HOSTAPD if ( drv -> last_freq_ht ) { struct hostapd_freq_params freq ; os_memset ( & freq , 0 , sizeof ( freq ) ) ; freq . freq = drv -> last_freq ; i802_set_freq ( priv , & freq ) ; } if ( drv -> eapol_sock >= 0 ) { eloop_unregister_read_sock ( drv -> eapol_sock ) ; close ( drv -> eapol_sock ) ; } if ( drv -> if_indices != drv -> default_if_indices ) os_free ( drv -> if_indices ) ; #endif if ( drv -> disabled_11b_rates ) nl80211_disable_11b_rates ( drv , drv -> ifindex , 0 ) ; netlink_send_oper_ifla ( drv -> global -> netlink , drv -> ifindex , 0 , IF_OPER_UP ) ; rfkill_deinit ( drv -> rfkill ) ; eloop_cancel_timeout ( wpa_driver_nl80211_scan_timeout , drv , drv -> ctx ) ; ( void ) linux_set_iface_flags ( drv -> global -> ioctl_sock , bss -> ifname , 0 ) ; wpa_driver_nl80211_set_mode ( bss , NL80211_IFTYPE_STATION ) ; nl80211_mgmt_unsubscribe ( bss , " " ) ; nl_cb_put ( drv -> nl_cb ) ; nl80211_destroy_bss ( & drv -> first_bss ) ; os_free ( drv -> filter_ssids ) ; os_free ( drv -> auth_ie ) ; if ( drv -> in_interface_list ) dl_list_del ( & drv -> list ) ; os_free ( drv ) ; }
wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface
 @priv: Pointer to private nl80211 data from wpa_driver_nl80211_init()
wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface @priv : Pointer to private nl80211 data from wpa_driver_nl80211_init ()
/* Clear HT flags from the driver */ /* HOSTAPD */