Bug 27283

Summary: netstat -i missing IPv4 input packet count for tun interface
Product: Base System Reporter: bill <bill>
Component: binAssignee: Brian Somers <brian>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.3-RELEASE   
Hardware: Any   
OS: Any   

Description bill 2001-05-12 14:20:01 UTC
The output of netstat -i shows zero for IPv4 Ipkts on tun interface:

tan:/etc/periodic/daily# netstat -in
Name  Mtu   Network       Address            Ipkts Ierrs    Opkts Oerrs  Coll
sis0  1500  <Link#1>    00:a0:cc:a1:2e:03   974724     0   944427     0     0
sis0  1500  192.168.15    192.168.15.1      149067     -    13257     -     -
sis0  1500  fe80:1::2a0 fe80:1::2a0:ccff:        0     -        0     -     -
sis1  1500  <Link#2>    00:a0:cc:a1:2d:e6  1356902     0   837296     0   557
sis1  1500  [IPv4 pub/26   IPv4 pub]        284980     -   836577     -     -
sis1  1500  [IPv6 pub]                           0     -        0     -     -
sis1  1500  [IPv4 pub alias0]                    0     -        0     -     -
sis1  1500  [IPv4 pub alias1]                    0     -        0     -     -
ppp0* 1500  <Link#3>                             0     0        0     0     0
sl0*  552   <Link#4>                             0     0        0     0     0
faith 1500  <Link#5>                             0     0        0     0     0
gif0* 1280  <Link#6>                             0     0        0     0     0
gif1* 1280  <Link#7>                             0     0        0     0     0
gif2* 1280  <Link#8>                             0     0        0     0     0
gif3* 1280  <Link#9>                             0     0        0     0     0
lo0   16384 <Link#10>                         2558     0     2558     0     0
lo0   16384 fe80:a::1/6 fe80:a::1                0     -        0     -     -
lo0   16384 ::1/128     ::1                      0     -        0     -     -
lo0   16384 127           127.0.0.1           2548     -     2548     -     -
tun1  1440  <Link#11>                       259503     0   243854     0     0
tun1  1440  192.168.250.1 192.168.250.14         0     -     1962     -     -
tun1  1440  fe80:b::2a0 fe80:b::2a0:ccff:        0     -        0     -     -

Fix: 

unknown, sorry
How-To-Repeat: rerun netstat -i
Comment 1 Brian Somers freebsd_committer freebsd_triage 2001-05-23 16:14:20 UTC
State Changed
From-To: open->feedback

Ipkts seems to be incrementing ok on my -stable machine. 
Can the submitter confirm that the link was actually functional 
when the netstat -i was done ?  Opkts seems very low.... 


Comment 2 Brian Somers freebsd_committer freebsd_triage 2001-05-23 16:14:20 UTC
Responsible Changed
From-To: freebsd-bugs->brian

I'll look after this
Comment 3 Brian Somers 2001-05-24 18:06:29 UTC
Hmm, I think I know what the problem is.

Recently, the network traffic counters were changed so that they 
count things on a per-ip basis.  I'd guess that your tun interface 
changed IP number and therefore lost all of the old packet counts.

WRT the other interfaces, I can't say for sure.  Maybe Joe (cc'd) can 
comment on this - he did the changes :)  Perhaps this is also due to 
an IP number change....  I've just done some quick tests here, and it 
looks as if just ifconfig'ing the interface with the same IP number 
that it currently has will reset the traffic counts.  This doesn't 
sound good...

Comments Joe ?

> Yes, the link was definitely functional. And yes, now that you
> mention it, the IPv4 opkts -- as well as almost all of the IPv4
> counts -- are too low. The only IPv4 count that could possibly be
> accurate is sis1 opkts, but all of the link-layer counts look good.
> 
> As an aside, all of my other systems, from 3.2-RELEASE through
> 4.2-STABLE, have the same count for the link-layer and IPv4 rows
> under each column. Starting with 4.3, the code appears to have
> changed in terms of how packets are classified. I see the same thing
> on one of my 5.0-CURRENT boxes.

-- 
Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
      <http://www.Awfulhak.org>                   <brian@[uk.]OpenBSD.org>
Don't _EVER_ lose your sense of humour !
Comment 4 bill 2001-05-25 03:02:08 UTC
No, the IP address has not changed on any of the interfaces.
And that wouldn't explain why ipkts is always zero for IPv4
on the tun interface.

The tun interface is used by pipsecd, by the way.

Bill

On 24-May-01 Brian Somers wrote:
> Hmm, I think I know what the problem is.
> 
> Recently, the network traffic counters were changed so that they 
> count things on a per-ip basis.  I'd guess that your tun interface 
> changed IP number and therefore lost all of the old packet counts.
> 
> WRT the other interfaces, I can't say for sure.  Maybe Joe (cc'd) can 
> comment on this - he did the changes :)  Perhaps this is also due to 
> an IP number change....  I've just done some quick tests here, and it 
> looks as if just ifconfig'ing the interface with the same IP number 
> that it currently has will reset the traffic counts.  This doesn't 
> sound good...
> 
> Comments Joe ?
> 
>> Yes, the link was definitely functional. And yes, now that you
>> mention it, the IPv4 opkts -- as well as almost all of the IPv4
>> counts -- are too low. The only IPv4 count that could possibly be
>> accurate is sis1 opkts, but all of the link-layer counts look good.
>> 
>> As an aside, all of my other systems, from 3.2-RELEASE through
>> 4.2-STABLE, have the same count for the link-layer and IPv4 rows
>> under each column. Starting with 4.3, the code appears to have
>> changed in terms of how packets are classified. I see the same thing
>> on one of my 5.0-CURRENT boxes.
> 
> -- 
> Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
>       <http://www.Awfulhak.org>                   <brian@[uk.]OpenBSD.org>
> Don't _EVER_ lose your sense of humour !
> 
>
Comment 5 Brian Somers freebsd_committer freebsd_triage 2004-06-29 10:25:50 UTC
State Changed
From-To: feedback->closed

After testing the current behaviour, I conclude that the netstat -i output 
is correct, and corresponds exactly to ``show ipcp'' from the ppp prompt. 

I would observe that when you ``close; open'' from the ppp prompt, ppp 
doesn't clear the interface counters, however because it modifies the 
inteface addresses (even if it gets the same one again when the interface 
comes up), the kernel counters are reset.  This behaviour was changed 
shortly before this bug was originally raised in 2001.