diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-11-01 12:37:03 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-11-01 12:37:03 +0000 |
commit | bc356cef8245214321c6b944bb8ebe2e72542387 (patch) | |
tree | 960cfe410346142baae68153ed3adad89641286c /package/network/services/ppp/files/ppp.sh | |
parent | e30531cd6791de54cc8231bfd0c9b7dae707202b (diff) | |
download | mtk-20170518-bc356cef8245214321c6b944bb8ebe2e72542387.zip mtk-20170518-bc356cef8245214321c6b944bb8ebe2e72542387.tar.gz mtk-20170518-bc356cef8245214321c6b944bb8ebe2e72542387.tar.bz2 |
ppp: support adaptive LCP echos
Port Debians adaptive LCP echo patch to pppd, make it configurable with UCI
and enable it by default.
When adaptive LCP echo is enabled, LCP echo requests are only sent if the
link is idle, this avoids the common situation where a congested PPP link
(e.g. during torrenting) is falsely detected as disconnected because the
LCP replies are not received in time.
Also bump the copyright year in the Makefile, remove a redundant maintainer
entry and fix the shell processing of the keepalive option when the two-
value syntax is used.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
SVN-Revision: 43143
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 0456fda..28cdb9c 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 \ |