diff --git a/executor-scripts/linux/link b/executor-scripts/linux/link index aec3a7c..d8e87a9 100755 --- a/executor-scripts/linux/link +++ b/executor-scripts/linux/link @@ -29,12 +29,14 @@ is_vlan() { } case "$PHASE" in -up|down) +pre-up|post-down) + UP_DOWN="${PHASE##*-}" + if is_vlan; then ADD_DEL="add" - [ "$PHASE" = "down" ] && ADD_DEL="delete" + [ "$UP_DOWN" = "down" ] && ADD_DEL="delete" - if [ -e /sys/class/net/$IFACE ]; then + if [ "$UP_DOWN" = "up" -a -e /sys/class/net/$IFACE ]; then exit 0 fi @@ -51,8 +53,9 @@ up|down) fi ${MOCK} ip link $ADD_DEL link "$IF_VLAN_RAW_DEVICE" name "$IFACE" type vlan id "$IF_VLAN_ID" + [ "$UP_DOWN" = "up" ] && ${MOCK} ip link set $UP_DOWN dev $IFACE $IF_LINK_OPTIONS else - ${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS + ${MOCK} ip link set $UP_DOWN dev $IFACE $IF_LINK_OPTIONS fi ;; depend)