Skip to content

Commit 3b6c011

Browse files
authored
pppd: On Linux < v3.8 force get_ppp_stats() to use ioctl() counters (#580)
This is to enable detecting wrap-around, and the sysfs overhead serves no purpose since the sysfs files don't contain 64-bit counters even on 64-bit architectures. Closes: #578 Signed-off-by: Jaco Kroon <jaco@uls.co.za>
1 parent f8d9940 commit 3b6c011

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pppd/sys-linux.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,15 @@ int get_ppp_stats(int u, struct pppd_stats *stats)
20082008
static int (*func)(int, struct pppd_stats*) = NULL;
20092009

20102010
if (!func) {
2011+
if (kernel_version < KVERSION(3, 8, 0)) {
2012+
/* In kernel versions prior to 3.8 pppstat in kernel was
2013+
* forced to __u32, so just use the IOCTL mechanism which
2014+
* will track wrap-around */
2015+
func = get_ppp_stats_ioctl;
2016+
TIMEOUT(ppp_stats_poller, (void*)(long)u, 25);
2017+
return func(u, stats);
2018+
}
2019+
20112020
if (get_ppp_stats_rtnetlink(u, stats)) {
20122021
func = get_ppp_stats_rtnetlink;
20132022
return 1;

0 commit comments

Comments
 (0)