mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
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:
parent
d86a45f991
commit
99185397de
@ -533,19 +533,12 @@ dirserv_free_fingerprint_list(void)
|
|||||||
static int
|
static int
|
||||||
dirserv_router_has_valid_address(routerinfo_t *ri)
|
dirserv_router_has_valid_address(routerinfo_t *ri)
|
||||||
{
|
{
|
||||||
struct in_addr iaddr;
|
|
||||||
if (get_options()->DirAllowPrivateAddresses)
|
if (get_options()->DirAllowPrivateAddresses)
|
||||||
return 0; /* whatever it is, we're fine with it */
|
return 0; /* whatever it is, we're fine with it */
|
||||||
if (!tor_inet_aton(ri->address, &iaddr)) {
|
if (is_internal_IP(ri->addr, 0)) {
|
||||||
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)) {
|
|
||||||
log_info(LD_DIRSERV,
|
log_info(LD_DIRSERV,
|
||||||
"Router %s published internal IP address '%s'. Refusing.",
|
"Router %s published internal IP address. Refusing.",
|
||||||
router_describe(ri), ri->address);
|
router_describe(ri));
|
||||||
return -1; /* it's a private IP, we should reject it */
|
return -1; /* it's a private IP, we should reject it */
|
||||||
}
|
}
|
||||||
return 0;
|
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) {
|
if (dirserv_router_has_valid_address(ri) < 0) {
|
||||||
log_fn(severity, LD_DIRSERV,
|
log_fn(severity, LD_DIRSERV,
|
||||||
"Router %s has invalid address '%s'. "
|
"Router %s has invalid address. Not adding (%s).",
|
||||||
"Not adding (%s).",
|
|
||||||
router_describe(ri),
|
router_describe(ri),
|
||||||
ri->address,
|
|
||||||
esc_router_info(ri));
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user