1105197Ssam/* $FreeBSD$ */ 2105197Ssam/* $OpenBSD: ip_esp.h,v 1.37 2002/06/09 16:26:10 itojun Exp $ */ 3139823Simp/*- 4105197Ssam * The authors of this code are John Ioannidis (ji@tla.org), 5105197Ssam * Angelos D. Keromytis (kermit@csd.uch.gr) and 6105197Ssam * Niels Provos (provos@physnet.uni-hamburg.de). 7105197Ssam * 8105197Ssam * The original version of this code was written by John Ioannidis 9105197Ssam * for BSD/OS in Athens, Greece, in November 1995. 10105197Ssam * 11105197Ssam * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996, 12105197Ssam * by Angelos D. Keromytis. 13105197Ssam * 14105197Ssam * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis 15105197Ssam * and Niels Provos. 16105197Ssam * 17105197Ssam * Additional features in 1999 by Angelos D. Keromytis. 18105197Ssam * 19105197Ssam * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis, 20105197Ssam * Angelos D. Keromytis and Niels Provos. 21105197Ssam * Copyright (c) 2001 Angelos D. Keromytis. 22105197Ssam * 23105197Ssam * Permission to use, copy, and modify this software with or without fee 24105197Ssam * is hereby granted, provided that this entire notice is included in 25105197Ssam * all copies of any software which is or includes a copy or 26105197Ssam * modification of this software. 27105197Ssam * You may use this code under the GNU public license if you so wish. Please 28105197Ssam * contribute changes back to the authors under this freer than GPL license 29105197Ssam * so that we may further the use of strong encryption without limitations to 30105197Ssam * all. 31105197Ssam * 32105197Ssam * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 33105197Ssam * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 34105197Ssam * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 35105197Ssam * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 36105197Ssam * PURPOSE. 37105197Ssam */ 38105197Ssam 39105197Ssam#ifndef _NETIPSEC_ESP_VAR_H_ 40105197Ssam#define _NETIPSEC_ESP_VAR_H_ 41105197Ssam 42105197Ssam/* 43105197Ssam * These define the algorithm indices into the histogram. They're 44105197Ssam * presently based on the PF_KEY v2 protocol values which is bogus; 45105197Ssam * they should be decoupled from the protocol at which time we can 46105197Ssam * pack them and reduce the size of the array to a reasonable value. 47105197Ssam */ 48105197Ssam#define ESP_ALG_MAX 256 /* NB: could be < but skipjack is 249 */ 49105197Ssam 50105197Ssamstruct espstat { 51105197Ssam u_int32_t esps_hdrops; /* Packet shorter than header shows */ 52105197Ssam u_int32_t esps_nopf; /* Protocol family not supported */ 53105197Ssam u_int32_t esps_notdb; 54105197Ssam u_int32_t esps_badkcr; 55105197Ssam u_int32_t esps_qfull; 56105197Ssam u_int32_t esps_noxform; 57105197Ssam u_int32_t esps_badilen; 58105197Ssam u_int32_t esps_wrap; /* Replay counter wrapped around */ 59105197Ssam u_int32_t esps_badenc; /* Bad encryption detected */ 60105197Ssam u_int32_t esps_badauth; /* Only valid for transforms with auth */ 61105197Ssam u_int32_t esps_replay; /* Possible packet replay detected */ 62105197Ssam u_int32_t esps_input; /* Input ESP packets */ 63105197Ssam u_int32_t esps_output; /* Output ESP packets */ 64105197Ssam u_int32_t esps_invalid; /* Trying to use an invalid TDB */ 65105197Ssam u_int64_t esps_ibytes; /* Input bytes */ 66105197Ssam u_int64_t esps_obytes; /* Output bytes */ 67105197Ssam u_int32_t esps_toobig; /* Packet got larger than IP_MAXPACKET */ 68105197Ssam u_int32_t esps_pdrops; /* Packet blocked due to policy */ 69105197Ssam u_int32_t esps_crypto; /* Crypto processing failure */ 70105197Ssam u_int32_t esps_tunnel; /* Tunnel sanity check failure */ 71105197Ssam u_int32_t esps_hist[ESP_ALG_MAX]; /* Per-algorithm op count */ 72105197Ssam}; 73105197Ssam 74105197Ssam#ifdef _KERNEL 75195699SrwatsonVNET_DECLARE(int, esp_enable); 76207369SbzVNET_DECLARE(struct espstat, espstat); 77207369Sbz 78252693Sae#define ESPSTAT_ADD(name, val) V_espstat.name += (val) 79252693Sae#define ESPSTAT_INC(name) ESPSTAT_ADD(name, 1) 80195727Srwatson#define V_esp_enable VNET(esp_enable) 81195727Srwatson#define V_espstat VNET(espstat) 82105197Ssam#endif /* _KERNEL */ 83105197Ssam#endif /*_NETIPSEC_ESP_VAR_H_*/ 84