xref: /freebsd/sys/netipsec/ipsec6.h (revision 00524fd475995d30780ce80ec75e085223206cac)
188768458SSam Leffler /*	$KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $	*/
288768458SSam Leffler 
3c398230bSWarner Losh /*-
451369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
551369649SPedro F. Giffuni  *
688768458SSam Leffler  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
788768458SSam Leffler  * All rights reserved.
888768458SSam Leffler  *
988768458SSam Leffler  * Redistribution and use in source and binary forms, with or without
1088768458SSam Leffler  * modification, are permitted provided that the following conditions
1188768458SSam Leffler  * are met:
1288768458SSam Leffler  * 1. Redistributions of source code must retain the above copyright
1388768458SSam Leffler  *    notice, this list of conditions and the following disclaimer.
1488768458SSam Leffler  * 2. Redistributions in binary form must reproduce the above copyright
1588768458SSam Leffler  *    notice, this list of conditions and the following disclaimer in the
1688768458SSam Leffler  *    documentation and/or other materials provided with the distribution.
1788768458SSam Leffler  * 3. Neither the name of the project nor the names of its contributors
1888768458SSam Leffler  *    may be used to endorse or promote products derived from this software
1988768458SSam Leffler  *    without specific prior written permission.
2088768458SSam Leffler  *
2188768458SSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2288768458SSam Leffler  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2388768458SSam Leffler  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2488768458SSam Leffler  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2588768458SSam Leffler  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2688768458SSam Leffler  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2788768458SSam Leffler  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2888768458SSam Leffler  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2988768458SSam Leffler  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3088768458SSam Leffler  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3188768458SSam Leffler  * SUCH DAMAGE.
3288768458SSam Leffler  */
3388768458SSam Leffler 
3488768458SSam Leffler /*
3588768458SSam Leffler  * IPsec controller part.
3688768458SSam Leffler  */
3788768458SSam Leffler 
3888768458SSam Leffler #ifndef _NETIPSEC_IPSEC6_H_
3988768458SSam Leffler #define _NETIPSEC_IPSEC6_H_
4088768458SSam Leffler 
4188768458SSam Leffler #include <net/pfkeyv2.h>
4288768458SSam Leffler #include <netipsec/keydb.h>
4388768458SSam Leffler 
4488768458SSam Leffler #ifdef _KERNEL
45db8c0879SAndrey V. Elsukov #include <sys/counter.h>
46db8c0879SAndrey V. Elsukov 
47db8c0879SAndrey V. Elsukov VNET_PCPUSTAT_DECLARE(struct ipsecstat, ipsec6stat);
48eddfbb76SRobert Watson VNET_DECLARE(int, ip6_esp_trans_deflev);
49eddfbb76SRobert Watson VNET_DECLARE(int, ip6_esp_net_deflev);
50eddfbb76SRobert Watson VNET_DECLARE(int, ip6_ah_trans_deflev);
51eddfbb76SRobert Watson VNET_DECLARE(int, ip6_ah_net_deflev);
52eddfbb76SRobert Watson VNET_DECLARE(int, ip6_ipsec_ecn);
5382cea7e6SBjoern A. Zeeb 
54db8c0879SAndrey V. Elsukov #define	IPSEC6STAT_INC(name)	\
55db8c0879SAndrey V. Elsukov     VNET_PCPUSTAT_ADD(struct ipsecstat, ipsec6stat, name, 1)
5682cea7e6SBjoern A. Zeeb #define	V_ip6_esp_trans_deflev	VNET(ip6_esp_trans_deflev)
5782cea7e6SBjoern A. Zeeb #define	V_ip6_esp_net_deflev	VNET(ip6_esp_net_deflev)
5882cea7e6SBjoern A. Zeeb #define	V_ip6_ah_trans_deflev	VNET(ip6_ah_trans_deflev)
5982cea7e6SBjoern A. Zeeb #define	V_ip6_ah_net_deflev	VNET(ip6_ah_net_deflev)
601e77c105SRobert Watson #define	V_ip6_ipsec_ecn		VNET(ip6_ipsec_ecn)
6188768458SSam Leffler 
6288768458SSam Leffler struct inpcb;
63fcf59617SAndrey V. Elsukov struct secpolicy *ipsec6_checkpolicy(const struct mbuf *,
6422bbefb2SAndrey V. Elsukov     struct inpcb *, int *, int);
6588768458SSam Leffler 
66fcf59617SAndrey V. Elsukov void ipsec6_setsockaddrs(const struct mbuf *, union sockaddr_union *,
67fcf59617SAndrey V. Elsukov     union sockaddr_union *);
68fcf59617SAndrey V. Elsukov int ipsec6_common_input_cb(struct mbuf *, struct secasvar *, int, int);
69de1da299SKonstantin Belousov int ipsec6_check_pmtu(struct ifnet *, struct mbuf *, struct secpolicy *, int);
70de1da299SKonstantin Belousov int ipsec6_process_packet(struct ifnet *, struct mbuf *, struct secpolicy *,
71*00524fd4SKonstantin Belousov     struct inpcb *, u_long);
72fcf59617SAndrey V. Elsukov 
73fcf59617SAndrey V. Elsukov int ip6_ipsec_filtertunnel(struct mbuf *);
74fcf59617SAndrey V. Elsukov int ip6_ipsec_pcbctl(struct inpcb *, struct sockopt *);
7588768458SSam Leffler #endif /*_KERNEL*/
7688768458SSam Leffler 
7788768458SSam Leffler #endif /*_NETIPSEC_IPSEC6_H_*/
78