mirror of
https://github.com/samba-team/samba.git
synced 2025-09-20 17:44:21 +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:
@@ -418,7 +418,14 @@ bool ctdb_sys_have_ip(ctdb_sock_addr *addr)
|
|||||||
int s;
|
int s;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
switch (addr->sa.sa_family) {
|
||||||
|
case AF_INET:
|
||||||
addr->ip.sin_port = 0;
|
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);
|
s = socket(addr->sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user