1139826Simp/*-
253541Sshin * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
353541Sshin * All rights reserved.
453541Sshin *
553541Sshin * Redistribution and use in source and binary forms, with or without
653541Sshin * modification, are permitted provided that the following conditions
753541Sshin * are met:
853541Sshin * 1. Redistributions of source code must retain the above copyright
953541Sshin *    notice, this list of conditions and the following disclaimer.
1053541Sshin * 2. Redistributions in binary form must reproduce the above copyright
1153541Sshin *    notice, this list of conditions and the following disclaimer in the
1253541Sshin *    documentation and/or other materials provided with the distribution.
1353541Sshin * 3. Neither the name of the project nor the names of its contributors
1453541Sshin *    may be used to endorse or promote products derived from this software
1553541Sshin *    without specific prior written permission.
1653541Sshin *
1753541Sshin * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
1853541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1953541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2053541Sshin * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2153541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2253541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2353541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2453541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2553541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2653541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2753541Sshin * SUCH DAMAGE.
28174510Sobrien *
29174510Sobrien *	$KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $
3053541Sshin */
3153541Sshin
32139826Simp/*-
3353541Sshin * Copyright (c) 1982, 1986, 1993
3453541Sshin *	The Regents of the University of California.  All rights reserved.
3553541Sshin *
3653541Sshin * Redistribution and use in source and binary forms, with or without
3753541Sshin * modification, are permitted provided that the following conditions
3853541Sshin * are met:
3953541Sshin * 1. Redistributions of source code must retain the above copyright
4053541Sshin *    notice, this list of conditions and the following disclaimer.
4153541Sshin * 2. Redistributions in binary form must reproduce the above copyright
4253541Sshin *    notice, this list of conditions and the following disclaimer in the
4353541Sshin *    documentation and/or other materials provided with the distribution.
4453541Sshin * 4. Neither the name of the University nor the names of its contributors
4553541Sshin *    may be used to endorse or promote products derived from this software
4653541Sshin *    without specific prior written permission.
4753541Sshin *
4853541Sshin * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4953541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5053541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5153541Sshin * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
5253541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5353541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5453541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5553541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5653541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5753541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5853541Sshin * SUCH DAMAGE.
5953541Sshin *
6053541Sshin *	@(#)ip_var.h	8.1 (Berkeley) 6/10/93
61174510Sobrien * $FreeBSD: stable/10/sys/netinet6/ip6_var.h 329158 2018-02-12 13:52:58Z ae $
6253541Sshin */
6353541Sshin
6453541Sshin#ifndef _NETINET6_IP6_VAR_H_
6553541Sshin#define _NETINET6_IP6_VAR_H_
6653541Sshin
6753541Sshin/*
6853541Sshin * IP6 reassembly queue structure.  Each fragment
6953541Sshin * being reassembled is attached to one of these structures.
7053541Sshin */
7153541Sshinstruct	ip6q {
7262587Sitojun	struct ip6asfrag *ip6q_down;
7362587Sitojun	struct ip6asfrag *ip6q_up;
7462587Sitojun	u_int32_t	ip6q_ident;
75170275Sjinmei	u_int8_t	ip6q_nxt;
76170275Sjinmei	u_int8_t	ip6q_ecn;
7762587Sitojun	u_int8_t	ip6q_ttl;
78170275Sjinmei	struct in6_addr ip6q_src, ip6q_dst;
7962587Sitojun	struct ip6q	*ip6q_next;
8062587Sitojun	struct ip6q	*ip6q_prev;
8162587Sitojun	int		ip6q_unfrglen;	/* len of unfragmentable part */
8262587Sitojun#ifdef notyet
8362587Sitojun	u_char		*ip6q_nxtp;
8462587Sitojun#endif
85121345Sume	int		ip6q_nfrag;	/* # of fragments */
86184307Srwatson	struct label	*ip6q_label;
8753541Sshin};
8853541Sshin
8953541Sshinstruct	ip6asfrag {
9062587Sitojun	struct ip6asfrag *ip6af_down;
9162587Sitojun	struct ip6asfrag *ip6af_up;
9262587Sitojun	struct mbuf	*ip6af_m;
9362587Sitojun	int		ip6af_offset;	/* offset in ip6af_m to next header */
9462587Sitojun	int		ip6af_frglen;	/* fragmentable part length */
9562587Sitojun	int		ip6af_off;	/* fragment offset */
9662587Sitojun	u_int16_t	ip6af_mff;	/* more fragment bit in frag off */
9753541Sshin};
9853541Sshin
9953541Sshin#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
10053541Sshin
101191672Sbms/*
102191672Sbms * Structure attached to inpcb.in6p_moptions and
103191672Sbms * passed to ip6_output when IPv6 multicast options are in use.
104191672Sbms * This structure is lazy-allocated.
105191672Sbms */
106191672Sbmsstruct ip6_moptions {
10753541Sshin	struct	ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
10853541Sshin	u_char	im6o_multicast_hlim;	/* hoplimit for outgoing multicasts */
10953541Sshin	u_char	im6o_multicast_loop;	/* 1 >= hear sends if a member */
110191672Sbms	u_short	im6o_num_memberships;	/* no. memberships this socket */
111191672Sbms	u_short	im6o_max_memberships;	/* max memberships this socket */
112191672Sbms	struct	in6_multi **im6o_membership;	/* group memberships */
113191672Sbms	struct	in6_mfilter *im6o_mfilters;	/* source filters */
11453541Sshin};
11553541Sshin
11653541Sshin/*
11753541Sshin * Control options for outgoing packets
11853541Sshin */
11953541Sshin
12053541Sshin/* Routing header related info */
12153541Sshinstruct	ip6po_rhinfo {
12253541Sshin	struct	ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
12353541Sshin	struct	route_in6 ip6po_rhi_route; /* Route to the 1st hop */
12453541Sshin};
12562587Sitojun#define ip6po_rthdr	ip6po_rhinfo.ip6po_rhi_rthdr
12662587Sitojun#define ip6po_route	ip6po_rhinfo.ip6po_rhi_route
12753541Sshin
128121472Sume/* Nexthop related info */
129121472Sumestruct	ip6po_nhinfo {
130121472Sume	struct	sockaddr *ip6po_nhi_nexthop;
131121472Sume	struct	route_in6 ip6po_nhi_route; /* Route to the nexthop */
132121472Sume};
133121472Sume#define ip6po_nexthop	ip6po_nhinfo.ip6po_nhi_nexthop
134121472Sume#define ip6po_nextroute	ip6po_nhinfo.ip6po_nhi_route
135121472Sume
13653541Sshinstruct	ip6_pktopts {
13753541Sshin	struct	mbuf *ip6po_m;	/* Pointer to mbuf storing the data */
13878064Sume	int	ip6po_hlim;	/* Hoplimit for outgoing packets */
13978064Sume
14078064Sume	/* Outgoing IF/address information */
14178064Sume	struct	in6_pktinfo *ip6po_pktinfo;
14278064Sume
143121472Sume	/* Next-hop address information */
144121472Sume	struct	ip6po_nhinfo ip6po_nhinfo;
145121472Sume
14653541Sshin	struct	ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
14778064Sume
14878064Sume	/* Destination options header (before a routing header) */
14978064Sume	struct	ip6_dest *ip6po_dest1;
15078064Sume
15178064Sume	/* Routing header related info. */
15278064Sume	struct	ip6po_rhinfo ip6po_rhinfo;
15378064Sume
15478064Sume	/* Destination options header (after a routing header) */
15578064Sume	struct	ip6_dest *ip6po_dest2;
156121472Sume
157121472Sume	int	ip6po_tclass;	/* traffic class */
158121472Sume
159121472Sume	int	ip6po_minmtu;  /* fragment vs PMTU discovery policy */
160121472Sume#define IP6PO_MINMTU_MCASTONLY	-1 /* default; send at min MTU for multicast*/
161121472Sume#define IP6PO_MINMTU_DISABLE	 0 /* always perform pmtu disc */
162121472Sume#define IP6PO_MINMTU_ALL	 1 /* always send at min MTU */
163121472Sume
164121472Sume	int	ip6po_prefer_tempaddr;  /* whether temporary addresses are
165121472Sume					   preferred as source address */
166121472Sume#define IP6PO_TEMPADDR_SYSTEM	-1 /* follow the system default */
167121472Sume#define IP6PO_TEMPADDR_NOTPREFER 0 /* not prefer temporary address */
168121472Sume#define IP6PO_TEMPADDR_PREFER	 1 /* prefer temporary address */
169121472Sume
170121472Sume	int ip6po_flags;
171121472Sume#if 0	/* parameters in this block is obsolete. do not reuse the values. */
172121472Sume#define IP6PO_REACHCONF	0x01	/* upper-layer reachability confirmation. */
173121472Sume#define IP6PO_MINMTU	0x02	/* use minimum MTU (IPV6_USE_MIN_MTU) */
174121472Sume#endif
175121472Sume#define IP6PO_DONTFRAG	0x04	/* disable fragmentation (IPV6_DONTFRAG) */
176121472Sume#define IP6PO_USECOA	0x08	/* use care of address */
17753541Sshin};
17853541Sshin
17978064Sume/*
18078064Sume * Control options for incoming packets
18178064Sume */
18278064Sume
18353541Sshinstruct	ip6stat {
184253081Sae	uint64_t ip6s_total;		/* total packets received */
185253081Sae	uint64_t ip6s_tooshort;		/* packet too short */
186253081Sae	uint64_t ip6s_toosmall;		/* not enough data */
187253081Sae	uint64_t ip6s_fragments;	/* fragments received */
188253081Sae	uint64_t ip6s_fragdropped;	/* frags dropped(dups, out of space) */
189253081Sae	uint64_t ip6s_fragtimeout;	/* fragments timed out */
190253081Sae	uint64_t ip6s_fragoverflow;	/* fragments that exceeded limit */
191253081Sae	uint64_t ip6s_forward;		/* packets forwarded */
192253081Sae	uint64_t ip6s_cantforward;	/* packets rcvd for unreachable dest */
193253081Sae	uint64_t ip6s_redirectsent;	/* packets forwarded on same net */
194253081Sae	uint64_t ip6s_delivered;	/* datagrams delivered to upper level*/
195253081Sae	uint64_t ip6s_localout;		/* total ip packets generated here */
196253081Sae	uint64_t ip6s_odropped;		/* lost packets due to nobufs, etc. */
197253081Sae	uint64_t ip6s_reassembled;	/* total packets reassembled ok */
198253081Sae	uint64_t ip6s_fragmented;	/* datagrams successfully fragmented */
199253081Sae	uint64_t ip6s_ofragments;	/* output fragments created */
200253081Sae	uint64_t ip6s_cantfrag;		/* don't fragment flag was set, etc. */
201253081Sae	uint64_t ip6s_badoptions;	/* error in option processing */
202253081Sae	uint64_t ip6s_noroute;		/* packets discarded due to no route */
203253081Sae	uint64_t ip6s_badvers;		/* ip6 version != 6 */
204253081Sae	uint64_t ip6s_rawout;		/* total raw ip packets generated */
205253081Sae	uint64_t ip6s_badscope;		/* scope error */
206253081Sae	uint64_t ip6s_notmember;	/* don't join this multicast group */
207249543Sae#define	IP6S_HDRCNT		256	/* headers count */
208253081Sae	uint64_t ip6s_nxthist[IP6S_HDRCNT]; /* next header history */
209253081Sae	uint64_t ip6s_m1;		/* one mbuf */
210249543Sae#define	IP6S_M2MMAX		32
211253081Sae	uint64_t ip6s_m2m[IP6S_M2MMAX];	/* two or more mbuf */
212253081Sae	uint64_t ip6s_mext1;		/* one ext mbuf */
213253081Sae	uint64_t ip6s_mext2m;		/* two or more ext mbuf */
214253081Sae	uint64_t ip6s_exthdrtoolong;	/* ext hdr are not contiguous */
215253081Sae	uint64_t ip6s_nogif;		/* no match gif found */
216253081Sae	uint64_t ip6s_toomanyhdr;	/* discarded due to too many headers */
21762587Sitojun
21862587Sitojun	/*
21962587Sitojun	 * statistics for improvement of the source address selection
22062587Sitojun	 * algorithm:
22162587Sitojun	 * XXX: hardcoded 16 = # of ip6 multicast scope types + 1
22262587Sitojun	 */
223249543Sae#define	IP6S_RULESMAX		16
224249543Sae#define	IP6S_SCOPECNT		16
22562587Sitojun	/* number of times that address selection fails */
226253081Sae	uint64_t ip6s_sources_none;
22762587Sitojun	/* number of times that an address on the outgoing I/F is chosen */
228253081Sae	uint64_t ip6s_sources_sameif[IP6S_SCOPECNT];
22962587Sitojun	/* number of times that an address on a non-outgoing I/F is chosen */
230253081Sae	uint64_t ip6s_sources_otherif[IP6S_SCOPECNT];
23162587Sitojun	/*
23262587Sitojun	 * number of times that an address that has the same scope
23362587Sitojun	 * from the destination is chosen.
23462587Sitojun	 */
235253081Sae	uint64_t ip6s_sources_samescope[IP6S_SCOPECNT];
23662587Sitojun	/*
23762587Sitojun	 * number of times that an address that has a different scope
23862587Sitojun	 * from the destination is chosen.
23962587Sitojun	 */
240253081Sae	uint64_t ip6s_sources_otherscope[IP6S_SCOPECNT];
241108470Sschweikh	/* number of times that a deprecated address is chosen */
242253081Sae	uint64_t ip6s_sources_deprecated[IP6S_SCOPECNT];
24362587Sitojun
244122077Sume	/* number of times that each rule of source selection is applied. */
245253081Sae	uint64_t ip6s_sources_rule[IP6S_RULESMAX];
24653541Sshin};
24753541Sshin
24853541Sshin#ifdef _KERNEL
249253085Sae#include <sys/counter.h>
250253085Sae
251253085SaeVNET_PCPUSTAT_DECLARE(struct ip6stat, ip6stat);
252253085Sae#define	IP6STAT_ADD(name, val)	\
253253085Sae    VNET_PCPUSTAT_ADD(struct ip6stat, ip6stat, name, (val))
254253085Sae#define	IP6STAT_SUB(name, val)	IP6STAT_ADD(name, -(val))
255191672Sbms#define	IP6STAT_INC(name)	IP6STAT_ADD(name, 1)
256191672Sbms#define	IP6STAT_DEC(name)	IP6STAT_SUB(name, 1)
257191672Sbms#endif
258191672Sbms
259191672Sbms#ifdef _KERNEL
26078064Sume/*
26178064Sume * IPv6 onion peeling state.
26278064Sume * it will be initialized when we come into ip6_input().
26378064Sume * XXX do not make it a kitchen sink!
26478064Sume */
26578064Sumestruct ip6aux {
26678064Sume	u_int32_t ip6a_flags;
26778064Sume#define IP6A_SWAP	0x01		/* swapped home/care-of on packet */
26878064Sume#define IP6A_HASEEN	0x02		/* HA was present */
26978064Sume#define IP6A_BRUID	0x04		/* BR Unique Identifier was present */
27078064Sume#define IP6A_RTALERTSEEN 0x08		/* rtalert present */
27178064Sume
27278064Sume	/* ip6.ip6_src */
27378064Sume	struct in6_addr ip6a_careof;	/* care-of address of the peer */
27478064Sume	struct in6_addr ip6a_home;	/* home address of the peer */
27578064Sume	u_int16_t	ip6a_bruid;	/* BR unique identifier */
27678064Sume
27778064Sume	/* ip6.ip6_dst */
27878064Sume	struct in6_ifaddr *ip6a_dstia6;	/* my ifaddr that matches ip6_dst */
27978064Sume
28078064Sume	/* rtalert */
28178064Sume	u_int16_t ip6a_rtalert;		/* rtalert option value */
28278064Sume
28378064Sume	/*
28478064Sume	 * decapsulation history will be here.
28578064Sume	 * with IPsec it may not be accurate.
28678064Sume	 */
28778064Sume};
28878064Sume#endif
28978064Sume
29078064Sume#ifdef _KERNEL
29153541Sshin/* flags passed to ip6_output as last parameter */
292151536Ssuz#define	IPV6_UNSPECSRC		0x01	/* allow :: as the source address */
29353541Sshin#define	IPV6_FORWARDING		0x02	/* most of IPv6 header exists */
29462587Sitojun#define	IPV6_MINMTU		0x04	/* use minimum MTU (IPV6_USE_MIN_MTU) */
29553541Sshin
296147744Sthompsa#ifdef __NO_STRICT_ALIGNMENT
297147744Sthompsa#define IP6_HDR_ALIGNED_P(ip)	1
298147744Sthompsa#else
299147744Sthompsa#define IP6_HDR_ALIGNED_P(ip)	((((intptr_t) (ip)) & 3) == 0)
300147744Sthompsa#endif
301147744Sthompsa
302195699SrwatsonVNET_DECLARE(int, ip6_defhlim);		/* default hop limit */
303195699SrwatsonVNET_DECLARE(int, ip6_defmcasthlim);	/* default multicast hop limit */
304195699SrwatsonVNET_DECLARE(int, ip6_forwarding);	/* act as router? */
305195699SrwatsonVNET_DECLARE(int, ip6_use_deprecated);	/* allow deprecated addr as source */
306195699SrwatsonVNET_DECLARE(int, ip6_rr_prune);	/* router renumbering prefix
30753541Sshin					 * walk list every 5 sec.    */
308195699SrwatsonVNET_DECLARE(int, ip6_mcast_pmtu);	/* enable pMTU discovery for multicast? */
309195699SrwatsonVNET_DECLARE(int, ip6_v6only);
310207369Sbz#define	V_ip6_defhlim			VNET(ip6_defhlim)
311207369Sbz#define	V_ip6_defmcasthlim		VNET(ip6_defmcasthlim)
312207369Sbz#define	V_ip6_forwarding		VNET(ip6_forwarding)
313207369Sbz#define	V_ip6_use_deprecated		VNET(ip6_use_deprecated)
314207369Sbz#define	V_ip6_rr_prune			VNET(ip6_rr_prune)
315207369Sbz#define	V_ip6_mcast_pmtu		VNET(ip6_mcast_pmtu)
316207369Sbz#define	V_ip6_v6only			VNET(ip6_v6only)
317207369Sbz
318195699SrwatsonVNET_DECLARE(struct socket *, ip6_mrouter);	/* multicast routing daemon */
319195699SrwatsonVNET_DECLARE(int, ip6_sendredirects);	/* send IP redirects when forwarding? */
320195699SrwatsonVNET_DECLARE(int, ip6_maxfragpackets);	/* Maximum packets in reassembly
321195699Srwatson					 * queue */
322195699SrwatsonVNET_DECLARE(int, ip6_maxfrags);	/* Maximum fragments in reassembly
323195699Srwatson					 * queue */
324195699SrwatsonVNET_DECLARE(int, ip6_accept_rtadv);	/* Acts as a host not a router */
325222728ShrsVNET_DECLARE(int, ip6_no_radr);		/* No defroute from RA */
326222728ShrsVNET_DECLARE(int, ip6_norbit_raif);	/* Disable R-bit in NA on RA
327222728Shrs					 * receiving IF. */
328225521ShrsVNET_DECLARE(int, ip6_rfc6204w3);	/* Accept defroute from RA even when
329225521Shrs					   forwarding enabled */
330195699SrwatsonVNET_DECLARE(int, ip6_keepfaith);	/* Firewall Aided Internet Translator */
331195699SrwatsonVNET_DECLARE(int, ip6_log_interval);
332195699SrwatsonVNET_DECLARE(time_t, ip6_log_time);
333195699SrwatsonVNET_DECLARE(int, ip6_hdrnestlimit);	/* upper limit of # of extension
334195699Srwatson					 * headers */
335195699SrwatsonVNET_DECLARE(int, ip6_dad_count);	/* DupAddrDetectionTransmits */
336195727Srwatson#define	V_ip6_mrouter			VNET(ip6_mrouter)
337195727Srwatson#define	V_ip6_sendredirects		VNET(ip6_sendredirects)
338195727Srwatson#define	V_ip6_maxfragpackets		VNET(ip6_maxfragpackets)
339195727Srwatson#define	V_ip6_maxfrags			VNET(ip6_maxfrags)
340195727Srwatson#define	V_ip6_accept_rtadv		VNET(ip6_accept_rtadv)
341222728Shrs#define	V_ip6_no_radr			VNET(ip6_no_radr)
342222728Shrs#define	V_ip6_norbit_raif		VNET(ip6_norbit_raif)
343225521Shrs#define	V_ip6_rfc6204w3			VNET(ip6_rfc6204w3)
344195727Srwatson#define	V_ip6_keepfaith			VNET(ip6_keepfaith)
345195727Srwatson#define	V_ip6_log_interval		VNET(ip6_log_interval)
346195727Srwatson#define	V_ip6_log_time			VNET(ip6_log_time)
347195727Srwatson#define	V_ip6_hdrnestlimit		VNET(ip6_hdrnestlimit)
348195727Srwatson#define	V_ip6_dad_count			VNET(ip6_dad_count)
349207369Sbz
350207369SbzVNET_DECLARE(int, ip6_auto_flowlabel);
351207369SbzVNET_DECLARE(int, ip6_auto_linklocal);
352195727Srwatson#define	V_ip6_auto_flowlabel		VNET(ip6_auto_flowlabel)
353195727Srwatson#define	V_ip6_auto_linklocal		VNET(ip6_auto_linklocal)
354207369Sbz
355207369SbzVNET_DECLARE(int, ip6_use_tempaddr);	/* Whether to use temporary addresses */
356207369SbzVNET_DECLARE(int, ip6_prefer_tempaddr);	/* Whether to prefer temporary
357207369Sbz					 * addresses in the source address
358207369Sbz					 * selection */
359195727Srwatson#define	V_ip6_use_tempaddr		VNET(ip6_use_tempaddr)
360195727Srwatson#define	V_ip6_prefer_tempaddr		VNET(ip6_prefer_tempaddr)
361207369Sbz
362207369SbzVNET_DECLARE(int, ip6_use_defzone);	/* Whether to use the default scope
363207369Sbz					 * zone when unspecified */
364195727Srwatson#define	V_ip6_use_defzone		VNET(ip6_use_defzone)
365195699Srwatson
366197952SjulianVNET_DECLARE (struct pfil_head, inet6_pfil_hook);	/* packet filter hooks */
367197952Sjulian#define	V_inet6_pfil_hook	VNET(inet6_pfil_hook)
368207369Sbz#ifdef IPSTEALTH
369207369SbzVNET_DECLARE(int, ip6stealth);
370207369Sbz#define	V_ip6stealth			VNET(ip6stealth)
371207369Sbz#endif
372120386Ssam
37353541Sshinextern struct	pr_usrreqs rip6_usrreqs;
37462587Sitojunstruct sockopt;
37553541Sshin
37662587Sitojunstruct inpcb;
37762587Sitojun
378241916Sdelphijint	icmp6_ctloutput(struct socket *, struct sockopt *sopt);
37953541Sshin
38078064Sumestruct in6_ifaddr;
381241916Sdelphijvoid	ip6_init(void);
382193731Szec#ifdef VIMAGE
383241916Sdelphijvoid	ip6_destroy(void);
384193731Szec#endif
385212155Sbzint	ip6proto_register(short);
386212155Sbzint	ip6proto_unregister(short);
387212155Sbz
388241916Sdelphijvoid	ip6_input(struct mbuf *);
389241916Sdelphijstruct in6_ifaddr *ip6_getdstifaddr(struct mbuf *);
390241916Sdelphijvoid	ip6_freepcbopts(struct ip6_pktopts *);
391191672Sbms
392241916Sdelphijint	ip6_unknown_opt(u_int8_t *, struct mbuf *, int);
393329158Saeint	ip6_get_prevhdr(struct mbuf *, int);
394241916Sdelphijint	ip6_nexthdr(struct mbuf *, int, int, int *);
395241916Sdelphijint	ip6_lasthdr(struct mbuf *, int, int, int *);
39678064Sume
397235956Sbz#ifdef __notyet__
398241916Sdelphijstruct ip6aux *ip6_findaux(struct mbuf *);
399235956Sbz#endif
40078064Sume
401166938Sbmsextern int	(*ip6_mforward)(struct ip6_hdr *, struct ifnet *,
402166938Sbms    struct mbuf *);
403166938Sbms
404241916Sdelphijint	ip6_process_hopopts(struct mbuf *, u_int8_t *, int, u_int32_t *,
405241916Sdelphij				 u_int32_t *);
406181782Sbzstruct mbuf	**ip6_savecontrol_v4(struct inpcb *, struct mbuf *,
407181782Sbz	    struct mbuf **, int *);
408241916Sdelphijvoid	ip6_savecontrol(struct inpcb *, struct mbuf *, struct mbuf **);
409279911Saevoid	ip6_notify_pmtu(struct inpcb *, struct sockaddr_in6 *, u_int32_t);
410241916Sdelphijint	ip6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
41153541Sshin
412241916Sdelphijvoid	ip6_forward(struct mbuf *, int);
41353541Sshin
414241916Sdelphijvoid	ip6_mloopback(struct ifnet *, struct mbuf *, struct sockaddr_in6 *);
415241916Sdelphijint	ip6_output(struct mbuf *, struct ip6_pktopts *,
41678064Sume			struct route_in6 *,
41778064Sume			int,
418105194Ssam			struct ip6_moptions *, struct ifnet **,
419241916Sdelphij			struct inpcb *);
420241916Sdelphijint	ip6_ctloutput(struct socket *, struct sockopt *);
421241916Sdelphijint	ip6_raw_ctloutput(struct socket *, struct sockopt *);
422241916Sdelphijvoid	ip6_initpktopts(struct ip6_pktopts *);
423241916Sdelphijint	ip6_setpktopts(struct mbuf *, struct ip6_pktopts *,
424241916Sdelphij	struct ip6_pktopts *, struct ucred *, int);
425241916Sdelphijvoid	ip6_clearpktopts(struct ip6_pktopts *, int);
426241916Sdelphijstruct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int);
427241916Sdelphijint	ip6_optlen(struct inpcb *);
428284568Skpint	ip6_deletefraghdr(struct mbuf *, int, int);
429284572Skpint	ip6_fragment(struct ifnet *, struct mbuf *, int, u_char, int,
430284572Skp			uint32_t);
43153541Sshin
432241916Sdelphijint	route6_input(struct mbuf **, int *, int);
43353541Sshin
434241916Sdelphijvoid	frag6_init(void);
435241916Sdelphijint	frag6_input(struct mbuf **, int *, int);
436241916Sdelphijvoid	frag6_slowtimo(void);
437241916Sdelphijvoid	frag6_drain(void);
43853541Sshin
439241916Sdelphijvoid	rip6_init(void);
440241916Sdelphijint	rip6_input(struct mbuf **, int *, int);
441241916Sdelphijvoid	rip6_ctlinput(int, struct sockaddr *, void *);
442241916Sdelphijint	rip6_ctloutput(struct socket *, struct sockopt *);
443241916Sdelphijint	rip6_output(struct mbuf *, ...);
444241916Sdelphijint	rip6_usrreq(struct socket *,
445241916Sdelphij	    int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *);
44653541Sshin
447241916Sdelphijint	dest6_input(struct mbuf **, int *, int);
448241916Sdelphijint	none_input(struct mbuf **, int *, int);
449120639Sume
450194777Sbzint	in6_selectsrc(struct sockaddr_in6 *, struct ip6_pktopts *,
451180371Sbz	struct inpcb *inp, struct route_in6 *, struct ucred *cred,
452194777Sbz	struct ifnet **, struct in6_addr *);
453241916Sdelphijint in6_selectroute(struct sockaddr_in6 *, struct ip6_pktopts *,
454122077Sume	struct ip6_moptions *, struct route_in6 *, struct ifnet **,
455241916Sdelphij	struct rtentry **);
456231852Sbzint	in6_selectroute_fib(struct sockaddr_in6 *, struct ip6_pktopts *,
457231852Sbz	    struct ip6_moptions *, struct route_in6 *, struct ifnet **,
458232127Sbz	    struct rtentry **, u_int);
459241916Sdelphiju_int32_t ip6_randomid(void);
460241916Sdelphiju_int32_t ip6_randomflowlabel(void);
461274132Saevoid in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset);
46253541Sshin#endif /* _KERNEL */
46353541Sshin
46453541Sshin#endif /* !_NETINET6_IP6_VAR_H_ */
465