* 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. */
| 1553 | * SMPng: NOTE: Returns with the INP write lock held. |
| 1554 | */ |
| 1555 | static struct ip6_moptions * |
| 1556 | in6p_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). |
no test coverage detected