From 6f7a0bff4b51c0409a8506afb142a0c9c822cc91 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 30 Nov 2016 11:31:30 +0000 Subject: [PATCH] [323] Allow outgoing IPv6 connections to use TLS. Bug: https://github.com/eclipse/mosquitto/issues/323 --- ChangeLog.txt | 5 +++++ lib/net_mosq.c | 10 ++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 57eb6af1..7cb1a5fb 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,11 @@ Broker: - Fix crash when "lazy" type bridge attempts to reconnect. Closes #259. - maximum_connections now applies to websockets listeners. Closes #271. +- Allow bridges to use TLS with IPv6. + +Client library: +- Clients can now use TLS with IPv6. + 1.4.10 - 20160816 ================= diff --git a/lib/net_mosq.c b/lib/net_mosq.c index f18d41b2..26f98554 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -281,14 +281,7 @@ int _mosquitto_try_connect(struct mosquitto *mosq, const char *host, uint16_t po *sock = INVALID_SOCKET; memset(&hints, 0, sizeof(struct addrinfo)); -#ifdef WITH_TLS - if(mosq->tls_cafile || mosq->tls_capath || mosq->tls_psk){ - hints.ai_family = PF_INET; - }else -#endif - { - hints.ai_family = PF_UNSPEC; - } + hints.ai_family = PF_UNSPEC; hints.ai_flags = AI_ADDRCONFIG; hints.ai_socktype = SOCK_STREAM; @@ -542,6 +535,7 @@ int _mosquitto_socket_connect(struct mosquitto *mosq, const char *host, uint16_t COMPAT_CLOSE(sock); return MOSQ_ERR_TLS; } + SSL_set_ex_data(mosq->ssl, tls_ex_index_mosq, mosq); bio = BIO_new_socket(sock, BIO_NOCLOSE); if(!bio){