|
@@ -12,6 +12,7 @@ ppp_generic_init_config() {
|
|
|
proto_config_add_string username
|
|
proto_config_add_string username
|
|
|
proto_config_add_string password
|
|
proto_config_add_string password
|
|
|
proto_config_add_string keepalive
|
|
proto_config_add_string keepalive
|
|
|
|
|
+ proto_config_add_boolean keepalive_adaptive
|
|
|
proto_config_add_int demand
|
|
proto_config_add_int demand
|
|
|
proto_config_add_string pppd_options
|
|
proto_config_add_string pppd_options
|
|
|
proto_config_add_string 'connect:file'
|
|
proto_config_add_string 'connect:file'
|
|
@@ -25,7 +26,7 @@ ppp_generic_init_config() {
|
|
|
ppp_generic_setup() {
|
|
ppp_generic_setup() {
|
|
|
local config="$1"; shift
|
|
local config="$1"; shift
|
|
|
|
|
|
|
|
- json_get_vars ipv6 demand keepalive username password pppd_options pppname
|
|
|
|
|
|
|
+ json_get_vars ipv6 demand keepalive keepalive_adaptive username password pppd_options pppname
|
|
|
if [ "$ipv6" = 0 ]; then
|
|
if [ "$ipv6" = 0 ]; then
|
|
|
ipv6=""
|
|
ipv6=""
|
|
|
elif [ -z "$ipv6" -o "$ipv6" = auto ]; then
|
|
elif [ -z "$ipv6" -o "$ipv6" = auto ]; then
|
|
@@ -38,19 +39,22 @@ ppp_generic_setup() {
|
|
|
else
|
|
else
|
|
|
demand="persist"
|
|
demand="persist"
|
|
|
fi
|
|
fi
|
|
|
- [ "${keepalive:-0}" -lt 1 ] && keepalive=""
|
|
|
|
|
[ -n "$mtu" ] || json_get_var mtu mtu
|
|
[ -n "$mtu" ] || json_get_var mtu mtu
|
|
|
[ -n "$pppname" ] || pppname="${proto:-ppp}-$config"
|
|
[ -n "$pppname" ] || pppname="${proto:-ppp}-$config"
|
|
|
|
|
|
|
|
- local interval="${keepalive##*[, ]}"
|
|
|
|
|
- [ "$interval" != "$keepalive" ] || interval=5
|
|
|
|
|
|
|
+ local lcp_failure="${keepalive%%[, ]*}"
|
|
|
|
|
+ local lcp_interval="${keepalive##*[, ]}"
|
|
|
|
|
+ local lcp_adaptive="lcp-echo-adaptive"
|
|
|
|
|
+ [ "${lcp_failure:-0}" -lt 1 ] && lcp_failure=""
|
|
|
|
|
+ [ "$lcp_interval" != "$keepalive" ] || lcp_interval=5
|
|
|
|
|
+ [ "${keepalive_adaptive:-1}" -lt 1 ] && lcp_adaptive=""
|
|
|
[ -n "$connect" ] || json_get_var connect connect
|
|
[ -n "$connect" ] || json_get_var connect connect
|
|
|
[ -n "$disconnect" ] || json_get_var disconnect disconnect
|
|
[ -n "$disconnect" ] || json_get_var disconnect disconnect
|
|
|
|
|
|
|
|
proto_run_command "$config" /usr/sbin/pppd \
|
|
proto_run_command "$config" /usr/sbin/pppd \
|
|
|
nodetach ipparam "$config" \
|
|
nodetach ipparam "$config" \
|
|
|
ifname "$pppname" \
|
|
ifname "$pppname" \
|
|
|
- ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
|
|
|
|
|
|
|
+ ${lcp_failure:+lcp-echo-interval $lcp_interval lcp-echo-failure $lcp_failure $lcp_adaptive} \
|
|
|
${ipv6:++ipv6} \
|
|
${ipv6:++ipv6} \
|
|
|
nodefaultroute \
|
|
nodefaultroute \
|
|
|
usepeerdns \
|
|
usepeerdns \
|