swrap: warn about unreachable addresses
authorStefan Metzmacher <metze@samba.org>
Wed, 17 Feb 2021 10:41:38 +0000 (11:41 +0100)
committerAndreas Schneider <asn@samba.org>
Mon, 15 Mar 2021 07:04:58 +0000 (08:04 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14640

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
src/socket_wrapper.c

index a950a0a0dbc882e8ca8b95278bcd1f013b0036ab..b6c76372d770d2f078f127c7957179c84661368a 100644 (file)
@@ -2027,6 +2027,13 @@ static int convert_in_un_remote(struct socket_info *si, const struct sockaddr *i
                        type = u_type;
                        iface = (addr & 0x000000FF);
                } else {
+                       char str[256] = {0,};
+                       inet_ntop(inaddr->sa_family,
+                                 &in->sin_addr,
+                                 str, sizeof(str));
+                       SWRAP_LOG(SWRAP_LOG_WARN,
+                                 "str[%s] prt[%u]",
+                                 str, (unsigned)prt);
                        errno = ENETUNREACH;
                        return -1;
                }
@@ -2062,6 +2069,13 @@ static int convert_in_un_remote(struct socket_info *si, const struct sockaddr *i
                if (IN6_ARE_ADDR_EQUAL(&cmp1, &cmp2)) {
                        iface = in->sin6_addr.s6_addr[15];
                } else {
+                       char str[256] = {0,};
+                       inet_ntop(inaddr->sa_family,
+                                 &in->sin6_addr,
+                                 str, sizeof(str));
+                       SWRAP_LOG(SWRAP_LOG_WARN,
+                                 "str[%s] prt[%u]",
+                                 str, (unsigned)prt);
                        errno = ENETUNREACH;
                        return -1;
                }