From nobody@FreeBSD.org  Thu Sep  5 22:41:13 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8DDD337B400
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  5 Sep 2002 22:41:13 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 522FC43E65
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  5 Sep 2002 22:41:13 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g865fDOT007030
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 5 Sep 2002 22:41:13 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g865fDnq007029;
	Thu, 5 Sep 2002 22:41:13 -0700 (PDT)
Message-Id: <200209060541.g865fDnq007029@www.freebsd.org>
Date: Thu, 5 Sep 2002 22:41:13 -0700 (PDT)
From: Hal Burch <hburch@lumeta.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: netstat -s does not include fabricated pkts in "packets sent from host"
X-Send-Pr-Version: www-1.0

>Number:         42467
>Category:       kern
>Synopsis:       netstat -s does not include fabricated pkts in "packets sent from host"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bms
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 05 22:50:02 PDT 2002
>Closed-Date:    Mon Jun 14 16:19:13 GMT 2004
>Last-Modified:  Mon Jun 14 16:19:13 GMT 2004
>Originator:     Hal Burch
>Release:        5.0-CURRENT
>Organization:
Lumeta Corporation
>Environment:
FreeBSD hburch-lap.corp.lumeta.com 5.0-CURRENT FreeBSD 5.0-CURRENT #5: Tue May  7 18:46:05 EDT 2002     hburch@hburch-lap.corp.lumeta.com:/usr/src/sys/i386/compile/LOCAL  i386


>Description:
"packets sent from this host" for ip: in netstat -in does not include packets with fabricated header.

This is not causing us any operational problems.

I have not tested the behavior of the similar ip6 counters.
>How-To-Repeat:
On a completely quite machine:
$ netstat -s | grep 'packets sent' > /tmp/a
$ traceroute -n 1.1.1.1
$ netstat -s | grep 'packets sent' | diff /tmp/a - 

notice that 'packets sent with fabricated header' (within ip: section) has increased, but 'packets sent from this host' has not.
>Fix:
      
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: bms 
State-Changed-When: Mon Jun 14 15:30:35 GMT 2004 
State-Changed-Why:  
This looks like a problem of definitions... 

ipstat.ips_localout is the global member concerned. 

It doesn't get incremented if the IP_RAWOUTPUT flag is set 
when ip_output() is called, and it doesn't get incremented 
if we act as a router and forwarded the packet (IP_FORWARDING). 

ipstat.ips_rawout is however incremented from within the 
raw IP socket code, specifically rip_output(). 

I have a feeling this is the stuff of bikesheds beyond our 
wildest nightmares, so I'm not touching it just now. 


Responsible-Changed-From-To: freebsd-bugs->bms 
Responsible-Changed-By: bms 
Responsible-Changed-When: Mon Jun 14 15:30:35 GMT 2004 
Responsible-Changed-Why:  
I'll take this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=42467 
State-Changed-From-To: analyzed->closed 
State-Changed-By: bms 
State-Changed-When: Mon Jun 14 16:18:00 GMT 2004 
State-Changed-Why:  
Changing this behaviour would depart from what other BSDs do. Bosko 
(bosko@) has a good explanation of why this would be a bad idea, 
as follows: 

This is a bikeshed issue.  The ipstat is sysctl-exported and 
readers can add the two together if they wish.  If you were to double-count 
there then they would have to subtract.  Also, raw packets might not actually 
appear to have come from local. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=42467 
>Unformatted:
