MCPcopy Create free account
hub / github.com/F-Stack/f-stack / imf_graft

Function imf_graft

freebsd/netinet/in_mcast.c:791–814  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

789 * Return the pointer to the new node, otherwise return NULL.
790 */
791static struct in_msource *
792imf_graft(struct in_mfilter *imf, const uint8_t st1,
793 const struct sockaddr_in *psin)
794{
795 struct ip_msource *nims;
796 struct in_msource *lims;
797
798#ifdef FSTACK
799 nims = malloc(sizeof(struct ip_msource), M_INMFILTER,
800#else
801 nims = malloc(sizeof(struct in_msource), M_INMFILTER,
802#endif
803 M_NOWAIT | M_ZERO);
804 if (nims == NULL)
805 return (NULL);
806 lims = (struct in_msource *)nims;
807 lims->ims_haddr = ntohl(psin->sin_addr.s_addr);
808 lims->imsl_st[0] = MCAST_UNDEFINED;
809 lims->imsl_st[1] = st1;
810 RB_INSERT(ip_msource_tree, &imf->imf_sources, nims);
811 ++imf->imf_nsrc;
812
813 return (lims);
814}
815
816/*
817 * Prune a source entry from an existing socket-layer filter set,

Callers 2

inp_block_unblock_sourceFunction · 0.85
inp_join_groupFunction · 0.85

Calls 1

mallocFunction · 0.85

Tested by

no test coverage detected