diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-04-01 21:49:01 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-04-01 21:49:01 -0400 |
commit | fc9e84062b73535b63bb3cf555604b1acbcc4c61 (patch) | |
tree | 8c47eb7b3f82bb6bf00c19481f058372fa68fd84 /src/or/directory.c | |
parent | dfc32177d9ec3b8a639d6831ca4bc92c4f273dcb (diff) | |
parent | 408bd98e79196933e447cbc68c73ecffebaf5a19 (diff) | |
download | tor-fc9e84062b73535b63bb3cf555604b1acbcc4c61.tar.gz tor-fc9e84062b73535b63bb3cf555604b1acbcc4c61.zip |
Merge remote-tracking branch 'public/bug4645'
Conflicts:
src/or/dirserv.c
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 5fe6897b51..8070a76a55 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1383,13 +1383,14 @@ http_set_address_origin(const char *headers, connection_t *conn) if (!fwd) fwd = http_get_header(headers, "X-Forwarded-For: "); if (fwd) { - struct in_addr in; - if (!tor_inet_aton(fwd, &in) || is_internal_IP(ntohl(in.s_addr), 0)) { - log_debug(LD_DIR, "Ignoring unrecognized or internal IP %s", - escaped(fwd)); + tor_addr_t toraddr; + if (tor_addr_parse(&toraddr,fwd) == -1 || + tor_addr_is_internal(&toraddr,0)) { + log_debug(LD_DIR, "Ignoring local/internal IP %s", escaped(fwd)); tor_free(fwd); return; } + tor_free(conn->address); conn->address = tor_strdup(fwd); tor_free(fwd); |