From owner-freebsd-bugs Tue May 14 22:10:18 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 93E1837B401 for ; Tue, 14 May 2002 22:10:03 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g4F5A3g51656; Tue, 14 May 2002 22:10:03 -0700 (PDT) (envelope-from gnats) Date: Tue, 14 May 2002 22:10:03 -0700 (PDT) Message-Id: <200205150510.g4F5A3g51656@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Crist J. Clark" Subject: Re: bin/37602: netstat -i -b does not count outgoing packets for ip aliases Reply-To: "Crist J. Clark" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/37602; it has been noted by GNATS. From: "Crist J. Clark" To: james brown Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/37602: netstat -i -b does not count outgoing packets for ip aliases Date: Tue, 14 May 2002 15:48:25 -0700 On Mon, May 13, 2002 at 04:45:04PM -0700, james brown wrote: > > > It doesn't make a lot of sense to track outgoing packets by source IP > > address on an interface. The destination IP address determines which > > i think in our situation it does make sense. here is our setup: > > - a single network interface. > > - multiple ip address aliases on that interface. > > - multiple http and ftp daemons bound to those ip addresses. > > we want to measure the network traffic for each ip address using > netstat -i -b in order to get statistics on how much traffic is moving > in and out of these daemons. But as you've found, you're not going to get it with netstat(1). That information simply isn't tracked. Figuring out what alias address a packet might be "leaving" simply isn't required in the IP output code, so it is not convenient to track it (since it is a bunch of extra code to run for every packet). And as I mentioned, in the case where you have multiple interfaces, trying to track it would be confusing. > > If you are playing with ipfw(8) accounting, you can see this by adding > > rules like, > > i am aware that we can count bytes using ipfw accounting but this only > produces the total in/out combined. we were hoping to use netstat > because it displays in and out separately. You can make ipfw(8) track in and out separately. In fact, I really don't see how you could get it to track in and out combined, pass ip from to any out pass ip from any to in > the bottom line is netstat -i -b does not appear to be working properly > for ip aliases, this is why i submitted the gnats report. The netstat(1) utility is working fine. It's just dumping the counters in various in-kernel data structures. The fact is, the data you desire is simply not and never has been tracked in the BSD stack. Feel free to take a look in sys/netinet/ip_output.c and see if you can find a place to do the accounting without creating too much additional overhead. -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message