batman executor: Use create/destroy phases

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
Maximilian Wilhelm 2020-09-10 00:40:57 +02:00
parent 017a12760c
commit 35e03475e4

View file

@ -68,13 +68,18 @@ case "${PHASE}" in
fi fi
;; ;;
pre-up) create)
# Main B.A.T.M.A.N. adv. interface # Main B.A.T.M.A.N. adv. interface
if [ "${IF_BATMAN_IFACES}" ]; then if [ "${IF_BATMAN_IFACES}" ]; then
if [ ! -d "/sys/class/net/${IFACE}" ]; then if [ ! -d "/sys/class/net/${IFACE}" ]; then
batctl "${mesh_if_param}" "${IFACE}" interface create || true batctl "${mesh_if_param}" "${IFACE}" interface create || true
fi fi
fi
;;
pre-up)
# Main B.A.T.M.A.N. adv. interface
if [ "${IF_BATMAN_IFACES}" ]; then
batctl_if add batctl_if add
set_batmam_params set_batmam_params
@ -84,7 +89,7 @@ case "${PHASE}" in
fi fi
;; ;;
post-down) destroy)
if [ "${IF_BATMAN_IFACES}" -a -d "/sys/class/net/${IFACE}" ]; then if [ "${IF_BATMAN_IFACES}" -a -d "/sys/class/net/${IFACE}" ]; then
# Newer versions of batctl provide the "interface destroy" API, try to use it # Newer versions of batctl provide the "interface destroy" API, try to use it
if ! batctl "${mesh_if_param}" "${IFACE}" interface destroy 2>/dev/null; then if ! batctl "${mesh_if_param}" "${IFACE}" interface destroy 2>/dev/null; then