FreeBSD/sys/netinet6/nd6_rtr.c
/*
 * default router list processing sub routines
 */
default router list processing sub routines
default router list processing sub routines
static void
defrouter_addreq(struct nd_defrouter *new)
{
	struct sockaddr_in6 def, mask, gate;
	struct rtentry *newrt = NULL;
	int error;
	bzero(&def, sizeof(def));
	bzero(&mask, sizeof(mask));
	bzero(&gate, sizeof(gate));
	def.sin6_len = mask.sin6_len = gate.sin6_len =
	    sizeof(struct sockaddr_in6);
	def.sin6_family = gate.sin6_family = AF_INET6;
	gate.sin6_addr = new->rtaddr;
	error = in6_rtrequest(RTM_ADD, (struct sockaddr *)&def,
	    (struct sockaddr *)&gate, (struct sockaddr *)&mask,
	    RTF_GATEWAY, &newrt, RT_DEFAULT_FIB);
	if (newrt) {
		nd6_rtmsg(RTM_ADD, newrt); 
		RTFREE(newrt);
	}
	if (error == 0)
		new->installed = 1;
}
static void defrouter_addreq ( struct nd_defrouter * new ) { struct sockaddr_in6 def , mask , gate ; struct rtentry * newrt = NULL ; int error ; bzero ( & def , sizeof ( def ) ) ; bzero ( & mask , sizeof ( mask ) ) ; bzero ( & gate , sizeof ( gate ) ) ; def . sin6_len = mask . sin6_len = gate . sin6_len = sizeof ( struct sockaddr_in6 ) ; def . sin6_family = gate . sin6_family = AF_INET6 ; gate . sin6_addr = new -> rtaddr ; error = in6_rtrequest ( RTM_ADD , ( struct sockaddr * ) & def , ( struct sockaddr * ) & gate , ( struct sockaddr * ) & mask , RTF_GATEWAY , & newrt , RT_DEFAULT_FIB ) ; if ( newrt ) { nd6_rtmsg ( RTM_ADD , newrt ) ; RTFREE ( newrt ) ; } if ( error == 0 ) new -> installed = 1 ; }
default router list processing sub routines
default router list processing sub routines
/* tell user process */