#!/bin/bash
# Example tun hook.
#
# Tun hooks are run with the "start" argument after a tun device is created and
# with the "stop" argument before it is destroyed.
#
# Environment variables:
#   ID: bond ID
#   TUN_NAME: tunnel interface name (i.e. tun1)
#   LOCAL_IP: local IP of the interface
#   PEER_IP: IP of the interface peer

start () {
    remove 2> /dev/null
    true
}
stop () {
    remove
}
remove () {
    true
}

# Avoid changing anything below here.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
        ;;
esac
