summaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2013-11-20 21:49:17 +0200
committerNick Mathewson <nickm@torproject.org>2014-02-03 14:20:24 -0500
commite82e772f2b1a2b2235d3b3bcde85666e09a182b5 (patch)
tree142878ebb0e236afaf1df8a4b4a5ed8eb2c3afd5 /src/or/directory.c
parent3a4b24c3aba56475822ad94d268b48fd58b74645 (diff)
downloadtor-e82e772f2b1a2b2235d3b3bcde85666e09a182b5.tar.gz
tor-e82e772f2b1a2b2235d3b3bcde85666e09a182b5.zip
Using proper functions to create tor_addr_t.
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 7f26affa20..6effe45db4 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1414,20 +1414,11 @@ 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)) {
- log_debug(LD_DIR, "Ignoring unrecognized IP %s",
- escaped(fwd));
- tor_free(fwd);
- return;
- }
-
tor_addr_t toraddr;
- toraddr.family = AF_INET;
- toraddr.addr.in_addr = in;
+ tor_addr_parse(&toraddr,fwd);
if (tor_addr_is_internal(&toraddr,0)) {
- log_debug(LD_DIR, "Ignoring local IP %s", escaped(fwd));
+ log_debug(LD_DIR, "Ignoring local/internal IP %s", escaped(fwd));
tor_free(fwd);
return;
}