#!/bin/sh DAEMON=vpnc . /etc/init.d/modlibrc config() { modlib_config } start() { # find remote network for tunneling NETWORK=$(grep network /var/mod/etc/vpnc.conf | sed -e 's/#network //g') MASK=$(grep mask /var/mod/etc/vpnc.conf | sed -e 's/#mask //g') if [ $NETWORK != "0.0.0.0" ]; then sed -e 's/#set -x/INTERNAL_IP4_DNS=\nCISCO_SPLIT_INC=1\nCISCO_SPLIT_INC_0_ADDR='$NETWORK'\nCISCO_SPLIT_INC_0_MASK='$MASK'\nCISCO_SPLIT_INC_0_MASKLEN=22\nCISCO_SPLIT_INC_0_PROTOCOL=0\nCISCO_SPLIT_INC_0_SPORT=0\nCISCO_SPLIT_INC_0_DPORT=0\n\n#set -x\n/g' /mod/etc/default.vpnc/vpnc-script > /var/tmp/vpnc-script chmod +x /var/tmp/vpnc-script VPNC_SCRIPT="/var/tmp/vpnc-script" else VPNC_SCRIPT="/mod/etc/default.vpnc/vpnc-script" fi modlib_startdaemon $DAEMON --script $VPNC_SCRIPT $DAEMON_CONFIG } stop () { killall -15 $DAEMON > /dev/null 2>&1 } case $1 in ""|load) modreg cgi 'vpnc' 'Vpnc' modreg daemon $DAEMON modlib_start $VPNC_ENABLED ;; unload) modunreg daemon $DAEMON modunreg cgi 'vpnc' modlib_stop ;; start) modlib_start ;; stop) modlib_stop ;; restart) modlib_restart ;; status) modlib_status ;; *) echo "Usage: $0 [start|stop|restart|status]" 1>&2 exit 1 ;; esac exit 0