aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2013-02-09 20:17:48 -0500
committerRoger Dingledine <arma@torproject.org>2013-02-09 20:49:11 -0500
commit99185397de44a093456890404b3bb6fbebc3e4ef (patch)
treed5d19472ceda7de007d25e3e56b0751304c7cdd2 /src/or/dirserv.c
parentd86a45f991693cf2367a6ccb94fc29c22f5f7b45 (diff)
downloadtor-99185397de44a093456890404b3bb6fbebc3e4ef.tar
tor-99185397de44a093456890404b3bb6fbebc3e4ef.tar.gz
Stop checking if ri->address is an IP
since router_parse_entry_from_string() already checks whether !tor_inet_aton(router->address, &in) (And no need to print address, since router_describe does that.)
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 620984288..87566470d 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -533,19 +533,12 @@ dirserv_free_fingerprint_list(void)
static int
dirserv_router_has_valid_address(routerinfo_t *ri)
{
- struct in_addr iaddr;
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.",
- router_describe(ri),
- ri->address);
- return -1;
- }
- if (is_internal_IP(ntohl(iaddr.s_addr), 0)) {
+ if (is_internal_IP(ri->addr, 0)) {
log_info(LD_DIRSERV,
- "Router %s published internal IP address '%s'. Refusing.",
- router_describe(ri), ri->address);
+ "Router %s published internal IP address. Refusing.",
+ router_describe(ri));
return -1; /* it's a private IP, we should reject it */
}
return 0;
@@ -597,12 +590,10 @@ authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
}
if (dirserv_router_has_valid_address(ri) < 0) {
log_fn(severity, LD_DIRSERV,
- "Router %s has invalid address '%s'. "
- "Not adding (%s).",
+ "Router %s has invalid address. Not adding (%s).",
router_describe(ri),
- ri->address,
esc_router_info(ri));
- *msg = "Rejected: Address is not an IP, or IP is a private address.";
+ *msg = "Rejected: Address is a private address.";
return -1;
}