diff options
author | Roger Dingledine <arma@torproject.org> | 2005-06-08 20:32:22 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-06-08 20:32:22 +0000 |
commit | 44e85544e4dc336c090473ad157e83b5511eb268 (patch) | |
tree | 61c4f806cf4c4171c2d652fed7a0d6a6fc9a6000 /src | |
parent | b0538591c7692abd372f3690e7c2c7e46daf8810 (diff) | |
download | tor-44e85544e4dc336c090473ad157e83b5511eb268.tar.gz tor-44e85544e4dc336c090473ad157e83b5511eb268.zip |
absolutely refuse to let people pick internal IP addresses if
they're using the default dirservers.
we're getting a big pile of a dozen or so servers that have picked
private IP addresses despite the warning (presumably they don't even
know they have logs)
svn:r4354
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/or/config.c b/src/or/config.c index 345d032b3d..0bd96d71ee 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -944,8 +944,9 @@ print_usage(void) } /** - * Based on <b>address</b>, guess our public IP address and put it - * in <b>addr</b>. + * Based on <b>options-\>Address</b>, guess our public IP address and put it + * in *<b>addr</b>. Return 0 if all is well, or -1 if we can't find a + * suitable public IP address. */ int resolve_my_address(or_options_t *options, uint32_t *addr) @@ -994,12 +995,23 @@ resolve_my_address(or_options_t *options, uint32_t *addr) } tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf)); - if (!explicit_ip && is_internal_IP(htonl(in.s_addr))) { - log_fn(LOG_WARN,"Address '%s' resolves to private IP '%s'. " - "Please set the Address config option to be the IP you want to use.", - hostname, tmpbuf); - if (!options->NoPublish) + if (is_internal_IP(htonl(in.s_addr)) && !options->NoPublish) { + /* make sure we're ok with publishing an internal IP */ + if (!options->DirServers) { + /* if they are using the default dirservers, disallow internal IPs always. */ + log_fn(LOG_WARN,"Address '%s' resolves to private IP '%s'. " + "Servers must use public IP addresses.", + hostname, tmpbuf); return -1; + } + if (!explicit_ip) { + /* even if they've set their own dirservers, require an explicit IP if + * they're using an internal address. */ + log_fn(LOG_WARN,"Address '%s' resolves to private IP '%s'. " + "Please set the Address config option to be the IP you want to use.", + hostname, tmpbuf); + return -1; + } } log_fn(LOG_DEBUG, "Resolved Address to %s.", tmpbuf); |