diff options
Diffstat (limited to 'package/network/services/ppp/files/ppp.sh')
-rwxr-xr-x | package/network/services/ppp/files/ppp.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/package/network/services/ppp/files/ppp.sh b/package/network/services/ppp/files/ppp.sh index 0456fda5d9..28cdb9cbd6 100755 --- a/package/network/services/ppp/files/ppp.sh +++ b/package/network/services/ppp/files/ppp.sh @@ -12,6 +12,7 @@ ppp_generic_init_config() { proto_config_add_string username proto_config_add_string password proto_config_add_string keepalive + proto_config_add_boolean keepalive_adaptive proto_config_add_int demand proto_config_add_string pppd_options proto_config_add_string 'connect:file' @@ -25,7 +26,7 @@ ppp_generic_init_config() { ppp_generic_setup() { 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 ipv6="" elif [ -z "$ipv6" -o "$ipv6" = auto ]; then @@ -38,19 +39,22 @@ ppp_generic_setup() { else demand="persist" fi - [ "${keepalive:-0}" -lt 1 ] && keepalive="" [ -n "$mtu" ] || json_get_var mtu mtu [ -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 "$disconnect" ] || json_get_var disconnect disconnect proto_run_command "$config" /usr/sbin/pppd \ nodetach ipparam "$config" \ 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} \ nodefaultroute \ usepeerdns \ |