flightonary/Moscapsule

ipv6 network

AlexIzh opened this issue · 0 comments

this library doesn't work with tls connection through ipv6 network.

it happens because this library has the next code:

/*#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;
    }

But PF_INET allows ipv4 only, can we use PF_UNSPEC for all connections? Because PF_UNSPEC allows both ipv4 and ipv6.

Currently, if you want to use tls connection in ipv6 only network, then getaddrinfo will return error. But if you change ai_family to PF_INET6, PF_UNSPEC or you will not setup it, then connection will work properly.

P.S. you will get reject from apple team if you use this library for connections with tls until this issue solved