FreeBSD/sys/netinet6/in6_mcast.c
/*
 * Perform filtering for multicast datagrams on a socket by group and source.
 *
 * Returns 0 if a datagram should be allowed through, or various error codes
 * if the socket was not a member of the group, or the source was muted, etc.
 */
Perform filtering for multicast datagrams on a socket by group and source.
Returns 0 if a datagram should be allowed through, or various error codes
if the socket was not a member of the group, or the source was muted, etc.
Perform filtering for multicast datagrams on a socket by group and source . Returns 0 if a datagram should be allowed through or various error codes if the socket was not a member of the group or the source was muted etc .
int
im6o_mc_filter(const struct ip6_moptions *imo, const struct ifnet *ifp,
    const struct sockaddr *group, const struct sockaddr *src)
{
	size_t gidx;
	struct in6_msource *ims;
	int mode;
	KASSERT(ifp != NULL, ("%s: null ifp", __func__));
	gidx = im6o_match_group(imo, ifp, group);
	if (gidx == -1)
		return (MCAST_NOTGMEMBER);
	mode = imo->im6o_mfilters[gidx].im6f_st[1];
	ims = im6o_match_source(imo, gidx, src);
	if ((ims == NULL && mode == MCAST_INCLUDE) ||
	    (ims != NULL && ims->im6sl_st[0] != mode))
		return (MCAST_NOTSMEMBER);
	return (MCAST_PASS);
}
int im6o_mc_filter ( const struct ip6_moptions * imo , const struct ifnet * ifp , const struct sockaddr * group , const struct sockaddr * src ) { size_t gidx ; struct in6_msource * ims ; int mode ; KASSERT ( ifp != NULL , ( " " , __func__ ) ) ; gidx = im6o_match_group ( imo , ifp , group ) ; if ( gidx == -1 ) return ( MCAST_NOTGMEMBER ) ; mode = imo -> im6o_mfilters [ gidx ] . im6f_st [ 1 ] ; ims = im6o_match_source ( imo , gidx , src ) ; if ( ( ims == NULL && mode == MCAST_INCLUDE ) || ( ims != NULL && ims -> im6sl_st [ 0 ] != mode ) ) return ( MCAST_NOTSMEMBER ) ; return ( MCAST_PASS ) ; }
Perform filtering for multicast datagrams on a socket by group and source.
Perform filtering for multicast datagrams on a socket by group and source .
/*
	 * Check if the source was included in an (S,G) join.
	 * Allow reception on exclusive memberships by default,
	 * reject reception on inclusive memberships by default.
	 * Exclude source only if an in-mode exclude filter exists.
	 * Include source only if an in-mode include filter exists.
	 * NOTE: We are comparing group state here at MLD t1 (now)
	 * with socket-layer t0 (since last downcall).
	 */