diff options
author | teor <teor@torproject.org> | 2020-03-18 18:48:01 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2020-04-09 11:00:04 +1000 |
commit | 2640030b10038ed0e6fc4a4a9628745708be9d83 (patch) | |
tree | db51acd2f614ff82a3e189a5723a29e64bfdc1e6 /src/feature/relay | |
parent | 5cb2bbea7d7e6bebe797a9d59cd8b98d41b201ba (diff) | |
download | tor-2640030b10038ed0e6fc4a4a9628745708be9d83.tar.gz tor-2640030b10038ed0e6fc4a4a9628745708be9d83.zip |
relay: Refactor some long lines from circuit_extend()
Part of 33633.
Diffstat (limited to 'src/feature/relay')
-rw-r--r-- | src/feature/relay/circuitbuild_relay.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/feature/relay/circuitbuild_relay.c b/src/feature/relay/circuitbuild_relay.c index 2781d14005..c57f0e5e8a 100644 --- a/src/feature/relay/circuitbuild_relay.c +++ b/src/feature/relay/circuitbuild_relay.c @@ -133,12 +133,12 @@ circuit_extend_lspec_valid_helper(const extend_cell_t *ec, return -1; } + const channel_t *p_chan = CONST_TO_OR_CIRCUIT(circ)->p_chan; + /* Next, check if we're being asked to connect to the hop that the * extend cell came from. There isn't any reason for that, and it can * assist circular-path attacks. */ - if (tor_memeq(ec->node_id, - CONST_TO_OR_CIRCUIT(circ)->p_chan->identity_digest, - DIGEST_LEN)) { + if (tor_memeq(ec->node_id, p_chan->identity_digest, DIGEST_LEN)) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "Client asked me to extend back to the previous hop."); return -1; @@ -146,8 +146,7 @@ circuit_extend_lspec_valid_helper(const extend_cell_t *ec, /* Check the previous hop Ed25519 ID too */ if (! ed25519_public_key_is_zero(&ec->ed_pubkey) && - ed25519_pubkey_eq(&ec->ed_pubkey, - &CONST_TO_OR_CIRCUIT(circ)->p_chan->ed25519_identity)) { + ed25519_pubkey_eq(&ec->ed_pubkey, &p_chan->ed25519_identity)) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "Client asked me to extend back to the previous hop " "(by Ed25519 ID)."); |