1/*	$FreeBSD$	*/
2/*	$OpenBSD: ip_ipip.h,v 1.5 2002/06/09 16:26:10 itojun Exp $ */
3/*-
4 * The authors of this code are John Ioannidis (ji@tla.org),
5 * Angelos D. Keromytis (kermit@csd.uch.gr) and
6 * Niels Provos (provos@physnet.uni-hamburg.de).
7 *
8 * The original version of this code was written by John Ioannidis
9 * for BSD/OS in Athens, Greece, in November 1995.
10 *
11 * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
12 * by Angelos D. Keromytis.
13 *
14 * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
15 * and Niels Provos.
16 *
17 * Additional features in 1999 by Angelos D. Keromytis.
18 *
19 * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
20 * Angelos D. Keromytis and Niels Provos.
21 * Copyright (c) 2001, Angelos D. Keromytis.
22 *
23 * Permission to use, copy, and modify this software with or without fee
24 * is hereby granted, provided that this entire notice is included in
25 * all copies of any software which is or includes a copy or
26 * modification of this software.
27 * You may use this code under the GNU public license if you so wish. Please
28 * contribute changes back to the authors under this freer than GPL license
29 * so that we may further the use of strong encryption without limitations to
30 * all.
31 *
32 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
33 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
34 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
35 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
36 * PURPOSE.
37 */
38
39#ifndef _NETINET_IPIP_H_
40#define _NETINET_IPIP_H_
41
42/*
43 * IP-inside-IP processing.
44 * Not quite all the functionality of RFC-1853, but the main idea is there.
45 */
46
47struct ipipstat {
48	uint64_t	ipips_ipackets;	/* total input packets */
49	uint64_t	ipips_opackets;	/* total output packets */
50	uint64_t	ipips_hdrops;	/* packet shorter than header shows */
51	uint64_t	ipips_qfull;
52	uint64_t	ipips_ibytes;
53	uint64_t	ipips_obytes;
54	uint64_t	ipips_pdrops;	/* packet dropped due to policy */
55	uint64_t	ipips_spoof;	/* IP spoofing attempts */
56	uint64_t	ipips_family;	/* Protocol family mismatch */
57	uint64_t	ipips_unspec;   /* Missing tunnel endpoint address */
58};
59
60#ifdef _KERNEL
61#include <sys/counter.h>
62
63VNET_DECLARE(int, ipip_allow);
64VNET_PCPUSTAT_DECLARE(struct ipipstat, ipipstat);
65
66#define	IPIPSTAT_ADD(name, val)	\
67    VNET_PCPUSTAT_ADD(struct ipipstat, ipipstat, name, (val))
68#define	IPIPSTAT_INC(name)	IPIPSTAT_ADD(name, 1)
69#define	V_ipip_allow		VNET(ipip_allow)
70#endif /* _KERNEL */
71#endif /* _NETINET_IPIP_H_ */
72