[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Stop checking if ri->address is an IP



commit 99185397de44a093456890404b3bb6fbebc3e4ef
Author: Roger Dingledine <arma@xxxxxxxxxxxxxx>
Date:   Sat Feb 9 20:17:48 2013 -0500

    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.)
---
 src/or/dirserv.c |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 6209842..8756647 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;
   }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits