diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2024-10-11 21:03:31 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2024-10-11 21:05:59 +0200 |
commit | c506520d28bfa9adb6c9cd2f8e719c1a35a84bbe (patch) | |
tree | bdd2491cd5822b78af807cf3e8aad42f4d6ca073 | |
parent | 4a45d282d9b76d5858fe8df3dcd02b227e1e3f23 (diff) |
Use only interfaces with non-link-local address for multicast
-rw-r--r-- | src/Erebos/Network/ifaddrs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Erebos/Network/ifaddrs.c b/src/Erebos/Network/ifaddrs.c index 70685bc..637716e 100644 --- a/src/Erebos/Network/ifaddrs.c +++ b/src/Erebos/Network/ifaddrs.c @@ -36,8 +36,10 @@ uint32_t * join_multicast(int fd, size_t * count) return 0; for (struct ifaddrs * ifa = addrs; ifa; ifa = ifa->ifa_next) { - if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET6 && - !(ifa->ifa_flags & IFF_LOOPBACK)) { + if( ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET6 && + ! (ifa->ifa_flags & IFF_LOOPBACK) && + (ifa->ifa_flags & IFF_MULTICAST) && + ! IN6_IS_ADDR_LINKLOCAL( & ((struct sockaddr_in6 *) ifa->ifa_addr)->sin6_addr ) ){ int idx = if_nametoindex(ifa->ifa_name); bool seen = false; |