ctdb-common: Use sin6_len only if the structure supports it
authorAmitay Isaacs <amitay@gmail.com>
Wed, 27 Jun 2018 03:41:38 +0000 (13:41 +1000)
committerKarolin Seeger <kseeger@samba.org>
Tue, 10 Jul 2018 08:44:13 +0000 (10:44 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 79992dbb73ac9749ac987cb6a88964fa600b4c35)

ctdb/common/ctdb_util.c
ctdb/common/system_util.c
ctdb/protocol/protocol_util.c

index 82526b58a1987f75ae35ea0429aa29ab2b8adc9c..ffaa1a780ed0e1736111f9c08f593a6b9d654e24 100644 (file)
@@ -389,8 +389,8 @@ void ctdb_canonicalize_ip(const ctdb_sock_addr *ip, ctdb_sock_addr *cip)
                               sizeof(cip->ip.sin_addr));
                } else {
                        cip->ip6.sin6_family = AF_INET6;
-#ifdef HAVE_SOCK_SIN_LEN
-                       cip->ip6.sin_len = sizeof(ctdb_sock_addr);
+#ifdef HAVE_SOCK_SIN6_LEN
+                       cip->ip6.sin6_len = sizeof(ctdb_sock_addr);
 #endif
                        cip->ip6.sin6_port   = ip->ip6.sin6_port;
                        memcpy(&cip->ip6.sin6_addr,
index f27eed7038da23e805b80254d322574b87906acb..f1e9763c52a3218540f1fe7c76775a62ea65f642 100644 (file)
@@ -154,7 +154,7 @@ static bool parse_ipv6(const char *s, const char *ifaces, unsigned port, ctdb_so
                saddr->ip6.sin6_scope_id = if_nametoindex(ifaces);
        }
 
-#ifdef HAVE_SOCK_SIN_LEN
+#ifdef HAVE_SOCK_SIN6_LEN
        saddr->ip6.sin6_len = sizeof(*saddr);
 #endif
        return true;
index 73652e7f060113525161f67f18e282b7e891b7d0..c75555fa7348118ce9ecafdbc51a2323b2abbaed 100644 (file)
@@ -206,7 +206,7 @@ static int ipv6_from_string(const char *str, struct sockaddr_in6 *ip6)
                return EINVAL;
        }
 
-#ifdef HAVE_SOCK_SIN_LEN
+#ifdef HAVE_SOCK_SIN6_LEN
        ip6->sin6_len = sizeof(*ip6);
 #endif
        return 0;