link executor: Better error message on conflicting link types.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
Maximilian Wilhelm 2020-09-04 23:33:27 +02:00
parent a6b95d495c
commit 2e6b3ca1ff

View file

@ -32,8 +32,9 @@ pre-up)
if [ "${IF_LINK_TYPE}" = "dummy" ]; then if [ "${IF_LINK_TYPE}" = "dummy" ]; then
if [ -d "/sys/class/net/${IFACE}" ]; then if [ -d "/sys/class/net/${IFACE}" ]; then
iface_type=$(ip -d link show dev "${IFACE}" | head -n3 | tail -n1 | awk '{ print $1 }') iface_type=$(ip -d link show dev "${IFACE}" | head -n3 | tail -n1 | awk '{ print $1 }')
if [ "${iface_type}" = 'dummy' ]; then if [ "${iface_type}" != 'dummy' ]; then
exit 0 echo "Interface ${IFACE} exists but is of type ${iface_type} instead of dummy"
exit 1
fi fi
fi fi