From 9dbe779db9be09c532c1cafeb69948e414ea8f37 Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Tue, 26 Jun 2012 21:11:17 +0200 Subject: [PATCH] Real fix of bug #1897 We are only interested in SOCK_STREAM and protocol IPPROTO_TCP as that is the way we communicate. When we don't specify that in the hints for getaddrinfo we also get SOCK_DGRAM/IPPROTO_UDP and on Linux SOCK_RAW. And possibly more on other platforms. So lets me more specific. The older fix to suppress duplicates is also useable as a user might specify two or more names that resolve to the same address and we want to suppress duplicates also. --- bacula/src/lib/bnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bacula/src/lib/bnet.c b/bacula/src/lib/bnet.c index 1e8b8f4d3e..a2b18370b3 100644 --- a/bacula/src/lib/bnet.c +++ b/bacula/src/lib/bnet.c @@ -418,8 +418,8 @@ const char *resolv_host(int family, const char *host, dlist *addr_list) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = family; - hints.ai_socktype = 0; - hints.ai_protocol = 0; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = 0; res = getaddrinfo(host, NULL, &hints, &ai); -- 2.39.5