From e7ee3ad1743d34cb6fdf0773e6a73e9d8bf15216 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Tue, 1 Sep 2020 20:53:30 +0200 Subject: [PATCH] pppd: Do not call update_link_stats() for every LcpSendEchoRequest() call MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Function update_link_stats() is doing more than reading number of received bytes, e.g. it changes state of link_stats_valid. This change replace update_link_stats() by get_ppp_stats() in LcpSendEchoRequest() function to avoid any side effects. Signed-off-by: Pali Rohár --- pppd/lcp.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pppd/lcp.c b/pppd/lcp.c index 902b64a..d7ea471 100644 --- a/pppd/lcp.c +++ b/pppd/lcp.c @@ -2339,12 +2339,10 @@ LcpSendEchoRequest (f) */ if (lcp_echo_adaptive) { static unsigned int last_pkts_in = 0; + struct pppd_stats cur_stats; - update_link_stats(f->unit); - link_stats_valid = 0; - - if (link_stats.pkts_in != last_pkts_in) { - last_pkts_in = link_stats.pkts_in; + if (get_ppp_stats(f->unit, &cur_stats) && cur_stats.pkts_in != last_pkts_in) { + last_pkts_in = cur_stats.pkts_in; return; } } -- 2.39.2