FreeBSD/sys/netinet6/ip6_mroute.c
/*
 * Handle MRT setsockopt commands to modify the multicast routing tables.
 */
Handle MRT setsockopt commands to modify the multicast routing tables.
Handle MRT setsockopt commands to modify the multicast routing tables .
int
X_ip6_mrouter_set(struct socket *so, struct sockopt *sopt)
{
	int error = 0;
	int optval;
	struct mif6ctl mifc;
	struct mf6cctl mfcc;
	mifi_t mifi;
	if (so != V_ip6_mrouter && sopt->sopt_name != MRT6_INIT)
		return (EPERM);
	switch (sopt->sopt_name) {
	case MRT6_INIT:
#ifdef MRT6_OINIT
	case MRT6_OINIT:
#endif
		error = sooptcopyin(sopt, &optval, sizeof(optval),
		    sizeof(optval));
		if (error)
			break;
		error = ip6_mrouter_init(so, optval, sopt->sopt_name);
		break;
	case MRT6_DONE:
		error = X_ip6_mrouter_done();
		break;
	case MRT6_ADD_MIF:
		error = sooptcopyin(sopt, &mifc, sizeof(mifc), sizeof(mifc));
		if (error)
			break;
		error = add_m6if(&mifc);
		break;
	case MRT6_ADD_MFC:
		error = sooptcopyin(sopt, &mfcc, sizeof(mfcc), sizeof(mfcc));
		if (error)
			break;
		error = add_m6fc(&mfcc);
		break;
	case MRT6_DEL_MFC:
		error = sooptcopyin(sopt, &mfcc, sizeof(mfcc), sizeof(mfcc));
		if (error)
			break;
		error = del_m6fc(&mfcc);
		break;
	case MRT6_DEL_MIF:
		error = sooptcopyin(sopt, &mifi, sizeof(mifi), sizeof(mifi));
		if (error)
			break;
		error = del_m6if(&mifi);
		break;
	case MRT6_PIM:
		error = sooptcopyin(sopt, &optval, sizeof(optval),
		    sizeof(optval));
		if (error)
			break;
		error = set_pim6(&optval);
		break;
	default:
		error = EOPNOTSUPP;
		break;
	}
	return (error);
}
int X_ip6_mrouter_set ( struct socket * so , struct sockopt * sopt ) { int error = 0 ; int optval ; struct mif6ctl mifc ; struct mf6cctl mfcc ; mifi_t mifi ; if ( so != V_ip6_mrouter && sopt -> sopt_name != MRT6_INIT ) return ( EPERM ) ; switch ( sopt -> sopt_name ) { case MRT6_INIT : #ifdef MRT6_OINIT case MRT6_OINIT : #endif error = sooptcopyin ( sopt , & optval , sizeof ( optval ) , sizeof ( optval ) ) ; if ( error ) break ; error = ip6_mrouter_init ( so , optval , sopt -> sopt_name ) ; break ; case MRT6_DONE : error = X_ip6_mrouter_done ( ) ; break ; case MRT6_ADD_MIF : error = sooptcopyin ( sopt , & mifc , sizeof ( mifc ) , sizeof ( mifc ) ) ; if ( error ) break ; error = add_m6if ( & mifc ) ; break ; case MRT6_ADD_MFC : error = sooptcopyin ( sopt , & mfcc , sizeof ( mfcc ) , sizeof ( mfcc ) ) ; if ( error ) break ; error = add_m6fc ( & mfcc ) ; break ; case MRT6_DEL_MFC : error = sooptcopyin ( sopt , & mfcc , sizeof ( mfcc ) , sizeof ( mfcc ) ) ; if ( error ) break ; error = del_m6fc ( & mfcc ) ; break ; case MRT6_DEL_MIF : error = sooptcopyin ( sopt , & mifi , sizeof ( mifi ) , sizeof ( mifi ) ) ; if ( error ) break ; error = del_m6if ( & mifi ) ; break ; case MRT6_PIM : error = sooptcopyin ( sopt , & optval , sizeof ( optval ) , sizeof ( optval ) ) ; if ( error ) break ; error = set_pim6 ( & optval ) ; break ; default : error = EOPNOTSUPP ; break ; } return ( error ) ; }
Handle MRT setsockopt commands to modify the multicast routing tables.
Handle MRT setsockopt commands to modify the multicast routing tables .