summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSridhar Samudrala <sri@us.ibm.com>2008-08-01 17:01:28 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-08-09 20:58:19 -0700
commit740871b0f56f371f2c4566999da98f0372f21a1d (patch)
tree080f481f300676a7f89e6e01e02bd2bfbf97f5a1
parent544abd789eebfafa0bb3f250f6a824e808e32122 (diff)
downloadtftp-hpa-740871b0f56f371f2c4566999da98f0372f21a1d.tar.gz
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 <sri@us.ibm.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--common/tftpsubs.c4
1 files changed, 3 insertions, 1 deletions
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;