]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Fix reliability of print_link_stats (with option persist) (#505)
authorenometh <57609820+enometh@users.noreply.github.com>
Tue, 10 Sep 2024 10:12:35 +0000 (15:42 +0530)
committerGitHub <noreply@github.com>
Tue, 10 Sep 2024 10:12:35 +0000 (20:12 +1000)
* pppd/ipcp.c: (ipcp_down): fix comment
* pppd/main.c: (reset_link_stats): reset print_link_stats to 1, set
start_time even if get_ppp_stats fails.

This is an attempt to fix the problem noted in the linux-ppp mailing list on
mar-26-2024 and may-03-2024 under the subject "ppp-2.5.0 sometimes doesn't
print stats on terminating on signal 2"

The sent/recv log messages were being lost, especially with the persist option.
This seems to be an oversight during reorg in commit ba7f7e0 "Header file
reorganization and cleaning up the public API for pppd version 2.5.0 (#379)"
around the repurposing of the link_stats_valid variable as link_stats_print.

It also fixes a stray reference to the old variable in a comment.

Signed-off-by: S Madhu <enometh@meer.net>
pppd/ipcp.c
pppd/main.c

index 1cf7f79bceb9ac53d6a60333080723fb6a7e3fc0..850e8cc894ce2aad3b42c85459d753b45580498a 100644 (file)
@@ -2026,7 +2026,7 @@ ipcp_down(fsm *f)
     sifvjcomp(f->unit, 0, 0, 0);
 
     print_link_stats(); /* _after_ running the notifiers and ip_down_hook(),
-                        * because print_link_stats() sets link_stats_valid
+                        * because print_link_stats() sets link_stats_print
                         * to 0 (zero) */
 
     /*
index d62e60301bcdc0a16f56f1ef118d85ea1417f9a6..b68917ff63105c62b67e7ce41a86a44ca9b62129 100644 (file)
@@ -1334,9 +1334,9 @@ print_link_stats(void)
 void
 reset_link_stats(int u)
 {
-    if (!get_ppp_stats(u, &old_link_stats))
-       return;
+    get_ppp_stats(u, &old_link_stats);
     ppp_get_time(&start_time);
+    link_stats_print = 1;
 }
 
 /*