/* * Detach net80211 state on device detach. Tear down * all vap's and reclaim all common state prior to the * device state going away. Note we may call back into * driver; it must be prepared for this. */ void ieee80211_ifdetach(struct ieee80211com *ic) { struct ifnet *ifp = ic->ic_ifp; struct ieee80211vap *vap; if_detach(ifp); while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) ieee80211_vap_destroy(vap); ieee80211_waitfor_parent(ic); ieee80211_sysctl_detach(ic); ieee80211_dfs_detach(ic); ieee80211_regdomain_detach(ic); ieee80211_scan_detach(ic); #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_superg_detach(ic); #endif ieee80211_ht_detach(ic); /* NB: must be called before ieee80211_node_detach */ ieee80211_proto_detach(ic); ieee80211_crypto_detach(ic); ieee80211_power_detach(ic); ieee80211_node_detach(ic); ifmedia_removeall(&ic->ic_media); taskqueue_free(ic->ic_tq); }
static int __init init_crypto_wep_test(void) { struct ieee80211com ic; struct ieee80211vap vap; int i, pass, total; memset(&ic, 0, sizeof(ic)); memset(&vap, 0, sizeof(vap)); vap.iv_ic = ⁣ if (debug) vap.iv_debug = IEEE80211_MSG_CRYPTO; ieee80211_crypto_attach(&ic); ieee80211_crypto_vattach(&vap); pass = 0; total = 0; for (i = 0; i < ARRAY_SIZE(weptests); i++) if (tests & (1 << i)) { total++; pass += runtest(&vap, &weptests[i]); } printk("%u of %u 802.11i WEP test vectors passed\n", pass, total); ieee80211_crypto_vdetach(&vap); ieee80211_crypto_detach(&ic); return (pass == total ? 0 : -ENXIO); }
void ieee80211_ifdetach(struct ifnet *ifp) { struct ieee80211com *ic = (void *)ifp; ieee80211_proto_detach(ifp); ieee80211_crypto_detach(ifp); ieee80211_node_detach(ifp); LIST_REMOVE(ic, ic_list); ifmedia_delete_instance(&ic->ic_media, IFM_INST_ANY); ether_ifdetach(ifp); }
static int __init init_crypto_tkip_test(void) { struct ieee80211com ic; memset(&ic, 0, sizeof(ic)); if (debug) ic.msg_enable = IEEE80211_MSG_CRYPTO; ieee80211_crypto_attach(&ic); tkip_test(&ic); ieee80211_crypto_detach(&ic); return 0; }
void ieee80211_ifdetach(struct ifnet *ifp) { struct ieee80211com *ic = (void *)ifp; ieee80211_proto_detach(ifp); ieee80211_crypto_detach(ifp); ieee80211_node_detach(ifp); #ifdef __FreeBSD__ ifmedia_removeall(&ic->ic_media); #else ifmedia_delete_instance(&ic->ic_media, IFM_INST_ANY); #endif #if NBPFILTER > 0 bpfdetach(ifp); #endif ether_ifdetach(ifp); }
/* * Detach net80211 state on device detach. Tear down * all vap's and reclaim all common state prior to the * device state going away. Note we may call back into * driver; it must be prepared for this. */ void ieee80211_ifdetach(struct ieee80211com *ic) { struct ifnet *ifp = ic->ic_ifp; struct ieee80211vap *vap; /* * This detaches the main interface, but not the vaps. * Each VAP may be in a separate VIMAGE. */ CURVNET_SET(ifp->if_vnet); if_detach(ifp); CURVNET_RESTORE(); /* * The VAP is responsible for setting and clearing * the VIMAGE context. */ while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) ieee80211_vap_destroy(vap); ieee80211_waitfor_parent(ic); ieee80211_sysctl_detach(ic); ieee80211_dfs_detach(ic); ieee80211_regdomain_detach(ic); ieee80211_scan_detach(ic); #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_superg_detach(ic); #endif ieee80211_ht_detach(ic); /* NB: must be called before ieee80211_node_detach */ ieee80211_proto_detach(ic); ieee80211_crypto_detach(ic); ieee80211_power_detach(ic); ieee80211_node_detach(ic); /* XXX VNET needed? */ ifmedia_removeall(&ic->ic_media); taskqueue_free(ic->ic_tq); IEEE80211_TX_LOCK_DESTROY(ic); IEEE80211_LOCK_DESTROY(ic); }
void ieee80211_ifdetach(struct ieee80211com *ic) { struct ifnet *ifp = ic->ic_ifp; ieee80211_remove_vap(ic); ieee80211_sysctl_detach(ic); ieee80211_proto_detach(ic); ieee80211_crypto_detach(ic); ieee80211_node_detach(ic); LIST_REMOVE(ic, ic_list); ifmedia_delete_instance(&ic->ic_media, IFM_INST_ANY); IEEE80211_BEACON_LOCK_DESTROY(ic); bpf_detach(ifp); ether_ifdetach(ifp); }
static int __init init_crypto_wep_test(void) { struct { struct ieee80211vap vap; struct ieee80211com ic; struct net_device netdev; } *buf; struct ieee80211vap *vap; int i, pass, total; buf = kzalloc(sizeof(*buf), GFP_KERNEL); if (!buf) return -ENOMEM; vap = &buf->vap; vap->iv_ic = &buf->ic; vap->iv_dev = &buf->netdev; vap->iv_ic->ic_dev = vap->iv_dev; strncpy(vap->iv_dev->name, "WEP test", sizeof(vap->iv_dev->name) - 1); if (debug) vap->iv_debug = IEEE80211_MSG_CRYPTO; ieee80211_crypto_attach(vap->iv_ic); ieee80211_crypto_vattach(vap); pass = 0; total = 0; for (i = 0; i < ARRAY_SIZE(weptests); i++) if (tests & (1 << i)) { total++; pass += runtest(vap, &weptests[i]); } printk("%u of %u 802.11i WEP test vectors passed\n", pass, total); ieee80211_crypto_vdetach(vap); ieee80211_crypto_detach(vap->iv_ic); kfree(buf); return (pass == total ? 0 : -ENXIO); }
static int __init init_crypto_ccmp_test(void) { struct ieee80211com *ic; struct ieee80211vap *vap; int i, pass, total; ic = kzalloc(sizeof(*ic), GFP_KERNEL); if (!ic) return -ENOMEM; ieee80211_crypto_attach(ic); vap = kzalloc(sizeof(*vap), GFP_KERNEL); if (!vap) { kfree(ic); return -ENOMEM; } vap->iv_ic = ic; if (debug) vap->iv_debug = IEEE80211_MSG_CRYPTO; ieee80211_crypto_vattach(vap); pass = 0; total = 0; for (i = 0; i < ARRAY_SIZE(ccmptests); i++) if (tests & (1 << i)) { total++; pass += runtest(vap, &ccmptests[i]); } printk("%u of %u 802.11i AES-CCMP test vectors passed\n", pass, total); ieee80211_crypto_vdetach(vap); ieee80211_crypto_detach(ic); kfree(vap); kfree(ic); return (pass == total ? 0 : -ENXIO); }
static int __init init_crypto_ccmp_test(void) { #define N(a) (sizeof(a)/sizeof(a[0])) struct ieee80211com ic; int i, pass, total; memset(&ic, 0, sizeof(ic)); if (debug) ic.msg_enable = IEEE80211_MSG_CRYPTO; ieee80211_crypto_attach(&ic); pass = 0; total = 0; for (i = 0; i < N(ccmptests); i++) if (tests & (1<<i)) { total++; pass += runtest(&ic, &ccmptests[i]); } printk("%u of %u 802.11i AES-CCMP test vectors passed\n", pass, total); ieee80211_crypto_detach(&ic); return (pass == total ? 0 : -1); #undef N }
void ieee80211_ifdetach(struct ieee80211com *ic) { if (!ic->ic_initialized) { return; } /* * Preparation for detaching objects. * For example, remove and cross references between objects such as those * between ResMgr and Scanner. */ ieee80211_scan_detach_prepare(ic->ic_scanner); ieee80211_resmgr_delete_prepare(ic->ic_resmgr); OS_FREE_TIMER(&ic->ic_inact_timer); #if UMAC_SUPPORT_WNM OS_FREE_TIMER(&ic->ic_bssload_timer); #endif /* all the vaps should have been deleted now */ ASSERT(TAILQ_FIRST(&ic->ic_vaps) == NULL); ieee80211_scan_table_detach(&(ic->ic_scan_table)); ieee80211_node_detach(ic); ieee80211_quiet_detach(ic); ieee80211_admctl_detach(ic); if (IEEE80211_ENAB_AOW(ic)) ieee80211_aow_detach(ic); #if ATH_SUPPORT_DFS ieee80211_dfs_detach(ic); #endif /* ATH_SUPPORT_DFS */ ieee80211_proto_detach(ic); ieee80211_crypto_detach(ic); ieee80211_power_detach(ic); ieee80211_mlme_detach(ic); ieee80211_notify_tx_bcn_detach(ic->ic_notify_tx_bcn_mgr); ieee80211_resmgr_delete(ic->ic_resmgr); ieee80211_scan_detach(&(ic->ic_scanner)); ieee80211_p2p_detach(ic); ieee80211_acs_detach(&(ic->ic_acs)); ieee80211_rptplacement_detach(ic); IEEE80211_TDLS_DETACH(ic); #if UMAC_SUPPORT_VI_DBG ieee80211_vi_dbg_detach(ic); #endif ieee80211_smartantenna_detach(ic); ieee80211_prdperfstats_detach(ic); spin_lock_destroy(&ic->ic_lock); /* Detach TSF timer at the end to avoid assertion */ if (ic->ic_tsf_timer) { ieee80211_tsf_timer_detach(ic->ic_tsf_timer); ic->ic_tsf_timer = NULL; } spin_lock_destroy(&ic->ic_lock); IEEE80211_STATE_LOCK_DESTROY(ic); }