diff options
author | Michael Adam <obnox@samba.org> | 2013-11-08 11:50:57 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-11-09 13:34:33 +0100 |
commit | d0732f9adeb523422e755bfc11d03e9cbccc99f6 (patch) | |
tree | 0916ecaa296e461fcb31581488d218fd3c3fdf48 | |
parent | e40b91974aae069aef5c2d2d1e12b4618289646d (diff) | |
download | tinyproxy-d0732f9adeb523422e755bfc11d03e9cbccc99f6.tar.gz tinyproxy-d0732f9adeb523422e755bfc11d03e9cbccc99f6.zip |
[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>
-rw-r--r-- | src/sock.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -281,9 +281,16 @@ int listen_sock (const char *addr, uint16_t port, vector_t listen_fds) vector_append (listen_fds, &listenfd, sizeof(int)); - /* success, don't continue */ + /* success */ ret = 0; - break; + + if (addr != NULL) { + /* + * Unless wildcard is requested, only listen + * on the first result that works. + */ + break; + } } if (ret != 0) { |