mirror of
https://github.com/btcsuite/btcd.git
synced 2026-08-13 12:32:51 +02:00
In this commit, we fix `IsRoutable` to correctly reject IPv6 addresses whose first 16-bit group is zero (i.e., in the `0000::/16` reserved block per RFC 4291). Differential fuzzing between btcd and Bitcoin Core revealed that addresses like `0:9881:8181:8181:fe00🅰️9e:9801` were slipping through as routable when they shouldn't be. We add a new `zero6Net` (`0000::/16`) definition alongside the existing `zero4Net`, and introduce an `IsZero` helper that checks both. The /16 prefix width is intentional: the broader /8 reservation would incorrectly catch allocated sub-ranges like `0064:ff9b::/96` (RFC 6052, NAT64). We also carve out an exception for RFC 6145 translated IPv4 addresses (`::ffff:0:0:0/96`), which live within `0000::/16` but are valid for routing. Test coverage includes the original bug report address, various zero-prefix IPv6 addresses, the RFC 6145 exclusion, and corresponding `GroupKey` entries to confirm they land in the "unroutable" bucket. Fixes #2431 |
||
|---|---|---|
| .. | ||
| addrmanager.go | ||
| addrmanager_internal_test.go | ||
| addrmanager_test.go | ||
| cov_report.sh | ||
| doc.go | ||
| internal_test.go | ||
| knownaddress.go | ||
| knownaddress_test.go | ||
| log.go | ||
| network.go | ||
| network_test.go | ||
| test_coverage.txt | ||