The control-spec says hops are 1-based, and we often log "first hop":
If HOP=HopNum is specified, Tor will choose the HopNumth hop in the circuit as the exit node, rather than the last node in the circuit. Hops are 1-indexed; generally, it is not permitted to attach to hop 1.
But the following functions log 0-based hops:
choose_good_middle_server
onion_extend_cpath (which also logs a 1-based hop message as well)
We need to add 1 to the 0-based hop counts in these functions.
Credit to Xiaofan Li for discovering this issue.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
Trac: Description: The control-spec says hops are 1-based, and we often log "first hop":
If HOP=HopNum is specified, Tor will choose the HopNumth hop in the circuit as the exit node, rather than the last node in the circuit. Hops are 1-indexed; generally, it is not permitted to attach to hop 1.
But the following functions log 0-based hops:
choose_good_middle_server
onion_extend_cpath (which also logs a 1-based hop message as well)
We need to add 1 to the 0-based hop counts in these functions.
to
The control-spec says hops are 1-based, and we often log "first hop":
If HOP=HopNum is specified, Tor will choose the HopNumth hop in the circuit as the exit node, rather than the last node in the circuit. Hops are 1-indexed; generally, it is not permitted to attach to hop 1.
But the following functions log 0-based hops:
choose_good_middle_server
onion_extend_cpath (which also logs a 1-based hop message as well)
We need to add 1 to the 0-based hop counts in these functions.
Ok, I found a moment to look at the patch. It has the problem that I expected it to have: there's no way to tell now whether somebody giving us one of these lines is using the old code or the new code -- so now seeing a log line talking about "hop 1" is ambiguous about whether it's the first relay or the second relay.
In the distant future, this issue won't matter anymore, because nobody will be using the old code. But the distant future is years away.
I think an easy fix might be to change something else in each of these log lines too, so it's possible, given just the log line, to disambiguate?