diff --git a/lib/net_mosq.c b/lib/net_mosq.c index 73c3207d..d331ef07 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -589,6 +589,14 @@ int net__socket_connect_step3(struct mosquitto *mosq, const char *host, uint16_t } SSL_set_bio(mosq->ssl, bio, bio); + /* + * required for the SNI resolving + */ + if(SSL_set_tlsext_host_name(mosq->ssl, host) != 1) { + COMPAT_CLOSE(mosq->sock); + return MOSQ_ERR_TLS; + } + if(net__socket_connect_tls(mosq)){ return MOSQ_ERR_TLS; }