Exemple #1
0
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;
	}
}
Exemple #2
0
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;
}
Exemple #3
0
void
loopattach(int n)
{

    (void)loop_clone_create(&loop_cloner, 0);	/* lo0 always exists */
    if_clone_attach(&loop_cloner);
}
Exemple #4
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;
}
Exemple #5
0
/* ARGSUSED */
static void
greattach(void)
{

	LIST_INIT(&gre_softc_list);
	if_clone_attach(&gre_cloner);
}
Exemple #6
0
/* ARGSUSED */
void
gifattach(int count)
{

	LIST_INIT(&gif_softc_list);
	if_clone_attach(&gif_cloner);
}
Exemple #7
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);
} 
Exemple #8
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);
}
Exemple #9
0
void
loopattach(int n)
{
	if (loop_clone_create(&loop_cloner, 0))
		panic("unable to create lo0");

	if_clone_attach(&loop_cloner);
}
Exemple #10
0
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);
}
Exemple #11
0
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);
}
Exemple #13
0
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);
}
Exemple #14
0
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);
}
Exemple #17
0
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;
}
Exemple #18
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);
}
Exemple #19
0
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);
}
Exemple #20
0
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);
}
Exemple #21
0
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);
}
Exemple #22
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
}
Exemple #23
0
/* ARGSUSED */
void
faithattach(int count)
{

	if_clone_attach(&faith_cloner);
}
Exemple #24
0
void
mpwattach(int n)
{
	if_clone_attach(&mpw_cloner);
}
Exemple #25
0
static void
mplsinit(void)
{
	if_clone_attach(&mpls_if_cloner);
}
Exemple #26
0
/* ARGSUSED */
void
ifmplsattach(int count)
{
	if_clone_attach(&mpls_if_cloner);
}
Exemple #27
0
/*
 * Called from boot code to establish ppp interfaces.
 */
void
pppattach()
{
    LIST_INIT(&ppp_softc_list);
    if_clone_attach(&ppp_cloner);
}
Exemple #28
0
void
greattach(int n)
{
	LIST_INIT(&gre_softc_list);
	if_clone_attach(&gre_cloner);
}
Exemple #29
0
void vnet_loif_init(void)
{
	if_clone_attach(&lo_cloner);
}
Exemple #30
0
void
pairattach(int npair)
{
	if_clone_attach(&pair_cloner);
}