From a6b95d495ca0c3b1b5890e61bdec113ae9216046 Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Fri, 4 Sep 2020 23:32:51 +0200 Subject: [PATCH] link executor: Only gather and set IFACE_OPTIONS on up. Signed-off-by: Maximilian Wilhelm --- executor-scripts/linux/link | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/executor-scripts/linux/link b/executor-scripts/linux/link index 9751987..9a716e1 100755 --- a/executor-scripts/linux/link +++ b/executor-scripts/linux/link @@ -4,10 +4,6 @@ set -e [ -n "$VERBOSE" ] && set -x -IF_LINK_OPTIONS="$IF_LINK_OPTIONS" -[ -n "$IF_MTU" ] && IF_LINK_OPTIONS="$IF_LINK_OPTIONS mtu $IF_MTU" -[ -n "$IF_HWADDRESS" ] && IF_LINK_OPTIONS="$IF_LINK_OPTIONS address $IF_HWADDRESS" - is_vlan() { case "$IFACE" in *#*) return 1 ;; @@ -64,14 +60,21 @@ pre-up) ${MOCK} ip link add link "${IF_VLAN_RAW_DEVICE}" name "${IFACE}" type vlan id "${IF_VLAN_ID}" fi ;; -up|down) - ${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS +up) + IF_LINK_OPTIONS="$IF_LINK_OPTIONS" + [ -n "$IF_MTU" ] && IF_LINK_OPTIONS="$IF_LINK_OPTIONS mtu $IF_MTU" + [ -n "$IF_HWADDRESS" ] && IF_LINK_OPTIONS="$IF_LINK_OPTIONS address $IF_HWADDRESS" + + ${MOCK} ip link set up dev "${IFACE}" ${IF_LINK_OPTIONS} # Set alias is configured if [ "${IF_ALIAS}" ]; then ${MOCK} ip link set alias "${IF_ALIAS}" dev "${IFACE}" fi ;; +down) + ${MOCK} ip link set down dev "${IFACE}" + ;; post-down) if [ "${IF_LINK_TYPE}" = "dummy" -o is_vlan ]; then if [ -d "/sys/class/net/${IFACE}" ]; then