Gathering of the local IPv6 candidates with a long adresses is not possible
sockaddr_to_string() which is used to get a string representation of the local address ignores ipv6
address scope and provides only INET6_ADDRSTRLEN+1(47 bytes) as an output buffer for
getnameinfo(), however, the
getnameinfo() returns ipv6 address in a form of
address%scope and if the address length is long enough there is a possibility that
getnameinfo() will return
In my case, the address was 'XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX%960119110' which is 49 bytes so the correct local candidate was never used and connectivity check was always failed.
It seems the
address scope has no max length limitation so probably the only solution here could be the usage of the hardcoded reasonable buffer size.