aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2020-09-22 00:24:06 +0000
committerNeels Hofmeyr <neels@hofmeyr.de>2020-10-15 04:54:02 +0200
commit5b094971badd26eba1286c09d5d02dd60609c945 (patch)
treec40de193f8512bc6d8fea9284f097bd39093dd15
parent1994355229d527fc050be2f5fb63f2835ec21a05 (diff)
socket.c v4/v6 error logneels/lcs
-rw-r--r--src/socket.c18
-rw-r--r--tests/socket/socket_sctp_test.err8
2 files changed, 21 insertions, 5 deletions
diff --git a/src/socket.c b/src/socket.c
index 229f72e3..f725ec19 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -710,6 +710,18 @@ int osmo_sock_init2_multiaddr(uint16_t family, uint16_t type, uint8_t proto,
loc_has_v4addr = rem_has_v4addr = (family == AF_INET);
loc_has_v6addr = rem_has_v6addr = (family == AF_INET6);
+ LOGP(DLGLOBAL, LOGL_DEBUG, "%s(): family %s\n",
+ __func__, family == AF_INET ? "AF_INET" : (family == AF_INET6 ? "AF_INET6" : "?"));
+
+ for (i = 0; i < local_hosts_cnt; i++) {
+ LOGP(DLGLOBAL, LOGL_DEBUG, "%s(): local host %d: %s:%d\n",
+ __func__, i, local_hosts[i], local_port);
+ }
+ for (i = 0; i < remote_hosts_cnt; i++) {
+ LOGP(DLGLOBAL, LOGL_DEBUG, "%s(): remote host %d: %s:%d\n",
+ __func__, i, remote_hosts[i], remote_port);
+ }
+
/* TODO: So far this function is only aimed for SCTP, but could be
reused in the future for other protocols with multi-addr support */
if (proto != IPPROTO_SCTP)
@@ -755,7 +767,11 @@ int osmo_sock_init2_multiaddr(uint16_t family, uint16_t type, uint8_t proto,
if (((flags & OSMO_SOCK_F_BIND) && (flags & OSMO_SOCK_F_CONNECT)) &&
!addrinfo_has_in6addr_any((const struct addrinfo **)res_loc, local_hosts_cnt) &&
(loc_has_v4addr != rem_has_v4addr || loc_has_v6addr != rem_has_v6addr)) {
- LOGP(DLGLOBAL, LOGL_ERROR, "Invalid v4 vs v6 in local vs remote addresses\n");
+ LOGP(DLGLOBAL, LOGL_ERROR, "Invalid v4 vs v6 in local vs remote addresses: "
+ "local:%s%s remote:%s%s\n",
+ loc_has_v4addr ? " v4" : "", loc_has_v6addr ? " v6" : "",
+ rem_has_v4addr ? " v4" : "", rem_has_v6addr ? " v6" : ""
+ );
rc = -EINVAL;
goto ret_freeaddrinfo;
}
diff --git a/tests/socket/socket_sctp_test.err b/tests/socket/socket_sctp_test.err
index 996d0922..7583a2a2 100644
--- a/tests/socket/socket_sctp_test.err
+++ b/tests/socket/socket_sctp_test.err
@@ -1,8 +1,8 @@
invalid: you have to specify either BIND or CONNECT flags
-Invalid v4 vs v6 in local vs remote addresses
-Invalid v4 vs v6 in local vs remote addresses
+Invalid v4 vs v6 in local vs remote addresses: local: v4 remote: v6
+Invalid v4 vs v6 in local vs remote addresses: local: v6 remote: v4
invalid: you have to specify either BIND or CONNECT flags
-Invalid v4 vs v6 in local vs remote addresses
-Invalid v4 vs v6 in local vs remote addresses
+Invalid v4 vs v6 in local vs remote addresses: local: v4 remote: v6
+Invalid v4 vs v6 in local vs remote addresses: local: v6 remote: v4
getaddrinfo(::1, 0) failed: Address family for hostname not supported
getaddrinfo(127.0.0.1, 0) failed: Address family for hostname not supported