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 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; }
void loopattach(int n) { (void)loop_clone_create(&loop_cloner, 0); /* lo0 always exists */ if_clone_attach(&loop_cloner); }
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; }
/* ARGSUSED */ static void greattach(void) { LIST_INIT(&gre_softc_list); if_clone_attach(&gre_cloner); }
/* ARGSUSED */ void gifattach(int count) { LIST_INIT(&gif_softc_list); if_clone_attach(&gif_cloner); }
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); }
/* ARGSUSED */ static void greattach(void) { mtx_init(&gre_mtx, "gre_mtx", NULL, MTX_DEF); LIST_INIT(&gre_softc_list); if_clone_attach(&gre_cloner); }
void loopattach(int n) { if (loop_clone_create(&loop_cloner, 0)) panic("unable to create lo0"); if_clone_attach(&loop_cloner); }
void tunattach(int unused) { mutex_init(&tun_softc_lock, MUTEX_DEFAULT, IPL_NET); LIST_INIT(&tun_softc_list); LIST_INIT(&tunz_softc_list); if_clone_attach(&tun_cloner); }
void pflogattach(int npflog) { int i; LIST_INIT(&pflogif_list); for (i = 0; i < PFLOGIFS_MAX; i++) pflogifs[i] = NULL; if_clone_attach(&pflog_cloner); }
void tunattach(int unused) { simple_lock_init(&tun_softc_lock); LIST_INIT(&tun_softc_list); LIST_INIT(&tunz_softc_list); if_clone_attach(&tun_cloner); }
void loopinit(void) { if (lo0ifp != NULL) /* can happen in rump kernel */ return; (void)loop_clone_create(&loop_cloner, 0); /* lo0 always exists */ if_clone_attach(&loop_cloner); }
void pflogattach(int npflog) { int i; LIST_INIT(&pflogif_list); for (i = 0; i < PFLOGIFS_MAX; i++) pflogifs[i] = NULL; if (mfake == NULL) mfake = m_get(M_DONTWAIT, MT_HEADER); if_clone_attach(&pflog_cloner); }
void pflogattach(int npflog) { LIST_INIT(&pflogif_list); if (pflog_mhdr == NULL) if ((pflog_mhdr = m_get(M_DONTWAIT, MT_HEADER)) == NULL) panic("pflogattach: no mbuf"); if (pflog_mptr == NULL) if ((pflog_mptr = m_get(M_DONTWAIT, MT_DATA)) == NULL) panic("pflogattach: no mbuf"); if_clone_attach(&pflog_cloner); }
void pflogattach(int npflog) { int i; LIST_INIT(&pflogif_list); for (i = 0; i < PFLOGIFS_MAX; i++) pflogifs[i] = NULL; #ifndef __FreeBSD__ (void) pflog_clone_create(&pflog_cloner, 0); #endif if_clone_attach(&pflog_cloner); }
int loopattach(int n) { int error; error = loop_clone_create(&loop_cloner, 0); /* lo0 always exists */ if ( error != 0 ) { return error; } if_clone_attach(&loop_cloner); return 0; }
void tapattach(int n) { int error; error = config_cfattach_attach(tap_cd.cd_name, &tap_ca); if (error) { aprint_error("%s: unable to register cfattach\n", tap_cd.cd_name); (void)config_cfdriver_detach(&tap_cd); return; } if_clone_attach(&tap_cloners); }
void pfloginit(void) { int i; if (pf_perim_lock == NULL || pf_lock == NULL) { panic("%s: called before PF is initialized", __func__); /* NOTREACHED */ } LIST_INIT(&pflogif_list); for (i = 0; i < PFLOGIFS_MAX; i++) pflogifs[i] = NULL; (void) if_clone_attach(&pflog_cloner); }
void pflogattach(int npflog) { int i; LIST_INIT(&pflogif_list); for (i = 0; i < PFLOGIFS_MAX; i++) pflogifs[i] = NULL; if (pflog_mhdr == NULL) if ((pflog_mhdr = m_get(M_DONTWAIT, MT_HEADER)) == NULL) panic("pflogattach: no mbuf"); if (pflog_mptr == NULL) if ((pflog_mptr = m_get(M_DONTWAIT, MT_DATA)) == NULL) panic("pflogattach: no mbuf"); if_clone_attach(&pflog_cloner); }
static int enc_modevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: mtx_init(&enc_mtx, "enc mtx", NULL, MTX_DEF); if_clone_attach(&enc_cloner); break; case MOD_UNLOAD: printf("enc module unload - not possible for this module\n"); return (EINVAL); default: return (EOPNOTSUPP); } return (0); }
static void tapinit(void) { int error = config_cfattach_attach(tap_cd.cd_name, &tap_ca); if (error) { aprint_error("%s: unable to register cfattach\n", tap_cd.cd_name); (void)config_cfdriver_detach(&tap_cd); return; } if_clone_attach(&tap_cloners); sysctl_tap_setup(&tap_sysctl_clog); #ifdef _MODULE devsw_attach("tap", NULL, &tap_bmajor, &tap_cdevsw, &tap_cmajor); #endif }
/* ARGSUSED */ void faithattach(int count) { if_clone_attach(&faith_cloner); }
void mpwattach(int n) { if_clone_attach(&mpw_cloner); }
static void mplsinit(void) { if_clone_attach(&mpls_if_cloner); }
/* ARGSUSED */ void ifmplsattach(int count) { if_clone_attach(&mpls_if_cloner); }
/* * Called from boot code to establish ppp interfaces. */ void pppattach() { LIST_INIT(&ppp_softc_list); if_clone_attach(&ppp_cloner); }
void greattach(int n) { LIST_INIT(&gre_softc_list); if_clone_attach(&gre_cloner); }
void vnet_loif_init(void) { if_clone_attach(&lo_cloner); }
void pairattach(int npair) { if_clone_attach(&pair_cloner); }