net: Use GetAdaptersAddresses to get local addresses on Windows #31014

pull laanwj wants to merge 2 commits into bitcoin:master from laanwj:2024-10-windows-address-discovery changing 5 files +65 −34
  1. laanwj commented at 6:57 pm on October 1, 2024: member

    Instead of a gethostname hack, use the official way of calling GetAdaptersAddresses to get local network addresses on Windows.

    Do the same checks as the UNIX path: interface is up, interface is not loopback.

    Suggested by Ava Chow.

    Addiional changes:

    • Add optional length checking to CService::SetSockAddr calls: In almost all cases (the only exception is getifaddrs), we know the size of the data passed into SetSockAddr, so we can check this to be what is expected, before reading the memory.
    • Cleanup: move out FromSockAddr in netif.cpp from MacOS and use it everywhere appropriate. This avoids code duplication.
  2. laanwj added the label Windows on Oct 1, 2024
  3. laanwj added the label P2P on Oct 1, 2024
  4. DrahtBot commented at 6:57 pm on October 1, 2024: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK 1440000bytes

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #31022 (test: Add mockable steady clock, tests for PCP and NATPMP implementations by laanwj)
    • #30988 (Split CConnman by vasild)

    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.

  5. laanwj force-pushed on Oct 1, 2024
  6. laanwj force-pushed on Oct 1, 2024
  7. laanwj force-pushed on Oct 1, 2024
  8. laanwj force-pushed on Oct 1, 2024
  9. laanwj force-pushed on Oct 1, 2024
  10. laanwj force-pushed on Oct 2, 2024
  11. DrahtBot added the label Needs rebase on Oct 2, 2024
  12. net: Add optional length checking to CService::SetSockAddr
    In almost all cases (the only exception is `getifaddrs`), we know the
    size of the data passed into SetSockAddr, so we can check this to be
    what is expected.
    1151ae1009
  13. net: Use GetAdaptersAddresses to get local addresses on Windows
    Instead of a `gethostname` hack, use the official way of calling
    `GetAdaptersAddresses` to get local network addresses on Windows.
    
    As additional cleanup, move out `FromSockAddr` from MacOS and use it
    everywhere appropriate.
    
    Suggested by Ava Chow.
    c2b2ec4fba
  14. laanwj force-pushed on Oct 3, 2024
  15. DrahtBot removed the label Needs rebase on Oct 3, 2024
  16. 1440000bytes commented at 8:29 pm on October 3, 2024: none

    Instead of a gethostname hack, use the official way of calling GetAdaptersAddresses to get local network addresses on Windows.

    Concept ACK


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: 2024-10-08 16:12 UTC

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