This commit is contained in:
Bryan Boreham committed 2014-09-17 16:11:30 +01:00
1 parent 7c979d6725
commit fd7b034713
1 file changed
+14 -14
+14 -14
View File
@@ -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