* does the address match? returns 0 if not, 1 if so */
| 884 | * does the address match? returns 0 if not, 1 if so |
| 885 | */ |
| 886 | static uint32_t |
| 887 | sctp_addr_match(struct sctp_paramhdr *ph, struct sockaddr *sa) |
| 888 | { |
| 889 | #if defined(INET) || defined(INET6) |
| 890 | uint16_t param_type, param_length; |
| 891 | |
| 892 | param_type = ntohs(ph->param_type); |
| 893 | param_length = ntohs(ph->param_length); |
| 894 | #endif |
| 895 | switch (sa->sa_family) { |
| 896 | #ifdef INET6 |
| 897 | case AF_INET6: |
| 898 | { |
| 899 | /* XXX scopeid */ |
| 900 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; |
| 901 | struct sctp_ipv6addr_param *v6addr; |
| 902 | |
| 903 | v6addr = (struct sctp_ipv6addr_param *)ph; |
| 904 | if ((param_type == SCTP_IPV6_ADDRESS) && |
| 905 | (param_length == sizeof(struct sctp_ipv6addr_param)) && |
| 906 | (memcmp(&v6addr->addr, &sin6->sin6_addr, |
| 907 | sizeof(struct in6_addr)) == 0)) { |
| 908 | return (1); |
| 909 | } |
| 910 | break; |
| 911 | } |
| 912 | #endif |
| 913 | #ifdef INET |
| 914 | case AF_INET: |
| 915 | { |
| 916 | struct sockaddr_in *sin = (struct sockaddr_in *)sa; |
| 917 | struct sctp_ipv4addr_param *v4addr; |
| 918 | |
| 919 | v4addr = (struct sctp_ipv4addr_param *)ph; |
| 920 | if ((param_type == SCTP_IPV4_ADDRESS) && |
| 921 | (param_length == sizeof(struct sctp_ipv4addr_param)) && |
| 922 | (memcmp(&v4addr->addr, &sin->sin_addr, |
| 923 | sizeof(struct in_addr)) == 0)) { |
| 924 | return (1); |
| 925 | } |
| 926 | break; |
| 927 | } |
| 928 | #endif |
| 929 | default: |
| 930 | break; |
| 931 | } |
| 932 | return (0); |
| 933 | } |
| 934 | |
| 935 | /* |
| 936 | * Cleanup for non-responded/OP ERR'd ASCONF |
no outgoing calls
no test coverage detected