ipsec.h revision 171133
1105197Ssam/* $FreeBSD: head/sys/netipsec/ipsec.h 171133 2007-07-01 11:41:27Z gnn $ */ 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> 47120585Ssam#include <netipsec/ipsec_osdep.h> 48105197Ssam 49105197Ssam#ifdef _KERNEL 50105197Ssam 51105197Ssam/* 52105197Ssam * Security Policy Index 53105197Ssam * Ensure that both address families in the "src" and "dst" are same. 54105197Ssam * When the value of the ul_proto is ICMPv6, the port field in "src" 55105197Ssam * specifies ICMPv6 type, and the port field in "dst" specifies ICMPv6 code. 56105197Ssam */ 57105197Ssamstruct secpolicyindex { 58105197Ssam u_int8_t dir; /* direction of packet flow, see blow */ 59105197Ssam union sockaddr_union src; /* IP src address for SP */ 60105197Ssam union sockaddr_union dst; /* IP dst address for SP */ 61105197Ssam u_int8_t prefs; /* prefix length in bits for src */ 62105197Ssam u_int8_t prefd; /* prefix length in bits for dst */ 63105197Ssam u_int16_t ul_proto; /* upper layer Protocol */ 64105197Ssam#ifdef notyet 65105197Ssam uid_t uids; 66105197Ssam uid_t uidd; 67105197Ssam gid_t gids; 68105197Ssam gid_t gidd; 69105197Ssam#endif 70105197Ssam}; 71105197Ssam 72105197Ssam/* Security Policy Data Base */ 73105197Ssamstruct secpolicy { 74105197Ssam LIST_ENTRY(secpolicy) chain; 75119643Ssam struct mtx lock; 76105197Ssam 77105197Ssam u_int refcnt; /* reference count */ 78105197Ssam struct secpolicyindex spidx; /* selector */ 79105197Ssam u_int32_t id; /* It's unique number on the system. */ 80105197Ssam u_int state; /* 0: dead, others: alive */ 81105197Ssam#define IPSEC_SPSTATE_DEAD 0 82105197Ssam#define IPSEC_SPSTATE_ALIVE 1 83120585Ssam u_int16_t policy; /* policy_type per pfkeyv2.h */ 84120585Ssam u_int16_t scangen; /* scan generation # */ 85105197Ssam struct ipsecrequest *req; 86105197Ssam /* pointer to the ipsec request tree, */ 87105197Ssam /* if policy == IPSEC else this value == NULL.*/ 88105197Ssam 89105197Ssam /* 90105197Ssam * lifetime handler. 91105197Ssam * the policy can be used without limitiation if both lifetime and 92105197Ssam * validtime are zero. 93105197Ssam * "lifetime" is passed by sadb_lifetime.sadb_lifetime_addtime. 94105197Ssam * "validtime" is passed by sadb_lifetime.sadb_lifetime_usetime. 95105197Ssam */ 96120585Ssam time_t created; /* time created the policy */ 97120585Ssam time_t lastused; /* updated every when kernel sends a packet */ 98105197Ssam long lifetime; /* duration of the lifetime of this policy */ 99105197Ssam long validtime; /* duration this policy is valid without use */ 100105197Ssam}; 101105197Ssam 102120585Ssam#define SECPOLICY_LOCK_INIT(_sp) \ 103120585Ssam mtx_init(&(_sp)->lock, "ipsec policy", NULL, MTX_DEF) 104120585Ssam#define SECPOLICY_LOCK(_sp) mtx_lock(&(_sp)->lock) 105120585Ssam#define SECPOLICY_UNLOCK(_sp) mtx_unlock(&(_sp)->lock) 106120585Ssam#define SECPOLICY_LOCK_DESTROY(_sp) mtx_destroy(&(_sp)->lock) 107120585Ssam#define SECPOLICY_LOCK_ASSERT(_sp) mtx_assert(&(_sp)->lock, MA_OWNED) 108120585Ssam 109105197Ssam/* Request for IPsec */ 110105197Ssamstruct ipsecrequest { 111105197Ssam struct ipsecrequest *next; 112105197Ssam /* pointer to next structure */ 113105197Ssam /* If NULL, it means the end of chain. */ 114105197Ssam struct secasindex saidx;/* hint for search proper SA */ 115105197Ssam /* if __ss_len == 0 then no address specified.*/ 116105197Ssam u_int level; /* IPsec level defined below. */ 117105197Ssam 118105197Ssam struct secasvar *sav; /* place holder of SA for use */ 119105197Ssam struct secpolicy *sp; /* back pointer to SP */ 120119643Ssam struct mtx lock; /* to interlock updates */ 121105197Ssam}; 122105197Ssam 123120585Ssam/* 124120585Ssam * Need recursion for when crypto callbacks happen directly, 125120585Ssam * as in the case of software crypto. Need to look at how 126120585Ssam * hard it is to remove this... 127120585Ssam */ 128120585Ssam#define IPSECREQUEST_LOCK_INIT(_isr) \ 129120585Ssam mtx_init(&(_isr)->lock, "ipsec request", NULL, MTX_DEF | MTX_RECURSE) 130120585Ssam#define IPSECREQUEST_LOCK(_isr) mtx_lock(&(_isr)->lock) 131120585Ssam#define IPSECREQUEST_UNLOCK(_isr) mtx_unlock(&(_isr)->lock) 132120585Ssam#define IPSECREQUEST_LOCK_DESTROY(_isr) mtx_destroy(&(_isr)->lock) 133120585Ssam#define IPSECREQUEST_LOCK_ASSERT(_isr) mtx_assert(&(_isr)->lock, MA_OWNED) 134120585Ssam 135105197Ssam/* security policy in PCB */ 136105197Ssamstruct inpcbpolicy { 137105197Ssam struct secpolicy *sp_in; 138105197Ssam struct secpolicy *sp_out; 139105197Ssam int priv; /* privileged socket ? */ 140105197Ssam}; 141105197Ssam 142105197Ssam/* SP acquiring list table. */ 143105197Ssamstruct secspacq { 144105197Ssam LIST_ENTRY(secspacq) chain; 145105197Ssam 146105197Ssam struct secpolicyindex spidx; 147105197Ssam 148120585Ssam time_t created; /* for lifetime */ 149105197Ssam int count; /* for lifetime */ 150105197Ssam /* XXX: here is mbuf place holder to be sent ? */ 151105197Ssam}; 152105197Ssam#endif /* _KERNEL */ 153105197Ssam 154105197Ssam/* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */ 155105197Ssam#define IPSEC_PORT_ANY 0 156105197Ssam#define IPSEC_ULPROTO_ANY 255 157105197Ssam#define IPSEC_PROTO_ANY 255 158105197Ssam 159105197Ssam/* mode of security protocol */ 160105197Ssam/* NOTE: DON'T use IPSEC_MODE_ANY at SPD. It's only use in SAD */ 161105197Ssam#define IPSEC_MODE_ANY 0 /* i.e. wildcard. */ 162105197Ssam#define IPSEC_MODE_TRANSPORT 1 163105197Ssam#define IPSEC_MODE_TUNNEL 2 164125680Sbms#define IPSEC_MODE_TCPMD5 3 /* TCP MD5 mode */ 165105197Ssam 166105197Ssam/* 167105197Ssam * Direction of security policy. 168105197Ssam * NOTE: Since INVALID is used just as flag. 169105197Ssam * The other are used for loop counter too. 170105197Ssam */ 171105197Ssam#define IPSEC_DIR_ANY 0 172105197Ssam#define IPSEC_DIR_INBOUND 1 173105197Ssam#define IPSEC_DIR_OUTBOUND 2 174105197Ssam#define IPSEC_DIR_MAX 3 175105197Ssam#define IPSEC_DIR_INVALID 4 176105197Ssam 177105197Ssam/* Policy level */ 178105197Ssam/* 179105197Ssam * IPSEC, ENTRUST and BYPASS are allowed for setsockopt() in PCB, 180105197Ssam * DISCARD, IPSEC and NONE are allowed for setkey() in SPD. 181105197Ssam * DISCARD and NONE are allowed for system default. 182105197Ssam */ 183105197Ssam#define IPSEC_POLICY_DISCARD 0 /* discarding packet */ 184105197Ssam#define IPSEC_POLICY_NONE 1 /* through IPsec engine */ 185105197Ssam#define IPSEC_POLICY_IPSEC 2 /* do IPsec */ 186105197Ssam#define IPSEC_POLICY_ENTRUST 3 /* consulting SPD if present. */ 187105197Ssam#define IPSEC_POLICY_BYPASS 4 /* only for privileged socket. */ 188105197Ssam 189105197Ssam/* Security protocol level */ 190105197Ssam#define IPSEC_LEVEL_DEFAULT 0 /* reference to system default */ 191105197Ssam#define IPSEC_LEVEL_USE 1 /* use SA if present. */ 192105197Ssam#define IPSEC_LEVEL_REQUIRE 2 /* require SA. */ 193105197Ssam#define IPSEC_LEVEL_UNIQUE 3 /* unique SA. */ 194105197Ssam 195105197Ssam#define IPSEC_MANUAL_REQID_MAX 0x3fff 196105197Ssam /* 197105197Ssam * if security policy level == unique, this id 198105197Ssam * indicate to a relative SA for use, else is 199105197Ssam * zero. 200105197Ssam * 1 - 0x3fff are reserved for manual keying. 201105197Ssam * 0 are reserved for above reason. Others is 202105197Ssam * for kernel use. 203105197Ssam * Note that this id doesn't identify SA 204105197Ssam * by only itself. 205105197Ssam */ 206105197Ssam#define IPSEC_REPLAYWSIZE 32 207105197Ssam 208171133Sgnn/* statistics for ipsec processing */ 209105197Ssamstruct ipsecstat { 210105197Ssam u_quad_t in_success; /* succeeded inbound process */ 211105197Ssam u_quad_t in_polvio; 212105197Ssam /* security policy violation for inbound process */ 213105197Ssam u_quad_t in_nosa; /* inbound SA is unavailable */ 214105197Ssam u_quad_t in_inval; /* inbound processing failed due to EINVAL */ 215105197Ssam u_quad_t in_nomem; /* inbound processing failed due to ENOBUFS */ 216105197Ssam u_quad_t in_badspi; /* failed getting a SPI */ 217105197Ssam u_quad_t in_ahreplay; /* AH replay check failed */ 218105197Ssam u_quad_t in_espreplay; /* ESP replay check failed */ 219105197Ssam u_quad_t in_ahauthsucc; /* AH authentication success */ 220105197Ssam u_quad_t in_ahauthfail; /* AH authentication failure */ 221105197Ssam u_quad_t in_espauthsucc; /* ESP authentication success */ 222105197Ssam u_quad_t in_espauthfail; /* ESP authentication failure */ 223105197Ssam u_quad_t in_esphist[256]; 224105197Ssam u_quad_t in_ahhist[256]; 225105197Ssam u_quad_t in_comphist[256]; 226105197Ssam u_quad_t out_success; /* succeeded outbound process */ 227105197Ssam u_quad_t out_polvio; 228105197Ssam /* security policy violation for outbound process */ 229105197Ssam u_quad_t out_nosa; /* outbound SA is unavailable */ 230105197Ssam u_quad_t out_inval; /* outbound process failed due to EINVAL */ 231105197Ssam u_quad_t out_nomem; /* inbound processing failed due to ENOBUFS */ 232105197Ssam u_quad_t out_noroute; /* there is no route */ 233105197Ssam u_quad_t out_esphist[256]; 234105197Ssam u_quad_t out_ahhist[256]; 235105197Ssam u_quad_t out_comphist[256]; 236125098Ssam 237125098Ssam u_quad_t spdcachelookup; 238125098Ssam u_quad_t spdcachemiss; 239105197Ssam 240105197Ssam u_int32_t ips_in_polvio; /* input: sec policy violation */ 241105197Ssam u_int32_t ips_out_polvio; /* output: sec policy violation */ 242105197Ssam u_int32_t ips_out_nosa; /* output: SA unavailable */ 243105197Ssam u_int32_t ips_out_nomem; /* output: no memory available */ 244105197Ssam u_int32_t ips_out_noroute; /* output: no route available */ 245105197Ssam u_int32_t ips_out_inval; /* output: generic error */ 246105197Ssam u_int32_t ips_out_bundlesa; /* output: bundled SA processed */ 247105197Ssam u_int32_t ips_mbcoalesced; /* mbufs coalesced during clone */ 248105197Ssam u_int32_t ips_clcoalesced; /* clusters coalesced during clone */ 249105197Ssam u_int32_t ips_clcopied; /* clusters copied during clone */ 250105197Ssam u_int32_t ips_mbinserted; /* mbufs inserted during makespace */ 251105197Ssam /* 252105197Ssam * Temporary statistics for performance analysis. 253105197Ssam */ 254105197Ssam /* See where ESP/AH/IPCOMP header land in mbuf on input */ 255105197Ssam u_int32_t ips_input_front; 256105197Ssam u_int32_t ips_input_middle; 257105197Ssam u_int32_t ips_input_end; 258105197Ssam}; 259105197Ssam 260105197Ssam/* 261105197Ssam * Definitions for IPsec & Key sysctl operations. 262105197Ssam */ 263105197Ssam/* 264105197Ssam * Names for IPsec & Key sysctl objects 265105197Ssam */ 266105197Ssam#define IPSECCTL_STATS 1 /* stats */ 267105197Ssam#define IPSECCTL_DEF_POLICY 2 268105197Ssam#define IPSECCTL_DEF_ESP_TRANSLEV 3 /* int; ESP transport mode */ 269105197Ssam#define IPSECCTL_DEF_ESP_NETLEV 4 /* int; ESP tunnel mode */ 270105197Ssam#define IPSECCTL_DEF_AH_TRANSLEV 5 /* int; AH transport mode */ 271105197Ssam#define IPSECCTL_DEF_AH_NETLEV 6 /* int; AH tunnel mode */ 272105197Ssam#if 0 /* obsolete, do not reuse */ 273105197Ssam#define IPSECCTL_INBOUND_CALL_IKE 7 274105197Ssam#endif 275105197Ssam#define IPSECCTL_AH_CLEARTOS 8 276105197Ssam#define IPSECCTL_AH_OFFSETMASK 9 277105197Ssam#define IPSECCTL_DFBIT 10 278105197Ssam#define IPSECCTL_ECN 11 279105197Ssam#define IPSECCTL_DEBUG 12 280105197Ssam#define IPSECCTL_ESP_RANDPAD 13 281105197Ssam#define IPSECCTL_MAXID 14 282105197Ssam 283105197Ssam#define IPSECCTL_NAMES { \ 284105197Ssam { 0, 0 }, \ 285105197Ssam { 0, 0 }, \ 286105197Ssam { "def_policy", CTLTYPE_INT }, \ 287105197Ssam { "esp_trans_deflev", CTLTYPE_INT }, \ 288105197Ssam { "esp_net_deflev", CTLTYPE_INT }, \ 289105197Ssam { "ah_trans_deflev", CTLTYPE_INT }, \ 290105197Ssam { "ah_net_deflev", CTLTYPE_INT }, \ 291105197Ssam { 0, 0 }, \ 292105197Ssam { "ah_cleartos", CTLTYPE_INT }, \ 293105197Ssam { "ah_offsetmask", CTLTYPE_INT }, \ 294105197Ssam { "dfbit", CTLTYPE_INT }, \ 295105197Ssam { "ecn", CTLTYPE_INT }, \ 296105197Ssam { "debug", CTLTYPE_INT }, \ 297105197Ssam { "esp_randpad", CTLTYPE_INT }, \ 298105197Ssam} 299105197Ssam 300105197Ssam#define IPSEC6CTL_NAMES { \ 301105197Ssam { 0, 0 }, \ 302105197Ssam { 0, 0 }, \ 303105197Ssam { "def_policy", CTLTYPE_INT }, \ 304105197Ssam { "esp_trans_deflev", CTLTYPE_INT }, \ 305105197Ssam { "esp_net_deflev", CTLTYPE_INT }, \ 306105197Ssam { "ah_trans_deflev", CTLTYPE_INT }, \ 307105197Ssam { "ah_net_deflev", CTLTYPE_INT }, \ 308105197Ssam { 0, 0 }, \ 309105197Ssam { 0, 0 }, \ 310105197Ssam { 0, 0 }, \ 311105197Ssam { 0, 0 }, \ 312105197Ssam { "ecn", CTLTYPE_INT }, \ 313105197Ssam { "debug", CTLTYPE_INT }, \ 314105197Ssam { "esp_randpad", CTLTYPE_INT }, \ 315105197Ssam} 316105197Ssam 317105197Ssam#ifdef _KERNEL 318105197Ssamstruct ipsec_output_state { 319105197Ssam struct mbuf *m; 320105197Ssam struct route *ro; 321105197Ssam struct sockaddr *dst; 322105197Ssam}; 323105197Ssam 324105197Ssamstruct ipsec_history { 325105197Ssam int ih_proto; 326105197Ssam u_int32_t ih_spi; 327105197Ssam}; 328105197Ssam 329105197Ssamextern int ipsec_debug; 330157634Spjd#ifdef REGRESSION 331157613Spjdextern int ipsec_replay; 332157613Spjdextern int ipsec_integrity; 333157634Spjd#endif 334105197Ssam 335171133Sgnnextern struct ipsecstat ipsec4stat; 336105197Ssamextern struct secpolicy ip4_def_policy; 337105197Ssamextern int ip4_esp_trans_deflev; 338105197Ssamextern int ip4_esp_net_deflev; 339105197Ssamextern int ip4_ah_trans_deflev; 340105197Ssamextern int ip4_ah_net_deflev; 341105197Ssamextern int ip4_ah_cleartos; 342105197Ssamextern int ip4_ah_offsetmask; 343105197Ssamextern int ip4_ipsec_dfbit; 344105197Ssamextern int ip4_ipsec_ecn; 345105197Ssamextern int ip4_esp_randpad; 346105197Ssamextern int crypto_support; 347105197Ssam 348105197Ssam#define ipseclog(x) do { if (ipsec_debug) log x; } while (0) 349105197Ssam/* for openbsd compatibility */ 350105197Ssam#define DPRINTF(x) do { if (ipsec_debug) printf x; } while (0) 351105197Ssam 352119643Ssamextern struct ipsecrequest *ipsec_newisr(void); 353119643Ssamextern void ipsec_delisr(struct ipsecrequest *); 354119643Ssam 355105197Ssamstruct tdb_ident; 356105197Ssamextern struct secpolicy *ipsec_getpolicy __P((struct tdb_ident*, u_int)); 357105197Ssamstruct inpcb; 358105197Ssamextern struct secpolicy *ipsec4_checkpolicy __P((struct mbuf *, u_int, u_int, 359105197Ssam int *, struct inpcb *)); 360105197Ssamextern struct secpolicy *ipsec_getpolicybysock(struct mbuf *, u_int, 361105197Ssam struct inpcb *, int *); 362105197Ssamextern struct secpolicy * ipsec_getpolicybyaddr(struct mbuf *, u_int, 363105197Ssam int, int *); 364105197Ssam 365105197Ssamstruct inpcb; 366105197Ssamextern int ipsec_init_policy __P((struct socket *so, struct inpcbpolicy **)); 367105197Ssamextern int ipsec_copy_policy 368105197Ssam __P((struct inpcbpolicy *, struct inpcbpolicy *)); 369105197Ssamextern u_int ipsec_get_reqlevel __P((struct ipsecrequest *)); 370105197Ssamextern int ipsec_in_reject __P((struct secpolicy *, struct mbuf *)); 371105197Ssam 372105197Ssamextern int ipsec4_set_policy __P((struct inpcb *inp, int optname, 373105197Ssam caddr_t request, size_t len, int priv)); 374105197Ssamextern int ipsec4_get_policy __P((struct inpcb *inpcb, caddr_t request, 375105197Ssam size_t len, struct mbuf **mp)); 376105197Ssamextern int ipsec4_delete_pcbpolicy __P((struct inpcb *)); 377105197Ssamextern int ipsec4_in_reject __P((struct mbuf *, struct inpcb *)); 378105197Ssam 379105197Ssamstruct secas; 380105197Ssamstruct tcpcb; 381105197Ssamextern int ipsec_chkreplay __P((u_int32_t, struct secasvar *)); 382105197Ssamextern int ipsec_updatereplay __P((u_int32_t, struct secasvar *)); 383105197Ssam 384105197Ssamextern size_t ipsec4_hdrsiz __P((struct mbuf *, u_int, struct inpcb *)); 385105197Ssamextern size_t ipsec_hdrsiz_tcp __P((struct tcpcb *)); 386105197Ssam 387105197Ssamunion sockaddr_union; 388105197Ssamextern char * ipsec_address(union sockaddr_union* sa); 389105197Ssamextern const char *ipsec_logsastr __P((struct secasvar *)); 390105197Ssam 391105197Ssamextern void ipsec_dumpmbuf __P((struct mbuf *)); 392105197Ssam 393105197Ssamstruct m_tag; 394106680Ssamextern void ah4_input(struct mbuf *m, int off); 395120585Ssamextern void ah4_ctlinput(int cmd, struct sockaddr *sa, void *); 396106680Ssamextern void esp4_input(struct mbuf *m, int off); 397120585Ssamextern void esp4_ctlinput(int cmd, struct sockaddr *sa, void *); 398106680Ssamextern void ipcomp4_input(struct mbuf *m, int off); 399105197Ssamextern int ipsec4_common_input(struct mbuf *m, ...); 400105197Ssamextern int ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, 401105197Ssam int skip, int protoff, struct m_tag *mt); 402105197Ssamextern int ipsec4_process_packet __P((struct mbuf *, struct ipsecrequest *, 403105197Ssam int, int)); 404105197Ssamextern int ipsec_process_done __P((struct mbuf *, struct ipsecrequest *)); 405105197Ssam 406105197Ssamextern struct mbuf *ipsec_copypkt __P((struct mbuf *)); 407105197Ssam 408105197Ssamextern void m_checkalignment(const char* where, struct mbuf *m0, 409105197Ssam int off, int len); 410105197Ssamextern struct mbuf *m_makespace(struct mbuf *m0, int skip, int hlen, int *off); 411105197Ssamextern caddr_t m_pad(struct mbuf *m, int n); 412105197Ssamextern int m_striphdr(struct mbuf *m, int skip, int hlen); 413159965Sthompsaextern int ipsec_filter(struct mbuf **, int); 414159965Sthompsaextern void ipsec_bpf(struct mbuf *, struct secasvar *, int); 415105197Ssam#endif /* _KERNEL */ 416105197Ssam 417105197Ssam#ifndef _KERNEL 418105197Ssamextern caddr_t ipsec_set_policy __P((char *, int)); 419105197Ssamextern int ipsec_get_policylen __P((caddr_t)); 420105197Ssamextern char *ipsec_dump_policy __P((caddr_t, char *)); 421105197Ssam 422105197Ssamextern const char *ipsec_strerror __P((void)); 423105197Ssam#endif /* !_KERNEL */ 424105197Ssam 425105197Ssam#endif /* _NETIPSEC_IPSEC_H_ */ 426