socket: getaddrinfo(): set AI_PASSIVE if we want to bind

This will tell getaddrinfo() that we want a INADDR_ANY style socket
This commit is contained in:
Harald Welte 2011-05-31 17:47:54 +02:00
parent 271c43b0ae
commit f9e0746add
1 changed files with 3 additions and 0 deletions

View File

@ -31,6 +31,9 @@ int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto,
hints.ai_flags = 0;
hints.ai_protocol = proto;
if (connect0_bind1)
hints.ai_flags |= AI_PASSIVE;
rc = getaddrinfo(host, portbuf, &hints, &result);
if (rc != 0) {
perror("getaddrinfo returned NULL");