FreeBSD/sys/netinet6/in6_mcast.c
/*
 * Graft a source entry into an existing socket-layer filter set,
 * maintaining any required invariants and checking allocations.
 *
 * The source is marked as being in the new filter mode at t1.
 *
 * Return the pointer to the new node, otherwise return NULL.
 */
Graft a source entry into an existing socket-layer filter set,
maintaining any required invariants and checking allocations.

The source is marked as being in the new filter mode at t1.

Return the pointer to the new node, otherwise return NULL.
Graft a source entry into an existing socket - layer filter set maintaining any required invariants and checking allocations . The source is marked as being in the new filter mode at t1 . Return the pointer to the new node otherwise return NULL .
static struct in6_msource *
im6f_graft(struct in6_mfilter *imf, const uint8_t st1,
    const struct sockaddr_in6 *psin)
{
	struct ip6_msource	*nims;
	struct in6_msource	*lims;
	nims = malloc(sizeof(struct in6_msource), M_IN6MFILTER,
	    M_NOWAIT | M_ZERO);
	if (nims == NULL)
		return (NULL);
	lims = (struct in6_msource *)nims;
	lims->im6s_addr = psin->sin6_addr;
	lims->im6sl_st[0] = MCAST_UNDEFINED;
	lims->im6sl_st[1] = st1;
	RB_INSERT(ip6_msource_tree, &imf->im6f_sources, nims);
	++imf->im6f_nsrc;
	return (lims);
}
static struct in6_msource * im6f_graft ( struct in6_mfilter * imf , const uint8_t st1 , const struct sockaddr_in6 * psin ) { struct ip6_msource * nims ; struct in6_msource * lims ; nims = malloc ( sizeof ( struct in6_msource ) , M_IN6MFILTER , M_NOWAIT | M_ZERO ) ; if ( nims == NULL ) return ( NULL ) ; lims = ( struct in6_msource * ) nims ; lims -> im6s_addr = psin -> sin6_addr ; lims -> im6sl_st [ 0 ] = MCAST_UNDEFINED ; lims -> im6sl_st [ 1 ] = st1 ; RB_INSERT ( ip6_msource_tree , & imf -> im6f_sources , nims ) ; ++ imf -> im6f_nsrc ; return ( lims ) ; }
Graft a source entry into an existing socket-layer filter set,
 maintaining any required invariants and checking allocations.
Graft a source entry into an existing socket - layer filter set maintaining any required invariants and checking allocations .