From owner-p4-projects@FreeBSD.ORG Thu Jul 30 20:39:59 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 93DE81065673; Thu, 30 Jul 2009 20:39:59 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53C19106566B for ; Thu, 30 Jul 2009 20:39:59 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 41A298FC0C for ; Thu, 30 Jul 2009 20:39:59 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n6UKdwFR020998 for ; Thu, 30 Jul 2009 20:39:58 GMT (envelope-from pgj@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n6UKdwEp020996 for perforce@freebsd.org; Thu, 30 Jul 2009 20:39:58 GMT (envelope-from pgj@FreeBSD.org) Date: Thu, 30 Jul 2009 20:39:58 GMT Message-Id: <200907302039.n6UKdwEp020996@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to pgj@FreeBSD.org using -f From: Gabor Pali To: Perforce Change Reviews Cc: Subject: PERFORCE change 166834 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2009 20:40:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=166834 Change 166834 by pgj@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 #include +#include #include #include @@ -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 {