4GB limit with netstat

Chuck Swiger cswiger at mac.com
Tue May 20 08:50:45 PDT 2003

Dag-Erling Smorgrav wrote:
[ ... ]
> I think "never" is a safe bet.

It's hard to change the existing if_data structure without breaking 
things, understood.  However, there are still some things that could be 
done to make the situation better, I think.

One would be to test for overflow when incrementing the counters and at 
least log (via the kernel message buffer) when a counter value has 
wrapped.  This should be easy to do, relatively cheap in terms of 
overhead-- most architectures have a conditional branch on the V flag-- 
and would be helpful for quantifying how frequently this situation happens.

It might be reasonable to do something like zero all of the counters 
when overflow happens (logging their values to dmesg, first), so that 
their relative values remain meaningful for the sake of comparision. 
And if the old stats are logged, it would be possible to accumulate 
those entries in a program using 64-bit counters and obtain the complete 
stats if one needed to.

Or one could even keep track of the number of times a 32-bit counter has 
overflowed, which suspiciously resembles keeping the high bits of a 
64-bit counter in a second 32-bit value, which could then be appended to 
the end of (struct if_data) without breaking backwards compatibility. 
        ifi_ibytes_msb and ifi_obytes_msb...?

While I'm thinking about it, is there a reason why nobody seems to put a 
version # into structures?


More information about the freebsd-stable mailing list