Use IPv4 and v6 only when suitable interfaces are configured
Only on systems supporting AI_ADDRCONFIG.
This commit is contained in:
parent
00b5cb2b8a
commit
7cce3124bf
2 changed files with 12 additions and 1 deletions
|
@ -46,6 +46,11 @@
|
|||
#include <unistd.h>
|
||||
#include "prototypes.h"
|
||||
|
||||
/* Portability cruft, should become unnecessary eventually */
|
||||
#ifndef AI_ADDRCONFIG
|
||||
#define AI_ADDRCONFIG 0
|
||||
#endif
|
||||
|
||||
static void cant_listen(char *, char *, const char *);
|
||||
|
||||
int
|
||||
|
@ -62,7 +67,7 @@ tcp_listen(char *host, char *serv, size_t *addrlenp)
|
|||
struct addrinfo hints, *res, *ressave;
|
||||
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue