link executor: Only create dummy interface when not present.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
Maximilian Wilhelm 2020-08-30 22:38:38 +02:00
parent 375b5d46cb
commit 7d81ceb898

View file

@ -34,6 +34,13 @@ is_vlan() {
case "$PHASE" in case "$PHASE" in
pre-up) pre-up)
if [ "${IF_LINK_TYPE}" = "dummy" ]; then if [ "${IF_LINK_TYPE}" = "dummy" ]; then
if [ -d "/sys/class/net/${IFACE}" ]; then
iface_type=$(ip -d link show dev "${IFACE}" | head -n3 | tail -n1 | awk '{ print $1 }')
if [ "${iface_type}" = 'dummy' ]; then
exit 0
fi
fi
ip link add "${IFACE}" type dummy ip link add "${IFACE}" type dummy
fi fi
;; ;;