netaddress: don't treat multicast addresses as routable #36718

pull Snan0M wants to merge 1 commits into bitcoin:master from Snan0M:netaddress-multicast-not-routable changing 4 files +22 −5
  1. Snan0M commented at 2:35 PM on October 31, 2026: none

    IsRoutable() doesn't exclude multicast (224.0.0.0/4, ff00::/8), so multicast addresses received over gossip can end up in addrman.

    This adds IsMulticast() and excludes it in IsRoutable().

    Test updates:

    • addrman_getaddr: expected counts change, since its generated addresses include the multicast range.
    • The last asmap test vector was a multicast address. I replaced it with a non-multicast one at the top of the range (same AS).
  2. netaddress: don't treat multicast addresses as routable
    IsRoutable() excluded private, documentation, link-local and other
    special ranges, but not multicast (224.0.0.0/4, ff00::/8). Gossiped
    multicast addresses were therefore accepted into addrman and could be
    selected for outbound connections.
    
    Add CNetAddr::IsMulticast() and exclude it in IsRoutable().
    
    addrman_getaddr generates addresses with every first octet, so the
    expected counts drop by the multicast ones. The last asmap test vector
    was an ff00::/8 address, which now maps to AS0 as unroutable; use a
    non-multicast address at the top of the range instead (same AS).
    d54f486882
  3. DrahtBot commented at 2:35 PM on October 31, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK atsushi196323

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. ValeraFinebits commented at 10:25 AM on November 1, 2026: none

    Is this PR intended only to reject new multicast entries, or to prevent multicast connection attempts altogether? Existing multicast entries in addrman remain selectable after an upgrade.

  5. atsushi196323 commented at 6:13 AM on November 2, 2026: none

    tested ACK d54f486882d4d6919b34b81ede6a681c7079f9e3

    Manual test on regtest:

    $ bitcoin-cli -regtest addpeeraddress 224.0.0.1 8333
    {
      "error": "failed-adding-to-new",
      "success": false
    }
    $ bitcoin-cli -regtest addpeeraddress ff0e::1 8333
    {
      "error": "failed-adding-to-new",
      "success": false
    }
    $ bitcoin-cli -regtest addpeeraddress 8.8.8.8 8333
    {
      "success": true
    }
    
  6. 0xB10C changes_requested
  7. 0xB10C commented at 6:47 PM on November 2, 2026: contributor

    I think it's OK to do this, but it does not actually solve a problem. Here's a more complete branch I worked on a few months ago covering more addresses ranges: https://github.com/bitcoin/bitcoin/compare/master...0xB10C:bitcoin:2026-09-reserved-networks

    I did not PR this for two reasons:

    1. The needed diff is quite large as the 250.x.x.x addresses used in src/test/addrman_tests.cpp would all need to change
    2. It actually does not matter in practice. If someone wants to send unreachable addresses, they still can. They are going to pick something from 6.0.0.0/8 or similar.
  8. sedited commented at 12:49 PM on November 6, 2026: contributor

    I think it's OK to do this, but it does not actually solve a problem.

    Is there a good reason we maintain this not routable list at all then?

  9. DrahtBot added the label CI failed on Nov 6, 2026
  10. maflcko commented at 4:46 PM on November 10, 2026: member

    Are you still working on this, or can it be closed?

  11. Snan0M commented at 7:05 PM on November 10, 2026: none

    Thanks for the reviews. Since this doesn't solve a practical problem, I'll close it.

  12. Snan0M closed this on Nov 10, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-21 11:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me