2 * Copyright (c) 2007-2008 University of Zagreb
3 * Copyright (c) 2007-2008 FreeBSD Foundation
5 * This software was developed by the University of Zagreb and the
6 * FreeBSD Foundation under sponsorship by the Stichting NLnet and the
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 #ifndef _NETIPSEC_VIPSEC_H_
34 #define _NETIPSEC_VIPSEC_H_
38 #include <sys/protosw.h>
39 #include <sys/socket.h>
41 #include <netipsec/ipsec.h>
42 #include <netipsec/esp_var.h>
43 #include <netipsec/ah_var.h>
44 #include <netipsec/ipcomp_var.h>
45 #include <netipsec/ipip_var.h>
48 #include <net/if_var.h>
49 #include <net/route.h>
50 #include <net/raw_cb.h>
52 #include <netipsec/keysock.h>
56 struct ipsecstat _ipsec4stat;
57 struct secpolicy _ip4_def_policy;
59 int _ip4_esp_trans_deflev;
60 int _ip4_esp_net_deflev;
61 int _ip4_ah_trans_deflev;
62 int _ip4_ah_net_deflev;
63 int _ip4_ah_offsetmask;
72 u_int32_t _key_debug_level;
73 u_int _key_spi_trycnt;
74 u_int32_t _key_spi_minval;
75 u_int32_t _key_spi_maxval;
77 u_int _key_int_random;
78 u_int _key_larval_lifetime;
79 int _key_blockacq_count;
80 int _key_blockacq_lifetime;
81 int _key_preferred_oldsa;
84 u_int _saorder_state_alive[3];
85 u_int _saorder_state_any[4];
87 struct espstat _espstat;
89 int _ipsec_esp_keymin;
93 struct ipipstat _ipipstat;
95 struct ipsecstat _ipsec6stat;
96 int _ip6_esp_trans_deflev;
97 int _ip6_esp_net_deflev;
98 int _ip6_ah_trans_deflev;
99 int _ip6_ah_net_deflev;
101 int _ip6_esp_randpad;
105 struct ahstat _ahstat;
108 struct ipcompstat _ipcompstat;
110 struct pfkeystat _pfkeystat;
111 struct key_cb _key_cb;
112 struct sockaddr _key_dst;
113 struct sockaddr _key_src;
115 LIST_HEAD(, secpolicy) _sptree[IPSEC_DIR_MAX];
116 LIST_HEAD(, secashead) _sahtree;
117 LIST_HEAD(, secreg) _regtree[SADB_SATYPE_MAX + 1];
118 LIST_HEAD(, secacq) _acqtree;
119 LIST_HEAD(, secspacq) _spacqtree;
124 * Symbol translation macros
126 #define INIT_VNET_IPSEC(vnet) \
127 INIT_FROM_VNET(vnet, VNET_MOD_IPSEC, struct vnet_ipsec, vnet_ipsec)
129 #define VNET_IPSEC(sym) VSYM(vnet_ipsec, sym)
131 #define V_acq_seq VNET_IPSEC(acq_seq)
132 #define V_acqtree VNET_IPSEC(acqtree)
133 #define V_ah_cleartos VNET_IPSEC(ah_cleartos)
134 #define V_ah_enable VNET_IPSEC(ah_enable)
135 #define V_ahstat VNET_IPSEC(ahstat)
136 #define V_crypto_support VNET_IPSEC(crypto_support)
137 #define V_esp_enable VNET_IPSEC(esp_enable)
138 #define V_esp_max_ivlen VNET_IPSEC(esp_max_ivlen)
139 #define V_espstat VNET_IPSEC(espstat)
140 #define V_ip4_ah_net_deflev VNET_IPSEC(ip4_ah_net_deflev)
141 #define V_ip4_ah_offsetmask VNET_IPSEC(ip4_ah_offsetmask)
142 #define V_ip4_ah_trans_deflev VNET_IPSEC(ip4_ah_trans_deflev)
143 #define V_ip4_def_policy VNET_IPSEC(ip4_def_policy)
144 #define V_ip4_esp_net_deflev VNET_IPSEC(ip4_esp_net_deflev)
145 #define V_ip4_esp_randpad VNET_IPSEC(ip4_esp_randpad)
146 #define V_ip4_esp_trans_deflev VNET_IPSEC(ip4_esp_trans_deflev)
147 #define V_ip4_ipsec_dfbit VNET_IPSEC(ip4_ipsec_dfbit)
148 #define V_ip4_ipsec_ecn VNET_IPSEC(ip4_ipsec_ecn)
149 #define V_ip6_ah_net_deflev VNET_IPSEC(ip6_ah_net_deflev)
150 #define V_ip6_ah_trans_deflev VNET_IPSEC(ip6_ah_trans_deflev)
151 #define V_ip6_esp_net_deflev VNET_IPSEC(ip6_esp_net_deflev)
152 #define V_ip6_esp_randpad VNET_IPSEC(ip6_esp_randpad)
153 #define V_ip6_esp_trans_deflev VNET_IPSEC(ip6_esp_trans_deflev)
154 #define V_ip6_ipsec_ecn VNET_IPSEC(ip6_ipsec_ecn)
155 #define V_ipcomp_enable VNET_IPSEC(ipcomp_enable)
156 #define V_ipcompstat VNET_IPSEC(ipcompstat)
157 #define V_ipip_allow VNET_IPSEC(ipip_allow)
158 #define V_ipipstat VNET_IPSEC(ipipstat)
159 #define V_ipsec4stat VNET_IPSEC(ipsec4stat)
160 #define V_ipsec6stat VNET_IPSEC(ipsec6stat)
161 #define V_ipsec_ah_keymin VNET_IPSEC(ipsec_ah_keymin)
162 #define V_ipsec_debug VNET_IPSEC(ipsec_debug)
163 #define V_ipsec_esp_auth VNET_IPSEC(ipsec_esp_auth)
164 #define V_ipsec_esp_keymin VNET_IPSEC(ipsec_esp_keymin)
165 #define V_ipsec_integrity VNET_IPSEC(ipsec_integrity)
166 #define V_ipsec_replay VNET_IPSEC(ipsec_replay)
167 #define V_key_blockacq_count VNET_IPSEC(key_blockacq_count)
168 #define V_key_blockacq_lifetime VNET_IPSEC(key_blockacq_lifetime)
169 #define V_key_cb VNET_IPSEC(key_cb)
170 #define V_key_debug_level VNET_IPSEC(key_debug_level)
171 #define V_key_dst VNET_IPSEC(key_dst)
172 #define V_key_int_random VNET_IPSEC(key_int_random)
173 #define V_key_larval_lifetime VNET_IPSEC(key_larval_lifetime)
174 #define V_key_preferred_oldsa VNET_IPSEC(key_preferred_oldsa)
175 #define V_key_spi_maxval VNET_IPSEC(key_spi_maxval)
176 #define V_key_spi_minval VNET_IPSEC(key_spi_minval)
177 #define V_key_spi_trycnt VNET_IPSEC(key_spi_trycnt)
178 #define V_key_src VNET_IPSEC(key_src)
179 #define V_pfkeystat VNET_IPSEC(pfkeystat)
180 #define V_policy_id VNET_IPSEC(policy_id)
181 #define V_regtree VNET_IPSEC(regtree)
182 #define V_sahtree VNET_IPSEC(sahtree)
183 #define V_saorder_state_alive VNET_IPSEC(saorder_state_alive)
184 #define V_saorder_state_any VNET_IPSEC(saorder_state_any)
185 #define V_spacqtree VNET_IPSEC(spacqtree)
186 #define V_sptree VNET_IPSEC(sptree)
188 #endif /* !_NETIPSEC_VIPSEC_H_ */