Route multicast packets across the weave network

Add a route to send multicast packets to ethwe and so across the weave
network.

Without that, multicast packets get sent to the default route, i.e.
to docker's eth0 interface, rather than across the weave network.
So IP multicast doesn't work between containers on different hosts,
even though weaver supports it.
This commit is contained in:
David Wragg committed 2014-09-26 09:30:46 +01:00
1 parent 28e74c166a
commit cb0541078a
1 file changed
+15 -4
+15 -4
View File
@@ -174,10 +174,20 @@ attach() {
return 1
fi
ip netns exec $NETNS ip link set $GUEST_IFNAME name $CONTAINER_IFNAME &&
ip netns exec $NETNS ip addr add $2 dev $CONTAINER_IFNAME &&
ip netns exec $NETNS ip link set $CONTAINER_IFNAME up &&
check_command_and_run ethtool ip netns exec $NETNS ethtool -K $3 tx off >/dev/null
if ! ip netns exec $NETNS ip link set $GUEST_IFNAME name $CONTAINER_IFNAME ||
! ip netns exec $NETNS ip addr add $2 dev $CONTAINER_IFNAME ||
! ip netns exec $NETNS ip link set $CONTAINER_IFNAME up ||
! check_command_and_run ethtool ip netns exec $NETNS ethtool -K $3 tx off >/dev/null ; then
return 1
fi
if ip netns exec $NETNS ip route show | grep '^224\.0\.0\.0/4' >/dev/null ; then
# There's a multicast route already present, leave it alone.
return 0
fi
# Route multicast packets across the weave network.
ip netns exec $NETNS ip route add 224.0.0.0/4 dev $CONTAINER_IFNAME
}
# Detach Container-ID $1 at CIDR address $2 from the weave network
@@ -197,6 +207,7 @@ detach() {
return 0
fi
# Deleting the interface will delete the multicast route we set up
ip link del $LOCAL_IFNAME type veth
}