mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 12:41:38 +00:00
net_processing: set fDisconnect instead of calling DisconnectNode #36894
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36894
Loading…
Reference in a new issue
No description provided.
Delete branch "2026-11/tor-disconnect-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
MaybeDiscourageAndDisconnectcallsDisconnectNodewhich creates aCSubNetcontaining only theCNode's address. This will disconnect everyCNodewith the same IP address. This is normally not a problem, except for clearnet-over-tor. If a node has an honest clearnet-over-tor inbound connection, the IP of the inbound peer will be the exit node's IP address. If an attacker connects to the node through the same exit node and sends an invalid message, they can cause every inbound peer sharing the exit node's IP to get disconnected. Fix this by only disconnecting the misbehavingCNoderather than everyCNodesharing the IP.The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.🔵 Suggestion ·
peer_discouragementmisses ordinary same-IP sibling coverageThe existing assertions would not detect restoring the old address-wide disconnect with its private-broadcast exclusion, leaving the PR's main behavior change unguarded.
Location:
src/net_processing.cpp:5404(head).Review coverage was incomplete.
Reviewed:
d63068c58ec9· Review report · Previous reportspermalink
There seems to be a prior attempt to do something similar https://github.com/bitcoin/bitcoin/pull/25257.
Concept ACK
ACK
d698b75f8bMisbehaviour used to result in an address ban prior to #19219, but now it just optimises who gets disconnected when our connections are full; so I think disconnecting all peers on the same address used to be consistent behaviour but now is not.
Concept ACK
looks like
disconnect_private_broadastis unused now and could be removed.thanks, fixed in
d63068c58ed698b75f8b->d63068cremoves the
disconnect_private_broadcastargument fromDisconnectNodeDid well addressing earlier concerns.
Approach ACK / tACK
d63068clgtm ACK
d63068c58eTested on my server with two addnode connections from a single IPv4.
If someone wants to test this with a unit test:
utACK
d63068c58ere utACK
d63068c58eBackported to
32.xin #36727.Leaving a note in case it interests anybody:
I haven't tested this, I think this change also prevents an attacker from disconnecting a normal A <-> B connection where A is running linux and the attacker knows they are connected: