Update executors to reflect new create/destroy phase.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
parent
e6c6f49143
commit
af94d760d0
7 changed files with 37 additions and 18 deletions
|
@ -4,6 +4,7 @@ set -e
|
||||||
|
|
||||||
# Copyright (C) 2012, 2020 Natanael Copa <ncopa@alpinelinux.org>
|
# Copyright (C) 2012, 2020 Natanael Copa <ncopa@alpinelinux.org>
|
||||||
# Copyright (C) 2020 Ariadne Conill <ariadne@dereferenced.org>
|
# Copyright (C) 2020 Ariadne Conill <ariadne@dereferenced.org>
|
||||||
|
# Copyright (C) 2020 Maximilian Wilhelm <max@sdn.clinic>
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, and/or distribute this software for any
|
# Permission to use, copy, modify, and/or distribute this software for any
|
||||||
# purpose with or without fee is hereby granted, provided that the above
|
# purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -134,8 +135,12 @@ esac
|
||||||
[ -z "$PORTS" ] && ! env | grep -q "^IF_BRIDGE" && exit
|
[ -z "$PORTS" ] && ! env | grep -q "^IF_BRIDGE" && exit
|
||||||
|
|
||||||
case "$PHASE" in
|
case "$PHASE" in
|
||||||
|
create)
|
||||||
|
if [ ! -d "/sys/class/net/${IFACE}" ]; then
|
||||||
|
brctl addbr "${IFACE}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
pre-up)
|
pre-up)
|
||||||
brctl addbr $IFACE || exit 1
|
|
||||||
wait_ports
|
wait_ports
|
||||||
set_bridge_opts
|
set_bridge_opts
|
||||||
add_ports
|
add_ports
|
||||||
|
@ -144,6 +149,10 @@ pre-up)
|
||||||
post-down)
|
post-down)
|
||||||
del_ports
|
del_ports
|
||||||
ip link set dev $IFACE down
|
ip link set dev $IFACE down
|
||||||
brctl delbr $IFACE || exit 1
|
;;
|
||||||
|
destroy)
|
||||||
|
if [ -d "/sys/class/net/${IFACE}" ]; then
|
||||||
|
brctl delbr "${IFACE}"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -19,10 +19,10 @@ PARAMS="mode $IF_GRE_MODE local '$IF_GRE_LOCAL' remote '$IF_GRE_REMOTE'"
|
||||||
[ -n "$PARAMS" ] || exit 0
|
[ -n "$PARAMS" ] || exit 0
|
||||||
|
|
||||||
case "$PHASE" in
|
case "$PHASE" in
|
||||||
pre-up)
|
create)
|
||||||
${MOCK} eval ip $FAMILY $COMMAND add $IFACE $PARAMS
|
${MOCK} eval ip $FAMILY $COMMAND add $IFACE $PARAMS
|
||||||
;;
|
;;
|
||||||
post-down)
|
destroy)
|
||||||
${MOCK} ip $FAMILY $COMMAND del $IFACE
|
${MOCK} ip $FAMILY $COMMAND del $IFACE
|
||||||
;;
|
;;
|
||||||
depend)
|
depend)
|
||||||
|
|
|
@ -28,7 +28,7 @@ is_vlan() {
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$PHASE" in
|
case "$PHASE" in
|
||||||
pre-up)
|
create)
|
||||||
if [ "${IF_LINK_TYPE}" = "dummy" ]; then
|
if [ "${IF_LINK_TYPE}" = "dummy" ]; then
|
||||||
if [ -d "/sys/class/net/${IFACE}" ]; then
|
if [ -d "/sys/class/net/${IFACE}" ]; then
|
||||||
iface_type=$(ip -d link show dev "${IFACE}" | head -n3 | tail -n1 | awk '{ print $1 }')
|
iface_type=$(ip -d link show dev "${IFACE}" | head -n3 | tail -n1 | awk '{ print $1 }')
|
||||||
|
@ -76,7 +76,7 @@ up)
|
||||||
down)
|
down)
|
||||||
${MOCK} ip link set down dev "${IFACE}"
|
${MOCK} ip link set down dev "${IFACE}"
|
||||||
;;
|
;;
|
||||||
post-down)
|
destroy)
|
||||||
if [ "${IF_LINK_TYPE}" = "dummy" ] || is_vlan; then
|
if [ "${IF_LINK_TYPE}" = "dummy" ] || is_vlan; then
|
||||||
if [ -z "${MOCK}" -a ! -d "/sys/class/net/${IFACE}" ]; then
|
if [ -z "${MOCK}" -a ! -d "/sys/class/net/${IFACE}" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ -z "$IF_PPP_PROVIDER" ] && exit 0
|
[ -z "$IF_PPP_PROVIDER" ] && exit 0
|
||||||
|
|
||||||
case "$PHASE" in
|
case "$PHASE" in
|
||||||
pre-up) ${MOCK} pon $IF_PPP_PROVIDER ;;
|
create)
|
||||||
post-down) ${MOCK} poff $IF_PPP_PROVIDER ;;
|
${MOCK} pon $IF_PPP_PROVIDER
|
||||||
depend) echo "$IF_PPP_PHYSDEV" ;;
|
;;
|
||||||
|
destroy)
|
||||||
|
${MOCK} poff $IF_PPP_PROVIDER
|
||||||
|
;;
|
||||||
|
depend)
|
||||||
|
echo "$IF_PPP_PHYSDEV"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -37,10 +37,10 @@ PARAMS=$(set | sed -E '
|
||||||
[ "$PARAMS" ] || exit 0
|
[ "$PARAMS" ] || exit 0
|
||||||
|
|
||||||
case "$PHASE" in
|
case "$PHASE" in
|
||||||
pre-up)
|
create)
|
||||||
${MOCK} eval ip $FAMILY $COMMAND add $IFACE $PARAMS
|
${MOCK} eval ip $FAMILY $COMMAND add $IFACE $PARAMS
|
||||||
;;
|
;;
|
||||||
post-down)
|
destroy)
|
||||||
${MOCK} ip $FAMILY $COMMAND del $IFACE
|
${MOCK} ip $FAMILY $COMMAND del $IFACE
|
||||||
;;
|
;;
|
||||||
depend)
|
depend)
|
||||||
|
|
|
@ -14,14 +14,14 @@ handle_member() {
|
||||||
[ -n "$VERBOSE" ] && set -x
|
[ -n "$VERBOSE" ] && set -x
|
||||||
|
|
||||||
case "$PHASE" in
|
case "$PHASE" in
|
||||||
pre-up)
|
create)
|
||||||
[ -n "$IF_VRF_TABLE" ] && handle_init "add"
|
[ -n "$IF_VRF_TABLE" ] && handle_init "add"
|
||||||
[ -n "$IF_VRF_MEMBER" ] && handle_member
|
|
||||||
exit 0
|
|
||||||
;;
|
;;
|
||||||
post-down)
|
pre-up)
|
||||||
|
[ -n "$IF_VRF_MEMBER" ] && handle_member
|
||||||
|
;;
|
||||||
|
destroy)
|
||||||
[ -n "$IF_VRF_TABLE" ] && handle_init "del"
|
[ -n "$IF_VRF_TABLE" ] && handle_init "del"
|
||||||
exit 0
|
|
||||||
;;
|
;;
|
||||||
depend)
|
depend)
|
||||||
echo "$IF_VRF_MEMBER"
|
echo "$IF_VRF_MEMBER"
|
||||||
|
|
|
@ -6,11 +6,13 @@ set -e
|
||||||
[ -z "$IF_WIREGUARD_CONFIG_PATH" ] && IF_WIREGUARD_CONFIG_PATH="/etc/wireguard/$IFACE.conf"
|
[ -z "$IF_WIREGUARD_CONFIG_PATH" ] && IF_WIREGUARD_CONFIG_PATH="/etc/wireguard/$IFACE.conf"
|
||||||
|
|
||||||
case "$PHASE" in
|
case "$PHASE" in
|
||||||
pre-up)
|
create)
|
||||||
${MOCK} ip link add $IFACE type wireguard
|
${MOCK} ip link add $IFACE type wireguard
|
||||||
|
;;
|
||||||
|
pre-up)
|
||||||
${MOCK} wg setconf $IFACE $IF_WIREGUARD_CONFIG_PATH
|
${MOCK} wg setconf $IFACE $IF_WIREGUARD_CONFIG_PATH
|
||||||
;;
|
;;
|
||||||
post-down)
|
destroy)
|
||||||
${MOCK} ip link delete dev $IFACE
|
${MOCK} ip link delete dev $IFACE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue