1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00

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)
This commit is contained in:
Michael Adam 2009-01-19 12:02:18 +01:00
parent 5e76a9bf65
commit 3dea35263c

View File

@ -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;