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