FreeBSD/sys/netinet6/in6_mcast.c
/*
 * Look up the ifnet to use for a multicast group membership,
 * given the address of an IPv6 group.
 *
 * This routine exists to support legacy IPv6 multicast applications.
 *
 * If inp is non-NULL, use this socket's current FIB number for any
 * required FIB lookup. Look up the group address in the unicast FIB,
 * and use its ifp; usually, this points to the default next-hop.
 * If the FIB lookup fails, return NULL.
 *
 * FUTURE: Support multiple forwarding tables for IPv6.
 *
 * Returns NULL if no ifp could be found.
 */
Look up the ifnet to use for a multicast group membership,
given the address of an IPv6 group.

This routine exists to support legacy IPv6 multicast applications.

If inp is non-NULL, use this socket's current FIB number for any
required FIB lookup. Look up the group address in the unicast FIB,
and use its ifp; usually, this points to the default next-hop.
If the FIB lookup fails, return NULL.

Support multiple forwarding tables for IPv6.

Returns NULL if no ifp could be found.
Look up the ifnet to use for a multicast group membership given the address of an IPv6 group . This routine exists to support legacy IPv6 multicast applications . If inp is non - NULL use this socket ' s current FIB number for any required FIB lookup . Look up the group address in the unicast FIB and use its ifp ; usually this points to the default next - hop . If the FIB lookup fails return NULL . Support multiple forwarding tables for IPv6 . Returns NULL if no ifp could be found .
static struct ifnet *
in6p_lookup_mcast_ifp(const struct inpcb *in6p,
    const struct sockaddr_in6 *gsin6)
{
	struct nhop6_basic	nh6;
	struct in6_addr		dst;
	uint32_t		scopeid;
	uint32_t		fibnum;
	KASSERT(in6p->inp_vflag & INP_IPV6,
	    ("%s: not INP_IPV6 inpcb", __func__));
	KASSERT(gsin6->sin6_family == AF_INET6,
	    ("%s: not AF_INET6 group", __func__));
	in6_splitscope(&gsin6->sin6_addr, &dst, &scopeid);
	fibnum = in6p ? in6p->inp_inc.inc_fibnum : RT_DEFAULT_FIB;
	if (fib6_lookup_nh_basic(fibnum, &dst, scopeid, 0, 0, &nh6) != 0)
		return (NULL);
	return (nh6.nh_ifp);
}
static struct ifnet * in6p_lookup_mcast_ifp ( const struct inpcb * in6p , const struct sockaddr_in6 * gsin6 ) { struct nhop6_basic nh6 ; struct in6_addr dst ; uint32_t scopeid ; uint32_t fibnum ; KASSERT ( in6p -> inp_vflag & INP_IPV6 , ( " " , __func__ ) ) ; KASSERT ( gsin6 -> sin6_family == AF_INET6 , ( " " , __func__ ) ) ; in6_splitscope ( & gsin6 -> sin6_addr , & dst , & scopeid ) ; fibnum = in6p ? in6p -> inp_inc . inc_fibnum : RT_DEFAULT_FIB ; if ( fib6_lookup_nh_basic ( fibnum , & dst , scopeid , 0 , 0 , & nh6 ) != 0 ) return ( NULL ) ; return ( nh6 . nh_ifp ) ; }
Look up the ifnet to use for a multicast group membership,
 given the address of an IPv6 group.
Look up the ifnet to use for a multicast group membership given the address of an IPv6 group .