xref: /freebsd/sys/netipsec/esp_var.h (revision c80211e3cf59276683fe85db8142f09fbc97e2cc)
188768458SSam Leffler /*	$FreeBSD$	*/
288768458SSam Leffler /*	$OpenBSD: ip_esp.h,v 1.37 2002/06/09 16:26:10 itojun Exp $	*/
3c398230bSWarner Losh /*-
488768458SSam Leffler  * The authors of this code are John Ioannidis (ji@tla.org),
588768458SSam Leffler  * Angelos D. Keromytis (kermit@csd.uch.gr) and
688768458SSam Leffler  * Niels Provos (provos@physnet.uni-hamburg.de).
788768458SSam Leffler  *
888768458SSam Leffler  * The original version of this code was written by John Ioannidis
988768458SSam Leffler  * for BSD/OS in Athens, Greece, in November 1995.
1088768458SSam Leffler  *
1188768458SSam Leffler  * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
1288768458SSam Leffler  * by Angelos D. Keromytis.
1388768458SSam Leffler  *
1488768458SSam Leffler  * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
1588768458SSam Leffler  * and Niels Provos.
1688768458SSam Leffler  *
1788768458SSam Leffler  * Additional features in 1999 by Angelos D. Keromytis.
1888768458SSam Leffler  *
1988768458SSam Leffler  * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
2088768458SSam Leffler  * Angelos D. Keromytis and Niels Provos.
2188768458SSam Leffler  * Copyright (c) 2001 Angelos D. Keromytis.
2288768458SSam Leffler  *
2388768458SSam Leffler  * Permission to use, copy, and modify this software with or without fee
2488768458SSam Leffler  * is hereby granted, provided that this entire notice is included in
2588768458SSam Leffler  * all copies of any software which is or includes a copy or
2688768458SSam Leffler  * modification of this software.
2788768458SSam Leffler  * You may use this code under the GNU public license if you so wish. Please
2888768458SSam Leffler  * contribute changes back to the authors under this freer than GPL license
2988768458SSam Leffler  * so that we may further the use of strong encryption without limitations to
3088768458SSam Leffler  * all.
3188768458SSam Leffler  *
3288768458SSam Leffler  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
3388768458SSam Leffler  * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
3488768458SSam Leffler  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
3588768458SSam Leffler  * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
3688768458SSam Leffler  * PURPOSE.
3788768458SSam Leffler  */
3888768458SSam Leffler 
3988768458SSam Leffler #ifndef _NETIPSEC_ESP_VAR_H_
4088768458SSam Leffler #define _NETIPSEC_ESP_VAR_H_
4188768458SSam Leffler 
4288768458SSam Leffler /*
4388768458SSam Leffler  * These define the algorithm indices into the histogram.  They're
4488768458SSam Leffler  * presently based on the PF_KEY v2 protocol values which is bogus;
4588768458SSam Leffler  * they should be decoupled from the protocol at which time we can
4688768458SSam Leffler  * pack them and reduce the size of the array to a reasonable value.
4788768458SSam Leffler  */
4888768458SSam Leffler #define	ESP_ALG_MAX	256		/* NB: could be < but skipjack is 249 */
4988768458SSam Leffler 
5088768458SSam Leffler struct espstat {
51*c80211e3SAndrey V. Elsukov 	uint64_t	esps_hdrops;	/* Packet shorter than header shows */
52*c80211e3SAndrey V. Elsukov 	uint64_t	esps_nopf;	/* Protocol family not supported */
53*c80211e3SAndrey V. Elsukov 	uint64_t	esps_notdb;
54*c80211e3SAndrey V. Elsukov 	uint64_t	esps_badkcr;
55*c80211e3SAndrey V. Elsukov 	uint64_t	esps_qfull;
56*c80211e3SAndrey V. Elsukov 	uint64_t	esps_noxform;
57*c80211e3SAndrey V. Elsukov 	uint64_t	esps_badilen;
58*c80211e3SAndrey V. Elsukov 	uint64_t	esps_wrap;	/* Replay counter wrapped around */
59*c80211e3SAndrey V. Elsukov 	uint64_t	esps_badenc;	/* Bad encryption detected */
60*c80211e3SAndrey V. Elsukov 	uint64_t	esps_badauth;	/* Only valid for transforms with auth */
61*c80211e3SAndrey V. Elsukov 	uint64_t	esps_replay;	/* Possible packet replay detected */
62*c80211e3SAndrey V. Elsukov 	uint64_t	esps_input;	/* Input ESP packets */
63*c80211e3SAndrey V. Elsukov 	uint64_t	esps_output;	/* Output ESP packets */
64*c80211e3SAndrey V. Elsukov 	uint64_t	esps_invalid;	/* Trying to use an invalid TDB */
65*c80211e3SAndrey V. Elsukov 	uint64_t	esps_ibytes;	/* Input bytes */
66*c80211e3SAndrey V. Elsukov 	uint64_t	esps_obytes;	/* Output bytes */
67*c80211e3SAndrey V. Elsukov 	uint64_t	esps_toobig;	/* Packet got larger than IP_MAXPACKET */
68*c80211e3SAndrey V. Elsukov 	uint64_t	esps_pdrops;	/* Packet blocked due to policy */
69*c80211e3SAndrey V. Elsukov 	uint64_t	esps_crypto;	/* Crypto processing failure */
70*c80211e3SAndrey V. Elsukov 	uint64_t	esps_tunnel;	/* Tunnel sanity check failure */
71*c80211e3SAndrey V. Elsukov 	uint64_t	esps_hist[ESP_ALG_MAX];	/* Per-algorithm op count */
7288768458SSam Leffler };
7388768458SSam Leffler 
7488768458SSam Leffler #ifdef _KERNEL
75eddfbb76SRobert Watson VNET_DECLARE(int, esp_enable);
76eddfbb76SRobert Watson VNET_DECLARE(struct espstat, espstat);
7782cea7e6SBjoern A. Zeeb 
78a04d64d8SAndrey V. Elsukov #define	ESPSTAT_ADD(name, val)	V_espstat.name += (val)
79a04d64d8SAndrey V. Elsukov #define	ESPSTAT_INC(name)	ESPSTAT_ADD(name, 1)
8082cea7e6SBjoern A. Zeeb #define	V_esp_enable	VNET(esp_enable)
811e77c105SRobert Watson #define	V_espstat	VNET(espstat)
8288768458SSam Leffler #endif /* _KERNEL */
8388768458SSam Leffler #endif /*_NETIPSEC_ESP_VAR_H_*/
84