====================
Tunnel device hooks
====================

Tunnel hooks are run with the "start" argument after a tun device is
created and with the "stop" argument before it is destroyed. They can be
used for custom routing rules that depend on the presence of a certain
tunnel device.

After a tunnel hook has been added, you can execute it by killing the
tunnel process. The hook will be run when the tunnel process is
restarted. You can also restart the bond from the management server or
from the host command line to execute the hook.

Hook locations:

-  ``/etc/bonding/tun.d/all``: hooks to be run for all tunnels
-  ``/etc/bonding/tun.d/<bond ID>``: hooks for individual tunnels
-  ``/etc/bonding/tun.d/default``: hooks for tunnels with no individual
   hook folder

An example route hook is available at
``/usr/share/doc/bonding/examples/tun-hook``.

Environment variables
----------------------

Tunnel hooks are run with the following 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
