diff --git a/weaver/weave b/weaver/weave index 4e76309a..d0598469 100755 --- a/weaver/weave +++ b/weaver/weave @@ -121,24 +121,24 @@ configure_container_networking() { LOCAL_IFNAME="v${CONTAINER_IFNAME}pl${NSPID}" GUEST_IFNAME="v${CONTAINER_IFNAME}pg${NSPID}" if ip link add name $LOCAL_IFNAME mtu $MTU type veth peer name $GUEST_IFNAME mtu $MTU ; then - if ip link set $LOCAL_IFNAME master $BRIDGE && \ - ip link set $LOCAL_IFNAME up && \ - ip link set $GUEST_IFNAME netns $NSPID - then - ip netns exec $NSPID ip link set $GUEST_IFNAME name $CONTAINER_IFNAME && \ - ip netns exec $NSPID ip addr add $2 dev $CONTAINER_IFNAME && \ - ip netns exec $NSPID ip link set $CONTAINER_IFNAME up && \ - $(check_command_and_run ethtool ip netns exec $NSPID ethtool -K $3 tx off >/dev/null) && \ - EXITCODE=0 - else - # failed before we assigned the veth to the container's namespace - delete it - ip link delete $LOCAL_IFNAME type veth || true - fi + if ip link set $LOCAL_IFNAME master $BRIDGE && \ + ip link set $LOCAL_IFNAME up && \ + ip link set $GUEST_IFNAME netns $NSPID + then + ip netns exec $NSPID ip link set $GUEST_IFNAME name $CONTAINER_IFNAME && \ + ip netns exec $NSPID ip addr add $2 dev $CONTAINER_IFNAME && \ + ip netns exec $NSPID ip link set $CONTAINER_IFNAME up && \ + $(check_command_and_run ethtool ip netns exec $NSPID ethtool -K $3 tx off >/dev/null) && \ + EXITCODE=0 + else + # failed before we assigned the veth to the container's namespace - delete it + ip link delete $LOCAL_IFNAME type veth || true + fi fi [ -f /var/run/netns/$NSPID ] && rm -f /var/run/netns/$NSPID - exit $EXITCODE + exit $EXITCODE } case "$COMMAND" in