X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Flcp.c;h=902b64a565c21d11940c39cb0fe5e10cf911848f;hb=0678d3bf69116af58b00fbc64bd4185acb4d5c37;hp=625d2f75a20debb9bebe19768d49e7ba5cfcceef;hpb=b1fcf16fa66159f380ee4abd7c9a76b59809dc7b;p=ppp.git diff --git a/pppd/lcp.c b/pppd/lcp.c index 625d2f7..902b64a 100644 --- a/pppd/lcp.c +++ b/pppd/lcp.c @@ -72,6 +72,7 @@ static void lcp_delayed_up __P((void *)); */ int lcp_echo_interval = 0; /* Interval between LCP echo-requests */ int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */ +bool lcp_echo_adaptive = 0; /* request echo only if the link was idle */ bool lax_recv = 0; /* accept control chars in asyncmap */ bool noendpoint = 0; /* don't send/accept endpoint discriminator */ @@ -150,6 +151,8 @@ static option_t lcp_option_list[] = { OPT_PRIO }, { "lcp-echo-interval", o_int, &lcp_echo_interval, "Set time in seconds between LCP echo requests", OPT_PRIO }, + { "lcp-echo-adaptive", o_bool, &lcp_echo_adaptive, + "Suppress LCP echo requests if traffic was received", 1 }, { "lcp-restart", o_int, &lcp_fsm[0].timeouttime, "Set time in seconds between LCP retransmissions", OPT_PRIO }, { "lcp-max-terminate", o_int, &lcp_fsm[0].maxtermtransmits, @@ -2330,6 +2333,22 @@ LcpSendEchoRequest (f) } } + /* + * If adaptive echos have been enabled, only send the echo request if + * no traffic was received since the last one. + */ + if (lcp_echo_adaptive) { + static unsigned int last_pkts_in = 0; + + update_link_stats(f->unit); + link_stats_valid = 0; + + if (link_stats.pkts_in != last_pkts_in) { + last_pkts_in = link_stats.pkts_in; + return; + } + } + /* * Make and send the echo request frame. */