[BB#81] allow listening on multiple families when no Listen is provided in config

This is achieved by not stopping at the first result of getaddrinfo
that we managed to listen on: Without "Listen" in the config, we
call getraddrinfo with NULL address. With AI_PASSIVE, this gives results
for both IPv4 and IPv6 wildcard addresses (if both are supported).

This lets tinyproxy listen on both IPv4 and IPv6 wildcard if the system
supports them.

Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Michael Adam 2013-11-08 11:50:57 +01:00
parent e40b91974a
commit d0732f9ade

View File

@ -281,9 +281,16 @@ int listen_sock (const char *addr, uint16_t port, vector_t listen_fds)
vector_append (listen_fds, &listenfd, sizeof(int)); vector_append (listen_fds, &listenfd, sizeof(int));
/* success, don't continue */ /* success */
ret = 0; ret = 0;
break;
if (addr != NULL) {
/*
* Unless wildcard is requested, only listen
* on the first result that works.
*/
break;
}
} }
if (ret != 0) { if (ret != 0) {