diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-02-03 14:31:31 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-02-03 14:31:31 -0500 |
commit | dafed84dabbb3afbada5e55ac1d030412418fae5 (patch) | |
tree | df6c051634f497ca35060f0ff119fd6b63098c3e | |
parent | e82e772f2b1a2b2235d3b3bcde85666e09a182b5 (diff) | |
download | tor-dafed84dabbb3afbada5e55ac1d030412418fae5.tar.gz tor-dafed84dabbb3afbada5e55ac1d030412418fae5.zip |
Fixes for bug4645 fix.
-rw-r--r-- | src/or/config.c | 10 | ||||
-rw-r--r-- | src/or/dirserv.c | 11 |
2 files changed, 9 insertions, 12 deletions
diff --git a/src/or/config.c b/src/or/config.c index a90468dfa7..517ca70ef7 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -2108,22 +2108,22 @@ resolve_my_address(int warn_severity, const or_options_t *options, if (!explicit_hostname && tor_addr_is_internal(&myaddr, 0)) { - uint32_t interface_ip; + tor_addr_t interface_ip; log_fn(notice_severity, LD_CONFIG, "Guessed local hostname '%s' " "resolves to a private IP address (%s). Trying something " "else.", hostname, fmt_addr32(addr)); - if (get_interface_address(warn_severity, &interface_ip)) { + if (get_interface_address6(warn_severity, AF_INET, &interface_ip)<0) { log_fn(warn_severity, LD_CONFIG, "Could not get local interface IP address. Too bad."); - } else if (tor_addr_is_internal(&myaddr, 0)) { + } else if (tor_addr_is_internal(&interface_ip, 0)) { log_fn(notice_severity, LD_CONFIG, "Interface IP address '%s' is a private address too. " - "Ignoring.", fmt_addr32(interface_ip)); + "Ignoring.", fmt_addr(&interface_ip)); } else { from_interface = 1; - addr = interface_ip; + addr = tor_addr_to_ipv4h(&interface_ip); log_fn(notice_severity, LD_CONFIG, "Learned IP address '%s' for local interface." " Using that.", fmt_addr32(addr)); diff --git a/src/or/dirserv.c b/src/or/dirserv.c index b6bb607fa9..e3e6519dd8 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -524,20 +524,17 @@ dirserv_free_fingerprint_list(void) static int dirserv_router_has_valid_address(routerinfo_t *ri) { - struct in_addr iaddr; + tor_addr_t addr; if (get_options()->DirAllowPrivateAddresses) return 0; /* whatever it is, we're fine with it */ - if (!tor_inet_aton(ri->address, &iaddr)) { - log_info(LD_DIRSERV,"Router %s published non-IP address '%s'. Refusing.", + if (tor_addr_parse(&addr, ri->address) != AF_INET) { + log_info(LD_DIRSERV,"Router %s published non-IPv4 address '%s'. Refusing.", router_describe(ri), ri->address); return -1; } - tor_addr_t toraddr; - tor_addr_from_in(&toraddr,&iaddr); - - if (tor_addr_is_internal(&toraddr, 0)) { + if (tor_addr_is_internal(&addr, 0)) { log_info(LD_DIRSERV, "Router %s published internal IP address '%s'. Refusing.", router_describe(ri), ri->address); |