ppp icon indicating copy to clipboard operation
ppp copied to clipboard

pppstats IN counter sometimes displays 0

Open electrofloat opened this issue 3 years ago • 2 comments
trafficstars

While I'm still investigating my issue of even if the lcp-echo-adaptive is set, sometimes pppd terminates the connection with "Peer not responding" when the line is saturated, I noticed that pppstats sometimes displays 0 in the IN column.

Digging into the code I noticed a few things:

  1. the pppstat struct stores everything in __u32, and although it seems these are the in-kernel values too (include/uapi/linux/ppp_defs.h) it is very small for todays traffic. One can wrap that number around very fast in merely minutes or seconds at least for the ppp_ibytes definitely.
  2. when printing the number you are casting an unsigned int back to signed int here: https://github.com/ppp-project/ppp/blob/master/pppstats/pppstats.c#L267, so every time the ppp_ibytes > 2147483647, it will print 0.

(unfortunately these findings don't explain my original issue, since in https://github.com/ppp-project/ppp/blob/master/pppd/lcp.c#L2279 even if the pkts_in wraps around, that expression will almost always be true if there were some traffic)

electrofloat avatar Nov 28 '21 09:11 electrofloat

@paulusmack: Have you seen this ticket?

Neustradamus avatar Mar 29 '22 00:03 Neustradamus

@Neustradamus this might be addressed by https://github.com/ppp-project/ppp/pull/298 indirectly?

jkroonza avatar Mar 29 '22 06:03 jkroonza

@electrofloat: Have you looked the last comment?

Neustradamus avatar Oct 25 '22 17:10 Neustradamus

@Neustradamus Yes, it seems that is would resolve this issue, so I'm closing this one, thanks.

electrofloat avatar Oct 26 '22 07:10 electrofloat

@electrofloat: Nice, thanks for your confirmation!

Thanks @jkroonza!

Neustradamus avatar Oct 26 '22 11:10 Neustradamus