[tor-commits] [tor/master] relay: Refactor address and port checks

nickm at torproject.org nickm at torproject.org
Wed Apr 29 23:23:42 UTC 2020


commit 07c008c6723644553827140f2f8a863a1e2d071a
Author: teor <teor at torproject.org>
Date:   Wed Apr 15 08:58:32 2020 +1000

    relay: Refactor address and port checks
    
    tor_addr_port_is_valid_ap(ap, 0) checks if the address or port are
    zero, exactly like the previous code.
    
    Preparation for 33817.
---
 src/feature/relay/circuitbuild_relay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/feature/relay/circuitbuild_relay.c b/src/feature/relay/circuitbuild_relay.c
index 2fa92eeac..96b46bb65 100644
--- a/src/feature/relay/circuitbuild_relay.c
+++ b/src/feature/relay/circuitbuild_relay.c
@@ -139,7 +139,7 @@ circuit_extend_lspec_valid_helper(const struct extend_cell_t *ec,
     return -1;
   }
 
-  if (!ec->orport_ipv4.port || tor_addr_is_null(&ec->orport_ipv4.addr)) {
+  if (!tor_addr_port_is_valid_ap(&ec->orport_ipv4, 0)) {
     log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
            "Client asked me to extend to zero destination port or addr.");
     return -1;





More information about the tor-commits mailing list