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

Function im6f_graft

freebsd/netinet6/in6_mcast.c:760–783  ·  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

758 * Return the pointer to the new node, otherwise return NULL.
759 */
760static struct in6_msource *
761im6f_graft(struct in6_mfilter *imf, const uint8_t st1,
762 const struct sockaddr_in6 *psin)
763{
764 struct ip6_msource *nims;
765 struct in6_msource *lims;
766
767#ifdef FSTACK
768 nims = malloc(sizeof(struct ip6_msource), M_IN6MFILTER,
769#else
770 nims = malloc(sizeof(struct in6_msource), M_IN6MFILTER,
771#endif
772 M_NOWAIT | M_ZERO);
773 if (nims == NULL)
774 return (NULL);
775 lims = (struct in6_msource *)nims;
776 lims->im6s_addr = psin->sin6_addr;
777 lims->im6sl_st[0] = MCAST_UNDEFINED;
778 lims->im6sl_st[1] = st1;
779 RB_INSERT(ip6_msource_tree, &imf->im6f_sources, nims);
780 ++imf->im6f_nsrc;
781
782 return (lims);
783}
784
785/*
786 * Prune a source entry from an existing socket-layer filter set,

Callers 2

in6p_join_groupFunction · 0.85

Calls 1

mallocFunction · 0.85

Tested by

no test coverage detected