PERFORCE change 166834 for review

Gabor Pali pgj at FreeBSD.org
Thu Jul 30 20:40:00 UTC 2009


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

Change 166834 by pgj at petymeg-current on 2009/07/30 20:39:19

	- Standardize and add header for pfkey statistics.
	- Expose data via sysctl(3) [net.key.stats].

Affected files ...

.. //depot/projects/soc2009/pgj_libstat/src/sys/netipsec/keysock.c#2 edit
.. //depot/projects/soc2009/pgj_libstat/src/sys/netipsec/keysock.h#2 edit

Differences ...

==== //depot/projects/soc2009/pgj_libstat/src/sys/netipsec/keysock.c#2 (text+ko) ====

@@ -59,6 +59,7 @@
 #include <net/vnet.h>
 
 #include <netinet/in.h>
+#include <netinet/tcp_var.h>
 
 #include <net/pfkeyv2.h>
 #include <netipsec/key.h>
@@ -70,6 +71,10 @@
 
 #ifdef VIMAGE_GLOBALS
 static struct key_cb key_cb;
+struct stat_header  pfkeystat_header = {
+	.sth_version = PFKEYSTAT_VERSION,
+	.sth_len = sizeof(struct pfkeystat)
+};
 struct pfkeystat pfkeystat;
 #endif
 
@@ -546,6 +551,11 @@
 /* sysctl */
 SYSCTL_NODE(_net, PF_KEY, key, CTLFLAG_RW, 0, "Key Family");
 
+SYSCTL_STRUCT(_net_key, OID_AUTO, stats, CTLFLAG_RW, &pfkeystat, pfkeystat,
+    "Key Statistics (struct pfkeystat, (netipsec/keysock.h)");
+SYSCTL_STRUCT(_net_key, OID_AUTO, stats_header, CTLFLAG_RD, &pfkeystat_header,
+    stat_header, "Key Statistics header");
+
 /*
  * Definitions of protocols supported in the KEY domain.
  */

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

@@ -34,28 +34,30 @@
 #define _NETIPSEC_KEYSOCK_H_
 
 /* statistics for pfkey socket */
+#define PFKEYSTAT_VERSION   0x00000001
+
 struct pfkeystat {
 	/* kernel -> userland */
-	u_quad_t out_total;		/* # of total calls */
-	u_quad_t out_bytes;		/* total bytecount */
-	u_quad_t out_msgtype[256];	/* message type histogram */
-	u_quad_t out_invlen;		/* invalid length field */
-	u_quad_t out_invver;		/* invalid version field */
-	u_quad_t out_invmsgtype;	/* invalid message type field */
-	u_quad_t out_tooshort;		/* msg too short */
-	u_quad_t out_nomem;		/* memory allocation failure */
-	u_quad_t out_dupext;		/* duplicate extension */
-	u_quad_t out_invexttype;	/* invalid extension type */
-	u_quad_t out_invsatype;		/* invalid sa type */
-	u_quad_t out_invaddr;		/* invalid address extension */
+	u_int64_t out_total;		/* # of total calls */
+	u_int64_t out_bytes;		/* total bytecount */
+	u_int64_t out_msgtype[256];	/* message type histogram */
+	u_int64_t out_invlen;		/* invalid length field */
+	u_int64_t out_invver;		/* invalid version field */
+	u_int64_t out_invmsgtype;	/* invalid message type field */
+	u_int64_t out_tooshort;		/* msg too short */
+	u_int64_t out_nomem;		/* memory allocation failure */
+	u_int64_t out_dupext;		/* duplicate extension */
+	u_int64_t out_invexttype;	/* invalid extension type */
+	u_int64_t out_invsatype;		/* invalid sa type */
+	u_int64_t out_invaddr;		/* invalid address extension */
 	/* userland -> kernel */
-	u_quad_t in_total;		/* # of total calls */
-	u_quad_t in_bytes;		/* total bytecount */
-	u_quad_t in_msgtype[256];	/* message type histogram */
-	u_quad_t in_msgtarget[3];	/* one/all/registered */
-	u_quad_t in_nomem;		/* memory allocation failure */
+	u_int64_t in_total;		/* # of total calls */
+	u_int64_t in_bytes;		/* total bytecount */
+	u_int64_t in_msgtype[256];	/* message type histogram */
+	u_int64_t in_msgtarget[3];	/* one/all/registered */
+	u_int64_t in_nomem;		/* memory allocation failure */
 	/* others */
-	u_quad_t sockerr;		/* # of socket related errors */
+	u_int64_t sockerr;		/* # of socket related errors */
 };
 
 struct key_cb {


More information about the p4-projects mailing list