ip6_var.h revision 284568
1233648Seadler/*-
2229997Sken * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3287707Smav * All rights reserved.
4229997Sken *
5233648Seadler * Redistribution and use in source and binary forms, with or without
6229997Sken * modification, are permitted provided that the following conditions
7229997Sken * are met:
8229997Sken * 1. Redistributions of source code must retain the above copyright
9229997Sken *    notice, this list of conditions and the following disclaimer.
10229997Sken * 2. Redistributions in binary form must reproduce the above copyright
11229997Sken *    notice, this list of conditions and the following disclaimer in the
12229997Sken *    documentation and/or other materials provided with the distribution.
13229997Sken * 3. Neither the name of the project nor the names of its contributors
14229997Sken *    may be used to endorse or promote products derived from this software
15229997Sken *    without specific prior written permission.
16229997Sken *
17233648Seadler * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18229997Sken * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19229997Sken * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20229997Sken * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21229997Sken * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22229997Sken * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23229997Sken * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24229997Sken * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25229997Sken * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26229997Sken * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27229997Sken * SUCH DAMAGE.
28229997Sken *
29229997Sken *	$KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $
30233648Seadler */
31229997Sken
32229997Sken/*-
33229997Sken * Copyright (c) 1982, 1986, 1993
34229997Sken *	The Regents of the University of California.  All rights reserved.
35229997Sken *
36229997Sken * Redistribution and use in source and binary forms, with or without
37229997Sken * modification, are permitted provided that the following conditions
38321367Sbcr * are met:
39229997Sken * 1. Redistributions of source code must retain the above copyright
40229997Sken *    notice, this list of conditions and the following disclaimer.
41229997Sken * 2. Redistributions in binary form must reproduce the above copyright
42229997Sken *    notice, this list of conditions and the following disclaimer in the
43229997Sken *    documentation and/or other materials provided with the distribution.
44229997Sken * 4. Neither the name of the University nor the names of its contributors
45229997Sken *    may be used to endorse or promote products derived from this software
46229997Sken *    without specific prior written permission.
47287620Smav *
48229997Sken * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49229997Sken * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50229997Sken * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51229997Sken * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52287620Smav * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53229997Sken * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54229997Sken * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55229997Sken * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56287620Smav * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57229997Sken * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58229997Sken * SUCH DAMAGE.
59229997Sken *
60287620Smav *	@(#)ip_var.h	8.1 (Berkeley) 6/10/93
61229997Sken * $FreeBSD: stable/10/sys/netinet6/ip6_var.h 284568 2015-06-18 20:21:02Z kp $
62229997Sken */
63229997Sken
64287620Smav#ifndef _NETINET6_IP6_VAR_H_
65229997Sken#define _NETINET6_IP6_VAR_H_
66229997Sken
67229997Sken/*
68287620Smav * IP6 reassembly queue structure.  Each fragment
69229997Sken * being reassembled is attached to one of these structures.
70229997Sken */
71229997Skenstruct	ip6q {
72229997Sken	struct ip6asfrag *ip6q_down;
73229997Sken	struct ip6asfrag *ip6q_up;
74229997Sken	u_int32_t	ip6q_ident;
75229997Sken	u_int8_t	ip6q_nxt;
76229997Sken	u_int8_t	ip6q_ecn;
77229997Sken	u_int8_t	ip6q_ttl;
78287620Smav	struct in6_addr ip6q_src, ip6q_dst;
79229997Sken	struct ip6q	*ip6q_next;
80229997Sken	struct ip6q	*ip6q_prev;
81229997Sken	int		ip6q_unfrglen;	/* len of unfragmentable part */
82229997Sken#ifdef notyet
83229997Sken	u_char		*ip6q_nxtp;
84229997Sken#endif
85229997Sken	int		ip6q_nfrag;	/* # of fragments */
86229997Sken	struct label	*ip6q_label;
87229997Sken};
88287620Smav
89229997Skenstruct	ip6asfrag {
90229997Sken	struct ip6asfrag *ip6af_down;
91229997Sken	struct ip6asfrag *ip6af_up;
92229997Sken	struct mbuf	*ip6af_m;
93287620Smav	int		ip6af_offset;	/* offset in ip6af_m to next header */
94229997Sken	int		ip6af_frglen;	/* fragmentable part length */
95229997Sken	int		ip6af_off;	/* fragment offset */
96229997Sken	u_int16_t	ip6af_mff;	/* more fragment bit in frag off */
97229997Sken};
98229997Sken
99229997Sken#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
100229997Sken
101287620Smav/*
102229997Sken * Structure attached to inpcb.in6p_moptions and
103229997Sken * passed to ip6_output when IPv6 multicast options are in use.
104229997Sken * This structure is lazy-allocated.
105229997Sken */
106229997Skenstruct ip6_moptions {
107287620Smav	struct	ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
108229997Sken	u_char	im6o_multicast_hlim;	/* hoplimit for outgoing multicasts */
109229997Sken	u_char	im6o_multicast_loop;	/* 1 >= hear sends if a member */
110229997Sken	u_short	im6o_num_memberships;	/* no. memberships this socket */
111229997Sken	u_short	im6o_max_memberships;	/* max memberships this socket */
112229997Sken	struct	in6_multi **im6o_membership;	/* group memberships */
113287620Smav	struct	in6_mfilter *im6o_mfilters;	/* source filters */
114229997Sken};
115229997Sken
116229997Sken/*
117229997Sken * Control options for outgoing packets
118229997Sken */
119229997Sken
120229997Sken/* Routing header related info */
121229997Skenstruct	ip6po_rhinfo {
122229997Sken	struct	ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
123229997Sken	struct	route_in6 ip6po_rhi_route; /* Route to the 1st hop */
124287620Smav};
125229997Sken#define ip6po_rthdr	ip6po_rhinfo.ip6po_rhi_rthdr
126229997Sken#define ip6po_route	ip6po_rhinfo.ip6po_rhi_route
127229997Sken
128229997Sken/* Nexthop related info */
129229997Skenstruct	ip6po_nhinfo {
130229997Sken	struct	sockaddr *ip6po_nhi_nexthop;
131229997Sken	struct	route_in6 ip6po_nhi_route; /* Route to the nexthop */
132229997Sken};
133229997Sken#define ip6po_nexthop	ip6po_nhinfo.ip6po_nhi_nexthop
134229997Sken#define ip6po_nextroute	ip6po_nhinfo.ip6po_nhi_route
135229997Sken
136229997Skenstruct	ip6_pktopts {
137229997Sken	struct	mbuf *ip6po_m;	/* Pointer to mbuf storing the data */
138229997Sken	int	ip6po_hlim;	/* Hoplimit for outgoing packets */
139229997Sken
140229997Sken	/* Outgoing IF/address information */
141229997Sken	struct	in6_pktinfo *ip6po_pktinfo;
142229997Sken
143229997Sken	/* Next-hop address information */
144229997Sken	struct	ip6po_nhinfo ip6po_nhinfo;
145229997Sken
146229997Sken	struct	ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
147229997Sken
148229997Sken	/* Destination options header (before a routing header) */
149229997Sken	struct	ip6_dest *ip6po_dest1;
150229997Sken
151229997Sken	/* Routing header related info. */
152232604Strasz	struct	ip6po_rhinfo ip6po_rhinfo;
153232604Strasz
154232604Strasz	/* Destination options header (after a routing header) */
155287500Smav	struct	ip6_dest *ip6po_dest2;
156232604Strasz
157232604Strasz	int	ip6po_tclass;	/* traffic class */
158229997Sken
159229997Sken	int	ip6po_minmtu;  /* fragment vs PMTU discovery policy */
160229997Sken#define IP6PO_MINMTU_MCASTONLY	-1 /* default; send at min MTU for multicast*/
161229997Sken#define IP6PO_MINMTU_DISABLE	 0 /* always perform pmtu disc */
162229997Sken#define IP6PO_MINMTU_ALL	 1 /* always send at min MTU */
163229997Sken
164229997Sken	int	ip6po_prefer_tempaddr;  /* whether temporary addresses are
165229997Sken					   preferred as source address */
166229997Sken#define IP6PO_TEMPADDR_SYSTEM	-1 /* follow the system default */
167229997Sken#define IP6PO_TEMPADDR_NOTPREFER 0 /* not prefer temporary address */
168229997Sken#define IP6PO_TEMPADDR_PREFER	 1 /* prefer temporary address */
169229997Sken
170272978Smav	int ip6po_flags;
171272978Smav#if 0	/* parameters in this block is obsolete. do not reuse the values. */
172272978Smav#define IP6PO_REACHCONF	0x01	/* upper-layer reachability confirmation. */
173278037Smav#define IP6PO_MINMTU	0x02	/* use minimum MTU (IPV6_USE_MIN_MTU) */
174272978Smav#endif
175272978Smav#define IP6PO_DONTFRAG	0x04	/* disable fragmentation (IPV6_DONTFRAG) */
176272978Smav#define IP6PO_USECOA	0x08	/* use care of address */
177272978Smav};
178272978Smav
179278037Smav/*
180278037Smav * Control options for incoming packets
181278037Smav */
182278037Smav
183278037Smavstruct	ip6stat {
184229997Sken	uint64_t ip6s_total;		/* total packets received */
185229997Sken	uint64_t ip6s_tooshort;		/* packet too short */
186229997Sken	uint64_t ip6s_toosmall;		/* not enough data */
187229997Sken	uint64_t ip6s_fragments;	/* fragments received */
188255570Strasz	uint64_t ip6s_fragdropped;	/* frags dropped(dups, out of space) */
189255570Strasz	uint64_t ip6s_fragtimeout;	/* fragments timed out */
190255570Strasz	uint64_t ip6s_fragoverflow;	/* fragments that exceeded limit */
191255570Strasz	uint64_t ip6s_forward;		/* packets forwarded */
192255570Strasz	uint64_t ip6s_cantforward;	/* packets rcvd for unreachable dest */
193257379Strasz	uint64_t ip6s_redirectsent;	/* packets forwarded on same net */
194255570Strasz	uint64_t ip6s_delivered;	/* datagrams delivered to upper level*/
195255570Strasz	uint64_t ip6s_localout;		/* total ip packets generated here */
196257379Strasz	uint64_t ip6s_odropped;		/* lost packets due to nobufs, etc. */
197255570Strasz	uint64_t ip6s_reassembled;	/* total packets reassembled ok */
198229997Sken	uint64_t ip6s_fragmented;	/* datagrams successfully fragmented */
199229997Sken	uint64_t ip6s_ofragments;	/* output fragments created */
200229997Sken	uint64_t ip6s_cantfrag;		/* don't fragment flag was set, etc. */
201229997Sken	uint64_t ip6s_badoptions;	/* error in option processing */
202229997Sken	uint64_t ip6s_noroute;		/* packets discarded due to no route */
203229997Sken	uint64_t ip6s_badvers;		/* ip6 version != 6 */
204229997Sken	uint64_t ip6s_rawout;		/* total raw ip packets generated */
205229997Sken	uint64_t ip6s_badscope;		/* scope error */
206229997Sken	uint64_t ip6s_notmember;	/* don't join this multicast group */
207229997Sken#define	IP6S_HDRCNT		256	/* headers count */
208229997Sken	uint64_t ip6s_nxthist[IP6S_HDRCNT]; /* next header history */
209229997Sken	uint64_t ip6s_m1;		/* one mbuf */
210229997Sken#define	IP6S_M2MMAX		32
211229997Sken	uint64_t ip6s_m2m[IP6S_M2MMAX];	/* two or more mbuf */
212229997Sken	uint64_t ip6s_mext1;		/* one ext mbuf */
213229997Sken	uint64_t ip6s_mext2m;		/* two or more ext mbuf */
214229997Sken	uint64_t ip6s_exthdrtoolong;	/* ext hdr are not contiguous */
215229997Sken	uint64_t ip6s_nogif;		/* no match gif found */
216229997Sken	uint64_t ip6s_toomanyhdr;	/* discarded due to too many headers */
217229997Sken
218229997Sken	/*
219229997Sken	 * statistics for improvement of the source address selection
220229997Sken	 * algorithm:
221229997Sken	 * XXX: hardcoded 16 = # of ip6 multicast scope types + 1
222287620Smav	 */
223287620Smav#define	IP6S_RULESMAX		16
224229997Sken#define	IP6S_SCOPECNT		16
225229997Sken	/* number of times that address selection fails */
226229997Sken	uint64_t ip6s_sources_none;
227229997Sken	/* number of times that an address on the outgoing I/F is chosen */
228229997Sken	uint64_t ip6s_sources_sameif[IP6S_SCOPECNT];
229229997Sken	/* number of times that an address on a non-outgoing I/F is chosen */
230229997Sken	uint64_t ip6s_sources_otherif[IP6S_SCOPECNT];
231229997Sken	/*
232229997Sken	 * number of times that an address that has the same scope
233229997Sken	 * from the destination is chosen.
234229997Sken	 */
235229997Sken	uint64_t ip6s_sources_samescope[IP6S_SCOPECNT];
236229997Sken	/*
237229997Sken	 * number of times that an address that has a different scope
238229997Sken	 * from the destination is chosen.
239229997Sken	 */
240229997Sken	uint64_t ip6s_sources_otherscope[IP6S_SCOPECNT];
241229997Sken	/* number of times that a deprecated address is chosen */
242229997Sken	uint64_t ip6s_sources_deprecated[IP6S_SCOPECNT];
243229997Sken
244229997Sken	/* number of times that each rule of source selection is applied. */
245229997Sken	uint64_t ip6s_sources_rule[IP6S_RULESMAX];
246229997Sken};
247229997Sken
248229997Sken#ifdef _KERNEL
249229997Sken#include <sys/counter.h>
250229997Sken
251229997SkenVNET_PCPUSTAT_DECLARE(struct ip6stat, ip6stat);
252229997Sken#define	IP6STAT_ADD(name, val)	\
253229997Sken    VNET_PCPUSTAT_ADD(struct ip6stat, ip6stat, name, (val))
254229997Sken#define	IP6STAT_SUB(name, val)	IP6STAT_ADD(name, -(val))
255229997Sken#define	IP6STAT_INC(name)	IP6STAT_ADD(name, 1)
256229997Sken#define	IP6STAT_DEC(name)	IP6STAT_SUB(name, 1)
257229997Sken#endif
258229997Sken
259229997Sken#ifdef _KERNEL
260229997Sken/*
261229997Sken * IPv6 onion peeling state.
262229997Sken * it will be initialized when we come into ip6_input().
263229997Sken * XXX do not make it a kitchen sink!
264229997Sken */
265229997Skenstruct ip6aux {
266229997Sken	u_int32_t ip6a_flags;
267229997Sken#define IP6A_SWAP	0x01		/* swapped home/care-of on packet */
268229997Sken#define IP6A_HASEEN	0x02		/* HA was present */
269229997Sken#define IP6A_BRUID	0x04		/* BR Unique Identifier was present */
270229997Sken#define IP6A_RTALERTSEEN 0x08		/* rtalert present */
271229997Sken
272229997Sken	/* ip6.ip6_src */
273229997Sken	struct in6_addr ip6a_careof;	/* care-of address of the peer */
274229997Sken	struct in6_addr ip6a_home;	/* home address of the peer */
275229997Sken	u_int16_t	ip6a_bruid;	/* BR unique identifier */
276229997Sken
277229997Sken	/* ip6.ip6_dst */
278229997Sken	struct in6_ifaddr *ip6a_dstia6;	/* my ifaddr that matches ip6_dst */
279229997Sken
280229997Sken	/* rtalert */
281229997Sken	u_int16_t ip6a_rtalert;		/* rtalert option value */
282229997Sken
283229997Sken	/*
284229997Sken	 * decapsulation history will be here.
285229997Sken	 * with IPsec it may not be accurate.
286229997Sken	 */
287229997Sken};
288229997Sken#endif
289229997Sken
290229997Sken#ifdef _KERNEL
291229997Sken/* flags passed to ip6_output as last parameter */
292229997Sken#define	IPV6_UNSPECSRC		0x01	/* allow :: as the source address */
293229997Sken#define	IPV6_FORWARDING		0x02	/* most of IPv6 header exists */
294229997Sken#define	IPV6_MINMTU		0x04	/* use minimum MTU (IPV6_USE_MIN_MTU) */
295229997Sken
296233648Seadler#ifdef __NO_STRICT_ALIGNMENT
297229997Sken#define IP6_HDR_ALIGNED_P(ip)	1
298229997Sken#else
299229997Sken#define IP6_HDR_ALIGNED_P(ip)	((((intptr_t) (ip)) & 3) == 0)
300229997Sken#endif
301229997Sken
302229997SkenVNET_DECLARE(int, ip6_defhlim);		/* default hop limit */
303229997SkenVNET_DECLARE(int, ip6_defmcasthlim);	/* default multicast hop limit */
304229997SkenVNET_DECLARE(int, ip6_forwarding);	/* act as router? */
305229997SkenVNET_DECLARE(int, ip6_use_deprecated);	/* allow deprecated addr as source */
306229997SkenVNET_DECLARE(int, ip6_rr_prune);	/* router renumbering prefix
307229997Sken					 * walk list every 5 sec.    */
308229997SkenVNET_DECLARE(int, ip6_mcast_pmtu);	/* enable pMTU discovery for multicast? */
309229997SkenVNET_DECLARE(int, ip6_v6only);
310229997Sken#define	V_ip6_defhlim			VNET(ip6_defhlim)
311229997Sken#define	V_ip6_defmcasthlim		VNET(ip6_defmcasthlim)
312229997Sken#define	V_ip6_forwarding		VNET(ip6_forwarding)
313229997Sken#define	V_ip6_use_deprecated		VNET(ip6_use_deprecated)
314229997Sken#define	V_ip6_rr_prune			VNET(ip6_rr_prune)
315229997Sken#define	V_ip6_mcast_pmtu		VNET(ip6_mcast_pmtu)
316229997Sken#define	V_ip6_v6only			VNET(ip6_v6only)
317229997Sken
318229997SkenVNET_DECLARE(struct socket *, ip6_mrouter);	/* multicast routing daemon */
319229997SkenVNET_DECLARE(int, ip6_sendredirects);	/* send IP redirects when forwarding? */
320229997SkenVNET_DECLARE(int, ip6_maxfragpackets);	/* Maximum packets in reassembly
321229997Sken					 * queue */
322229997SkenVNET_DECLARE(int, ip6_maxfrags);	/* Maximum fragments in reassembly
323229997Sken					 * queue */
324229997SkenVNET_DECLARE(int, ip6_accept_rtadv);	/* Acts as a host not a router */
325229997SkenVNET_DECLARE(int, ip6_no_radr);		/* No defroute from RA */
326229997SkenVNET_DECLARE(int, ip6_norbit_raif);	/* Disable R-bit in NA on RA
327229997Sken					 * receiving IF. */
328229997SkenVNET_DECLARE(int, ip6_rfc6204w3);	/* Accept defroute from RA even when
329229997Sken					   forwarding enabled */
330229997SkenVNET_DECLARE(int, ip6_keepfaith);	/* Firewall Aided Internet Translator */
331229997SkenVNET_DECLARE(int, ip6_log_interval);
332229997SkenVNET_DECLARE(time_t, ip6_log_time);
333229997SkenVNET_DECLARE(int, ip6_hdrnestlimit);	/* upper limit of # of extension
334229997Sken					 * headers */
335229997SkenVNET_DECLARE(int, ip6_dad_count);	/* DupAddrDetectionTransmits */
336229997Sken#define	V_ip6_mrouter			VNET(ip6_mrouter)
337229997Sken#define	V_ip6_sendredirects		VNET(ip6_sendredirects)
338229997Sken#define	V_ip6_maxfragpackets		VNET(ip6_maxfragpackets)
339229997Sken#define	V_ip6_maxfrags			VNET(ip6_maxfrags)
340229997Sken#define	V_ip6_accept_rtadv		VNET(ip6_accept_rtadv)
341229997Sken#define	V_ip6_no_radr			VNET(ip6_no_radr)
342229997Sken#define	V_ip6_norbit_raif		VNET(ip6_norbit_raif)
343229997Sken#define	V_ip6_rfc6204w3			VNET(ip6_rfc6204w3)
344229997Sken#define	V_ip6_keepfaith			VNET(ip6_keepfaith)
345229997Sken#define	V_ip6_log_interval		VNET(ip6_log_interval)
346229997Sken#define	V_ip6_log_time			VNET(ip6_log_time)
347229997Sken#define	V_ip6_hdrnestlimit		VNET(ip6_hdrnestlimit)
348229997Sken#define	V_ip6_dad_count			VNET(ip6_dad_count)
349229997Sken
350229997SkenVNET_DECLARE(int, ip6_auto_flowlabel);
351229997SkenVNET_DECLARE(int, ip6_auto_linklocal);
352229997Sken#define	V_ip6_auto_flowlabel		VNET(ip6_auto_flowlabel)
353229997Sken#define	V_ip6_auto_linklocal		VNET(ip6_auto_linklocal)
354229997Sken
355229997SkenVNET_DECLARE(int, ip6_use_tempaddr);	/* Whether to use temporary addresses */
356229997SkenVNET_DECLARE(int, ip6_prefer_tempaddr);	/* Whether to prefer temporary
357229997Sken					 * addresses in the source address
358229997Sken					 * selection */
359229997Sken#define	V_ip6_use_tempaddr		VNET(ip6_use_tempaddr)
360229997Sken#define	V_ip6_prefer_tempaddr		VNET(ip6_prefer_tempaddr)
361229997Sken
362229997SkenVNET_DECLARE(int, ip6_use_defzone);	/* Whether to use the default scope
363229997Sken					 * zone when unspecified */
364229997Sken#define	V_ip6_use_defzone		VNET(ip6_use_defzone)
365229997Sken
366229997SkenVNET_DECLARE (struct pfil_head, inet6_pfil_hook);	/* packet filter hooks */
367229997Sken#define	V_inet6_pfil_hook	VNET(inet6_pfil_hook)
368229997Sken#ifdef IPSTEALTH
369229997SkenVNET_DECLARE(int, ip6stealth);
370229997Sken#define	V_ip6stealth			VNET(ip6stealth)
371229997Sken#endif
372229997Sken
373229997Skenextern struct	pr_usrreqs rip6_usrreqs;
374236509Sjoelstruct sockopt;
375229997Sken
376229997Skenstruct inpcb;
377229997Sken
378229997Skenint	icmp6_ctloutput(struct socket *, struct sockopt *sopt);
379229997Sken
380229997Skenstruct in6_ifaddr;
381229997Skenvoid	ip6_init(void);
382229997Sken#ifdef VIMAGE
383229997Skenvoid	ip6_destroy(void);
384229997Sken#endif
385229997Skenint	ip6proto_register(short);
386229997Skenint	ip6proto_unregister(short);
387229997Sken
388229997Skenvoid	ip6_input(struct mbuf *);
389229997Skenstruct in6_ifaddr *ip6_getdstifaddr(struct mbuf *);
390229997Skenvoid	ip6_freepcbopts(struct ip6_pktopts *);
391229997Sken
392229997Skenint	ip6_unknown_opt(u_int8_t *, struct mbuf *, int);
393229997Skenchar *	ip6_get_prevhdr(struct mbuf *, int);
394229997Skenint	ip6_nexthdr(struct mbuf *, int, int, int *);
395229997Skenint	ip6_lasthdr(struct mbuf *, int, int, int *);
396229997Sken
397229997Sken#ifdef __notyet__
398229997Skenstruct ip6aux *ip6_findaux(struct mbuf *);
399229997Sken#endif
400229997Sken
401229997Skenextern int	(*ip6_mforward)(struct ip6_hdr *, struct ifnet *,
402229997Sken    struct mbuf *);
403229997Sken
404229997Skenint	ip6_process_hopopts(struct mbuf *, u_int8_t *, int, u_int32_t *,
405229997Sken				 u_int32_t *);
406229997Skenstruct mbuf	**ip6_savecontrol_v4(struct inpcb *, struct mbuf *,
407229997Sken	    struct mbuf **, int *);
408229997Skenvoid	ip6_savecontrol(struct inpcb *, struct mbuf *, struct mbuf **);
409229997Skenvoid	ip6_notify_pmtu(struct inpcb *, struct sockaddr_in6 *, u_int32_t);
410229997Skenint	ip6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
411229997Sken
412229997Skenvoid	ip6_forward(struct mbuf *, int);
413229997Sken
414229997Skenvoid	ip6_mloopback(struct ifnet *, struct mbuf *, struct sockaddr_in6 *);
415229997Skenint	ip6_output(struct mbuf *, struct ip6_pktopts *,
416229997Sken			struct route_in6 *,
417229997Sken			int,
418229997Sken			struct ip6_moptions *, struct ifnet **,
419229997Sken			struct inpcb *);
420229997Skenint	ip6_ctloutput(struct socket *, struct sockopt *);
421233648Seadlerint	ip6_raw_ctloutput(struct socket *, struct sockopt *);
422229997Skenvoid	ip6_initpktopts(struct ip6_pktopts *);
423229997Skenint	ip6_setpktopts(struct mbuf *, struct ip6_pktopts *,
424229997Sken	struct ip6_pktopts *, struct ucred *, int);
425229997Skenvoid	ip6_clearpktopts(struct ip6_pktopts *, int);
426229997Skenstruct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int);
427229997Skenint	ip6_optlen(struct inpcb *);
428229997Skenint	ip6_deletefraghdr(struct mbuf *, int, int);
429229997Sken
430229997Skenint	route6_input(struct mbuf **, int *, int);
431229997Sken
432229997Skenvoid	frag6_init(void);
433229997Skenint	frag6_input(struct mbuf **, int *, int);
434229997Skenvoid	frag6_slowtimo(void);
435229997Skenvoid	frag6_drain(void);
436229997Sken
437229997Skenvoid	rip6_init(void);
438229997Skenint	rip6_input(struct mbuf **, int *, int);
439229997Skenvoid	rip6_ctlinput(int, struct sockaddr *, void *);
440229997Skenint	rip6_ctloutput(struct socket *, struct sockopt *);
441249373Sjoelint	rip6_output(struct mbuf *, ...);
442229997Skenint	rip6_usrreq(struct socket *,
443268457Spluknet	    int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *);
444229997Sken
445229997Skenint	dest6_input(struct mbuf **, int *, int);
446229997Skenint	none_input(struct mbuf **, int *, int);
447229997Sken
448229997Skenint	in6_selectsrc(struct sockaddr_in6 *, struct ip6_pktopts *,
449229997Sken	struct inpcb *inp, struct route_in6 *, struct ucred *cred,
450229997Sken	struct ifnet **, struct in6_addr *);
451229997Skenint in6_selectroute(struct sockaddr_in6 *, struct ip6_pktopts *,
452229997Sken	struct ip6_moptions *, struct route_in6 *, struct ifnet **,
453229997Sken	struct rtentry **);
454235873Swblockint	in6_selectroute_fib(struct sockaddr_in6 *, struct ip6_pktopts *,
455229997Sken	    struct ip6_moptions *, struct route_in6 *, struct ifnet **,
456229997Sken	    struct rtentry **, u_int);
457229997Skenu_int32_t ip6_randomid(void);
458229997Skenu_int32_t ip6_randomflowlabel(void);
459229997Skenvoid in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset);
460229997Sken#endif /* _KERNEL */
461229997Sken
462233648Seadler#endif /* !_NETINET6_IP6_VAR_H_ */
463229997Sken