This is based loosely in concept on the Debian patch, and is also needed for
OpenWrt unless we want to add a bunch of OpenWrt-specific stuff in here too.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
OS="`uname -s`"
+HOOKS_DIR=/etc/vpnc
DEFAULT_ROUTE_FILE=/var/run/vpnc/defaultroute
RESOLV_CONF_BACKUP=/var/run/vpnc/resolv.conf-backup
SCRIPTNAME=`basename $0`
RESTORERESOLVCONF=restore_resolvconf_generic
fi
+
+# =========== script hooks =================================================
+
+run_hooks() {
+ HOOK="$1"
+
+ if [ -d ${HOOKS_DIR}/${HOOK}.d ]; then
+ for script in ${HOOKS_DIR}/${HOOK}.d/* ; do
+ [ -f $script ] && . $script
+ done
+ fi
+}
+
# =========== tunnel interface handling ====================================
do_ifconfig() {
case "$reason" in
pre-init)
+ run_hooks pre-init
do_pre_init
;;
connect)
+ run_hooks connect
do_connect
+ run_hooks post-connect
;;
disconnect)
+ run_hooks disconnect
do_disconnect
+ run_hooks post-disconnect
+ ;;
+ reconnect)
+ run_hooks reconnect
;;
*)
echo "unknown reason '$reason'. Maybe vpnc-script is out of date" 1>&2