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:
parent
1fe88da7f1
commit
5451f73bb8
1 changed files with 4 additions and 4 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue