diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-01-02 10:37:03 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-01-02 10:37:03 -0500 |
commit | ee4182612f7f06ae09531bf75e9b84ea30871278 (patch) | |
tree | 96e57d880bf515509c860f663f07713597d4af10 /src | |
parent | 11e8a445c3051f017600b27999f0d666b7d63b04 (diff) | |
download | tor-ee4182612f7f06ae09531bf75e9b84ea30871278.tar tor-ee4182612f7f06ae09531bf75e9b84ea30871278.tar.gz |
Avoid spurious local-port warnings
Our old warn_nonlocal_client_ports() would give a bogus warning for
every nonlocal port every time it parsed any ports at all. So if it
parsed a nonlocal socksport, it would complain that it had a nonlocal
socksport...and then turn around and complain about the nonlocal
socksport again, calling it a nonlocal transport or nonlocal dnsport,
if it had any of those.
Fixes bug 7836; bugfix on 0.2.3.3-alpha.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/or/config.c b/src/or/config.c index 2947d1cf1..60866218c 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -4633,12 +4633,15 @@ port_cfg_free(port_cfg_t *port) tor_free(port); } -/** Warn for every port in <b>ports</b> that is on a publicly routable - * address. */ +/** Warn for every port in <b>ports</b> of type <b>listener_type</b> that is + * on a publicly routable address. */ static void -warn_nonlocal_client_ports(const smartlist_t *ports, const char *portname) +warn_nonlocal_client_ports(const smartlist_t *ports, const char *portname, + int listener_type) { SMARTLIST_FOREACH_BEGIN(ports, const port_cfg_t *, port) { + if (port->type != listener_type) + continue; if (port->is_unix_addr) { /* Unix sockets aren't accessible over a network. */ } else if (!tor_addr_is_internal(&port->addr, 1)) { @@ -4835,7 +4838,7 @@ parse_port_config(smartlist_t *out, if (is_control) warn_nonlocal_controller_ports(out, forbid_nonlocal); else - warn_nonlocal_client_ports(out, portname); + warn_nonlocal_client_ports(out, portname, listener_type); } return 0; } /* end if (listenaddrs) */ @@ -5101,7 +5104,7 @@ parse_port_config(smartlist_t *out, if (is_control) warn_nonlocal_controller_ports(out, forbid_nonlocal); else - warn_nonlocal_client_ports(out, portname); + warn_nonlocal_client_ports(out, portname, listener_type); } if (got_zero_port && got_nonzero_port) { |