* Endpoint probe expects that the INP_INFO is locked. */
| 1598 | * Endpoint probe expects that the INP_INFO is locked. |
| 1599 | */ |
| 1600 | static struct sctp_inpcb * |
| 1601 | sctp_endpoint_probe(struct sockaddr *nam, struct sctppcbhead *head, |
| 1602 | uint16_t lport, uint32_t vrf_id) |
| 1603 | { |
| 1604 | struct sctp_inpcb *inp; |
| 1605 | struct sctp_laddr *laddr; |
| 1606 | #ifdef INET |
| 1607 | struct sockaddr_in *sin; |
| 1608 | #endif |
| 1609 | #ifdef INET6 |
| 1610 | struct sockaddr_in6 *sin6; |
| 1611 | struct sockaddr_in6 *intf_addr6; |
| 1612 | #endif |
| 1613 | int fnd; |
| 1614 | |
| 1615 | #ifdef INET |
| 1616 | sin = NULL; |
| 1617 | #endif |
| 1618 | #ifdef INET6 |
| 1619 | sin6 = NULL; |
| 1620 | #endif |
| 1621 | switch (nam->sa_family) { |
| 1622 | #ifdef INET |
| 1623 | case AF_INET: |
| 1624 | sin = (struct sockaddr_in *)nam; |
| 1625 | break; |
| 1626 | #endif |
| 1627 | #ifdef INET6 |
| 1628 | case AF_INET6: |
| 1629 | sin6 = (struct sockaddr_in6 *)nam; |
| 1630 | break; |
| 1631 | #endif |
| 1632 | default: |
| 1633 | /* unsupported family */ |
| 1634 | return (NULL); |
| 1635 | } |
| 1636 | |
| 1637 | if (head == NULL) |
| 1638 | return (NULL); |
| 1639 | |
| 1640 | LIST_FOREACH(inp, head, sctp_hash) { |
| 1641 | SCTP_INP_RLOCK(inp); |
| 1642 | if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { |
| 1643 | SCTP_INP_RUNLOCK(inp); |
| 1644 | continue; |
| 1645 | } |
| 1646 | if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) && |
| 1647 | (inp->sctp_lport == lport)) { |
| 1648 | /* got it */ |
| 1649 | switch (nam->sa_family) { |
| 1650 | #ifdef INET |
| 1651 | case AF_INET: |
| 1652 | if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && |
| 1653 | SCTP_IPV6_V6ONLY(inp)) { |
| 1654 | /* |
| 1655 | * IPv4 on a IPv6 socket with ONLY |
| 1656 | * IPv6 set |
| 1657 | */ |
no test coverage detected