Skip to content

Commit

Permalink
Check the interface names earlier when scanning on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
fgo-ableton committed Feb 1, 2024
1 parent ece9bff commit 9c968b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/ableton/platforms/posix/ScanIpIfAddrs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ struct ScanIpIfAddrs
{
const auto addr =
reinterpret_cast<const struct sockaddr_in*>(interface->ifa_addr);
if (addr && interface->ifa_flags & IFF_RUNNING && addr->sin_family == AF_INET6)
if (IpInterfaceNames.find(interface->ifa_name) != IpInterfaceNames.end() && addr
&& interface->ifa_flags & IFF_RUNNING && addr->sin_family == AF_INET6)
{
const auto addr6 = reinterpret_cast<const struct sockaddr_in6*>(addr);
const auto bytes = reinterpret_cast<const char*>(&addr6->sin6_addr);
const auto scopeId = addr6->sin6_scope_id;
const auto address =
discovery::makeAddress<discovery::IpAddressV6>(bytes, scopeId);
if (IpInterfaceNames.find(interface->ifa_name) != IpInterfaceNames.end()
&& !address.is_loopback() && address.is_link_local())
if (!address.is_loopback() && address.is_link_local())
{
addrs.emplace_back(address);
}
Expand Down

0 comments on commit 9c968b6

Please sign in to comment.