ipsec.h revision 120585
1206360Sjoel/* $FreeBSD: head/sys/netipsec/ipsec.h 120585 2003-09-29 22:57:43Z sam $ */ 2215800Szec/* $KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $ */ 3182734Sjulian 4182734Sjulian/* 5182734Sjulian * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6182734Sjulian * All rights reserved. 7182734Sjulian * 8182734Sjulian * Redistribution and use in source and binary forms, with or without 9182734Sjulian * modification, are permitted provided that the following conditions 10182734Sjulian * are met: 11182734Sjulian * 1. Redistributions of source code must retain the above copyright 12182734Sjulian * notice, this list of conditions and the following disclaimer. 13182734Sjulian * 2. Redistributions in binary form must reproduce the above copyright 14182734Sjulian * notice, this list of conditions and the following disclaimer in the 15182734Sjulian * documentation and/or other materials provided with the distribution. 16182734Sjulian * 3. Neither the name of the project nor the names of its contributors 17182734Sjulian * may be used to endorse or promote products derived from this software 18182734Sjulian * without specific prior written permission. 19182734Sjulian * 20182734Sjulian * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 21182734Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22182734Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23182734Sjulian * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 24182734Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25182734Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26182734Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27182734Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28182734Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29182734Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30182734Sjulian * SUCH DAMAGE. 31182734Sjulian */ 32182734Sjulian 33182734Sjulian/* 34182734Sjulian * IPsec controller part. 35182734Sjulian */ 36182734Sjulian 37182734Sjulian#ifndef _NETIPSEC_IPSEC_H_ 38182734Sjulian#define _NETIPSEC_IPSEC_H_ 39182734Sjulian 40182734Sjulian#if defined(_KERNEL) && !defined(_LKM) && !defined(KLD_MODULE) 41182734Sjulian#include "opt_inet.h" 42182734Sjulian#include "opt_ipsec.h" 43182734Sjulian#endif 44182734Sjulian 45182734Sjulian#include <net/pfkeyv2.h> 46182734Sjulian#include <netipsec/keydb.h> 47182734Sjulian#include <netipsec/ipsec_osdep.h> 48182734Sjulian 49182734Sjulian#ifdef _KERNEL 50182734Sjulian 51182734Sjulian/* 52196019Srwatson * Security Policy Index 53196019Srwatson * Ensure that both address families in the "src" and "dst" are same. 54182734Sjulian * When the value of the ul_proto is ICMPv6, the port field in "src" 55182734Sjulian * specifies ICMPv6 type, and the port field in "dst" specifies ICMPv6 code. 56182734Sjulian */ 57182734Sjulianstruct secpolicyindex { 58182734Sjulian u_int8_t dir; /* direction of packet flow, see blow */ 59182734Sjulian union sockaddr_union src; /* IP src address for SP */ 60182734Sjulian union sockaddr_union dst; /* IP dst address for SP */ 61182734Sjulian u_int8_t prefs; /* prefix length in bits for src */ 62182734Sjulian u_int8_t prefd; /* prefix length in bits for dst */ 63182734Sjulian u_int16_t ul_proto; /* upper layer Protocol */ 64182734Sjulian#ifdef notyet 65182734Sjulian uid_t uids; 66182734Sjulian uid_t uidd; 67182734Sjulian gid_t gids; 68182734Sjulian gid_t gidd; 69182734Sjulian#endif 70182734Sjulian}; 71182734Sjulian 72182734Sjulian/* Security Policy Data Base */ 73182734Sjulianstruct secpolicy { 74182734Sjulian LIST_ENTRY(secpolicy) chain; 75182734Sjulian struct mtx lock; 76182734Sjulian 77182734Sjulian u_int refcnt; /* reference count */ 78182734Sjulian struct secpolicyindex spidx; /* selector */ 79182734Sjulian u_int32_t id; /* It's unique number on the system. */ 80182734Sjulian u_int state; /* 0: dead, others: alive */ 81182734Sjulian#define IPSEC_SPSTATE_DEAD 0 82182734Sjulian#define IPSEC_SPSTATE_ALIVE 1 83182734Sjulian u_int16_t policy; /* policy_type per pfkeyv2.h */ 84182734Sjulian u_int16_t scangen; /* scan generation # */ 85182734Sjulian struct ipsecrequest *req; 86182734Sjulian /* pointer to the ipsec request tree, */ 87182734Sjulian /* if policy == IPSEC else this value == NULL.*/ 88182734Sjulian 89182734Sjulian /* 90182734Sjulian * lifetime handler. 91182734Sjulian * the policy can be used without limitiation if both lifetime and 92182734Sjulian * validtime are zero. 93182734Sjulian * "lifetime" is passed by sadb_lifetime.sadb_lifetime_addtime. 94182734Sjulian * "validtime" is passed by sadb_lifetime.sadb_lifetime_usetime. 95182734Sjulian */ 96182734Sjulian time_t created; /* time created the policy */ 97182734Sjulian time_t lastused; /* updated every when kernel sends a packet */ 98182734Sjulian long lifetime; /* duration of the lifetime of this policy */ 99182734Sjulian long validtime; /* duration this policy is valid without use */ 100182734Sjulian}; 101182734Sjulian 102182734Sjulian#define SECPOLICY_LOCK_INIT(_sp) \ 103215800Szec mtx_init(&(_sp)->lock, "ipsec policy", NULL, MTX_DEF) 104215800Szec#define SECPOLICY_LOCK(_sp) mtx_lock(&(_sp)->lock) 105182734Sjulian#define SECPOLICY_UNLOCK(_sp) mtx_unlock(&(_sp)->lock) 106182734Sjulian#define SECPOLICY_LOCK_DESTROY(_sp) mtx_destroy(&(_sp)->lock) 107182734Sjulian#define SECPOLICY_LOCK_ASSERT(_sp) mtx_assert(&(_sp)->lock, MA_OWNED) 108182734Sjulian 109182734Sjulian/* Request for IPsec */ 110182734Sjulianstruct ipsecrequest { 111182734Sjulian struct ipsecrequest *next; 112182734Sjulian /* pointer to next structure */ 113182734Sjulian /* If NULL, it means the end of chain. */ 114182734Sjulian struct secasindex saidx;/* hint for search proper SA */ 115182734Sjulian /* if __ss_len == 0 then no address specified.*/ 116182734Sjulian u_int level; /* IPsec level defined below. */ 117182734Sjulian 118182734Sjulian struct secasvar *sav; /* place holder of SA for use */ 119182734Sjulian struct secpolicy *sp; /* back pointer to SP */ 120182734Sjulian struct mtx lock; /* to interlock updates */ 121182734Sjulian}; 122182734Sjulian 123182734Sjulian/* 124182734Sjulian * Need recursion for when crypto callbacks happen directly, 125182734Sjulian * as in the case of software crypto. Need to look at how 126182734Sjulian * hard it is to remove this... 127182734Sjulian */ 128182734Sjulian#define IPSECREQUEST_LOCK_INIT(_isr) \ 129182734Sjulian mtx_init(&(_isr)->lock, "ipsec request", NULL, MTX_DEF | MTX_RECURSE) 130182734Sjulian#define IPSECREQUEST_LOCK(_isr) mtx_lock(&(_isr)->lock) 131182734Sjulian#define IPSECREQUEST_UNLOCK(_isr) mtx_unlock(&(_isr)->lock) 132182734Sjulian#define IPSECREQUEST_LOCK_DESTROY(_isr) mtx_destroy(&(_isr)->lock) 133215800Szec#define IPSECREQUEST_LOCK_ASSERT(_isr) mtx_assert(&(_isr)->lock, MA_OWNED) 134182734Sjulian 135182734Sjulian/* security policy in PCB */ 136182734Sjulianstruct inpcbpolicy { 137182734Sjulian struct secpolicy *sp_in; 138182734Sjulian struct secpolicy *sp_out; 139182734Sjulian int priv; /* privileged socket ? */ 140182734Sjulian}; 141182734Sjulian 142182734Sjulian/* SP acquiring list table. */ 143182734Sjulianstruct secspacq { 144182734Sjulian LIST_ENTRY(secspacq) chain; 145182734Sjulian 146182734Sjulian struct secpolicyindex spidx; 147182734Sjulian 148182734Sjulian time_t created; /* for lifetime */ 149182734Sjulian int count; /* for lifetime */ 150182734Sjulian /* XXX: here is mbuf place holder to be sent ? */ 151182734Sjulian}; 152182734Sjulian#endif /* _KERNEL */ 153182734Sjulian 154182734Sjulian/* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */ 155182734Sjulian#define IPSEC_PORT_ANY 0 156182734Sjulian#define IPSEC_ULPROTO_ANY 255 157182734Sjulian#define IPSEC_PROTO_ANY 255 158182734Sjulian 159182734Sjulian/* mode of security protocol */ 160182734Sjulian/* NOTE: DON'T use IPSEC_MODE_ANY at SPD. It's only use in SAD */ 161182734Sjulian#define IPSEC_MODE_ANY 0 /* i.e. wildcard. */ 162182734Sjulian#define IPSEC_MODE_TRANSPORT 1 163182734Sjulian#define IPSEC_MODE_TUNNEL 2 164182734Sjulian 165182734Sjulian/* 166182734Sjulian * Direction of security policy. 167182734Sjulian * NOTE: Since INVALID is used just as flag. 168182734Sjulian * The other are used for loop counter too. 169182734Sjulian */ 170182734Sjulian#define IPSEC_DIR_ANY 0 171182734Sjulian#define IPSEC_DIR_INBOUND 1 172182734Sjulian#define IPSEC_DIR_OUTBOUND 2 173182734Sjulian#define IPSEC_DIR_MAX 3 174182734Sjulian#define IPSEC_DIR_INVALID 4 175182734Sjulian 176182734Sjulian/* Policy level */ 177182734Sjulian/* 178182734Sjulian * IPSEC, ENTRUST and BYPASS are allowed for setsockopt() in PCB, 179182734Sjulian * DISCARD, IPSEC and NONE are allowed for setkey() in SPD. 180182734Sjulian * DISCARD and NONE are allowed for system default. 181182734Sjulian */ 182182734Sjulian#define IPSEC_POLICY_DISCARD 0 /* discarding packet */ 183182734Sjulian#define IPSEC_POLICY_NONE 1 /* through IPsec engine */ 184182734Sjulian#define IPSEC_POLICY_IPSEC 2 /* do IPsec */ 185182734Sjulian#define IPSEC_POLICY_ENTRUST 3 /* consulting SPD if present. */ 186182734Sjulian#define IPSEC_POLICY_BYPASS 4 /* only for privileged socket. */ 187182734Sjulian 188182734Sjulian/* Security protocol level */ 189182734Sjulian#define IPSEC_LEVEL_DEFAULT 0 /* reference to system default */ 190182734Sjulian#define IPSEC_LEVEL_USE 1 /* use SA if present. */ 191182734Sjulian#define IPSEC_LEVEL_REQUIRE 2 /* require SA. */ 192182734Sjulian#define IPSEC_LEVEL_UNIQUE 3 /* unique SA. */ 193182734Sjulian 194182734Sjulian#define IPSEC_MANUAL_REQID_MAX 0x3fff 195182734Sjulian /* 196182734Sjulian * if security policy level == unique, this id 197182734Sjulian * indicate to a relative SA for use, else is 198182734Sjulian * zero. 199182734Sjulian * 1 - 0x3fff are reserved for manual keying. 200182734Sjulian * 0 are reserved for above reason. Others is 201182734Sjulian * for kernel use. 202182734Sjulian * Note that this id doesn't identify SA 203182734Sjulian * by only itself. 204182734Sjulian */ 205182734Sjulian#define IPSEC_REPLAYWSIZE 32 206182734Sjulian 207182734Sjulian/* old statistics for ipsec processing */ 208182734Sjulianstruct ipsecstat { 209182734Sjulian u_quad_t in_success; /* succeeded inbound process */ 210182734Sjulian u_quad_t in_polvio; 211182734Sjulian /* security policy violation for inbound process */ 212182734Sjulian u_quad_t in_nosa; /* inbound SA is unavailable */ 213182734Sjulian u_quad_t in_inval; /* inbound processing failed due to EINVAL */ 214182734Sjulian u_quad_t in_nomem; /* inbound processing failed due to ENOBUFS */ 215182734Sjulian u_quad_t in_badspi; /* failed getting a SPI */ 216182734Sjulian u_quad_t in_ahreplay; /* AH replay check failed */ 217182734Sjulian u_quad_t in_espreplay; /* ESP replay check failed */ 218182734Sjulian u_quad_t in_ahauthsucc; /* AH authentication success */ 219182734Sjulian u_quad_t in_ahauthfail; /* AH authentication failure */ 220182734Sjulian u_quad_t in_espauthsucc; /* ESP authentication success */ 221182734Sjulian u_quad_t in_espauthfail; /* ESP authentication failure */ 222182734Sjulian u_quad_t in_esphist[256]; 223182734Sjulian u_quad_t in_ahhist[256]; 224182734Sjulian u_quad_t in_comphist[256]; 225182734Sjulian u_quad_t out_success; /* succeeded outbound process */ 226182734Sjulian u_quad_t out_polvio; 227182734Sjulian /* security policy violation for outbound process */ 228182734Sjulian u_quad_t out_nosa; /* outbound SA is unavailable */ 229182734Sjulian u_quad_t out_inval; /* outbound process failed due to EINVAL */ 230182734Sjulian u_quad_t out_nomem; /* inbound processing failed due to ENOBUFS */ 231182734Sjulian u_quad_t out_noroute; /* there is no route */ 232182734Sjulian u_quad_t out_esphist[256]; 233182734Sjulian u_quad_t out_ahhist[256]; 234182734Sjulian u_quad_t out_comphist[256]; 235182734Sjulian}; 236182734Sjulian 237182734Sjulian/* statistics for ipsec processing */ 238182734Sjulianstruct newipsecstat { 239182734Sjulian u_int32_t ips_in_polvio; /* input: sec policy violation */ 240182734Sjulian u_int32_t ips_out_polvio; /* output: sec policy violation */ 241182734Sjulian u_int32_t ips_out_nosa; /* output: SA unavailable */ 242182734Sjulian u_int32_t ips_out_nomem; /* output: no memory available */ 243182734Sjulian u_int32_t ips_out_noroute; /* output: no route available */ 244182734Sjulian u_int32_t ips_out_inval; /* output: generic error */ 245182734Sjulian u_int32_t ips_out_bundlesa; /* output: bundled SA processed */ 246182734Sjulian u_int32_t ips_mbcoalesced; /* mbufs coalesced during clone */ 247182734Sjulian u_int32_t ips_clcoalesced; /* clusters coalesced during clone */ 248182734Sjulian u_int32_t ips_clcopied; /* clusters copied during clone */ 249182734Sjulian u_int32_t ips_mbinserted; /* mbufs inserted during makespace */ 250182734Sjulian /* 251182734Sjulian * Temporary statistics for performance analysis. 252182734Sjulian */ 253182734Sjulian /* See where ESP/AH/IPCOMP header land in mbuf on input */ 254182734Sjulian u_int32_t ips_input_front; 255182734Sjulian u_int32_t ips_input_middle; 256220768Sglebius u_int32_t ips_input_end; 257182734Sjulian}; 258182734Sjulian 259215800Szec/* 260215800Szec * Definitions for IPsec & Key sysctl operations. 261215800Szec */ 262215800Szec/* 263215800Szec * Names for IPsec & Key sysctl objects 264182734Sjulian */ 265182734Sjulian#define IPSECCTL_STATS 1 /* stats */ 266182734Sjulian#define IPSECCTL_DEF_POLICY 2 267182734Sjulian#define IPSECCTL_DEF_ESP_TRANSLEV 3 /* int; ESP transport mode */ 268182734Sjulian#define IPSECCTL_DEF_ESP_NETLEV 4 /* int; ESP tunnel mode */ 269182734Sjulian#define IPSECCTL_DEF_AH_TRANSLEV 5 /* int; AH transport mode */ 270182734Sjulian#define IPSECCTL_DEF_AH_NETLEV 6 /* int; AH tunnel mode */ 271182734Sjulian#if 0 /* obsolete, do not reuse */ 272182734Sjulian#define IPSECCTL_INBOUND_CALL_IKE 7 273182734Sjulian#endif 274182734Sjulian#define IPSECCTL_AH_CLEARTOS 8 275182734Sjulian#define IPSECCTL_AH_OFFSETMASK 9 276182734Sjulian#define IPSECCTL_DFBIT 10 277182734Sjulian#define IPSECCTL_ECN 11 278182734Sjulian#define IPSECCTL_DEBUG 12 279182734Sjulian#define IPSECCTL_ESP_RANDPAD 13 280182734Sjulian#define IPSECCTL_MAXID 14 281182734Sjulian 282182734Sjulian#define IPSECCTL_NAMES { \ 283182734Sjulian { 0, 0 }, \ 284182734Sjulian { 0, 0 }, \ 285182734Sjulian { "def_policy", CTLTYPE_INT }, \ 286182734Sjulian { "esp_trans_deflev", CTLTYPE_INT }, \ 287182734Sjulian { "esp_net_deflev", CTLTYPE_INT }, \ 288182734Sjulian { "ah_trans_deflev", CTLTYPE_INT }, \ 289182734Sjulian { "ah_net_deflev", CTLTYPE_INT }, \ 290182734Sjulian { 0, 0 }, \ 291182734Sjulian { "ah_cleartos", CTLTYPE_INT }, \ 292182734Sjulian { "ah_offsetmask", CTLTYPE_INT }, \ 293182734Sjulian { "dfbit", CTLTYPE_INT }, \ 294182734Sjulian { "ecn", CTLTYPE_INT }, \ 295182734Sjulian { "debug", CTLTYPE_INT }, \ 296182734Sjulian { "esp_randpad", CTLTYPE_INT }, \ 297182734Sjulian} 298182734Sjulian 299182734Sjulian#define IPSEC6CTL_NAMES { \ 300182734Sjulian { 0, 0 }, \ 301222257Szec { 0, 0 }, \ 302182734Sjulian { "def_policy", CTLTYPE_INT }, \ 303182734Sjulian { "esp_trans_deflev", CTLTYPE_INT }, \ 304182734Sjulian { "esp_net_deflev", CTLTYPE_INT }, \ 305182734Sjulian { "ah_trans_deflev", CTLTYPE_INT }, \ 306222257Szec { "ah_net_deflev", CTLTYPE_INT }, \ 307182734Sjulian { 0, 0 }, \ 308182734Sjulian { 0, 0 }, \ 309182734Sjulian { 0, 0 }, \ 310182734Sjulian { 0, 0 }, \ 311182734Sjulian { "ecn", CTLTYPE_INT }, \ 312182734Sjulian { "debug", CTLTYPE_INT }, \ 313182734Sjulian { "esp_randpad", CTLTYPE_INT }, \ 314182734Sjulian} 315182734Sjulian 316182734Sjulian#ifdef _KERNEL 317182734Sjulianstruct ipsec_output_state { 318182734Sjulian struct mbuf *m; 319182734Sjulian struct route *ro; 320182734Sjulian struct sockaddr *dst; 321182734Sjulian}; 322215800Szec 323182734Sjulianstruct ipsec_history { 324182734Sjulian int ih_proto; 325182734Sjulian u_int32_t ih_spi; 326182734Sjulian}; 327182734Sjulian 328182734Sjulianextern int ipsec_debug; 329182734Sjulian 330182734Sjulianextern struct newipsecstat newipsecstat; 331182734Sjulianextern struct secpolicy ip4_def_policy; 332182734Sjulianextern int ip4_esp_trans_deflev; 333182734Sjulianextern int ip4_esp_net_deflev; 334182734Sjulianextern int ip4_ah_trans_deflev; 335182734Sjulianextern int ip4_ah_net_deflev; 336182734Sjulianextern int ip4_ah_cleartos; 337182734Sjulianextern int ip4_ah_offsetmask; 338182734Sjulianextern int ip4_ipsec_dfbit; 339182734Sjulianextern int ip4_ipsec_ecn; 340182734Sjulianextern int ip4_esp_randpad; 341215800Szecextern int crypto_support; 342182734Sjulian 343182734Sjulian#define ipseclog(x) do { if (ipsec_debug) log x; } while (0) 344182734Sjulian/* for openbsd compatibility */ 345182734Sjulian#define DPRINTF(x) do { if (ipsec_debug) printf x; } while (0) 346182734Sjulian 347182734Sjulianextern struct ipsecrequest *ipsec_newisr(void); 348182734Sjulianextern void ipsec_delisr(struct ipsecrequest *); 349182734Sjulian 350182734Sjulianstruct tdb_ident; 351182734Sjulianextern struct secpolicy *ipsec_getpolicy __P((struct tdb_ident*, u_int)); 352182734Sjulianstruct inpcb; 353215800Szecextern struct secpolicy *ipsec4_checkpolicy __P((struct mbuf *, u_int, u_int, 354182734Sjulian int *, struct inpcb *)); 355182734Sjulianextern struct secpolicy *ipsec_getpolicybysock(struct mbuf *, u_int, 356182734Sjulian struct inpcb *, int *); 357182734Sjulianextern struct secpolicy * ipsec_getpolicybyaddr(struct mbuf *, u_int, 358182734Sjulian int, int *); 359182734Sjulian 360182734Sjulianstruct inpcb; 361182734Sjulianextern int ipsec_init_policy __P((struct socket *so, struct inpcbpolicy **)); 362182734Sjulianextern int ipsec_copy_policy 363182734Sjulian __P((struct inpcbpolicy *, struct inpcbpolicy *)); 364182734Sjulianextern u_int ipsec_get_reqlevel __P((struct ipsecrequest *)); 365182734Sjulianextern int ipsec_in_reject __P((struct secpolicy *, struct mbuf *)); 366182734Sjulian 367182734Sjulianextern int ipsec4_set_policy __P((struct inpcb *inp, int optname, 368182734Sjulian caddr_t request, size_t len, int priv)); 369182734Sjulianextern int ipsec4_get_policy __P((struct inpcb *inpcb, caddr_t request, 370215800Szec size_t len, struct mbuf **mp)); 371182734Sjulianextern int ipsec4_delete_pcbpolicy __P((struct inpcb *)); 372182734Sjulianextern int ipsec4_in_reject __P((struct mbuf *, struct inpcb *)); 373182734Sjulian 374182734Sjulianstruct secas; 375182734Sjulianstruct tcpcb; 376182734Sjulianextern int ipsec_chkreplay __P((u_int32_t, struct secasvar *)); 377182734Sjulianextern int ipsec_updatereplay __P((u_int32_t, struct secasvar *)); 378182734Sjulian 379182734Sjulianextern size_t ipsec4_hdrsiz __P((struct mbuf *, u_int, struct inpcb *)); 380182734Sjulianextern size_t ipsec_hdrsiz_tcp __P((struct tcpcb *)); 381182734Sjulian 382182734Sjulianunion sockaddr_union; 383182734Sjulianextern char * ipsec_address(union sockaddr_union* sa); 384182734Sjulianextern const char *ipsec_logsastr __P((struct secasvar *)); 385182734Sjulian 386182734Sjulianextern void ipsec_dumpmbuf __P((struct mbuf *)); 387182734Sjulian 388182734Sjulianstruct m_tag; 389182734Sjulianextern void ah4_input(struct mbuf *m, int off); 390182734Sjulianextern void ah4_ctlinput(int cmd, struct sockaddr *sa, void *); 391182734Sjulianextern void esp4_input(struct mbuf *m, int off); 392182734Sjulianextern void esp4_ctlinput(int cmd, struct sockaddr *sa, void *); 393182734Sjulianextern void ipcomp4_input(struct mbuf *m, int off); 394182734Sjulianextern int ipsec4_common_input(struct mbuf *m, ...); 395182734Sjulianextern int ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, 396182734Sjulian int skip, int protoff, struct m_tag *mt); 397215800Szecextern int ipsec4_process_packet __P((struct mbuf *, struct ipsecrequest *, 398215800Szec int, int)); 399182734Sjulianextern int ipsec_process_done __P((struct mbuf *, struct ipsecrequest *)); 400182734Sjulian 401182734Sjulianextern struct mbuf *ipsec_copypkt __P((struct mbuf *)); 402182734Sjulian 403182734Sjulianextern void m_checkalignment(const char* where, struct mbuf *m0, 404182734Sjulian int off, int len); 405182734Sjulianextern struct mbuf *m_clone(struct mbuf *m0); 406182734Sjulianextern struct mbuf *m_makespace(struct mbuf *m0, int skip, int hlen, int *off); 407222257Szecextern caddr_t m_pad(struct mbuf *m, int n); 408222257Szecextern int m_striphdr(struct mbuf *m, int skip, int hlen); 409182734Sjulian#endif /* _KERNEL */ 410215800Szec 411182734Sjulian#ifndef _KERNEL 412215800Szecextern caddr_t ipsec_set_policy __P((char *, int)); 413222257Szecextern int ipsec_get_policylen __P((caddr_t)); 414222257Szecextern char *ipsec_dump_policy __P((caddr_t, char *)); 415222257Szec 416222257Szecextern const char *ipsec_strerror __P((void)); 417222257Szec#endif /* !_KERNEL */ 418222257Szec 419222257Szec#endif /* _NETIPSEC_IPSEC_H_ */ 420222257Szec