FreeBSD/sys/netinet6/in6_mcast.c
/*
 * Find an IPv6 multicast source entry for this imo which matches
 * the given group index for this socket, and source address.
 *
 * XXX TODO: The scope ID, if present in src, is stripped before
 * any comparison. We SHOULD enforce scope/zone checks where the source
 * filter entry has a link scope.
 *
 * NOTE: This does not check if the entry is in-mode, merely if
 * it exists, which may not be the desired behaviour.
 */
Find an IPv6 multicast source entry for this imo which matches
the given group index for this socket, and source address.

XXX TODO: The scope ID, if present in src, is stripped before
any comparison. We SHOULD enforce scope/zone checks where the source
filter entry has a link scope.

This does not check if the entry is in-mode, merely if
it exists, which may not be the desired behaviour.
Find an IPv6 multicast source entry for this imo which matches the given group index for this socket and source address . XXX TODO : The scope ID if present in src is stripped before any comparison . We SHOULD enforce scope / zone checks where the source filter entry has a link scope . This does not check if the entry is in - mode merely if it exists which may not be the desired behaviour .
static struct in6_msource *
im6o_match_source(const struct ip6_moptions *imo, const size_t gidx,
    const struct sockaddr *src)
{
	struct ip6_msource	 find;
	struct in6_mfilter	*imf;
	struct ip6_msource	*ims;
	const sockunion_t	*psa;
	KASSERT(src->sa_family == AF_INET6, ("%s: !AF_INET6", __func__));
	KASSERT(gidx != -1 && gidx < imo->im6o_num_memberships,
	    ("%s: invalid index %d\n", __func__, (int)gidx));
	if (imo->im6o_mfilters == NULL)
		return (NULL);
	imf = &imo->im6o_mfilters[gidx];
	psa = (const sockunion_t *)src;
	find.im6s_addr = psa->sin6.sin6_addr;
	in6_clearscope(&find.im6s_addr);		
	ims = RB_FIND(ip6_msource_tree, &imf->im6f_sources, &find);
	return ((struct in6_msource *)ims);
}
static struct in6_msource * im6o_match_source ( const struct ip6_moptions * imo , const size_t gidx , const struct sockaddr * src ) { struct ip6_msource find ; struct in6_mfilter * imf ; struct ip6_msource * ims ; const sockunion_t * psa ; KASSERT ( src -> sa_family == AF_INET6 , ( " " , __func__ ) ) ; KASSERT ( gidx != -1 && gidx < imo -> im6o_num_memberships , ( " \n " , __func__ , ( int ) gidx ) ) ; if ( imo -> im6o_mfilters == NULL ) return ( NULL ) ; imf = & imo -> im6o_mfilters [ gidx ] ; psa = ( const sockunion_t * ) src ; find . im6s_addr = psa -> sin6 . sin6_addr ; in6_clearscope ( & find . im6s_addr ) ; ims = RB_FIND ( ip6_msource_tree , & imf -> im6f_sources , & find ) ; return ( ( struct in6_msource * ) ims ) ; }
Find an IPv6 multicast source entry for this imo which matches
 the given group index for this socket, and source address.
Find an IPv6 multicast source entry for this imo which matches the given group index for this socket and source address .
/* The im6o_mfilters array may be lazy allocated. */ /* XXX */