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.)
This commit is contained in:
Roger Dingledine 2013-02-09 20:17:48 -05:00
parent d86a45f991
commit 99185397de

View File

@ -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;
}