laanwj
commented at 9:39 am on April 28, 2024:
member
Checking the interface name is kind of brittle. In the age of network namespaces and containers, there is no reason a loopback interface can’t be called differently.
Check for the IFF_LOOPBACK flag to detect loopback interface instead.
Also remove a misleading comment in Discover’s doc comment.
net: Replace ifname check with IFF_LOOPBACK in Discover
Checking the interface name is kind of brittle. In the age of network
namespaces and containers, there is no reason a loopback interface can't
be called differently.
Check for the `IFF_LOOPBACK` flag to detect loopback interface instead.
7766dd280d
laanwj added the label
P2P
on Apr 28, 2024
DrahtBot
commented at 9:39 am on April 28, 2024:
contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
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:
#30043 (net: Replace libnatpmp with built-in PCP implementation by laanwj)
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.
net: Fix misleading comment for Discover
All network addresses are being iterated over and added, not just the first one per interface.
a68fed111b
sipa
commented at 12:39 pm on April 28, 2024:
member
utACKa68fed111be393ddbbcd7451f78bc63601253ee0
willcl-ark approved
willcl-ark
commented at 8:31 am on April 30, 2024:
member
utACKa68fed111be393ddbbcd7451f78bc63601253ee0
Agree this will be less brittle than name-checking. I don’t think it’s possible that IFF_LOOPBACK would ever be unset for a loopback device unless someone had modified their kernel.
theuni approved
theuni
commented at 5:24 pm on May 6, 2024:
member
laanwj
commented at 8:14 am on May 8, 2024:
member
Thanks for checking! it’s kind of a belt-and-suspenders check: we only look for routable addresses in Discover, so unless someone assigned a routable address to the loopback interface-which would be really strange-it doesn’t actually influence the result.
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-12-21 15:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me