*BSD News Article 81135


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!hunter.premier.net!news.mathworks.com!news.sprintlink.net!news-peer.sprintlink.net!cs.utexas.edu!news.sprintlink.net!news-stk-200.sprintlink.net!imp.ch!sunqbc.risq.net!bellglobal.com!news1.sympatico.ca!news
From: gbuchanan@sympatico.ca (Gardner Buchanan)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: IP accounting only (2.1.5)
Date: 20 Oct 1996 00:05:48 GMT
Organization: Sympatico
Lines: 26
Sender: gardner@localhost.on.sympatico.ca (Gardner Buchanan)
Message-ID: <54bqcs$ae7@news1.sympatico.ca>
References: <3269365A.32D5@sirene.woman.de>
Reply-To: gbuchanan@sympatico.ca
NNTP-Posting-Host: ppp2197.on.sympatico.ca
X-Newsreader: knews 0.9.3

In article <3269365A.32D5@sirene.woman.de>,
	"Nora E. Etukudo" <nora@sirene.woman.de> writes:
>Hi.
>
>Want to count the (mega) bytes for one ppp device in both directions.
>Have I to fidle with the whole ipfw, ipfirewalling or is there a "cheap"
>way ? I want to count only nothin'else (system is 2.1.5).
>

The interface (assuming iijppp, tunX) keeps (or could keep) track of this.
Use netstat to dump it out like this:

netstat -nbI tun0
Name  Mtu   Network     Address            Ipkts Ierrs     Ibytes    Opkts Oerrs     Obytes  Coll
tun0  1500  <Link>                          3890     0          0     4007     0          0     0
tun0  1500  111.111.111 111.111.111.11      3890     0          0     4007     0          0     0

You would have to hack the interface (/usr/src/sys/net/if_tun.c) to update
if_ibytes and if_obytes (where it currently tracks ifp->if_ipackets and
and ifp->if_opackets).  The kernel ppp interface (pppX) already counts
the bytes and should work without any additional hacking.

============================================
Gardner Buchanan    <gbuchanan@sympatico.ca>
Ottawa, ON          <gbuchanan@shl.com>