mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:26:38 +00:00
bugfix: send shortened IPv6 addresses to SOCKS5 proxies in full #36675
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!36675
Loading…
Reference in a new issue
No description provided.
Delete branch "2026-10-socks5-ipv6-expand"
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?
Found while auditing #36628
Already known upstream issue with C-tor: https://gitlab.torproject.org/tpo/core/tor/-/issues/32314
With
-proxypointed at Tor, outbound connections to IPv6 peers whoseaddress contains an inner
::always fail with "general failure".Core sends every SOCKS5 destination as a DOMAINNAME, with IPv6 in its
compressed form. Tor copies the name into its relay BEGIN cell as
<name>:<port>, and the exit'stor_addr_port_splitfirst tries to parsethe whole string as an IPv6 address.
2001:db8::1:8333is a valid one,because the
::absorbs the port as an eighth group. The exit then sees noport and closes the stream. Addresses written with all eight groups, or
ending in
::, are unaffected: appending:portto them does not give avalid address.
About 20% of the IPv6 addresses in a gossip-filled addrman, and 29% of
current IPv6 DNS seed answers, have an inner
::. The failure is closed;there is no fallback to a direct connection.
Note that this also effects private broadcast by default.
This PR sends such addresses with all eight groups written out
(
2001:db8:0:0:0:0:0:1).<name>:<port>then has nine groups, so the exitsplits at the last colon. Other forms:
2001:db8::1(today)[2001:db8::1]Tested against tor 0.4.9.13: on mainnet, master could not reach four
seed-provided peers with inner-
::addresses (30 "general failure"); withthis change all four connected and completed the version handshake.
feature_proxy.pyand a newnetbase_testscase check the bytes sent.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.Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Workaround seems fine to do. But it's surprising the Tor daemon does not follow its own spec and format the IPv6 with brackets.
@darosior https://gitlab.torproject.org/tpo/core/tor/-/issues/32314 already known and closed. "Just use Arti"
Concept ACK
🔵 Suggestion · SOCKS5 address expansion depends on normalization and the DNS mock
The expansion inherits address normalization and consumes the connman fuzz harness's mocked DNS results instead of deterministically formatting the supplied IPv6 literal.
Location:
src/netbase.cpp:406(head).🔵 Suggestion · Log the SOCKS5 destination name
netbase.cpp:421/424/441/506/540 still log
strDest, but lines 482–483 senddest_name. For compressed IPv6, Core's debug logs therefore differ from the SOCKS5 DOMAINNAME on the wire, which makes them harder to match against proxy logs. Diagnostic impact only.Location:
src/netbase.cpp:421(head).Review coverage was incomplete.
Reviewed:
e8469d76b46b· Full review report · Previous reportspermalink
ACK
721e2f5051Nice find. Tested with a small patch to only select IPV6 peers via private broadcast. Many SOCKS connection failures to addresses with
::on master, successfully connected to an address with::with this patch.This will also cause issues with anyone using the
-proxy=with tor feature.I see from a cursory analysis in bitnod.es that this would fail to connect to ~50% of known reachable ipv6 peers.
nit
We could dedupe this with the above test.
taken
applied but kept the have_ipv6 guard
reACK
e8469d76b4ACK
e8469d76b4