From 263a9b30a3661c27f147f5850f779802fcb26be3 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Tue, 6 Nov 2018 09:32:28 +0100 Subject: [PATCH] Do not consider loopback on Windows multicast-capable Tests with network interface set to 127.0.0.1 don't see any multicasts despite multicast loopback being enabled. It therefore seems the multicast flag on the loopback interface on Windows is at least unreliable, and so the safest course of action is to disable multicast by default on that interface. Internal/AssumeMulticastCapable can still be used to override this and enable multicasting anyway. Signed-off-by: Erik Boasson --- src/os/src/windows/os_platform_ifaddrs.c | 31 +++++++++++++----------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/os/src/windows/os_platform_ifaddrs.c b/src/os/src/windows/os_platform_ifaddrs.c index fb24835..5303425 100644 --- a/src/os/src/windows/os_platform_ifaddrs.c +++ b/src/os/src/windows/os_platform_ifaddrs.c @@ -112,24 +112,27 @@ getflags(const PIP_ADAPTER_ADDRESSES iface) if (iface->OperStatus == IfOperStatusUp) { flags |= IFF_UP; } - if (iface->IfType == IF_TYPE_SOFTWARE_LOOPBACK) { - flags |= IFF_LOOPBACK; - } - if (!(iface->Flags & IP_ADAPTER_NO_MULTICAST)) { + if (!(iface->Flags & IP_ADAPTER_NO_MULTICAST) && iface->IfType != IF_TYPE_SOFTWARE_LOOPBACK) { + /* multicast over loopback doesn't seem to work despite the NO_MULTICAST flag being clear + assuming an interface is multicast-capable when in fact it isn't is disastrous, so it + makes more sense to err by assuming it won't work as there is always the + AssumeMulticastCapable setting to overrule it */ flags |= IFF_MULTICAST; } - /* FIXME: Shouldn't IFF_LOOPBACK be included here? */ switch (iface->IfType) { - case IF_TYPE_ETHERNET_CSMACD: - case IF_TYPE_IEEE80211: - case IF_TYPE_IEEE1394: - case IF_TYPE_ISO88025_TOKENRING: - flags |= IFF_BROADCAST; - break; - default: - flags |= IFF_POINTTOPOINT; - break; + case IF_TYPE_SOFTWARE_LOOPBACK: + flags |= IFF_LOOPBACK; + break; + case IF_TYPE_ETHERNET_CSMACD: + case IF_TYPE_IEEE80211: + case IF_TYPE_IEEE1394: + case IF_TYPE_ISO88025_TOKENRING: + flags |= IFF_BROADCAST; + break; + default: + flags |= IFF_POINTTOPOINT; + break; } return flags;