diff --git a/weave b/weave index eb62ad64..796effef 100755 --- a/weave +++ b/weave @@ -196,29 +196,26 @@ attach() { return 1 fi - if ! ip link set $LOCAL_IFNAME master $BRIDGE || - ! ip link set $LOCAL_IFNAME up || - ! ip link set $GUEST_IFNAME netns $NETNS ; then + if ! ip link set $GUEST_IFNAME netns $NETNS ; then # failed before we assigned the veth to the container's # namespace - delete it ip link del $LOCAL_IFNAME type veth || true return 1 fi - if ! ip netns exec $NETNS ip link set $GUEST_IFNAME name $CONTAINER_IFNAME || + if ! ip link set $LOCAL_IFNAME master $BRIDGE || + ! ip link set $LOCAL_IFNAME up || + ! ip netns exec $NETNS ip link set $GUEST_IFNAME name $CONTAINER_IFNAME || ! ip netns exec $NETNS ip addr add $1 dev $CONTAINER_IFNAME || ! ip netns exec $NETNS ip link set $CONTAINER_IFNAME up || ! check_command_and_run ethtool ip netns exec $NETNS ethtool -K $CONTAINER_IFNAME 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 + if ! ip netns exec $NETNS ip route show | grep '^224\.0\.0\.0/4' >/dev/null ; then + ip netns exec $NETNS ip route add 224.0.0.0/4 dev $CONTAINER_IFNAME + fi } detach() {