Found this code in mg_do_connect() when trying to debug an IPv6 addressing issue I was having.
DBG(("%p %s://%s:%hu", nc, proto == SOCK_DGRAM ? "udp" : "tcp",
inet_ntoa(sa->sin.sin_addr), ntohs(sa->sin.sin_port)));
Modified it to the following to handle IPv6:
if (AF_INET == sa->sa.sa_family )
{
DBG(("%p %s://%s:%hu", nc, proto == SOCK_DGRAM ? "udp" : "tcp",
inet_ntoa(sa->sin.sin_addr), ntohs(sa->sin.sin_port)));
}
else
{
char dst[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6,&(sa->sin6.sin6_addr), dst, INET6_ADDRSTRLEN );
DBG(("%p %s://%s:%hu", nc, proto == SOCK_DGRAM ? "udp" : "tcp",
dst, ntohs(sa->sin6.sin6_port)));
}
Would like to see this change implemented in a future release