[or-cvs] backport the requiring servers to have public IPs
arma at seul.org
arma at seul.org
Thu Jun 9 04:15:19 UTC 2005
Update of /home/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/tor-010x/tor/src/or
Modified Files:
Tag: tor-0_1_0-patches
config.c
Log Message:
backport the requiring servers to have public IPs
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.353.2.2
retrieving revision 1.353.2.3
diff -u -d -r1.353.2.2 -r1.353.2.3
--- config.c 8 Jun 2005 20:36:13 -0000 1.353.2.2
+++ config.c 9 Jun 2005 04:15:17 -0000 1.353.2.3
@@ -945,8 +945,9 @@
}
/**
- * 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)
@@ -995,12 +996,23 @@
}
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'. "
+ "Tor servers that use the default DirServers must have 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);
More information about the tor-commits
mailing list