FreeBSD/sys/netinet6/in6_rmx.c
/*
 * Do what we need to do when inserting a route.
 */
Do what we need to do when inserting a route.
Do what we need to do when inserting a route .
static struct radix_node *
in6_addroute(void *v_arg, void *n_arg, struct radix_head *head,
    struct radix_node *treenodes)
{
	struct rtentry *rt = (struct rtentry *)treenodes;
	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rt_key(rt);
	if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
		rt->rt_flags |= RTF_MULTICAST;
	if (rt->rt_flags & RTF_HOST) {
		if (IN6_ARE_ADDR_EQUAL(&satosin6(rt->rt_ifa->ifa_addr)
					->sin6_addr,
				       &sin6->sin6_addr)) {
			rt->rt_flags |= RTF_LOCAL;
		}
	}
	if (rt->rt_ifp != NULL) {
		if (rt->rt_mtu == 0) {
			rt->rt_mtu = IN6_LINKMTU(rt->rt_ifp);
		} else if (rt->rt_mtu > IN6_LINKMTU(rt->rt_ifp))
			rt->rt_mtu = IN6_LINKMTU(rt->rt_ifp);
	}
	return (rn_addroute(v_arg, n_arg, head, treenodes));
}
static struct radix_node * in6_addroute ( void * v_arg , void * n_arg , struct radix_head * head , struct radix_node * treenodes ) { struct rtentry * rt = ( struct rtentry * ) treenodes ; struct sockaddr_in6 * sin6 = ( struct sockaddr_in6 * ) rt_key ( rt ) ; if ( IN6_IS_ADDR_MULTICAST ( & sin6 -> sin6_addr ) ) rt -> rt_flags |= RTF_MULTICAST ; if ( rt -> rt_flags & RTF_HOST ) { if ( IN6_ARE_ADDR_EQUAL ( & satosin6 ( rt -> rt_ifa -> ifa_addr ) -> sin6_addr , & sin6 -> sin6_addr ) ) { rt -> rt_flags |= RTF_LOCAL ; } } if ( rt -> rt_ifp != NULL ) { if ( rt -> rt_mtu == 0 ) { rt -> rt_mtu = IN6_LINKMTU ( rt -> rt_ifp ) ; } else if ( rt -> rt_mtu > IN6_LINKMTU ( rt -> rt_ifp ) ) rt -> rt_mtu = IN6_LINKMTU ( rt -> rt_ifp ) ; } return ( rn_addroute ( v_arg , n_arg , head , treenodes ) ) ; }
Do what we need to do when inserting a route.
Do what we need to do when inserting a route .
/*
	 * A little bit of help for both IPv6 output and input:
	 *   For local addresses, we make sure that RTF_LOCAL is set,
	 *   with the thought that this might one day be used to speed up
	 *   ip_input().
	 *
	 * We also mark routes to multicast addresses as such, because
	 * it's easy to do and might be useful (but this is much more
	 * dubious since it's so easy to inspect the address).  (This
	 * is done above.)
	 *
	 * XXX
	 * should elaborate the code.
	 */ /*
		 * Check route MTU:
		 * inherit interface MTU if not set or
		 * check if MTU is too large.
		 */