#!/bin/sh # PROVIDE: softether_server # REQUIRE: NETWORKING SERVERS # BEFORE: DAEMON # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable softether_server: # softether_server_enable (bool): Set to "NO" by default. # Set it to "YES" to enable # . /etc/rc.subr name=softether_server rcvar=softether_server_enable load_rc_config ${name} : ${softether_server_enable:=NO} # modified by shrdlu - added config options # - tap_ifaces - list of TAP interfaces names for ifconfig command # - tap_idle - delay before run ifconfig command for setup IP addreses on TAP interfaces # - if_ - TAP interface IP address for ifconfig command, # may be in CIDR format (a.b.c.d/x) or IP-address with netmask # (a.b.c.d netmask e.f.g.h) # # Example: # # softether_server_enable="YES" # softether_server_tap_ifaces="tap_vpn0 tap_vpn1" # softether_server_if_tap_vpn0="192.168.1.1/24" # softether_server_if_tap_vpn1="192.168.10.1/24" # softether_server_tap_ifaces=${softether_server_tap_ifaces:-"none"} softether_server_tap_idle=${softether_server_tap_Idle:-"5"} command="/usr/local/libexec/softether/vpnserver/vpnserver" datadir="/var/db/softether" start_precmd="${name}_precmd" start_cmd="${command} start" stop_cmd="${command} stop" # modified by shrdlu - added command, running after softether-server started # start_postcmd="${name}_postcmd" softether_server_precmd() { if [ ! -d "${datadir}" ]; then mkdir -p ${datadir} fi } # modified by shrdlu - postcmd - running ifconfig after softether-server started # with new configuration parameters # softether_server_postcmd() { if [ "${softether_server_tap_ifaceS}" != none ]; then echo "Waiting ${softether_server_tap_idle} sec to create TAP interface" sleep ${softether_server_tap_idle} for if_name in $softether_server_tap_ifaces; do ifvar="softether_server_if_${if_name}" eval "ifcfg=\$$ifvar" ifconfig $if_name inet $ifcfg done; fi } run_rc_command "$1"