sockets: don't call getaddrinfo with AI_ADDRCONFIG

On linux, using AI_ADDRCONFIG causes getaddrinfo to return no ip
address for localhost when only the loopback connection is
active. Also, we only get ipv4 addresses anyway due to specifying
ai_family = AF_INET, therefore the AI_ADDRCONFIG flag in not necessary
anyway.
This commit is contained in:
Marius Gerbershagen 2020-04-19 10:42:07 +02:00
parent 1fe88da7f1
commit 5451f73bb8

View file

@ -222,10 +222,10 @@ other weird stuff - see getaddrinfo(3) for details."
int err;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET; /* IPv4 */
hints.ai_socktype = 0; /* Any type */
hints.ai_protocol = 0; /* Any protocol */
hints.ai_flags = (AI_ADDRCONFIG | AI_CANONNAME); /* Get cannonname */
hints.ai_family = AF_INET; /* IPv4 */
hints.ai_socktype = 0; /* Any type */
hints.ai_protocol = 0; /* Any protocol */
hints.ai_flags = (AI_CANONNAME); /* Get cannonname */
hints.ai_addr = NULL;
hints.ai_next = NULL;