From 7d81ceb898e374f37c95b01ddd5c4f6f1203502f Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Sun, 30 Aug 2020 22:38:38 +0200 Subject: [PATCH 1/2] link executor: Only create dummy interface when not present. Signed-off-by: Maximilian Wilhelm --- executor-scripts/linux/link | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/executor-scripts/linux/link b/executor-scripts/linux/link index 4d21381..e50b928 100755 --- a/executor-scripts/linux/link +++ b/executor-scripts/linux/link @@ -34,6 +34,13 @@ is_vlan() { case "$PHASE" in pre-up) 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 fi ;; From e854819e8f66de5932192cc9138a07e44b8d5f7f Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Sun, 30 Aug 2020 22:38:58 +0200 Subject: [PATCH 2/2] link executor: Delete dummy interface in post-down. Signed-off-by: Maximilian Wilhelm --- executor-scripts/linux/link | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/executor-scripts/linux/link b/executor-scripts/linux/link index e50b928..08e6c6f 100755 --- a/executor-scripts/linux/link +++ b/executor-scripts/linux/link @@ -71,6 +71,13 @@ up|down) ${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS ;; +post-down) + if [ "${IF_LINK_TYPE}" = "dummy" ]; then + if [ -d "/sys/class/net/${IFACE}" ]; then + ip link del "${IFACE}" + fi + fi + ;; depend) if is_vlan; then echo "$IF_VLAN_RAW_DEVICE"