| 1087 | } |
| 1088 | |
| 1089 | static int |
| 1090 | sctp6_in6getaddr(struct socket *so, struct sockaddr **nam) |
| 1091 | { |
| 1092 | struct inpcb *inp = sotoinpcb(so); |
| 1093 | int error; |
| 1094 | |
| 1095 | if (inp == NULL) { |
| 1096 | SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); |
| 1097 | return (EINVAL); |
| 1098 | } |
| 1099 | |
| 1100 | /* allow v6 addresses precedence */ |
| 1101 | error = sctp6_getaddr(so, nam); |
| 1102 | #ifdef INET |
| 1103 | if (error) { |
| 1104 | struct sockaddr_in6 *sin6; |
| 1105 | |
| 1106 | /* try v4 next if v6 failed */ |
| 1107 | error = sctp_ingetaddr(so, nam); |
| 1108 | if (error) { |
| 1109 | return (error); |
| 1110 | } |
| 1111 | SCTP_MALLOC_SONAME(sin6, struct sockaddr_in6 *, sizeof *sin6); |
| 1112 | if (sin6 == NULL) { |
| 1113 | SCTP_FREE_SONAME(*nam); |
| 1114 | return (ENOMEM); |
| 1115 | } |
| 1116 | in6_sin_2_v4mapsin6((struct sockaddr_in *)*nam, sin6); |
| 1117 | SCTP_FREE_SONAME(*nam); |
| 1118 | *nam = (struct sockaddr *)sin6; |
| 1119 | } |
| 1120 | #endif |
| 1121 | return (error); |
| 1122 | } |
| 1123 | |
| 1124 | static int |
| 1125 | sctp6_getpeeraddr(struct socket *so, struct sockaddr **nam) |
nothing calls this directly
no test coverage detected