Repository navigation
net: Check an assumed onion inbound's source address under -v2onlyclearnet - #454
Open
LionThunderFingers wants to merge 2 commits into
Conversation
…arnet Without a -bind=...=onion listener, an inbound connection on the first -bind is treated as onion, and for a bind that is not bind-any every inbound connection there is. -v2onlyclearnet then exempted all of them from its inbound v1 check, so a clearnet peer could stay connected over v1 (knots#427). Keep that assumption everywhere else, but for the v1 check also judge an assumed onion inbound by its source address. Tor reaches the node from this host or a private address, which stays exempt; any other public source address is a clearnet peer. Inbound connections on an explicit -bind=...=onion listener are unchanged. Fixes bitcoinknots#427
|
Please rebase onto the oldest commit this applies to rather than the |
LionThunderFingers
force-pushed
the
fix/v2onlyclearnet-assumed-onion-inbound
branch
from
October 13, 2026 07:18
3ef3079 to
fc74e6f
Compare
Author
|
Saw you'd already rebased it in |
kwsantiago
reviewed
Oct 17, 2026
kwsantiago
left a comment
There was a problem hiding this comment.
Tested ACK fc74e6f merged into 29.x-knots. With -bind=1.2.3.4 -v2onlyclearnet=1, a v1 inbound from public 5.6.7.8 is now dropped instead of kept as onion; private, bind-address, loopback and v2 peers still connect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #427.
What it changes:
net.cpp: if a peer only counts as onion because there's no=onionbind, the peer is now flagged withm_inbound_onion_assumed. Peers connecting from the bind address itself don't get the flag.net_processing.cpp: the inbound v1 check also drops the peer if it ism_inbound_onion_assumedandRequiresV2Peer(pfrom.addr.GetNetClass())is true, i.e. its real address is public IPv4/IPv6. Local and private addresses where Tor connects from still pass.Tested with public addresses in two network namespaces, regtest,
-bind=1.2.3.4:18444 -v2onlyclearnet=1:Two cases added to
v2onlyclearnet_inbound_v1(the public-address one fails without the change). Standard test suite passes.