Date: Mon, 20 Dec 1999 02:19:01 +1100 (EST) From: Ian Smith <smithi@nimnet.asn.au> To: Aldrin Leal <aldrin@americasnet.com> Cc: freebsd-net@FreeBSD.ORG Subject: Re: Math Help for IPFW :) Message-ID: <Pine.BSF.3.96.991220015547.8584A-100000@gaia.nimnet.asn.au> In-Reply-To: <007101bf49a8$5eeeb9a0$0200a8c0@expert.com.br>
next in thread | previous in thread | raw e-mail | index | archive | help
> How to look at the byte counters? :]
>
> My source is:
>
> ### Cut here
> #!/usr/bin/suidperl
>
> $rule = 2500;
> if (open(HANDLE, "/sbin/ipfw -q show $rule|")) {
> if ($line = <HANDLE>) {
> chomp $line;
> @values = split(' ', $line);
> $packets = $values[2];
> }
> close(HANDLE);
> }
>
> system "/sbin/ipfw -q zero $rule";
> print "$packets\n$packets\n00:00\nrule $rule\n";
> ### Unclip
>
> The rule is: 02500 108 11320 allow ip from 200.242.253.6 to any
So, 108 is the packet count and 11320 is the byte count. At this point
average packet size is 11320 bytes / 108 packets = 104.8 bytes/packet.
I know little perl, don't quote me, but it seems likely that adding ..
$bytes = $values[3];
.. just below your $packets assignment above, ought to do the job?
Cheers, Ian
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.991220015547.8584A-100000>
