]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
relay: Refactor address and port checks
authorteor <teor@torproject.org>
Tue, 14 Apr 2020 22:58:32 +0000 (08:58 +1000)
committerteor <teor@torproject.org>
Wed, 29 Apr 2020 12:43:09 +0000 (22:43 +1000)
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

index 2fa92eeac194d6c3a5c01ec9abc5cf2d6b4f6fc8..96b46bb65afb47a146b5c001bf272ed28c2e823e 100644 (file)
@@ -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;