1/*
2 * Copyright (c) 2000-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29/*	$FreeBSD: src/sys/netinet6/ip6_var.h,v 1.2.2.2 2001/07/03 11:01:54 ume Exp $	*/
30/*	$KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $	*/
31
32/*
33 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 *    notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 *    notice, this list of conditions and the following disclaimer in the
43 *    documentation and/or other materials provided with the distribution.
44 * 3. Neither the name of the project nor the names of its contributors
45 *    may be used to endorse or promote products derived from this software
46 *    without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 */
60
61/*
62 * Copyright (c) 1982, 1986, 1993
63 *	The Regents of the University of California.  All rights reserved.
64 *
65 * Redistribution and use in source and binary forms, with or without
66 * modification, are permitted provided that the following conditions
67 * are met:
68 * 1. Redistributions of source code must retain the above copyright
69 *    notice, this list of conditions and the following disclaimer.
70 * 2. Redistributions in binary form must reproduce the above copyright
71 *    notice, this list of conditions and the following disclaimer in the
72 *    documentation and/or other materials provided with the distribution.
73 * 3. All advertising materials mentioning features or use of this software
74 *    must display the following acknowledgement:
75 *	This product includes software developed by the University of
76 *	California, Berkeley and its contributors.
77 * 4. Neither the name of the University nor the names of its contributors
78 *    may be used to endorse or promote products derived from this software
79 *    without specific prior written permission.
80 *
81 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
82 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
83 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
84 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
85 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
86 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
87 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
88 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
89 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
90 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
91 * SUCH DAMAGE.
92 *
93 *	@(#)ip_var.h	8.1 (Berkeley) 6/10/93
94 */
95
96#ifndef _NETINET6_IP6_VAR_H_
97#define _NETINET6_IP6_VAR_H_
98#include <sys/appleapiopts.h>
99
100#ifdef XNU_KERNEL_PRIVATE
101/*
102 * IP6 reassembly queue structure.  Each fragment
103 * being reassembled is attached to one of these structures.
104 */
105struct	ip6q {
106	struct ip6asfrag *ip6q_down;
107	struct ip6asfrag *ip6q_up;
108	u_int32_t	ip6q_ident;
109	u_int8_t	ip6q_nxt;
110	u_int8_t	ip6q_ecn;
111	u_int8_t	ip6q_ttl;
112	struct in6_addr ip6q_src, ip6q_dst;
113	struct ip6q	*ip6q_next;
114	struct ip6q	*ip6q_prev;
115	int		ip6q_unfrglen;	/* len of unfragmentable part */
116#if notyet
117	u_char	*ip6q_nxtp;
118#endif
119	int		ip6q_nfrag;	/* # of fragments */
120};
121
122struct	ip6asfrag {
123	struct ip6asfrag *ip6af_down;
124	struct ip6asfrag *ip6af_up;
125	struct mbuf	*ip6af_m;
126	int		ip6af_offset;	/* offset in ip6af_m to next header */
127	int		ip6af_frglen;	/* fragmentable part length */
128	int		ip6af_off;	/* fragment offset */
129	u_int16_t	ip6af_mff;	/* more fragment bit in frag off */
130};
131
132#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
133
134struct	ip6_moptions {
135	decl_lck_mtx_data(, im6o_lock);
136	uint32_t im6o_refcnt;		/* ref count */
137	uint32_t im6o_debug;		/* see ifa_debug flags */
138	struct	ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
139	u_char	im6o_multicast_hlim;	/* hoplimit for outgoing multicasts */
140	u_char	im6o_multicast_loop;	/* 1 >= hear sends if a member */
141	u_short	im6o_num_memberships;	/* no. memberships this socket */
142	u_short	im6o_max_memberships;	/* max memberships this socket */
143	struct	in6_multi **im6o_membership;	/* group memberships */
144	struct	in6_mfilter *im6o_mfilters;	/* source filters */
145	void (*im6o_trace)		/* callback fn for tracing refs */
146	    (struct ip6_moptions *, int);
147};
148
149#define	IM6O_LOCK_ASSERT_HELD(_im6o)					\
150	lck_mtx_assert(&(_im6o)->im6o_lock, LCK_MTX_ASSERT_OWNED)
151
152#define	IM6O_LOCK_ASSERT_NOTHELD(_im6o)					\
153	lck_mtx_assert(&(_im6o)->im6o_lock, LCK_MTX_ASSERT_NOTOWNED)
154
155#define	IM6O_LOCK(_im6o)						\
156	lck_mtx_lock(&(_im6o)->im6o_lock)
157
158#define	IM6O_LOCK_SPIN(_im6o)						\
159	lck_mtx_lock_spin(&(_im6o)->im6o_lock)
160
161#define	IM6O_CONVERT_LOCK(_im6o) do {					\
162	IM6O_LOCK_ASSERT_HELD(_im6o);					\
163	lck_mtx_convert_spin(&(_im6o)->im6o_lock);			\
164} while (0)
165
166#define	IM6O_UNLOCK(_im6o)						\
167	lck_mtx_unlock(&(_im6o)->im6o_lock)
168
169#define	IM6O_ADDREF(_im6o)						\
170	im6o_addref(_im6o, 0)
171
172#define	IM6O_ADDREF_LOCKED(_im6o)					\
173	im6o_addref(_im6o, 1)
174
175#define	IM6O_REMREF(_im6o)						\
176	im6o_remref(_im6o)
177
178struct ip6_exthdrs {
179	struct mbuf *ip6e_ip6;
180	struct mbuf *ip6e_hbh;
181	struct mbuf *ip6e_dest1;
182	struct mbuf *ip6e_rthdr;
183	struct mbuf *ip6e_dest2;
184};
185
186/*
187 * Control options for outgoing packets
188 */
189
190/* Routing header related info */
191struct	ip6po_rhinfo {
192	struct	ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
193	struct	route_in6 ip6po_rhi_route; /* Route to the 1st hop */
194};
195#define ip6po_rthdr	ip6po_rhinfo.ip6po_rhi_rthdr
196#define ip6po_route	ip6po_rhinfo.ip6po_rhi_route
197
198/* Nexthop related info */
199struct	ip6po_nhinfo {
200	struct	sockaddr *ip6po_nhi_nexthop;
201	struct	route_in6 ip6po_nhi_route; /* Route to the nexthop */
202};
203#define ip6po_nexthop	ip6po_nhinfo.ip6po_nhi_nexthop
204#define ip6po_nextroute	ip6po_nhinfo.ip6po_nhi_route
205
206struct	ip6_pktopts {
207	struct	mbuf *ip6po_m;	/* Pointer to mbuf storing the data */
208	int	ip6po_hlim;	/* Hoplimit for outgoing packets */
209
210	/* Outgoing IF/address information */
211	struct	in6_pktinfo *ip6po_pktinfo;
212
213	/* Next-hop address information */
214	struct	ip6po_nhinfo ip6po_nhinfo;
215
216	struct	ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
217
218	/* Destination options header (before a routing header) */
219	struct	ip6_dest *ip6po_dest1;
220
221	/* Routing header related info. */
222	struct	ip6po_rhinfo ip6po_rhinfo;
223
224	/* Destination options header (after a routing header) */
225	struct	ip6_dest *ip6po_dest2;
226
227	int	ip6po_tclass;	/* traffic class */
228
229	int	ip6po_minmtu;  /* fragment vs PMTU discovery policy */
230#define IP6PO_MINMTU_MCASTONLY	-1 /* default; send at min MTU for multicast*/
231#define IP6PO_MINMTU_DISABLE	 0 /* always perform pmtu disc */
232#define IP6PO_MINMTU_ALL	 1 /* always send at min MTU */
233
234	int	ip6po_prefer_tempaddr;  /* whether temporary addresses are
235					   preferred as source address */
236#define IP6PO_TEMPADDR_SYSTEM	-1 /* follow the system default */
237#define IP6PO_TEMPADDR_NOTPREFER 0 /* not prefer temporary address */
238#define IP6PO_TEMPADDR_PREFER	 1 /* prefer temporary address */
239
240	int ip6po_flags;
241#if 0	/* parameters in this block is obsolete. do not reuse the values. */
242#define IP6PO_REACHCONF	0x01	/* upper-layer reachability confirmation. */
243#define IP6PO_MINMTU	0x02	/* use minimum MTU (IPV6_USE_MIN_MTU) */
244#endif
245#define IP6PO_DONTFRAG	0x04	/* disable fragmentation (IPV6_DONTFRAG) */
246#define IP6PO_USECOA	0x08	/* use care of address */
247};
248
249/*
250 * Control options for incoming packets
251 */
252#endif /* XNU_KERNEL_PRIVATE */
253
254struct	ip6stat {
255	u_quad_t ip6s_total;		/* total packets received */
256	u_quad_t ip6s_tooshort;		/* packet too short */
257	u_quad_t ip6s_toosmall;		/* not enough data */
258	u_quad_t ip6s_fragments;	/* fragments received */
259	u_quad_t ip6s_fragdropped;	/* frags dropped(dups, out of space) */
260	u_quad_t ip6s_fragtimeout;	/* fragments timed out */
261	u_quad_t ip6s_fragoverflow;	/* fragments that exceeded limit */
262	u_quad_t ip6s_forward;		/* packets forwarded */
263	u_quad_t ip6s_cantforward;	/* packets rcvd for unreachable dest */
264	u_quad_t ip6s_redirectsent;	/* packets forwarded on same net */
265	u_quad_t ip6s_delivered;	/* datagrams delivered to upper level*/
266	u_quad_t ip6s_localout;		/* total ip packets generated here */
267	u_quad_t ip6s_odropped;		/* lost packets due to nobufs, etc. */
268	u_quad_t ip6s_reassembled;	/* total packets reassembled ok */
269	u_quad_t ip6s_fragmented;	/* datagrams successfully fragmented */
270	u_quad_t ip6s_ofragments;	/* output fragments created */
271	u_quad_t ip6s_cantfrag;		/* don't fragment flag was set, etc. */
272	u_quad_t ip6s_badoptions;	/* error in option processing */
273	u_quad_t ip6s_noroute;		/* packets discarded due to no route */
274	u_quad_t ip6s_badvers;		/* ip6 version != 6 */
275	u_quad_t ip6s_rawout;		/* total raw ip packets generated */
276	u_quad_t ip6s_badscope;		/* scope error */
277	u_quad_t ip6s_notmember;	/* don't join this multicast group */
278	u_quad_t ip6s_nxthist[256];	/* next header history */
279	u_quad_t ip6s_m1;		/* one mbuf */
280	u_quad_t ip6s_m2m[32];		/* two or more mbuf */
281	u_quad_t ip6s_mext1;		/* one ext mbuf */
282	u_quad_t ip6s_mext2m;		/* two or more ext mbuf */
283	u_quad_t ip6s_exthdrtoolong;	/* ext hdr are not continuous */
284	u_quad_t ip6s_nogif;		/* no match gif found */
285	u_quad_t ip6s_toomanyhdr;	/* discarded due to too many headers */
286
287	/*
288	 * statistics for improvement of the source address selection
289	 * algorithm:
290	 * XXX: hardcoded 16 = # of ip6 multicast scope types + 1
291	 */
292	/* number of times that address selection fails */
293	u_quad_t ip6s_sources_none;
294	/* number of times that an address on the outgoing I/F is chosen */
295	u_quad_t ip6s_sources_sameif[16];
296	/* number of times that an address on a non-outgoing I/F is chosen */
297	u_quad_t ip6s_sources_otherif[16];
298	/*
299	 * number of times that an address that has the same scope
300	 * from the destination is chosen.
301	 */
302	u_quad_t ip6s_sources_samescope[16];
303	/*
304	 * number of times that an address that has a different scope
305	 * from the destination is chosen.
306	 */
307	u_quad_t ip6s_sources_otherscope[16];
308	/* number of times that a deprecated address is chosen */
309	u_quad_t ip6s_sources_deprecated[16];
310
311	u_quad_t ip6s_forward_cachehit;
312	u_quad_t ip6s_forward_cachemiss;
313
314	/* number of times that each rule of source selection is applied. */
315	u_quad_t ip6s_sources_rule[16];
316#ifdef PRIVATE
317	u_quad_t ip6s_pktdropcntrl;	/* pkt dropped, no mbufs for control data */
318#endif /* PRIVATE */
319};
320
321#ifdef KERNEL_PRIVATE
322#ifdef KERNEL
323/*
324 * IPv6 onion peeling state.
325 * it will be initialized when we come into ip6_input().
326 * XXX do not make it a kitchen sink!
327 */
328struct ip6aux {
329	u_int32_t ip6a_flags;
330#define IP6A_SWAP	0x01		/* swapped home/care-of on packet */
331#define IP6A_HASEEN	0x02		/* HA was present */
332#define IP6A_BRUID	0x04		/* BR Unique Identifier was present */
333#define IP6A_RTALERTSEEN 0x08		/* rtalert present */
334
335	/* ip6.ip6_src */
336	struct in6_addr ip6a_careof;	/* care-of address of the peer */
337	struct in6_addr ip6a_home;	/* home address of the peer */
338	u_int16_t	ip6a_bruid;	/* BR unique identifier */
339
340	/* ip6.ip6_dst */
341	struct in6_ifaddr *ip6a_dstia6;	/* my ifaddr that matches ip6_dst */
342
343	/* rtalert */
344	u_int16_t ip6a_rtalert;		/* rtalert option value */
345
346	/*
347	 * decapsulation history will be here.
348	 * with IPsec it may not be accurate.
349	 */
350};
351
352/* flags passed to ip6_output as last parameter */
353#define	IPV6_UNSPECSRC		0x01	/* allow :: as the source address */
354#define	IPV6_FORWARDING		0x02	/* most of IPv6 header exists */
355#define	IPV6_MINMTU		0x04	/* use minimum MTU (IPV6_USE_MIN_MTU) */
356#define	IPV6_FLAG_NOSRCIFSEL	0x80	/* bypas source address selection */
357#define	IPV6_OUTARGS		0x100	/* has ancillary output info */
358
359#ifdef XNU_KERNEL_PRIVATE
360#define IP6_HDR_ALIGNED_P(_ip6)	((((uintptr_t)(_ip6)) & ((uintptr_t)3)) == 0)
361
362/*
363 * On platforms which require strict alignment (currently for anything but
364 * i386 or x86_64), this macro checks whether the pointer to the IP header
365 * is 32-bit aligned, and assert otherwise.
366 */
367#if defined(__i386__) || defined(__x86_64__)
368#define	IP6_HDR_STRICT_ALIGNMENT_CHECK(_ip6) do { } while (0)
369#else /* !__i386__ && !__x86_64__ */
370#define	IP6_HDR_STRICT_ALIGNMENT_CHECK(_ip6) do {			\
371	if (!IP_HDR_ALIGNED_P(_ip6)) {					\
372		panic_plain("\n%s: Unaligned IPv6 header %p\n",		\
373		    __func__, _ip6);					\
374	}								\
375} while (0)
376#endif /* !__i386__ && !__x86_64__ */
377#endif /* XNU_KERNEL_PRIVATE */
378
379#include <net/flowadv.h>
380
381/*
382 * Extra information passed to ip6_output when IPV6_OUTARGS is set.
383 */
384struct ip6_out_args {
385	unsigned int	ip6oa_boundif;	/* bound outgoing interface */
386	struct flowadv	ip6oa_flowadv;	/* flow advisory code */
387	u_int32_t	ip6oa_flags;	/* IP6OAF flags (see below) */
388#define	IP6OAF_SELECT_SRCIF	0x00000001	/* src interface selection */
389#define	IP6OAF_BOUND_IF		0x00000002	/* boundif value is valid */
390#define	IP6OAF_BOUND_SRCADDR	0x00000004	/* bound to src address */
391#define	IP6OAF_NO_CELLULAR	0x00000010	/* skip IFT_CELLULAR */
392};
393
394extern struct	ip6stat ip6stat;	/* statistics */
395extern u_int32_t ip6_id; 		/* fragment identifier */
396extern int	ip6_defhlim;		/* default hop limit */
397extern int	ip6_defmcasthlim;	/* default multicast hop limit */
398extern int	ip6_forwarding;		/* act as router? */
399extern int	ip6_forward_srcrt;	/* forward src-routed? */
400extern int	ip6_gif_hlim;		/* Hop limit for gif encap packet */
401extern int	ip6_use_deprecated;	/* allow deprecated addr as source */
402extern int	ip6_rr_prune;		/* router renumbering prefix
403					 * walk list every 5 sec.    */
404extern int	ip6_mcast_pmtu;		/* enable pMTU discovery for multicast? */
405#define ip6_mapped_addr_on      (!ip6_v6only)
406extern int	ip6_v6only;
407
408extern int	ip6_neighborgcthresh;	/* Threshold # of NDP entries for GC */
409extern int	ip6_maxifprefixes;	/* Max acceptable prefixes via RA per IF */
410extern int	ip6_maxifdefrouters;	/* Max acceptable def routers via RA */
411extern int	ip6_maxdynroutes;	/* Max # of routes created via redirect */
412#if MROUTING
413extern struct socket *ip6_mrouter; 	/* multicast routing daemon */
414#endif
415extern int	ip6_sendredirects;	/* send IP redirects when forwarding? */
416extern int	ip6_maxfragpackets; /* Maximum packets in reassembly queue */
417extern int	ip6_maxfrags;	/* Maximum fragments in reassembly queue */
418extern int	ip6_sourcecheck;	/* Verify source interface */
419extern int	ip6_sourcecheck_interval; /* Interval between log messages */
420extern int	ip6_accept_rtadv;	/* deprecated */
421extern int	ip6_log_interval;
422extern time_t	ip6_log_time;
423extern int	ip6_hdrnestlimit; /* upper limit of # of extension headers */
424extern int	ip6_dad_count;		/* DupAddrDetectionTransmits */
425extern int	ip6_only_allow_rfc4193_prefix;	/* RFC4193 Unique Local Unicast Prefixes only */
426
427extern u_int32_t ip6_flow_seq;
428extern int ip6_auto_flowlabel;
429extern int ip6_auto_linklocal;
430
431extern int   ip6_anonportmin;		/* minimum ephemeral port */
432extern int   ip6_anonportmax;		/* maximum ephemeral port */
433extern int   ip6_lowportmin;		/* minimum reserved port */
434extern int   ip6_lowportmax;		/* maximum reserved port */
435
436extern int	ip6_use_tempaddr; /* whether to use temporary addresses. */
437extern int	ip6_prefer_tempaddr; /* whether to prefer temporary addresses
438					in the source address selection */
439extern int	ip6_use_defzone; /* whether to use the default scope zone
440				    when unspecified */
441
442extern struct	pr_usrreqs rip6_usrreqs;
443extern struct   pr_usrreqs icmp6_dgram_usrreqs;
444
445extern int	ip6_doscopedroute;
446extern int	ip6_restrictrecvif;
447
448struct sockopt;
449
450struct inpcb;
451
452int	icmp6_ctloutput(struct socket *, struct sockopt *);
453int	icmp6_dgram_ctloutput(struct socket *, struct sockopt *);
454int 	icmp6_dgram_send(struct socket *, int , struct mbuf *, struct sockaddr *, struct mbuf *, struct proc *);
455int 	icmp6_dgram_attach(struct socket *, int , struct proc *);
456
457
458struct in6_ifaddr;
459void	ip6_init(void);
460void	ip6_input(struct mbuf *);
461struct in6_ifaddr *ip6_getdstifaddr(struct mbuf *);
462void	ip6_freepcbopts(struct ip6_pktopts *);
463int	ip6_unknown_opt(u_int8_t *, struct mbuf *, int);
464char *	ip6_get_prevhdr(struct mbuf *, int);
465int	ip6_nexthdr(struct mbuf *, int, int, int *);
466int	ip6_lasthdr(struct mbuf *, int, int, int *);
467
468extern void ip6_moptions_init(void);
469extern struct ip6_moptions *ip6_allocmoptions(int);
470extern void im6o_addref(struct ip6_moptions *, int);
471extern void im6o_remref(struct ip6_moptions *);
472
473struct ip6aux *ip6_addaux(struct mbuf *);
474struct ip6aux *ip6_findaux(struct mbuf *);
475void	ip6_delaux(struct mbuf *);
476extern void ip6_destroyaux(struct ip6aux *);
477extern void ip6_copyaux(struct ip6aux *, struct ip6aux *);
478
479int	ip6_mforward(struct ip6_hdr *, struct ifnet *, struct mbuf *);
480int	ip6_process_hopopts(struct mbuf *, u_int8_t *, int, u_int32_t *,
481				 u_int32_t *);
482struct mbuf	**ip6_savecontrol_v4(struct inpcb *, struct mbuf *,
483	    struct mbuf **, int *);
484int	ip6_savecontrol(struct inpcb *, struct mbuf *, struct mbuf **);
485struct mbuf *ip6_forward(struct mbuf *, struct route_in6 *, int);
486void	ip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *,
487			     u_int32_t *));
488void	ip6_mloopback(struct ifnet *, struct mbuf *, struct sockaddr_in6 *);
489int	ip6_output(struct mbuf *, struct ip6_pktopts *, struct route_in6 *,
490	    int, struct ip6_moptions *, struct ifnet **, struct ip6_out_args *);
491int	ip6_output_list(struct mbuf *, int, struct ip6_pktopts *,
492	    struct route_in6 *, int, struct ip6_moptions *, struct ifnet **,
493	    struct ip6_out_args *);
494int	ip6_ctloutput(struct socket *, struct sockopt *sopt);
495void	ip6_initpktopts(struct ip6_pktopts *);
496int	ip6_setpktoptions(struct mbuf *, struct ip6_pktopts *, int, int);
497void	ip6_clearpktopts(struct ip6_pktopts *, int);
498struct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int);
499int	ip6_optlen(struct inpcb *);
500
501int	route6_input(struct mbuf **, int *, int);
502
503void	frag6_init(void);
504int	frag6_input(struct mbuf **, int *, int);
505void	frag6_slowtimo(void);
506void	frag6_drain(void);
507
508int	rip6_input(struct mbuf **, int *, int);
509void	rip6_ctlinput(int, struct sockaddr *, void *);
510int	rip6_ctloutput(struct socket *so, struct sockopt *sopt);
511int	rip6_output(struct mbuf *, struct socket *, struct sockaddr_in6 *, struct mbuf *, int);
512
513int	dest6_input(struct mbuf **, int *, int);
514extern struct in6_addr *in6_selectsrc(struct sockaddr_in6 *,
515	    struct ip6_pktopts *, struct inpcb *, struct route_in6 *,
516	    struct ifnet **, struct in6_addr *, unsigned int, int *);
517extern struct in6_addrpolicy *
518	in6_addrsel_lookup_policy(struct sockaddr_in6 *);
519int in6_selectroute(struct sockaddr_in6 *, struct sockaddr_in6 *,
520	struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *,
521	struct ifnet **, struct rtentry **, int, const struct ip6_out_args *);
522int ip6_setpktopts(struct mbuf *control, struct ip6_pktopts *opt, struct ip6_pktopts *stickyopt, int uproto);
523u_int32_t ip6_randomid(void);
524u_int32_t ip6_randomflowlabel(void);
525
526#endif /* KERNEL */
527#endif /* KERNEL_PRIVATE */
528
529#endif /* !_NETINET6_IP6_VAR_H_ */
530