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

Function in6p_findmoptions

freebsd/netinet6/in6_mcast.c:1555–1580  ·  view source on GitHub ↗

* Given an inpcb, return its multicast options structure pointer. Accepts * an unlocked inpcb pointer, but will return it locked. May sleep. * * SMPng: NOTE: Potentially calls malloc(M_WAITOK) with Giant held. * SMPng: NOTE: Returns with the INP write lock held. */

Source from the content-addressed store, hash-verified

1553 * SMPng: NOTE: Returns with the INP write lock held.
1554 */
1555static struct ip6_moptions *
1556in6p_findmoptions(struct inpcb *inp)
1557{
1558 struct ip6_moptions *imo;
1559
1560 INP_WLOCK(inp);
1561 if (inp->in6p_moptions != NULL)
1562 return (inp->in6p_moptions);
1563
1564 INP_WUNLOCK(inp);
1565
1566 imo = malloc(sizeof(*imo), M_IP6MOPTS, M_WAITOK);
1567
1568 imo->im6o_multicast_ifp = NULL;
1569 imo->im6o_multicast_hlim = V_ip6_defmcasthlim;
1570 imo->im6o_multicast_loop = in6_mcast_loop;
1571 STAILQ_INIT(&imo->im6o_head);
1572
1573 INP_WLOCK(inp);
1574 if (inp->in6p_moptions != NULL) {
1575 free(imo, M_IP6MOPTS);
1576 return (inp->in6p_moptions);
1577 }
1578 inp->in6p_moptions = imo;
1579 return (imo);
1580}
1581
1582/*
1583 * Discard the IPv6 multicast options (and source filters).

Callers 6

in6p_join_groupFunction · 0.85
in6p_leave_groupFunction · 0.85
in6p_set_multicast_ifFunction · 0.85
in6p_set_source_filtersFunction · 0.85
ip6_setmoptionsFunction · 0.85

Calls 2

mallocFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected