* 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. */
| 1597 | * SMPng: NOTE: Returns with the INP write lock held. |
| 1598 | */ |
| 1599 | static struct ip_moptions * |
| 1600 | inp_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 | |
| 1628 | static void |
| 1629 | inp_gcmoptions(struct ip_moptions *imo) |
no test coverage detected