void ipfw_bpf_uninit(int last) { if_clone_detach(V_ipfw_cloner); if_clone_detach(V_ipfwlog_cloner); if (last) LOGIF_LOCK_DESTROY(); }
static int pflog_modevent(module_t mod, int type, void *data) { int error = 0; switch (type) { case MOD_LOAD: pflogattach(1); PF_RULES_WLOCK(); pflog_packet_ptr = pflog_packet; PF_RULES_WUNLOCK(); break; case MOD_UNLOAD: PF_RULES_WLOCK(); pflog_packet_ptr = NULL; PF_RULES_WUNLOCK(); if_clone_detach(pflog_cloner); break; default: error = EINVAL; break; } return error; }
static int faithmodevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: LIST_INIT(&faith_softc_list); if_clone_attach(&faith_cloner); #ifdef INET6 faithprefix_p = faithprefix; #endif break; case MOD_UNLOAD: #ifdef INET6 faithprefix_p = NULL; #endif if_clone_detach(&faith_cloner); while (!LIST_EMPTY(&faith_softc_list)) faith_clone_destroy( &LIST_FIRST(&faith_softc_list)->sc_if); break; } return 0; }
static int disc_modevent(module_t mod, int type, void *data) { struct disc_softc *sc; switch (type) { case MOD_LOAD: mtx_init(&disc_mtx, "disc_mtx", NULL, MTX_DEF); LIST_INIT(&disc_softc_list); if_clone_attach(&disc_cloner); break; case MOD_UNLOAD: if_clone_detach(&disc_cloner); mtx_lock(&disc_mtx); while ((sc = LIST_FIRST(&disc_softc_list)) != NULL) { LIST_REMOVE(sc, sc_list); mtx_unlock(&disc_mtx); disc_destroy(sc); mtx_lock(&disc_mtx); } mtx_unlock(&disc_mtx); mtx_destroy(&disc_mtx); break; default: return (EOPNOTSUPP); } return (0); }
static int pflog_modevent(module_t mod, int type, void *data) { int error = 0; switch (type) { case MOD_LOAD: LIST_INIT(&pflog_list); if_clone_attach(&pflog_cloner); break; case MOD_UNLOAD: if_clone_detach(&pflog_cloner); while (!LIST_EMPTY(&pflog_list)) pflog_clone_destroy( &LIST_FIRST(&pflog_list)->sc_if); break; default: error = EINVAL; break; } return error; }
void ipfw3_log_modevent(int type){ struct ifnet *tmpif; int i; switch (type) { case MOD_LOAD: LOGIF_LOCK_INIT(); log_if_count = 0; if_clone_attach(&ipfw_log_cloner); ipfw_log_ifdetach_cookie = EVENTHANDLER_REGISTER(ifnet_detach_event, ipfw_log_clone_destroy, &ipfw_log_cloner, EVENTHANDLER_PRI_ANY); break; case MOD_UNLOAD: EVENTHANDLER_DEREGISTER(ifnet_detach_event, ipfw_log_ifdetach_cookie); if_clone_detach(&ipfw_log_cloner); for(i = 0; log_if_count > 0 && i < LOG_IF_MAX; i++){ tmpif = log_if_table[i]; if (tmpif != NULL) { ipfw_log_clone_destroy(tmpif); } } LOGIF_LOCK_DESTROY(); break; default: break; } }
static void usbpf_uninit(void *arg) { int devlcnt; device_t *devlp; devclass_t dc; struct usb_bus *ubus; int error; int i; if_clone_detach(usbpf_cloner); dc = devclass_find(usbusname); if (dc == NULL) return; error = devclass_get_devices(dc, &devlp, &devlcnt); if (error) return; for (i = 0; i < devlcnt; i++) { ubus = device_get_softc(devlp[i]); if (ubus != NULL && ubus->ifp != NULL) usbpf_clone_destroy(usbpf_cloner, ubus->ifp); } free(devlp, M_TEMP); }
int loopdetach(int n) { if_clone_detach(&loop_cloner); return loop_clone_destroy_lo0(); }
void pflogdetach(void) { int i; for (i = 0; i < PFLOGIFS_MAX; i++) { if (pflogifs[i] != NULL) pflog_clone_destroy(pflogifs[i]); } if_clone_detach(&pflog_cloner); }
static int mplsdetach(void) { int error = 0; if (mpls_count != 0) error = EBUSY; if (error == 0) if_clone_detach(&mpls_if_cloner); return error; }
void ipfw_log_bpf(int onoff) { if (onoff) { LOGIF_LOCK_INIT(); ipfw_log_cloner = if_clone_advanced(ipfwname, 0, ipfw_log_clone_match, ipfw_log_clone_create, ipfw_log_clone_destroy); } else { if_clone_detach(ipfw_log_cloner); LOGIF_LOCK_DESTROY(); } }
void t4_tracer_modunload() { if (t4_cloner != NULL) { /* * The module is being unloaded so the nexus drivers have * detached. The tracing interfaces can not outlive the nexus * (ifp->if_softc is the nexus) and must have been destroyed * already. XXX: but if_clone is opaque to us and we can't * assert LIST_EMPTY(&t4_cloner->ifc_iflist) at this time. */ if_clone_detach(t4_cloner); } sx_destroy(&t4_trace_lock); }
static int disc_modevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: disc_cloner = if_clone_simple(discname, disc_clone_create, disc_clone_destroy, 0); break; case MOD_UNLOAD: if_clone_detach(disc_cloner); break; default: return (EOPNOTSUPP); } return (0); }
/* * Module event handler. */ static int vether_mod_event(module_t mod, int event, void *data) { int error = 0; switch (event) { case MOD_LOAD: mtx_init(&vether_list_mtx, "if_vether_list", NULL, MTX_DEF); vether_cloner = if_clone_simple(vether_name, vether_clone_create, vether_clone_destroy, 0); break; case MOD_UNLOAD: if_clone_detach(vether_cloner); mtx_destroy(&vether_list_mtx); break; default: error = EOPNOTSUPP; } return (error); }
static int tapdetach(void) { int error = 0; if (tap_count != 0) return EBUSY; #ifdef _MODULE if (error == 0) error = devsw_detach(NULL, &tap_cdevsw); #endif if (error == 0) sysctl_teardown(&tap_sysctl_clog); if (error == 0) if_clone_detach(&tap_cloners); if (error == 0) error = config_cfattach_detach(tap_cd.cd_name, &tap_ca); return error; }
void vhost_exit(void) { if_clone_detach(vhost_cloner); }