WAN data counter wraps around at 4GB?

Hi,

Using LuCI lede-17.01 branch (git-17.152.82987-7f6fc16) / LEDE Reboot 17.01.2 r3435-65eec8bd5f on Archer C7 v2.
I couldn't help noticing that interface data counter "wraps around" every 4GB of trafic, while LAN one does not. 417M packets is bit more than 800MB of traffic, so to say :slight_smile:
I suspect somebody was using 32 bit integer for counter? Is this a known bug?

Well. Lots of devices out there only have 32bit hardware, so just using a 64bit int here might be kind of a problem for those. So this either is done purely in 32bit anyway and detects integer overflow situations responded by the driver or it's different build paths for native 64bit and fallback 32bit with overflow detection.

My guess: There's overflow detection in place that doesn't count every single package but only once in a while, and if you manage to transport just enough data to make the overflow detection not detect that particular overflow, count is wrong.

Please see my traffic data attached. It's a banana pi m3, and as you can see, WAN is at 1.56 TB RX and 66.74 GB TX while LAN (the barely used one) is at 10 GB RX and 42 GB TX and other LANs (differently named but also green) are on up to 815 GB TX and 25 GB RX.

So I guess it's really a bug in overflow detection.

As far as I know, all interfaces are equal. The only difference is LAN zones are always displayed green and WAN zones are always displayed red. But except for the coloring, there's really no difference to interfaces and zones.

Regards,
Stephan.

Hm, interesting.

LAN counter seems to work correctly (displaying ~500GB aggregate traffic and ~400 million packets).
But WAN counter never goes above 4GB, despite correct count of all the packets (~ slightly less then 400 million packets).

I use my router as router only (almost no WiFi and only one switch port used), so amount of traffic on LAN should roughly correspond to WAN traffic.

I bet there was a unfortunate cast to 32bit somewhere in Archer C7 fork...