From owner-freebsd-net Sun Dec 19 11: 4:36 1999 Delivered-To: freebsd-net@freebsd.org Received: from gaia.nimnet.asn.au (nimbin.lnk.telstra.net [139.130.45.143]) by hub.freebsd.org (Postfix) with ESMTP id EC77714CE7 for ; Sun, 19 Dec 1999 11:04:29 -0800 (PST) (envelope-from smithi@nimnet.asn.au) Received: from localhost (smithi@localhost) by gaia.nimnet.asn.au (8.8.8/8.8.8R1.0) with SMTP id CAA09038; Mon, 20 Dec 1999 02:19:01 +1100 (EST) (envelope-from smithi@nimnet.asn.au) Date: Mon, 20 Dec 1999 02:19:01 +1100 (EST) From: Ian Smith Reply-To: Ian Smith To: Aldrin Leal Cc: freebsd-net@FreeBSD.ORG Subject: Re: Math Help for IPFW :) In-Reply-To: <007101bf49a8$5eeeb9a0$0200a8c0@expert.com.br> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > 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 = ) { > 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