PERFORCE change 166641 for review

Gabor Pali pgj at FreeBSD.org
Mon Jul 27 18:32:59 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=166641

Change 166641 by pgj at petymeg-current on 2009/07/27 18:32:28

	Standardize IP statistics and add header.

Affected files ...

.. //depot/projects/soc2009/pgj_libstat/src/sys/netinet/ip_input.c#3 edit
.. //depot/projects/soc2009/pgj_libstat/src/sys/netinet/ip_var.h#2 edit

Differences ...

==== //depot/projects/soc2009/pgj_libstat/src/sys/netinet/ip_input.c#3 (text+ko) ====

@@ -84,6 +84,7 @@
 #endif /* IPSEC */
 
 #include <sys/socketvar.h>
+#include <netinet/tcp_var.h>
 
 /* XXX: Temporary until ipfw_ether and ipfw_bridge are converted. */
 #include <netinet/ip_fw.h>
@@ -112,6 +113,10 @@
 struct	in_ifaddrhead in_ifaddrhead; 		/* first inet address */
 struct	in_ifaddrhashhead *in_ifaddrhashtbl;	/* inet addr hash table  */
 u_long 	in_ifaddrhmask;				/* mask for hash table */
+struct stat_header  ipstat_header = {
+	.sth_version = IPSTAT_VERSION,
+	.sth_len = sizeof(struct ipstat)
+};
 struct ipstat ipstat;
 static int ip_rsvp_on;
 struct socket *ip_rsvpd;
@@ -180,6 +185,9 @@
 SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RW,
     ipstat, ipstat, "IP statistics (struct ipstat, netinet/ip_var.h)");
 
+SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, stats_header,
+    CTLFLAG_RD, ipstat_header, stat_header, "IP statistics header");
+
 #ifdef VIMAGE_GLOBALS
 static uma_zone_t ipq_zone;
 #endif

==== //depot/projects/soc2009/pgj_libstat/src/sys/netinet/ip_var.h#2 (text+ko) ====

@@ -98,36 +98,38 @@
 	struct	in_mfilter *imo_mfilters;	/* source filters */
 };
 
+#define	IPSTAT_VERSION	    0x00000001
+
 struct	ipstat {
-	u_long	ips_total;		/* total packets received */
-	u_long	ips_badsum;		/* checksum bad */
-	u_long	ips_tooshort;		/* packet too short */
-	u_long	ips_toosmall;		/* not enough data */
-	u_long	ips_badhlen;		/* ip header length < data size */
-	u_long	ips_badlen;		/* ip length < ip header length */
-	u_long	ips_fragments;		/* fragments received */
-	u_long	ips_fragdropped;	/* frags dropped (dups, out of space) */
-	u_long	ips_fragtimeout;	/* fragments timed out */
-	u_long	ips_forward;		/* packets forwarded */
-	u_long	ips_fastforward;	/* packets fast forwarded */
-	u_long	ips_cantforward;	/* packets rcvd for unreachable dest */
-	u_long	ips_redirectsent;	/* packets forwarded on same net */
-	u_long	ips_noproto;		/* unknown or unsupported protocol */
-	u_long	ips_delivered;		/* datagrams delivered to upper level*/
-	u_long	ips_localout;		/* total ip packets generated here */
-	u_long	ips_odropped;		/* lost packets due to nobufs, etc. */
-	u_long	ips_reassembled;	/* total packets reassembled ok */
-	u_long	ips_fragmented;		/* datagrams successfully fragmented */
-	u_long	ips_ofragments;		/* output fragments created */
-	u_long	ips_cantfrag;		/* don't fragment flag was set, etc. */
-	u_long	ips_badoptions;		/* error in option processing */
-	u_long	ips_noroute;		/* packets discarded due to no route */
-	u_long	ips_badvers;		/* ip version != 4 */
-	u_long	ips_rawout;		/* total raw ip packets generated */
-	u_long	ips_toolong;		/* ip length > max ip packet size */
-	u_long	ips_notmember;		/* multicasts for unregistered grps */
-	u_long	ips_nogif;		/* no match gif found */
-	u_long	ips_badaddr;		/* invalid address on header */
+	u_int64_t	ips_total;		/* total packets received */
+	u_int64_t	ips_badsum;		/* checksum bad */
+	u_int64_t	ips_tooshort;		/* packet too short */
+	u_int64_t	ips_toosmall;		/* not enough data */
+	u_int64_t	ips_badhlen;		/* ip header length < data size */
+	u_int64_t	ips_badlen;		/* ip length < ip header length */
+	u_int64_t	ips_fragments;		/* fragments received */
+	u_int64_t	ips_fragdropped;	/* frags dropped (dups, out of space) */
+	u_int64_t	ips_fragtimeout;	/* fragments timed out */
+	u_int64_t	ips_forward;		/* packets forwarded */
+	u_int64_t	ips_fastforward;	/* packets fast forwarded */
+	u_int64_t	ips_cantforward;	/* packets rcvd for unreachable dest */
+	u_int64_t	ips_redirectsent;	/* packets forwarded on same net */
+	u_int64_t	ips_noproto;		/* unknown or unsupported protocol */
+	u_int64_t	ips_delivered;		/* datagrams delivered to upper level*/
+	u_int64_t	ips_localout;		/* total ip packets generated here */
+	u_int64_t	ips_odropped;		/* lost packets due to nobufs, etc. */
+	u_int64_t	ips_reassembled;	/* total packets reassembled ok */
+	u_int64_t	ips_fragmented;		/* datagrams successfully fragmented */
+	u_int64_t	ips_ofragments;		/* output fragments created */
+	u_int64_t	ips_cantfrag;		/* don't fragment flag was set, etc. */
+	u_int64_t	ips_badoptions;		/* error in option processing */
+	u_int64_t	ips_noroute;		/* packets discarded due to no route */
+	u_int64_t	ips_badvers;		/* ip version != 4 */
+	u_int64_t	ips_rawout;		/* total raw ip packets generated */
+	u_int64_t	ips_toolong;		/* ip length > max ip packet size */
+	u_int64_t	ips_notmember;		/* multicasts for unregistered grps */
+	u_int64_t	ips_nogif;		/* no match gif found */
+	u_int64_t	ips_badaddr;		/* invalid address on header */
 };
 
 #ifdef _KERNEL


More information about the p4-projects mailing list