From fe13e6ccbd7bff993e8c2575ce1f578579805b34 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 1 Nov 2014 12:37:03 +0000 Subject: 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 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43143 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/network/services/ppp/files/ppp.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'package/network/services/ppp/files/ppp.sh') 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 \ -- cgit v1.2.3