summaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2019-10-03 15:44:24 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2019-10-03 15:44:24 +0100
commit40e3c5bf336560b49acf722d19cc9284fc43dba8 (patch)
tree51734c08f3712e4d861aefc955d0b9953f7d28aa /test/src
parentd6c829b9a350f61c98196768e3260beb3cbecbfe (diff)
downloadexim4-40e3c5bf336560b49acf722d19cc9284fc43dba8.tar.gz
Testsuite: use a %ifname appended to fe80:: ipv6 address when using such
Diffstat (limited to 'test/src')
-rw-r--r--test/src/client.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/src/client.c b/test/src/client.c
index 1cec2cb92..63195347f 100644
--- a/test/src/client.c
+++ b/test/src/client.c
@@ -1179,14 +1179,30 @@ if (interface != NULL)
#if HAVE_IPV6
if (host_af == AF_INET6)
{
+# ifdef HAVE_GETADDRINFO
+ struct addrinfo hints, *res;
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_INET6;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_NUMERICHOST;
+ if ((rc = getaddrinfo(address, NULL, &hints, &res)) != 0 || res == NULL)
+ {
+ printf("unable to parse \"%s\" as an IP address: %s\n", address,
+ rc == 0 ? "NULL result returned" : gai_strerror(rc));
+ exit(86);
+ }
+ memcpy(&s_in6, res->ai_addr, res->ai_addrlen);
+ freeaddrinfo(res);
+# else
memset(&s_in6, 0, sizeof(s_in6));
s_in6.sin6_family = AF_INET6;
- s_in6.sin6_port = htons(port);
if (inet_pton(host_af, address, &s_in6.sin6_addr) != 1)
{
printf("Unable to parse \"%s\"", address);
exit(86);
}
+# endif
+ s_in6.sin6_port = htons(port);
}
else
#endif