[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Fixes for bug4645 fix.
commit dafed84dabbb3afbada5e55ac1d030412418fae5
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Mon Feb 3 14:31:31 2014 -0500
Fixes for bug4645 fix.
---
src/or/config.c | 10 +++++-----
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 a90468d..517ca70 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 b6bb607..e3e6519 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);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits