From nobody@FreeBSD.org  Thu Dec 16 08:50:06 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 834F81065673
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Dec 2010 08:50:06 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (unknown [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 684868FC18
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Dec 2010 08:50:06 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id oBG8o67F064236
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Dec 2010 08:50:06 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id oBG8o66x064235;
	Thu, 16 Dec 2010 08:50:06 GMT
	(envelope-from nobody)
Message-Id: <201012160850.oBG8o66x064235@red.freebsd.org>
Date: Thu, 16 Dec 2010 08:50:06 GMT
From: Dennis Yusupoff <yusdyr@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: "netstat -sz" doesn't reset any IPv6 statistic
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         153206
>Category:       bin
>Synopsis:       [patch] netstat(1): "netstat -sz" doesn't reset any IPv6 statistic
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    maxim
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 16 09:00:19 UTC 2010
>Closed-Date:    Fri Aug 31 06:39:24 UTC 2012
>Last-Modified:  Fri Aug 31 06:39:24 UTC 2012
>Originator:     Dennis Yusupoff
>Release:        8.1-STABLE
>Organization:
SOHO
>Environment:
FreeBSD server.dyr 8.1-STABLE FreeBSD 8.1-STABLE #5: Wed Nov 10 23:34:51 MSK 2010     root@server.dyr:/usr/obj/usr/src/sys/DYR_SERVER  amd64
>Description:
nestat doesn't clear IPv6 statictic, under any circumstates, by using "netstat -sz" or "netstat -s -z -f inet6".

===
root@server:/usr/home/dyr (7203) netstat -ssz -f inet6; netstat -ss -f inet6
tcp:
        1767 packets sent
                243 data packets (32971 bytes)
                1212 ack-only packets (0 delayed)
                101 window update packets
                211 control packets
        1490 packets received
                404 acks (for 33086 bytes)
                14 duplicate acks
                1092 packets (1392624 bytes) received in-sequence
                7 window update packets
                1 packet received after close
        101 connection requests
        14 connection accepts
        102 connections established (including accepts)
        116 connections closed (including 0 drops)
                15 connections updated cached RTT on close
                15 connections updated cached RTT variance on close
        13 embryonic connections dropped
        402 segments updated rtt (of 402 attempts)
        18 retransmit timeouts
        2 keepalive timeouts
                2 connections dropped by keepalive
        918 correct data packet header predictions
        14 syncache entries added
                14 completed
        14 cookies sent
        7 SACK options (SACK blocks) received
udp:
        438 datagrams received
        22 dropped due to no socket
        7 broadcast/multicast datagrams undelivered
        34 dropped due to full socket buffers
        375 delivered
        392 datagrams output
ip6:
        669902 total packets received
        93933 packets for this host
        517361 packets forwarded
        192733 packets sent from this host
        265 multicast packets which we don't join
        Input histogram:
                TCP: 377282
                UDP: 69829
                ICMP6: 214085
                no next header: 8706
        Mbuf statistics:
                26188 one mbuf
                two or more mbuf:
                        lo0= 2
                643712 one ext mbuf
                0 two or more ext mbuf
        Source addresses selection rule applied:
                111354 first candidate
                10366 same address
                139781 appropriate scope
                135406 outgoing interface
icmp6:
        28088 calls to icmp6_error
        Output histogram:
                unreach: 28088
                echo reply: 12
                router advertisement: 9185
                neighbor solicitation: 52557
                neighbor advertisement: 20923
                MLDv2 listener report: 22
        Input histogram:
                echo: 12
                router solicitation: 197
                router advertisement: 10877
                neighbor solicitation: 20923
                neighbor advertisement: 37674
        Histogram of error messages to be generated:
                4635 address unreachable
                23453 port unreachable
        12 message responses generated
ipsec6:
rip6:
tcp:
        11 packets sent
                11 data packets (2636 bytes)
        3 packets received
                3 acks (for 2688 bytes)
        2 segments updated rtt (of 1 attempt)
udp:
ip6:
        669902 total packets received
        93933 packets for this host
        517361 packets forwarded
        192733 packets sent from this host
        265 multicast packets which we don't join
        Input histogram:
                TCP: 377282
                UDP: 69829
                ICMP6: 214085
                no next header: 8706
        Mbuf statistics:
                26188 one mbuf
                two or more mbuf:
                        lo0= 2
                643712 one ext mbuf
                0 two or more ext mbuf
        Source addresses selection rule applied:
                111354 first candidate
                10366 same address
                139781 appropriate scope
                135406 outgoing interface
icmp6:
        28088 calls to icmp6_error
        Output histogram:
                unreach: 28088
                echo reply: 12
                router advertisement: 9185
                neighbor solicitation: 52557
                neighbor advertisement: 20923
                MLDv2 listener report: 22
        Input histogram:
                echo: 12
                router solicitation: 197
                router advertisement: 10877
                neighbor solicitation: 20923
                neighbor advertisement: 37674
        Histogram of error messages to be generated:
                4635 address unreachable
                23453 port unreachable
        12 message responses generated
ipsec6:
rip6:
===

>How-To-Repeat:
Do netstat -ssz -f inet6; netstat -ss -f inet6 and compare.
>Fix:


>Release-Note:
>Audit-Trail:

From: Maxim Konovalov <maxim.konovalov@gmail.com>
To: bug-followup@freebsd.org
Cc:  
Subject: bin/153206
Date: Wed, 27 Jul 2011 14:43:44 +0400 (MSD)

 Hello,
 
 please try the following patch:
 
 Index: sys/netinet6/in6_proto.c
 ===================================================================
 --- sys/netinet6/in6_proto.c	(revision 224466)
 +++ sys/netinet6/in6_proto.c	(working copy)
 @@ -515,7 +515,7 @@
  	&VNET_NAME(ip6_sendredirects), 0, "");
  SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM, hlim, CTLFLAG_RW,
  	&VNET_NAME(ip6_defhlim), 0, "");
 -SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RD,
 +SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RW,
  	&VNET_NAME(ip6stat), ip6stat, "");
  SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, maxfragpackets,
  	CTLFLAG_RW, &VNET_NAME(ip6_maxfragpackets), 0, "");
 @@ -551,7 +551,7 @@
  	&VNET_NAME(ip6_v6only), 0, "");
  SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL, auto_linklocal,
  	CTLFLAG_RW, &VNET_NAME(ip6_auto_linklocal), 0, "");
 -SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RD,
 +SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RW,
  	&VNET_NAME(rip6stat), rip6stat, "");
  SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR, prefer_tempaddr,
  	CTLFLAG_RW, &VNET_NAME(ip6_prefer_tempaddr), 0, "");
 @@ -571,7 +571,7 @@
  	CTLFLAG_RW, &VNET_NAME(icmp6_rediraccept), 0, "");
  SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT, redirtimeout,
  	CTLFLAG_RW, &VNET_NAME(icmp6_redirtimeout), 0, "");
 -SYSCTL_VNET_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RD,
 +SYSCTL_VNET_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RW,
  	&VNET_NAME(icmp6stat), icmp6stat, "");
  SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE, nd6_prune, CTLFLAG_RW,
  	&VNET_NAME(nd6_prune), 0, "");
 Index: sys/netinet6/ip6_mroute.c
 ===================================================================
 --- sys/netinet6/ip6_mroute.c	(revision 224466)
 +++ sys/netinet6/ip6_mroute.c	(working copy)
 @@ -250,7 +250,7 @@
  static mifi_t reg_mif_num = (mifi_t)-1;
 
  static struct pim6stat pim6stat;
 -SYSCTL_STRUCT(_net_inet6_pim, PIM6CTL_STATS, stats, CTLFLAG_RD,
 +SYSCTL_STRUCT(_net_inet6_pim, PIM6CTL_STATS, stats, CTLFLAG_RW,
      &pim6stat, pim6stat,
      "PIM Statistics (struct pim6stat, netinet6/pim_var.h)");
 
 Index: usr.bin/netstat/inet6.c
 ===================================================================
 --- usr.bin/netstat/inet6.c	(revision 224466)
 +++ usr.bin/netstat/inet6.c	(working copy)
 @@ -364,15 +364,17 @@
  void
  ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
  {
 -	struct ip6stat ip6stat;
 +	struct ip6stat ip6stat, zefostat;
  	int first, i;
  	size_t len;
 
  	len = sizeof ip6stat;
  	if (live) {
  		memset(&ip6stat, 0, len);
 -		if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len, NULL,
 -		    0) < 0) {
 +		if (zflag)
 +			memset(&zerostat, 0, len);
 +		if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len,
 +		    zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
  			if (errno != ENOENT)
  				warn("sysctl: net.inet6.ip6.stats");
  			return;
 @@ -844,15 +846,17 @@
  void
  icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
  {
 -	struct icmp6stat icmp6stat;
 +	struct icmp6stat icmp6stat, zerostat;
  	int i, first;
  	size_t len;
 
  	len = sizeof icmp6stat;
  	if (live) {
  		memset(&icmp6stat, 0, len);
 +		if (zflag)
 +			memset(&zerostat, 0, len);
  		if (sysctlbyname("net.inet6.icmp6.stats", &icmp6stat, &len,
 -		    NULL, 0) < 0) {
 +		    zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
  			if (errno != ENOENT)
  				warn("sysctl: net.inet6.icmp6.stats");
  			return;
 @@ -1037,14 +1041,16 @@
  void
  rip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
  {
 -	struct rip6stat rip6stat;
 +	struct rip6stat rip6stat, zerostat;
  	u_quad_t delivered;
  	size_t len;
 
  	len = sizeof(rip6stat);
  	if (live) {
 +		if (zflag)
 +			memset(&zerostat, 0, len);
  		if (sysctlbyname("net.inet6.ip6.rip6stats", &rip6stat, &len,
 -		    NULL, 0) < 0) {
 +		    zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
  			if (errno != ENOENT)
  				warn("sysctl: net.inet6.ip6.rip6stats");
  			return;
 %%%
 
 -- 
 Maxim Konovalov

Date: Fri, 18 Nov 2011 13:54:37 +0400
From: Dennis Yusupoff <dyr@smartspb.net>
To: maxim.konovalov@gmail.com, bug-followup@freebsd.org
Subject: Re: bin/153206: [patch] netstat(1): "netstat -sz" doesn't reset any IPv6 statistic

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enig82C375F1FCCD316CB2695D2D
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable
 
 Hello, Maxim!
 
 At first, let me bring to you my apologize for a late answer, I've just
 saw your patch.
 I've tried to apply your patch, but patched files have been changed from
 your revision (224466), so you patch isn't valid now.  Then I tried to
 manually patch 8.2-STABLE, I've got an error:
 =3D=3D=3D
 root@ntsled:/usr/src/usr.bin/netstat (1609) make
 Warning: Object directory not changed from original /usr/src/usr.bin/nets=
 tat
 cc -O2 -pipe  -fno-strict-aliasing -DIPSEC -DSCTP -DINET6 -DNETGRAPH
 -DIPX -std=3Dgnu99 -fstack-protector -Wsystem-headers -Werror -Wall
 -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes
 -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized
 -Wno-pointer-sign -c inet.c
 inet.c: In function 'protopr':
 inet.c:464: error: 'struct tcpcb' has no member named 't_sndrexmitpack'
 inet.c:465: error: 'struct tcpcb' has no member named 't_rcvoopack'
 inet.c:466: error: 'struct tcpcb' has no member named 't_sndzerowin'
 *** Error code 1
 
 Stop in /usr/src/usr.bin/netstat.
 =3D=3D=3D
 
 Therefore, Would you be so kind to create new one?
 By the way, same bug with zeroing ipv6 statistic is exists in the
 FreeBSD 9.0-RC1 also.
 
 --=20
 With best regards,
 Dennis Yusupoff,
 network engineer of
 Smart-Telecom ISP
 Russia, Saint-Petersburg=20
 
 
 
 --------------enig82C375F1FCCD316CB2695D2D
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iQEcBAEBAgAGBQJOxiteAAoJEBUTaqBS2NB4cBMH/1COaq/yGkaWPB8xaGtPKGyV
 ZQUemYAkm2u8idjObTR/r72dj9Itdj916BKs3tA4K4vZBTnOjZVZrOetfXlZeFU+
 qgm4QgkIvI+kleFV1ZKmA43vV2n6olHgAmsn/QlPz/vcsfK7L6j6cmk6q6nFV8aW
 Z3bDUaA4ScNCCCEKFi+UsMIbtk45tcw0e8ZW8z/KP5HAxXf9Mgluioa8wlphSC6K
 mzfsyW+B+kMl4f+HP1zJop7FlaA7lDArnQJv8qQsVXWL0taA+62DiTEHMPxW/ek2
 KfjeQM30ZLL9WUQRleGuC/o29m8LQLupiFcU51Xgmjfy0kd73STGYEHzJI12iy8=
 =hC0g
 -----END PGP SIGNATURE-----
 
 --------------enig82C375F1FCCD316CB2695D2D--

Date: Fri, 18 Nov 2011 17:34:53 +0400 (MSK)
From: Maxim Konovalov <maxim.konovalov@gmail.com>
To: Dennis Yusupoff <dyr@smartspb.net>
In-Reply-To: <4EC62B5D.8020001@smartspb.net>
Subject: Re: bin/153206: [patch] netstat(1): "netstat -sz" doesn't reset any IPv6 statistic

 On Fri, 18 Nov 2011, 13:54+0400, Dennis Yusupoff wrote:
 
 > Therefore, Would you be so kind to create new one?
 > By the way, same bug with zeroing ipv6 statistic is exists in the
 > FreeBSD 9.0-RC1 also.
 >
 Sure it is.  There is no such code in all branches.
 
 -- 
 Maxim Konovalov

From: Maxim Konovalov <maxim.konovalov@gmail.com>
To: bug-followup@freebsd.org
Cc:  
Subject: bin/153206
Date: Tue, 22 Nov 2011 13:36:19 +0400 (MSK)

 Added to the audit trail.
 
 -- 
 Maxim Konovalov
 
 ---------- Forwarded message ----------
 Date: Tue, 22 Nov 2011 13:13:27 +0400
 From: Dennis Yusupoff <yusdyr@gmail.com>
 To: Maxim Konovalov <maxim.konovalov@gmail.com>
 Subject: Re: Bug bin/153206
 
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 21.11.2011 16:23, Dennis Yusupoff ?????:
 >
 >
 > Will test it after finished kernel make.
 You're patch is working fine on fresh 8.2-STABLE, thank you.
 
 ==
 |root@ntsled:/usr/home/dyr (1783) uname -a
 FreeBSD ntsled.ru 8.2-STABLE FreeBSD 8.2-STABLE #1: Tue Nov 22 11:31:59
 MSK 2011     root@ntsled.ru:/usr/obj/usr/src/sys/DYR_DE  amd64
 root@ntsled:/usr/home/dyr (1784) netstat -ss -f inet6
 tcp:
         105 packets sent
                 83 data packets (9394 bytes)
                 14 ack-only packets (0 delayed)
                 8 control packets
         109 packets received
                 81 acks (for 9347 bytes)
                 4 duplicate acks
                 82 packets (9240 bytes) received in-sequence
         4 connection requests
         1 connection accept
         5 connections established (including accepts)
         33 connections closed (including 0 drops)
         77 segments updated rtt (of 78 attempts)
         23 correct data packet header predictions
         1 syncache entry added
                 1 completed
         1 cookie sent
 udp:
         40 datagrams received
         1 dropped due to no socket
         2 broadcast/multicast datagrams undelivered
         37 delivered
         38 datagrams output
 ip6:
         9 packets sent from this host
         Mbuf statistics:
                 0 one mbuf
                 0 one ext mbuf
                 0 two or more ext mbuf
         Source addresses selection rule applied:
                 9 first candidate
                 9 appropriate scope
 icmp6:
         Output histogram:
                 neighbor solicitation: 5
                 MLDv2 listener report: 4
         Histogram of error messages to be generated:
 rip6:
 root@ntsled:/usr/home/dyr (1785) netstat -ss -f inet6 -z > /dev/null
 root@ntsled:/usr/home/dyr (1786) netstat -ss -f inet6
 tcp:
         4 packets sent
                 4 data packets (288 bytes)
         5 packets received
                 3 acks (for 288 bytes)
                 3 packets (156 bytes) received in-sequence
         3 segments updated rtt (of 3 attempts)
         2 correct data packet header predictions
 udp:
 ip6:
         Mbuf statistics:
                 0 one mbuf
                 0 one ext mbuf
                 0 two or more ext mbuf
         Source addresses selection rule applied:
 icmp6:
         Histogram of error messages to be generated:
 rip6:
 root@ntsled:/usr/home/dyr (1787) netstat -ss -f inet6
 tcp:
         25 packets sent
                 25 data packets (1716 bytes)
         13 packets received
                 9 acks (for 1716 bytes)
                 5 packets (260 bytes) received in-sequence
         5 segments updated rtt (of 5 attempts)
         4 correct data packet header predictions
 udp:
         2 datagrams received
         2 broadcast/multicast datagrams undelivered
 ip6:
         Mbuf statistics:
                 0 one mbuf
                 0 one ext mbuf
                 0 two or more ext mbuf
         Source addresses selection rule applied:
 icmp6:
         Histogram of error messages to be generated:
 rip6:
 root@ntsled:/usr/home/dyr (1788)|
 ==
 
 By the way, there is other little bug - ip6 Mbuf statistics show it's
 zero values under "-ss" command arguments, as you can see.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iQEcBAEBAgAGBQJOy2e3AAoJEBUTaqBS2NB42KoH/RQC82gd04nx0J8X7hbRHdQv
 VLM2MWnveRlisucycvrRBMRbaPEw9EtUemyjLKpEjwniiM99ju/ztHhMWGImo7Os
 PBUj7IJJOxaz9h5fOe8/+tG4dPSnhWN7HnNk7j7MD8MXi6Tnvo7w2QS5XbkKLRHi
 oELsOW4paFR0WZ6bHb7FPzKnhHOjifup4XntqHa2i4j3rosqNV+cy+f2AehNlIl2
 RSXI7mA0Zw3OsX4N8+qF6BMqLbQIaWNrgVjheHEbyBy3SVWqigX0I/91A0lVIzf+
 59w+lB3hlB11etHIEoJYTgY3ibw4yxAJKLCXc87tprTzPwU1/JNXuuSEqUwcJh8=
 =kvDw
 -----END PGP SIGNATURE-----
 
State-Changed-From-To: open->patched 
State-Changed-By: maxim 
State-Changed-When: Mon Dec 19 05:50:49 UTC 2011 
State-Changed-Why:  
Fixed in HEAD 

http://www.freebsd.org/cgi/query-pr.cgi?pr=153206 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/153206: commit references a PR
Date: Mon, 19 Dec 2011 05:50:49 +0000 (UTC)

 Author: maxim
 Date: Mon Dec 19 05:50:34 2011
 New Revision: 228700
 URL: http://svn.freebsd.org/changeset/base/228700
 
 Log:
   o Convert IPv6 read-only stats sysctls to the read-write ones.
   o Teach netstat(1) -z to reset these stats sysctls.
   
   PR:		bin/153206
   Reviewed by:	glebuis
   Sponsored by:	NGINX, Inc.
   MFC after:	1 month
 
 Modified:
   head/sys/netinet6/in6_proto.c
   head/sys/netinet6/ip6_mroute.c
   head/usr.bin/netstat/inet6.c
 
 Modified: head/sys/netinet6/in6_proto.c
 ==============================================================================
 --- head/sys/netinet6/in6_proto.c	Mon Dec 19 05:09:08 2011	(r228699)
 +++ head/sys/netinet6/in6_proto.c	Mon Dec 19 05:50:34 2011	(r228700)
 @@ -520,7 +520,7 @@ SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_
  	&VNET_NAME(ip6_sendredirects), 0, "");
  SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM, hlim, CTLFLAG_RW,
  	&VNET_NAME(ip6_defhlim), 0, "");
 -SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RD,
 +SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RW,
  	&VNET_NAME(ip6stat), ip6stat, "");
  SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, maxfragpackets,
  	CTLFLAG_RW, &VNET_NAME(ip6_maxfragpackets), 0, "");
 @@ -573,7 +573,7 @@ SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_
  	CTLFLAG_RW, &VNET_NAME(ip6_auto_linklocal), 0,
  	"Default value of per-interface flag for automatically adding an IPv6"
  	" link-local address to interfaces when attached");
 -SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RD,
 +SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RW,
  	&VNET_NAME(rip6stat), rip6stat, "");
  SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR, prefer_tempaddr,
  	CTLFLAG_RW, &VNET_NAME(ip6_prefer_tempaddr), 0, "");
 @@ -603,7 +603,7 @@ SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6
  	CTLFLAG_RW, &VNET_NAME(icmp6_rediraccept), 0, "");
  SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT, redirtimeout,
  	CTLFLAG_RW, &VNET_NAME(icmp6_redirtimeout), 0, "");
 -SYSCTL_VNET_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RD,
 +SYSCTL_VNET_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RW,
  	&VNET_NAME(icmp6stat), icmp6stat, "");
  SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE, nd6_prune, CTLFLAG_RW,
  	&VNET_NAME(nd6_prune), 0, "");
 
 Modified: head/sys/netinet6/ip6_mroute.c
 ==============================================================================
 --- head/sys/netinet6/ip6_mroute.c	Mon Dec 19 05:09:08 2011	(r228699)
 +++ head/sys/netinet6/ip6_mroute.c	Mon Dec 19 05:50:34 2011	(r228700)
 @@ -250,7 +250,7 @@ static mifi_t nummifs = 0;
  static mifi_t reg_mif_num = (mifi_t)-1;
  
  static struct pim6stat pim6stat;
 -SYSCTL_STRUCT(_net_inet6_pim, PIM6CTL_STATS, stats, CTLFLAG_RD,
 +SYSCTL_STRUCT(_net_inet6_pim, PIM6CTL_STATS, stats, CTLFLAG_RW,
      &pim6stat, pim6stat,
      "PIM Statistics (struct pim6stat, netinet6/pim_var.h)");
  
 
 Modified: head/usr.bin/netstat/inet6.c
 ==============================================================================
 --- head/usr.bin/netstat/inet6.c	Mon Dec 19 05:09:08 2011	(r228699)
 +++ head/usr.bin/netstat/inet6.c	Mon Dec 19 05:50:34 2011	(r228700)
 @@ -360,15 +360,17 @@ static char *srcrule_str[] = {
  void
  ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
  {
 -	struct ip6stat ip6stat;
 +	struct ip6stat ip6stat, zerostat;
  	int first, i;
  	size_t len;
  
  	len = sizeof ip6stat;
  	if (live) {
  		memset(&ip6stat, 0, len);
 -		if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len, NULL,
 -		    0) < 0) {
 +		if (zflag)
 +			memset(&zerostat, 0, len);
 +		if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len,
 +		    zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
  			if (errno != ENOENT)
  				warn("sysctl: net.inet6.ip6.stats");
  			return;
 @@ -840,15 +842,17 @@ static	const char *icmp6names[] = {
  void
  icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
  {
 -	struct icmp6stat icmp6stat;
 +	struct icmp6stat icmp6stat, zerostat;
  	int i, first;
  	size_t len;
  
  	len = sizeof icmp6stat;
  	if (live) {
  		memset(&icmp6stat, 0, len);
 +		if (zflag)
 +			memset(&zerostat, 0, len);
  		if (sysctlbyname("net.inet6.icmp6.stats", &icmp6stat, &len,
 -		    NULL, 0) < 0) {
 +		    zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
  			if (errno != ENOENT)
  				warn("sysctl: net.inet6.icmp6.stats");
  			return;
 @@ -1033,14 +1037,16 @@ pim6_stats(u_long off, const char *name,
  void
  rip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
  {
 -	struct rip6stat rip6stat;
 +	struct rip6stat rip6stat, zerostat;
  	u_quad_t delivered;
  	size_t len;
  
  	len = sizeof(rip6stat);
  	if (live) {
 +		if (zflag)
 +			memset(&zerostat, 0, len);
  		if (sysctlbyname("net.inet6.ip6.rip6stats", &rip6stat, &len,
 -		    NULL, 0) < 0) {
 +		    zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
  			if (errno != ENOENT)
  				warn("sysctl: net.inet6.ip6.rip6stats");
  			return;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
Responsible-Changed-From-To: freebsd-bugs->maxim 
Responsible-Changed-By: bz 
Responsible-Changed-When: Mon Dec 19 07:40:02 UTC 2011 
Responsible-Changed-Why:  
maxim comitted the change to head; please track and close after mfc. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=153206 
State-Changed-From-To: patched->closed 
State-Changed-By: maxim 
State-Changed-When: Fri Aug 31 06:39:04 UTC 2012 
State-Changed-Why:  
Merged to stable/9. 

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