Re: IPChains counter wrapping

From: Glynn Clements (glynn@sensei.co.uk)
Date: Tue Feb 29 2000 - 09:06:08 EST


Charl Matthee wrote:

> I have written a little script that measures throughput based on taking
> snapshots of the proc fs counters (/proc/net/ip_fwchains) for an ipchains rule
> and using the deltas and a sliding window to determine the average throughput.
>
> I notice the counter in the proc fs has place for 9 digits. Does this mean the
> counter will wrap at 999999999 or some other defined number?
>
> I would like to be able to deal with the fact that the counter may wrap while
> measuring throughput and deal with it correctly.

The packet and byte counters are each 64 bits wide. The
/proc/net/ip_fwchains entry shows each counter as 2 32-bit integers
(high word first). See dump_rule() in /usr/src/linux/net/ipv4/ip_fw.c
for the details.

I think that you can be fairly sure that a 64-bit counter isn't going
to wrap within any practical time frame.

-- 
Glynn Clements <glynn@sensei.co.uk>

- To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.rutgers.edu



This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:27 EST