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

Function inp_findmoptions

freebsd/netinet/in_mcast.c:1599–1626  ·  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

1597 * SMPng: NOTE: Returns with the INP write lock held.
1598 */
1599static struct ip_moptions *
1600inp_findmoptions(struct inpcb *inp)
1601{
1602 struct ip_moptions *imo;
1603
1604 INP_WLOCK(inp);
1605 if (inp->inp_moptions != NULL)
1606 return (inp->inp_moptions);
1607
1608 INP_WUNLOCK(inp);
1609
1610 imo = malloc(sizeof(*imo), M_IPMOPTS, M_WAITOK);
1611
1612 imo->imo_multicast_ifp = NULL;
1613 imo->imo_multicast_addr.s_addr = INADDR_ANY;
1614 imo->imo_multicast_vif = -1;
1615 imo->imo_multicast_ttl = IP_DEFAULT_MULTICAST_TTL;
1616 imo->imo_multicast_loop = in_mcast_loop;
1617 STAILQ_INIT(&imo->imo_head);
1618
1619 INP_WLOCK(inp);
1620 if (inp->inp_moptions != NULL) {
1621 free(imo, M_IPMOPTS);
1622 return (inp->inp_moptions);
1623 }
1624 inp->inp_moptions = imo;
1625 return (imo);
1626}
1627
1628static void
1629inp_gcmoptions(struct ip_moptions *imo)

Callers 6

inp_block_unblock_sourceFunction · 0.85
inp_join_groupFunction · 0.85
inp_leave_groupFunction · 0.85
inp_set_multicast_ifFunction · 0.85
inp_set_source_filtersFunction · 0.85
inp_setmoptionsFunction · 0.85

Calls 2

mallocFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected