1105197Ssam/*	$FreeBSD$	*/
2105197Ssam/*	$KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $	*/
3105197Ssam
4139823Simp/*-
5105197Ssam * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6105197Ssam * All rights reserved.
7105197Ssam *
8105197Ssam * Redistribution and use in source and binary forms, with or without
9105197Ssam * modification, are permitted provided that the following conditions
10105197Ssam * are met:
11105197Ssam * 1. Redistributions of source code must retain the above copyright
12105197Ssam *    notice, this list of conditions and the following disclaimer.
13105197Ssam * 2. Redistributions in binary form must reproduce the above copyright
14105197Ssam *    notice, this list of conditions and the following disclaimer in the
15105197Ssam *    documentation and/or other materials provided with the distribution.
16105197Ssam * 3. Neither the name of the project nor the names of its contributors
17105197Ssam *    may be used to endorse or promote products derived from this software
18105197Ssam *    without specific prior written permission.
19105197Ssam *
20105197Ssam * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21105197Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22105197Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23105197Ssam * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24105197Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25105197Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26105197Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27105197Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28105197Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29105197Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30105197Ssam * SUCH DAMAGE.
31105197Ssam */
32105197Ssam
33105197Ssam/*
34105197Ssam * IPsec controller part.
35105197Ssam */
36105197Ssam
37105197Ssam#ifndef _NETIPSEC_IPSEC_H_
38105197Ssam#define _NETIPSEC_IPSEC_H_
39105197Ssam
40105197Ssam#if defined(_KERNEL) && !defined(_LKM) && !defined(KLD_MODULE)
41105197Ssam#include "opt_inet.h"
42105197Ssam#include "opt_ipsec.h"
43105197Ssam#endif
44105197Ssam
45105197Ssam#include <net/pfkeyv2.h>
46105197Ssam#include <netipsec/keydb.h>
47105197Ssam
48105197Ssam#ifdef _KERNEL
49105197Ssam
50179067Sgnn#define	IPSEC_ASSERT(_c,_m) KASSERT(_c, _m)
51179067Sgnn
52179067Sgnn#define	IPSEC_IS_PRIVILEGED_SO(_so) \
53179067Sgnn	((_so)->so_cred != NULL && \
54179067Sgnn	 priv_check_cred((_so)->so_cred, PRIV_NETINET_IPSEC, 0) \
55179067Sgnn	 == 0)
56179067Sgnn
57105197Ssam/*
58105197Ssam * Security Policy Index
59105197Ssam * Ensure that both address families in the "src" and "dst" are same.
60105197Ssam * When the value of the ul_proto is ICMPv6, the port field in "src"
61105197Ssam * specifies ICMPv6 type, and the port field in "dst" specifies ICMPv6 code.
62105197Ssam */
63105197Ssamstruct secpolicyindex {
64196882Spjd	u_int8_t dir;			/* direction of packet flow, see below */
65105197Ssam	union sockaddr_union src;	/* IP src address for SP */
66105197Ssam	union sockaddr_union dst;	/* IP dst address for SP */
67105197Ssam	u_int8_t prefs;			/* prefix length in bits for src */
68105197Ssam	u_int8_t prefd;			/* prefix length in bits for dst */
69105197Ssam	u_int16_t ul_proto;		/* upper layer Protocol */
70105197Ssam#ifdef notyet
71105197Ssam	uid_t uids;
72105197Ssam	uid_t uidd;
73105197Ssam	gid_t gids;
74105197Ssam	gid_t gidd;
75105197Ssam#endif
76105197Ssam};
77105197Ssam
78105197Ssam/* Security Policy Data Base */
79105197Ssamstruct secpolicy {
80105197Ssam	LIST_ENTRY(secpolicy) chain;
81119643Ssam	struct mtx lock;
82105197Ssam
83105197Ssam	u_int refcnt;			/* reference count */
84105197Ssam	struct secpolicyindex spidx;	/* selector */
85105197Ssam	u_int32_t id;			/* It's unique number on the system. */
86105197Ssam	u_int state;			/* 0: dead, others: alive */
87105197Ssam#define IPSEC_SPSTATE_DEAD	0
88105197Ssam#define IPSEC_SPSTATE_ALIVE	1
89120585Ssam	u_int16_t policy;		/* policy_type per pfkeyv2.h */
90120585Ssam	u_int16_t scangen;		/* scan generation # */
91105197Ssam	struct ipsecrequest *req;
92105197Ssam				/* pointer to the ipsec request tree, */
93105197Ssam				/* if policy == IPSEC else this value == NULL.*/
94105197Ssam
95105197Ssam	/*
96105197Ssam	 * lifetime handler.
97105197Ssam	 * the policy can be used without limitiation if both lifetime and
98105197Ssam	 * validtime are zero.
99105197Ssam	 * "lifetime" is passed by sadb_lifetime.sadb_lifetime_addtime.
100105197Ssam	 * "validtime" is passed by sadb_lifetime.sadb_lifetime_usetime.
101105197Ssam	 */
102120585Ssam	time_t created;		/* time created the policy */
103120585Ssam	time_t lastused;	/* updated every when kernel sends a packet */
104105197Ssam	long lifetime;		/* duration of the lifetime of this policy */
105105197Ssam	long validtime;		/* duration this policy is valid without use */
106105197Ssam};
107105197Ssam
108120585Ssam#define	SECPOLICY_LOCK_INIT(_sp) \
109120585Ssam	mtx_init(&(_sp)->lock, "ipsec policy", NULL, MTX_DEF)
110120585Ssam#define	SECPOLICY_LOCK(_sp)		mtx_lock(&(_sp)->lock)
111120585Ssam#define	SECPOLICY_UNLOCK(_sp)		mtx_unlock(&(_sp)->lock)
112120585Ssam#define	SECPOLICY_LOCK_DESTROY(_sp)	mtx_destroy(&(_sp)->lock)
113120585Ssam#define	SECPOLICY_LOCK_ASSERT(_sp)	mtx_assert(&(_sp)->lock, MA_OWNED)
114120585Ssam
115105197Ssam/* Request for IPsec */
116105197Ssamstruct ipsecrequest {
117105197Ssam	struct ipsecrequest *next;
118105197Ssam				/* pointer to next structure */
119105197Ssam				/* If NULL, it means the end of chain. */
120105197Ssam	struct secasindex saidx;/* hint for search proper SA */
121105197Ssam				/* if __ss_len == 0 then no address specified.*/
122105197Ssam	u_int level;		/* IPsec level defined below. */
123105197Ssam
124105197Ssam	struct secasvar *sav;	/* place holder of SA for use */
125105197Ssam	struct secpolicy *sp;	/* back pointer to SP */
126220206Sfabient	struct rwlock lock;	/* to interlock updates */
127105197Ssam};
128105197Ssam
129120585Ssam/*
130120585Ssam * Need recursion for when crypto callbacks happen directly,
131120585Ssam * as in the case of software crypto.  Need to look at how
132120585Ssam * hard it is to remove this...
133120585Ssam */
134120585Ssam#define	IPSECREQUEST_LOCK_INIT(_isr) \
135220206Sfabient	rw_init_flags(&(_isr)->lock, "ipsec request", RW_RECURSE)
136220206Sfabient#define	IPSECREQUEST_LOCK(_isr)		rw_rlock(&(_isr)->lock)
137220206Sfabient#define	IPSECREQUEST_UNLOCK(_isr)	rw_runlock(&(_isr)->lock)
138220206Sfabient#define	IPSECREQUEST_WLOCK(_isr)	rw_wlock(&(_isr)->lock)
139220206Sfabient#define	IPSECREQUEST_WUNLOCK(_isr)	rw_wunlock(&(_isr)->lock)
140220206Sfabient#define	IPSECREQUEST_UPGRADE(_isr)	rw_try_upgrade(&(_isr)->lock)
141220206Sfabient#define	IPSECREQUEST_DOWNGRADE(_isr)	rw_downgrade(&(_isr)->lock)
142220206Sfabient#define	IPSECREQUEST_LOCK_DESTROY(_isr)	rw_destroy(&(_isr)->lock)
143220206Sfabient#define	IPSECREQUEST_LOCK_ASSERT(_isr)	rw_assert(&(_isr)->lock, RA_LOCKED)
144120585Ssam
145105197Ssam/* security policy in PCB */
146105197Ssamstruct inpcbpolicy {
147105197Ssam	struct secpolicy *sp_in;
148105197Ssam	struct secpolicy *sp_out;
149105197Ssam	int priv;			/* privileged socket ? */
150105197Ssam};
151105197Ssam
152105197Ssam/* SP acquiring list table. */
153105197Ssamstruct secspacq {
154105197Ssam	LIST_ENTRY(secspacq) chain;
155105197Ssam
156105197Ssam	struct secpolicyindex spidx;
157105197Ssam
158120585Ssam	time_t created;		/* for lifetime */
159105197Ssam	int count;		/* for lifetime */
160105197Ssam	/* XXX: here is mbuf place holder to be sent ? */
161105197Ssam};
162105197Ssam#endif /* _KERNEL */
163105197Ssam
164105197Ssam/* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */
165105197Ssam#define IPSEC_PORT_ANY		0
166105197Ssam#define IPSEC_ULPROTO_ANY	255
167105197Ssam#define IPSEC_PROTO_ANY		255
168105197Ssam
169105197Ssam/* mode of security protocol */
170105197Ssam/* NOTE: DON'T use IPSEC_MODE_ANY at SPD.  It's only use in SAD */
171105197Ssam#define	IPSEC_MODE_ANY		0	/* i.e. wildcard. */
172105197Ssam#define	IPSEC_MODE_TRANSPORT	1
173105197Ssam#define	IPSEC_MODE_TUNNEL	2
174125680Sbms#define	IPSEC_MODE_TCPMD5	3	/* TCP MD5 mode */
175105197Ssam
176105197Ssam/*
177105197Ssam * Direction of security policy.
178105197Ssam * NOTE: Since INVALID is used just as flag.
179105197Ssam * The other are used for loop counter too.
180105197Ssam */
181105197Ssam#define IPSEC_DIR_ANY		0
182105197Ssam#define IPSEC_DIR_INBOUND	1
183105197Ssam#define IPSEC_DIR_OUTBOUND	2
184105197Ssam#define IPSEC_DIR_MAX		3
185105197Ssam#define IPSEC_DIR_INVALID	4
186105197Ssam
187105197Ssam/* Policy level */
188105197Ssam/*
189105197Ssam * IPSEC, ENTRUST and BYPASS are allowed for setsockopt() in PCB,
190105197Ssam * DISCARD, IPSEC and NONE are allowed for setkey() in SPD.
191105197Ssam * DISCARD and NONE are allowed for system default.
192105197Ssam */
193105197Ssam#define IPSEC_POLICY_DISCARD	0	/* discarding packet */
194105197Ssam#define IPSEC_POLICY_NONE	1	/* through IPsec engine */
195105197Ssam#define IPSEC_POLICY_IPSEC	2	/* do IPsec */
196105197Ssam#define IPSEC_POLICY_ENTRUST	3	/* consulting SPD if present. */
197105197Ssam#define IPSEC_POLICY_BYPASS	4	/* only for privileged socket. */
198105197Ssam
199105197Ssam/* Security protocol level */
200105197Ssam#define	IPSEC_LEVEL_DEFAULT	0	/* reference to system default */
201105197Ssam#define	IPSEC_LEVEL_USE		1	/* use SA if present. */
202105197Ssam#define	IPSEC_LEVEL_REQUIRE	2	/* require SA. */
203105197Ssam#define	IPSEC_LEVEL_UNIQUE	3	/* unique SA. */
204105197Ssam
205105197Ssam#define IPSEC_MANUAL_REQID_MAX	0x3fff
206105197Ssam				/*
207105197Ssam				 * if security policy level == unique, this id
208105197Ssam				 * indicate to a relative SA for use, else is
209105197Ssam				 * zero.
210105197Ssam				 * 1 - 0x3fff are reserved for manual keying.
211105197Ssam				 * 0 are reserved for above reason.  Others is
212105197Ssam				 * for kernel use.
213105197Ssam				 * Note that this id doesn't identify SA
214105197Ssam				 * by only itself.
215105197Ssam				 */
216105197Ssam#define IPSEC_REPLAYWSIZE  32
217105197Ssam
218171133Sgnn/* statistics for ipsec processing */
219105197Ssamstruct ipsecstat {
220253571Sae	uint64_t ips_in_polvio;		/* input: sec policy violation */
221253571Sae	uint64_t ips_in_nomem;		/* input: no memory available */
222253571Sae	uint64_t ips_in_inval;		/* input: generic error */
223125098Ssam
224253081Sae	uint64_t ips_out_polvio;	/* output: sec policy violation */
225253081Sae	uint64_t ips_out_nosa;		/* output: SA unavailable  */
226253081Sae	uint64_t ips_out_nomem;		/* output: no memory available */
227253081Sae	uint64_t ips_out_noroute;	/* output: no route available */
228253081Sae	uint64_t ips_out_inval;		/* output: generic error */
229253081Sae	uint64_t ips_out_bundlesa;	/* output: bundled SA processed */
230253571Sae
231253081Sae	uint64_t ips_mbcoalesced;	/* mbufs coalesced during clone */
232253081Sae	uint64_t ips_clcoalesced;	/* clusters coalesced during clone */
233253081Sae	uint64_t ips_clcopied;		/* clusters copied during clone */
234253081Sae	uint64_t ips_mbinserted;	/* mbufs inserted during makespace */
235105197Ssam	/*
236105197Ssam	 * Temporary statistics for performance analysis.
237105197Ssam	 */
238105197Ssam	/* See where ESP/AH/IPCOMP header land in mbuf on input */
239253081Sae	uint64_t ips_input_front;
240253081Sae	uint64_t ips_input_middle;
241253081Sae	uint64_t ips_input_end;
242105197Ssam};
243105197Ssam
244105197Ssam/*
245105197Ssam * Definitions for IPsec & Key sysctl operations.
246105197Ssam */
247105197Ssam/*
248105197Ssam * Names for IPsec & Key sysctl objects
249105197Ssam */
250105197Ssam#define IPSECCTL_STATS			1	/* stats */
251105197Ssam#define IPSECCTL_DEF_POLICY		2
252105197Ssam#define IPSECCTL_DEF_ESP_TRANSLEV	3	/* int; ESP transport mode */
253105197Ssam#define IPSECCTL_DEF_ESP_NETLEV		4	/* int; ESP tunnel mode */
254105197Ssam#define IPSECCTL_DEF_AH_TRANSLEV	5	/* int; AH transport mode */
255105197Ssam#define IPSECCTL_DEF_AH_NETLEV		6	/* int; AH tunnel mode */
256105197Ssam#if 0	/* obsolete, do not reuse */
257105197Ssam#define IPSECCTL_INBOUND_CALL_IKE	7
258105197Ssam#endif
259105197Ssam#define	IPSECCTL_AH_CLEARTOS		8
260105197Ssam#define	IPSECCTL_AH_OFFSETMASK		9
261105197Ssam#define	IPSECCTL_DFBIT			10
262105197Ssam#define	IPSECCTL_ECN			11
263105197Ssam#define	IPSECCTL_DEBUG			12
264105197Ssam#define	IPSECCTL_ESP_RANDPAD		13
265105197Ssam#define IPSECCTL_MAXID			14
266105197Ssam
267105197Ssam#ifdef _KERNEL
268253088Sae#include <sys/counter.h>
269253088Sae
270105197Ssamstruct ipsec_output_state {
271105197Ssam	struct mbuf *m;
272105197Ssam	struct route *ro;
273105197Ssam	struct sockaddr *dst;
274105197Ssam};
275105197Ssam
276105197Ssamstruct ipsec_history {
277105197Ssam	int ih_proto;
278105197Ssam	u_int32_t ih_spi;
279105197Ssam};
280105197Ssam
281195699SrwatsonVNET_DECLARE(int, ipsec_debug);
282195727Srwatson#define	V_ipsec_debug		VNET(ipsec_debug)
283207369Sbz
284207369Sbz#ifdef REGRESSION
285207369SbzVNET_DECLARE(int, ipsec_replay);
286207369SbzVNET_DECLARE(int, ipsec_integrity);
287207369Sbz
288207369Sbz#define	V_ipsec_replay		VNET(ipsec_replay)
289207369Sbz#define	V_ipsec_integrity	VNET(ipsec_integrity)
290207369Sbz#endif
291207369Sbz
292253088SaeVNET_PCPUSTAT_DECLARE(struct ipsecstat, ipsec4stat);
293207369SbzVNET_DECLARE(struct secpolicy, ip4_def_policy);
294207369SbzVNET_DECLARE(int, ip4_esp_trans_deflev);
295207369SbzVNET_DECLARE(int, ip4_esp_net_deflev);
296207369SbzVNET_DECLARE(int, ip4_ah_trans_deflev);
297207369SbzVNET_DECLARE(int, ip4_ah_net_deflev);
298195699SrwatsonVNET_DECLARE(int, ip4_ah_offsetmask);
299195699SrwatsonVNET_DECLARE(int, ip4_ipsec_dfbit);
300207369SbzVNET_DECLARE(int, ip4_ipsec_ecn);
301207369SbzVNET_DECLARE(int, ip4_esp_randpad);
302207369SbzVNET_DECLARE(int, crypto_support);
303207369Sbz
304253088Sae#define	IPSECSTAT_INC(name)	\
305253088Sae    VNET_PCPUSTAT_ADD(struct ipsecstat, ipsec4stat, name, 1)
306207369Sbz#define	V_ip4_def_policy	VNET(ip4_def_policy)
307195727Srwatson#define	V_ip4_esp_trans_deflev	VNET(ip4_esp_trans_deflev)
308195727Srwatson#define	V_ip4_esp_net_deflev	VNET(ip4_esp_net_deflev)
309195727Srwatson#define	V_ip4_ah_trans_deflev	VNET(ip4_ah_trans_deflev)
310195727Srwatson#define	V_ip4_ah_net_deflev	VNET(ip4_ah_net_deflev)
311207369Sbz#define	V_ip4_ah_offsetmask	VNET(ip4_ah_offsetmask)
312207369Sbz#define	V_ip4_ipsec_dfbit	VNET(ip4_ipsec_dfbit)
313195727Srwatson#define	V_ip4_ipsec_ecn		VNET(ip4_ipsec_ecn)
314195727Srwatson#define	V_ip4_esp_randpad	VNET(ip4_esp_randpad)
315195727Srwatson#define	V_crypto_support	VNET(crypto_support)
316195699Srwatson
317181803Sbz#define ipseclog(x)	do { if (V_ipsec_debug) log x; } while (0)
318105197Ssam/* for openbsd compatibility */
319181803Sbz#define	DPRINTF(x)	do { if (V_ipsec_debug) printf x; } while (0)
320105197Ssam
321119643Ssamextern	struct ipsecrequest *ipsec_newisr(void);
322119643Ssamextern	void ipsec_delisr(struct ipsecrequest *);
323119643Ssam
324105197Ssamstruct tdb_ident;
325105197Ssamextern struct secpolicy *ipsec_getpolicy __P((struct tdb_ident*, u_int));
326105197Ssamstruct inpcb;
327105197Ssamextern struct secpolicy *ipsec4_checkpolicy __P((struct mbuf *, u_int, u_int,
328105197Ssam	int *, struct inpcb *));
329105197Ssamextern struct secpolicy * ipsec_getpolicybyaddr(struct mbuf *, u_int,
330105197Ssam	int, int *);
331105197Ssam
332105197Ssamstruct inpcb;
333105197Ssamextern int ipsec_init_policy __P((struct socket *so, struct inpcbpolicy **));
334105197Ssamextern int ipsec_copy_policy
335105197Ssam	__P((struct inpcbpolicy *, struct inpcbpolicy *));
336105197Ssamextern u_int ipsec_get_reqlevel __P((struct ipsecrequest *));
337105197Ssamextern int ipsec_in_reject __P((struct secpolicy *, struct mbuf *));
338105197Ssam
339188306Sbzextern int ipsec_set_policy __P((struct inpcb *inp, int optname,
340175892Sbz	caddr_t request, size_t len, struct ucred *cred));
341188306Sbzextern int ipsec_get_policy __P((struct inpcb *inpcb, caddr_t request,
342105197Ssam	size_t len, struct mbuf **mp));
343185366Sbzextern int ipsec_delete_pcbpolicy __P((struct inpcb *));
344105197Ssamextern int ipsec4_in_reject __P((struct mbuf *, struct inpcb *));
345105197Ssam
346105197Ssamstruct secas;
347105197Ssamstruct tcpcb;
348105197Ssamextern int ipsec_chkreplay __P((u_int32_t, struct secasvar *));
349105197Ssamextern int ipsec_updatereplay __P((u_int32_t, struct secasvar *));
350105197Ssam
351188306Sbzextern size_t ipsec_hdrsiz __P((struct mbuf *, u_int, struct inpcb *));
352105197Ssamextern size_t ipsec_hdrsiz_tcp __P((struct tcpcb *));
353105197Ssam
354105197Ssamunion sockaddr_union;
355105197Ssamextern char * ipsec_address(union sockaddr_union* sa);
356105197Ssamextern const char *ipsec_logsastr __P((struct secasvar *));
357105197Ssam
358105197Ssamextern void ipsec_dumpmbuf __P((struct mbuf *));
359105197Ssam
360105197Ssamstruct m_tag;
361106680Ssamextern void ah4_input(struct mbuf *m, int off);
362120585Ssamextern void ah4_ctlinput(int cmd, struct sockaddr *sa, void *);
363106680Ssamextern void esp4_input(struct mbuf *m, int off);
364120585Ssamextern void esp4_ctlinput(int cmd, struct sockaddr *sa, void *);
365106680Ssamextern void ipcomp4_input(struct mbuf *m, int off);
366105197Ssamextern int ipsec4_common_input(struct mbuf *m, ...);
367105197Ssamextern int ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav,
368105197Ssam			int skip, int protoff, struct m_tag *mt);
369105197Ssamextern int ipsec4_process_packet __P((struct mbuf *, struct ipsecrequest *,
370105197Ssam			int, int));
371105197Ssamextern int ipsec_process_done __P((struct mbuf *, struct ipsecrequest *));
372105197Ssam
373105197Ssamextern struct mbuf *ipsec_copypkt __P((struct mbuf *));
374105197Ssam
375105197Ssamextern	void m_checkalignment(const char* where, struct mbuf *m0,
376105197Ssam		int off, int len);
377105197Ssamextern	struct mbuf *m_makespace(struct mbuf *m0, int skip, int hlen, int *off);
378105197Ssamextern	caddr_t m_pad(struct mbuf *m, int n);
379105197Ssamextern	int m_striphdr(struct mbuf *m, int skip, int hlen);
380174054Sbz
381174054Sbz#ifdef DEV_ENC
382174054Sbz#define	ENC_BEFORE	0x0001
383174054Sbz#define	ENC_AFTER	0x0002
384174054Sbz#define	ENC_IN		0x0100
385174054Sbz#define	ENC_OUT		0x0200
386174054Sbzextern	int ipsec_filter(struct mbuf **, int, int);
387174054Sbzextern	void ipsec_bpf(struct mbuf *, struct secasvar *, int, int);
388174054Sbz#endif
389105197Ssam#endif /* _KERNEL */
390105197Ssam
391105197Ssam#ifndef _KERNEL
392105197Ssamextern caddr_t ipsec_set_policy __P((char *, int));
393105197Ssamextern int ipsec_get_policylen __P((caddr_t));
394105197Ssamextern char *ipsec_dump_policy __P((caddr_t, char *));
395105197Ssam
396105197Ssamextern const char *ipsec_strerror __P((void));
397105197Ssam
398183550Szec#endif /* ! KERNEL */
399183550Szec
400105197Ssam#endif /* _NETIPSEC_IPSEC_H_ */
401