summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorreyk <>2015-02-08 04:12:34 +0000
committerreyk <>2015-02-08 04:12:34 +0000
commit653ed322d15a6087960710834e7221c7ff8b0af1 (patch)
treefce44d8ce9c2f2c7e3e34ed502c9843f8f1978b0 /src
parentc3aa9e0ac657cbb4f52610c81e0b717fef4a556e (diff)
downloadopenbsd-653ed322d15a6087960710834e7221c7ff8b0af1.tar.gz
openbsd-653ed322d15a6087960710834e7221c7ff8b0af1.tar.bz2
openbsd-653ed322d15a6087960710834e7221c7ff8b0af1.zip
Use the AI_ADDRCONFIG flag in tls_connect(). This tells the resolver
to ignore unsupported address families - eg. don't resolv IPv6 on IPv4-only hosts. OK jsing@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libtls/tls_client.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_client.c b/src/lib/libtls/tls_client.c
index 85733cdd5e..0894ce6333 100644
--- a/src/lib/libtls/tls_client.c
+++ b/src/lib/libtls/tls_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_client.c,v 1.11 2015/02/07 09:50:09 jsing Exp $ */ 1/* $OpenBSD: tls_client.c,v 1.12 2015/02/08 04:12:34 reyk Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -82,6 +82,7 @@ tls_connect(struct tls *ctx, const char *host, const char *port)
82 memset(&hints, 0, sizeof(hints)); 82 memset(&hints, 0, sizeof(hints));
83 hints.ai_family = AF_UNSPEC; 83 hints.ai_family = AF_UNSPEC;
84 hints.ai_socktype = SOCK_STREAM; 84 hints.ai_socktype = SOCK_STREAM;
85 hints.ai_flags = AI_ADDRCONFIG;
85 86
86 if ((ret = getaddrinfo(h, p, &hints, &res0)) != 0) { 87 if ((ret = getaddrinfo(h, p, &hints, &res0)) != 0) {
87 tls_set_error(ctx, "%s", gai_strerror(ret)); 88 tls_set_error(ctx, "%s", gai_strerror(ret));