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