mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-03 14:37:11 +01:00
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.
This commit is contained in:
parent
3aaf7328eb
commit
7766dd280d
1 changed files with 1 additions and 2 deletions
|
@ -3077,8 +3077,7 @@ void Discover()
|
|||
{
|
||||
if (ifa->ifa_addr == nullptr) continue;
|
||||
if ((ifa->ifa_flags & IFF_UP) == 0) continue;
|
||||
if (strcmp(ifa->ifa_name, "lo") == 0) continue;
|
||||
if (strcmp(ifa->ifa_name, "lo0") == 0) continue;
|
||||
if ((ifa->ifa_flags & IFF_LOOPBACK) != 0) continue;
|
||||
if (ifa->ifa_addr->sa_family == AF_INET)
|
||||
{
|
||||
struct sockaddr_in* s4 = (struct sockaddr_in*)(ifa->ifa_addr);
|
||||
|
|
Loading…
Add table
Reference in a new issue