From 740871b0f56f371f2c4566999da98f0372f21a1d Mon Sep 17 00:00:00 2001 From: Sridhar Samudrala Date: Fri, 1 Aug 2008 17:01:28 -0700 Subject: [PATCH] Fix numeric IPv6 address handling The following patch sets additional hints to restrict the addresses returned by getaddrinfo() to specify preferred socket type, protocol and a flag to return only v4/v6 addresses based on the configured addresses. Signed-off-by: Sridhar Samudrala Signed-off-by: H. Peter Anvin --- common/tftpsubs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/tftpsubs.c b/common/tftpsubs.c index a796bec..8c999f6 100644 --- a/common/tftpsubs.c +++ b/common/tftpsubs.c @@ -308,7 +308,9 @@ set_sock_addr(char *host,union sock_addr *s, char **name) memset(&hints, 0, sizeof(hints)); hints.ai_family = s->sa.sa_family; - hints.ai_flags = AI_CANONNAME; + hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_protocol = IPPROTO_UDP; err = getaddrinfo(strip_address(host), NULL, &hints, &addrResult); if (err) return err;