예제 #1
0
파일: if_enc.c 프로젝트: coyizumi/cs111
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);
		enc_cloner = if_clone_simple(encname, enc_clone_create,
		    enc_clone_destroy, 1);
		break;
	case MOD_UNLOAD:
		printf("enc module unload - not possible for this module\n");
		return (EINVAL);
	default:
		return (EOPNOTSUPP);
	}
	return (0);
}
예제 #2
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);
} 
예제 #3
0
		(*ng_gif_detach_p)(ifp);
	bpfdetach(ifp);
	if_detach(ifp);
	ifp->if_softc = NULL;
	sx_xunlock(&gif_ioctl_sx);

	GIF_WAIT();
	if_free(ifp);
	free(sc, M_GIF);
}

static void
vnet_gif_init(const void *unused __unused)
{

	V_gif_cloner = if_clone_simple(gifname, gif_clone_create,
	    gif_clone_destroy, 0);
#ifdef INET
	in_gif_init();
#endif
#ifdef INET6
	in6_gif_init();
#endif
}
VNET_SYSINIT(vnet_gif_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
    vnet_gif_init, NULL);

static void
vnet_gif_uninit(const void *unused __unused)
{

	if_clone_detach(V_gif_cloner);
예제 #4
0
파일: if_enc.c 프로젝트: 2asoft/freebsd
#endif
#ifdef INET6
	hki.hook_id = AF_INET6;
	hki.hook_type = HHOOK_TYPE_IPSEC_IN;
	hhook_remove_hook(V_ipsec_hhh_in[HHOOK_IPSEC_INET6], &hki);
	hki.hook_type = HHOOK_TYPE_IPSEC_OUT;
	hhook_remove_hook(V_ipsec_hhh_out[HHOOK_IPSEC_INET6], &hki);
#endif
}

static void
vnet_enc_init(const void *unused __unused)
{

	V_enc_sc = NULL;
	V_enc_cloner = if_clone_simple(encname, enc_clone_create,
	    enc_clone_destroy, 1);
}
VNET_SYSINIT(vnet_enc_init, SI_SUB_PSEUDO, SI_ORDER_ANY,
    vnet_enc_init, NULL);

static void
vnet_enc_init_proto(void *unused __unused)
{
	KASSERT(V_enc_sc != NULL, ("%s: V_enc_sc is %p\n", __func__, V_enc_sc));

	if (enc_add_hhooks(V_enc_sc) != 0)
		enc_clone_destroy(V_enc_sc->sc_ifp);
}
VNET_SYSINIT(vnet_enc_init_proto, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
    vnet_enc_init_proto, NULL);
예제 #5
0
파일: if_loop.c 프로젝트: coyizumi/cs111
	    IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6;
	ifp->if_hwassist = LO_CSUM_FEATURES | LO_CSUM_FEATURES6;
	if_attach(ifp);
	bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
	if (V_loif == NULL)
		V_loif = ifp;

	return (0);
}

static void
vnet_loif_init(const void *unused __unused)
{

#ifdef VIMAGE
	lo_cloner = if_clone_simple(loname, lo_clone_create, lo_clone_destroy,
	    1);
	V_lo_cloner = lo_cloner;
#else
	lo_cloner = if_clone_simple(loname, lo_clone_create, lo_clone_destroy,
	    1);
#endif
}
VNET_SYSINIT(vnet_loif_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
    vnet_loif_init, NULL);

#ifdef VIMAGE
static void
vnet_loif_uninit(const void *unused __unused)
{

	if_clone_detach(V_lo_cloner);
예제 #6
0
 * careful to configure the tunnels so that it won't make a loop.
 */
#define MAX_GRE_NEST 1
#endif

static VNET_DEFINE(int, max_gre_nesting) = MAX_GRE_NEST;
#define	V_max_gre_nesting	VNET(max_gre_nesting)
SYSCTL_INT(_net_link_gre, OID_AUTO, max_nesting, CTLFLAG_RW | CTLFLAG_VNET,
    &VNET_NAME(max_gre_nesting), 0, "Max nested tunnels");

static void
vnet_gre_init(const void *unused __unused)
{
	LIST_INIT(&V_gre_softc_list);
	GRE_LIST_LOCK_INIT();
	V_gre_cloner = if_clone_simple(grename, gre_clone_create,
	    gre_clone_destroy, 0);
}
VNET_SYSINIT(vnet_gre_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
    vnet_gre_init, NULL);

static void
vnet_gre_uninit(const void *unused __unused)
{

	if_clone_detach(V_gre_cloner);
	GRE_LIST_LOCK_DESTROY();
}
VNET_SYSUNINIT(vnet_gre_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
    vnet_gre_uninit, NULL);

static int