85b3ba5bf1
Attach FAST-IPSEC statistics with 64-bit counters to new sysctl MIB. Rework netstat to show FAST_IPSEC statistics, via sysctl, for netstat -p ipsec. New kernel files: sys/netipsec/Makefile (new file; install *_var.h includes) sys/netipsec/ipsec_var.h (new 64-bit mib counter struct) Changed kernel files: sys/Makefile (recurse into sys/netipsec/) sys/netinet/in.h (fake IP_PROTO name for fast_ipsec sysctl subtree.) sys/netipsec/ipsec.h (minimal userspace inclusion) sys/netipsec/ipsec_osdep.h (minimal userspace inclusion) sys/netipsec/ipsec_netbsd.c (redo sysctl subtree from scratch) sys/netipsec/key*.c (fix broken net.key subtree) sys/netipsec/ah_var.h (increase all counters to 64 bits) sys/netipsec/esp_var.h (increase all counters to 64 bits) sys/netipsec/ipip_var.h (increase all counters to 64 bits) sys/netipsec/ipcomp_var.h (increase all counters to 64 bits) sys/netipsec/ipsec.c (add #include netipsec/ipsec_var.h) sys/netipsec/ipsec_mbuf.c (add #include netipsec/ipsec_var.h) sys/netipsec/ipsec_output.c (add #include netipsec/ipsec_var.h) sys/netinet/raw_ip.c (add #include netipsec/ipsec_var.h) sys/netinet/tcp_input.c (add #include netipsec/ipsec_var.h) sys/netinet/udp_usrreq.c (add #include netipsec/ipsec_var.h) Changes to usr.bin/netstat to print the new fast-ipsec sysctl tree for "netstat -s -p ipsec": New file: usr.bin/netstat/fast_ipsec.c (print fast-ipsec counters) Changed files: usr.bin/netstat/Makefile (add fast_ipsec.c) usr.bin/netstat/netstat.h (declarations for fast_ipsec.c) usr.bin/netstat/main.c (call KAME-vs-fast-ipsec dispatcher)
132 lines
4.5 KiB
C
132 lines
4.5 KiB
C
/* $NetBSD: ipsec_var.h,v 1.1 2004/05/07 00:55:14 jonathan Exp $ */
|
|
/* $FreeBSD: src/sys/netipsec/ipsec.h,v 1.2.4.2 2004/02/14 22:23:23 bms Exp $ */
|
|
|
|
/*-
|
|
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*
|
|
* $FreeBSD: src/tools/tools/crypto/ipsecstats.c,v 1.1.4.1 2003/06/03 00:13:13 sam Exp $
|
|
*/
|
|
|
|
#ifndef _NETIPSEC_IPSEC_VAR_H_
|
|
#define _NETIPSEC_IPSEC_VAR_H_
|
|
|
|
/* statistics for ipsec processing */
|
|
struct newipsecstat {
|
|
u_int64_t ips_in_polvio; /* input: sec policy violation */
|
|
u_int64_t ips_out_polvio; /* output: sec policy violation */
|
|
u_int64_t ips_out_nosa; /* output: SA unavailable */
|
|
u_int64_t ips_out_nomem; /* output: no memory available */
|
|
u_int64_t ips_out_noroute; /* output: no route available */
|
|
u_int64_t ips_out_inval; /* output: generic error */
|
|
u_int64_t ips_out_bundlesa; /* output: bundled SA processed */
|
|
u_int64_t ips_mbcoalesced; /* mbufs coalesced during clone */
|
|
u_int64_t ips_clcoalesced; /* clusters coalesced during clone */
|
|
u_int64_t ips_clcopied; /* clusters copied during clone */
|
|
u_int64_t ips_mbinserted; /* mbufs inserted during makespace */
|
|
#ifdef __NetBSD__
|
|
u_int64_t ips_spdcache_lookup;
|
|
u_int64_t ips_spdcache_miss;
|
|
#endif /* __NetBSD__ */
|
|
|
|
/*
|
|
* Temporary statistics for performance analysis.
|
|
*/
|
|
/* See where ESP/AH/IPCOMP header land in mbuf on input */
|
|
u_int64_t ips_input_front;
|
|
u_int64_t ips_input_middle;
|
|
u_int64_t ips_input_end;
|
|
|
|
};
|
|
|
|
#ifdef _KERNEL
|
|
/*
|
|
* XXX JRS FIXME: later replace NetBSD sourcecode with an IPSECSTAT_POLVIO() macro.
|
|
* for now, map the old fields to the new fields. */
|
|
#define ipsecstat newipsecstat
|
|
|
|
#define in_polvio ips_in_polvio
|
|
#define out_polvio ips_out_polvio
|
|
#define out_inval ips_out_inval
|
|
#endif /*_KERNEL*/
|
|
|
|
/*
|
|
* Definitions for IPsec & Key sysctl operations.
|
|
*/
|
|
/*
|
|
* Names for IPsec & Key sysctl objects
|
|
*/
|
|
#define IPSECCTL_STATS 1 /* stats */
|
|
#define IPSECCTL_DEF_POLICY 2
|
|
#define IPSECCTL_DEF_ESP_TRANSLEV 3 /* int; ESP transport mode */
|
|
#define IPSECCTL_DEF_ESP_NETLEV 4 /* int; ESP tunnel mode */
|
|
#define IPSECCTL_DEF_AH_TRANSLEV 5 /* int; AH transport mode */
|
|
#define IPSECCTL_DEF_AH_NETLEV 6 /* int; AH tunnel mode */
|
|
#if 0 /* obsolete, do not reuse */
|
|
#define IPSECCTL_INBOUND_CALL_IKE 7
|
|
#endif
|
|
#define IPSECCTL_AH_CLEARTOS 8
|
|
#define IPSECCTL_AH_OFFSETMASK 9
|
|
#define IPSECCTL_DFBIT 10
|
|
#define IPSECCTL_ECN 11
|
|
#define IPSECCTL_DEBUG 12
|
|
#define IPSECCTL_ESP_RANDPAD 13
|
|
#define IPSECCTL_MAXID 14
|
|
|
|
#define IPSECCTL_NAMES { \
|
|
{ 0, 0 }, \
|
|
{ 0, 0 }, \
|
|
{ "def_policy", CTLTYPE_INT }, \
|
|
{ "esp_trans_deflev", CTLTYPE_INT }, \
|
|
{ "esp_net_deflev", CTLTYPE_INT }, \
|
|
{ "ah_trans_deflev", CTLTYPE_INT }, \
|
|
{ "ah_net_deflev", CTLTYPE_INT }, \
|
|
{ 0, 0 }, \
|
|
{ "ah_cleartos", CTLTYPE_INT }, \
|
|
{ "ah_offsetmask", CTLTYPE_INT }, \
|
|
{ "dfbit", CTLTYPE_INT }, \
|
|
{ "ecn", CTLTYPE_INT }, \
|
|
{ "debug", CTLTYPE_INT }, \
|
|
{ "esp_randpad", CTLTYPE_INT }, \
|
|
}
|
|
|
|
#define IPSEC6CTL_NAMES { \
|
|
{ 0, 0 }, \
|
|
{ 0, 0 }, \
|
|
{ "def_policy", CTLTYPE_INT }, \
|
|
{ "esp_trans_deflev", CTLTYPE_INT }, \
|
|
{ "esp_net_deflev", CTLTYPE_INT }, \
|
|
{ "ah_trans_deflev", CTLTYPE_INT }, \
|
|
{ "ah_net_deflev", CTLTYPE_INT }, \
|
|
{ 0, 0 }, \
|
|
{ 0, 0 }, \
|
|
{ 0, 0 }, \
|
|
{ 0, 0 }, \
|
|
{ "ecn", CTLTYPE_INT }, \
|
|
{ "debug", CTLTYPE_INT }, \
|
|
{ "esp_randpad", CTLTYPE_INT }, \
|
|
}
|
|
|
|
#endif /*_NETIPSEC_IPSEC_VAR_H_*/
|