FreeBSD/sys/netinet/in_mcast.c
/*
 * Find an IPv4 multicast source entry for this imo which matches
 * the given group index for this socket, and source address.
 *
 * NOTE: This does not check if the entry is in-mode, merely if
 * it exists, which may not be the desired behaviour.
 */
Find an IPv4 multicast source entry for this imo which matches
the given group index for this socket, and source address.

This does not check if the entry is in-mode, merely if
it exists, which may not be the desired behaviour.
Find an IPv4 multicast source entry for this imo which matches the given group index for this socket and source address . This does not check if the entry is in - mode merely if it exists which may not be the desired behaviour .
static struct in_msource *
imo_match_source(const struct ip_moptions *imo, const size_t gidx,
    const struct sockaddr *src)
{
	struct ip_msource	 find;
	struct in_mfilter	*imf;
	struct ip_msource	*ims;
	const sockunion_t	*psa;
	KASSERT(src->sa_family == AF_INET, ("%s: !AF_INET", __func__));
	KASSERT(gidx != -1 && gidx < imo->imo_num_memberships,
	    ("%s: invalid index %d\n", __func__, (int)gidx));
	if (imo->imo_mfilters == NULL)
		return (NULL);
	imf = &imo->imo_mfilters[gidx];
	psa = (const sockunion_t *)src;
	find.ims_haddr = ntohl(psa->sin.sin_addr.s_addr);
	ims = RB_FIND(ip_msource_tree, &imf->imf_sources, &find);
	return ((struct in_msource *)ims);
}
static struct in_msource * imo_match_source ( const struct ip_moptions * imo , const size_t gidx , const struct sockaddr * src ) { struct ip_msource find ; struct in_mfilter * imf ; struct ip_msource * ims ; const sockunion_t * psa ; KASSERT ( src -> sa_family == AF_INET , ( " " , __func__ ) ) ; KASSERT ( gidx != -1 && gidx < imo -> imo_num_memberships , ( " \n " , __func__ , ( int ) gidx ) ) ; if ( imo -> imo_mfilters == NULL ) return ( NULL ) ; imf = & imo -> imo_mfilters [ gidx ] ; psa = ( const sockunion_t * ) src ; find . ims_haddr = ntohl ( psa -> sin . sin_addr . s_addr ) ; ims = RB_FIND ( ip_msource_tree , & imf -> imf_sources , & find ) ; return ( ( struct in_msource * ) ims ) ; }
Find an IPv4 multicast source entry for this imo which matches
 the given group index for this socket, and source address.
Find an IPv4 multicast source entry for this imo which matches the given group index for this socket and source address .
/* The imo_mfilters array may be lazy allocated. */ /* Source trees are keyed in host byte order. */