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 <eb@ilities.com>
This commit is contained in:
Erik Boasson 2018-11-06 09:32:28 +01:00
parent 8ba218dca8
commit 263a9b30a3

View file

@ -112,24 +112,27 @@ getflags(const PIP_ADAPTER_ADDRESSES iface)
if (iface->OperStatus == IfOperStatusUp) { if (iface->OperStatus == IfOperStatusUp) {
flags |= IFF_UP; flags |= IFF_UP;
} }
if (iface->IfType == IF_TYPE_SOFTWARE_LOOPBACK) { if (!(iface->Flags & IP_ADAPTER_NO_MULTICAST) && iface->IfType != IF_TYPE_SOFTWARE_LOOPBACK) {
flags |= IFF_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
if (!(iface->Flags & IP_ADAPTER_NO_MULTICAST)) { makes more sense to err by assuming it won't work as there is always the
AssumeMulticastCapable setting to overrule it */
flags |= IFF_MULTICAST; flags |= IFF_MULTICAST;
} }
/* FIXME: Shouldn't IFF_LOOPBACK be included here? */
switch (iface->IfType) { switch (iface->IfType) {
case IF_TYPE_ETHERNET_CSMACD: case IF_TYPE_SOFTWARE_LOOPBACK:
case IF_TYPE_IEEE80211: flags |= IFF_LOOPBACK;
case IF_TYPE_IEEE1394: break;
case IF_TYPE_ISO88025_TOKENRING: case IF_TYPE_ETHERNET_CSMACD:
flags |= IFF_BROADCAST; case IF_TYPE_IEEE80211:
break; case IF_TYPE_IEEE1394:
default: case IF_TYPE_ISO88025_TOKENRING:
flags |= IFF_POINTTOPOINT; flags |= IFF_BROADCAST;
break; break;
default:
flags |= IFF_POINTTOPOINT;
break;
} }
return flags; return flags;