local p; local v; local s="$1"; shift
for p in $*; do
config_get_bool v "$s" "$p"
- [ "$v" == 1 ] && append_param "$s" "$p" && echo >> "/var/etc/openvpn-$s.conf"
+ [ "$v" = 1 ] && append_param "$s" "$p" && echo >> "/var/etc/openvpn-$s.conf"
done
}
[ $enable -gt 0 ] || [ $enabled -gt 0 ]
}
+openvpn_add_instance() {
+ local name="$1"
+ local dir="$2"
+ local conf="$3"
+
+ procd_open_instance
+ procd_set_param command "$PROG" \
+ --syslog "openvpn($name)" \
+ --cd "$dir" \
+ --config "$conf"
+ procd_set_param file "$dir/$conf"
+ procd_set_param respawn
+ procd_close_instance
+}
+
start_instance() {
local s="$1"
[ ! -d "/var/run" ] && mkdir -p "/var/run"
if [ ! -z "$config" ]; then
- procd_open_instance
- procd_set_param command "$PROG" \
- --config "$config" \
- --cd "$(dirname $config)" \
- --syslog "openvpn($s)" \
- --writepid "/var/run/openvpn-$s.pid"
- procd_set_param file "/etc/config/openvpn"
- procd_close_instance
+ openvpn_add_instance "$s" "$(dirname "$config")" "$(basename "$config")"
return
fi
route_metric route_up rport script_security secret server server_bridge setenv shaper sndbuf \
socks_proxy status status_version syslog tcp_queue_limit tls_auth \
tls_cipher tls_remote tls_timeout tls_verify tmp_dir topology tran_window \
- tun_mtu tun_mtu_extra txqueuelen user verb down push up
-
+ tun_mtu tun_mtu_extra txqueuelen user verb down push up \
+ ifconfig_ipv6 route_ipv6 server_ipv6 ifconfig_ipv6_pool ifconfig_ipv6_push iroute_ipv6
- procd_open_instance
- procd_set_param command "$PROG" \
- --config "/var/etc/openvpn-$s.conf" \
- --cd "/var/etc" \
- --syslog "openvpn($s)" \
- --writepid "/var/run/openvpn-$s.pid"
- procd_set_param file "/etc/config/openvpn"
- procd_close_instance
+ openvpn_add_instance "$s" "/var/etc" "openvpn-$s.conf"
}
start_service() {