From 36fe61d8e78c84251b91b715dbcbc03ada80caef Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Wed, 26 Aug 2020 22:41:32 +0200 Subject: [PATCH 1/3] link executor: Unify code paths. Signed-off-by: Maximilian Wilhelm --- executor-scripts/linux/link | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/executor-scripts/linux/link b/executor-scripts/linux/link index 5cae17d..7fbad75 100755 --- a/executor-scripts/linux/link +++ b/executor-scripts/linux/link @@ -55,11 +55,9 @@ up|down) ${MOCK} ip link $ADD_DEL link "$IF_VLAN_RAW_DEVICE" name "$IFACE" type vlan id "$IF_VLAN_ID" [ "$PHASE" = "down" ] && exit 0 + fi ${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS - else - ${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS - fi ;; depend) if is_vlan; then From e51ce613e6eb716361d317fa54bc18b00951341a Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Wed, 26 Aug 2020 23:02:48 +0200 Subject: [PATCH 2/3] link executor: Add support for dummy interfaces. closes #49 Signed-off-by: Maximilian Wilhelm --- doc/interfaces.scd | 5 +++++ executor-scripts/linux/link | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/doc/interfaces.scd b/doc/interfaces.scd index 262a7a3..9701647 100644 --- a/doc/interfaces.scd +++ b/doc/interfaces.scd @@ -66,6 +66,10 @@ the system will only respond to certain keywords by default: is for backwards compatibility and should not be used in new deployments. +*link-type* _link-type_ + Denotes the link-type of the interface. When set to _dummy_, + the interface is created as a virtual dummy interfaces. + *requires* _interfaces_... Designates one or more required interfaces that must be brought up before configuration of the parent interface. @@ -165,3 +169,4 @@ iface eth0 # AUTHORS Ariadne Conill +Maximilian Wilhelm diff --git a/executor-scripts/linux/link b/executor-scripts/linux/link index 7fbad75..2de4f4c 100755 --- a/executor-scripts/linux/link +++ b/executor-scripts/linux/link @@ -32,6 +32,11 @@ is_vlan() { } case "$PHASE" in +pre-up) + if [ "${IF_LINK_TYPE}" = "dummy" ]; then + ip link add "${IFACE}" type dummy + fi + ;; up|down) if is_vlan; then ADD_DEL="add" From 8f3e1f06f174f65478df37c3c2ae0c7f395c9742 Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Thu, 27 Aug 2020 00:47:51 +0200 Subject: [PATCH 3/3] link executor: Fix indentation. Signed-off-by: Maximilian Wilhelm --- executor-scripts/linux/link | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor-scripts/linux/link b/executor-scripts/linux/link index 2de4f4c..4d21381 100755 --- a/executor-scripts/linux/link +++ b/executor-scripts/linux/link @@ -62,7 +62,7 @@ up|down) [ "$PHASE" = "down" ] && exit 0 fi - ${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS + ${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS ;; depend) if is_vlan; then