Skip to content

Commit

Permalink
mdns: Fix ipv6 interfaces filtering
Browse files Browse the repository at this point in the history
We are interested in link local interfaces so that we can use the
scope_id field, and use it to specify which interface index we want to
send multicast requests through
  • Loading branch information
chouquette committed Aug 26, 2020
1 parent 3c833c5 commit 72210fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ mdns_is_interface_valuable(const struct ifaddrs* ifa, int family)
(ifa->ifa_flags & IFF_LOOPBACK) == 0 &&
(ifa->ifa_flags & IFF_UP) != 0 &&
(ifa->ifa_flags & IFF_RUNNING) != 0 &&
((ifa->ifa_addr->sa_family == AF_INET6 &&
saddr.sin6_scope_id == 0) ||
/* We only want a link local address, especially since we then
* can get the associated interface index */
((family == AF_INET6 && saddr.sin6_scope_id != 0) ||
ifa->ifa_addr->sa_family == AF_INET);
}

Expand Down

0 comments on commit 72210fb

Please sign in to comment.