diff options
author | Michael Adam <obnox@samba.org> | 2009-01-19 12:02:18 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-01-19 22:49:11 +0100 |
commit | 3dea35263cc69b0f34b0a11ca74b23ff89cd0abf (patch) | |
tree | f90a38fb281fdac76cf605bd309815dbfe9010d2 /ctdb/common/system_linux.c | |
parent | 5e76a9bf654e05c66b6f40661436375cfe35e88e (diff) | |
download | samba-3dea35263cc69b0f34b0a11ca74b23ff89cd0abf.tar.gz samba-3dea35263cc69b0f34b0a11ca74b23ff89cd0abf.tar.xz samba-3dea35263cc69b0f34b0a11ca74b23ff89cd0abf.zip |
Fix verification of IP allocation with ipv6 addresses on Linux.
Set sin_port or sin6_port to 0, depending on sa_family.
Michael
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit e0c70110e241b065c42c1c07f32c3657bac5d98b)
Diffstat (limited to 'ctdb/common/system_linux.c')
-rw-r--r-- | ctdb/common/system_linux.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ctdb/common/system_linux.c b/ctdb/common/system_linux.c index 1bf4903330..6c0efc1f02 100644 --- a/ctdb/common/system_linux.c +++ b/ctdb/common/system_linux.c @@ -418,7 +418,14 @@ bool ctdb_sys_have_ip(ctdb_sock_addr *addr) int s; int ret; - addr->ip.sin_port = 0; + switch (addr->sa.sa_family) { + case AF_INET: + addr->ip.sin_port = 0; + break; + case AF_INET6: + addr->ip6.sin6_port = 0; + break; + } s = socket(addr->sa.sa_family, SOCK_STREAM, IPPROTO_TCP); if (s == -1) { return false; |