From d5f6294f409ee47f7202f518a7853f18eb319348 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 3 Jul 2017 17:09:48 +0200 Subject: Adding interface max length check in container start command. Signed-off-by: Daniel Baumann --- lib/container/start | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/container/start') diff --git a/lib/container/start b/lib/container/start index 102bc71..6d2c7a9 100755 --- a/lib/container/start +++ b/lib/container/start @@ -308,6 +308,11 @@ then NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} --network-veth-extra=${VETH}" INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')" + if [ "$(echo ${INTERFACE} | wc -c)" -gt 15 ] + then + echo "'${INTERFACE}': name exceeds maximum of 15 characters, network might be not working." + fi + cat > "/etc/network/interfaces.d/${INTERFACE}" << EOF allow-hotplug ${INTERFACE} iface ${INTERFACE} inet manual @@ -331,6 +336,11 @@ EOF INTERFACE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $1 }')" BRIDGE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $2 }')" + if [ "$(echo ${INTERFACE} | wc -c)" -gt 15 ] + then + echo "'${INTERFACE}': name exceeds maximum of 15 characters, network might be not working." + fi + if [ -n "${BRIDGE}" ] && [ -n "${INTERFACE}" ] then -- cgit v1.2.3