Deleted Added
full compact
ip6_var.h (187989) ip6_var.h (191672)
1/*-
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the project nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $
30 */
31
32/*-
33 * Copyright (c) 1982, 1986, 1993
34 * The Regents of the University of California. 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 * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 * @(#)ip_var.h 8.1 (Berkeley) 6/10/93
1/*-
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the project nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $
30 */
31
32/*-
33 * Copyright (c) 1982, 1986, 1993
34 * The Regents of the University of California. 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 * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 * @(#)ip_var.h 8.1 (Berkeley) 6/10/93
61 * $FreeBSD: head/sys/netinet6/ip6_var.h 187989 2009-02-01 21:11:08Z bz $
61 * $FreeBSD: head/sys/netinet6/ip6_var.h 191672 2009-04-29 19:19:13Z bms $
62 */
63
64#ifndef _NETINET6_IP6_VAR_H_
65#define _NETINET6_IP6_VAR_H_
66
67/*
68 * IP6 reassembly queue structure. Each fragment
69 * being reassembled is attached to one of these structures.
70 */
71struct ip6q {
72 struct ip6asfrag *ip6q_down;
73 struct ip6asfrag *ip6q_up;
74 u_int32_t ip6q_ident;
75 u_int8_t ip6q_nxt;
76 u_int8_t ip6q_ecn;
77 u_int8_t ip6q_ttl;
78 struct in6_addr ip6q_src, ip6q_dst;
79 struct ip6q *ip6q_next;
80 struct ip6q *ip6q_prev;
81 int ip6q_unfrglen; /* len of unfragmentable part */
82#ifdef notyet
83 u_char *ip6q_nxtp;
84#endif
85 int ip6q_nfrag; /* # of fragments */
86 struct label *ip6q_label;
87};
88
89struct ip6asfrag {
90 struct ip6asfrag *ip6af_down;
91 struct ip6asfrag *ip6af_up;
92 struct mbuf *ip6af_m;
93 int ip6af_offset; /* offset in ip6af_m to next header */
94 int ip6af_frglen; /* fragmentable part length */
95 int ip6af_off; /* fragment offset */
96 u_int16_t ip6af_mff; /* more fragment bit in frag off */
97};
98
99#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
100
62 */
63
64#ifndef _NETINET6_IP6_VAR_H_
65#define _NETINET6_IP6_VAR_H_
66
67/*
68 * IP6 reassembly queue structure. Each fragment
69 * being reassembled is attached to one of these structures.
70 */
71struct ip6q {
72 struct ip6asfrag *ip6q_down;
73 struct ip6asfrag *ip6q_up;
74 u_int32_t ip6q_ident;
75 u_int8_t ip6q_nxt;
76 u_int8_t ip6q_ecn;
77 u_int8_t ip6q_ttl;
78 struct in6_addr ip6q_src, ip6q_dst;
79 struct ip6q *ip6q_next;
80 struct ip6q *ip6q_prev;
81 int ip6q_unfrglen; /* len of unfragmentable part */
82#ifdef notyet
83 u_char *ip6q_nxtp;
84#endif
85 int ip6q_nfrag; /* # of fragments */
86 struct label *ip6q_label;
87};
88
89struct ip6asfrag {
90 struct ip6asfrag *ip6af_down;
91 struct ip6asfrag *ip6af_up;
92 struct mbuf *ip6af_m;
93 int ip6af_offset; /* offset in ip6af_m to next header */
94 int ip6af_frglen; /* fragmentable part length */
95 int ip6af_off; /* fragment offset */
96 u_int16_t ip6af_mff; /* more fragment bit in frag off */
97};
98
99#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
100
101struct ip6_moptions {
101/*
102 * Structure attached to inpcb.in6p_moptions and
103 * passed to ip6_output when IPv6 multicast options are in use.
104 * This structure is lazy-allocated.
105 */
106struct ip6_moptions {
102 struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
103 u_char im6o_multicast_hlim; /* hoplimit for outgoing multicasts */
104 u_char im6o_multicast_loop; /* 1 >= hear sends if a member */
107 struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
108 u_char im6o_multicast_hlim; /* hoplimit for outgoing multicasts */
109 u_char im6o_multicast_loop; /* 1 >= hear sends if a member */
105 LIST_HEAD(, in6_multi_mship) im6o_memberships;
110 u_short im6o_num_memberships; /* no. memberships this socket */
111 u_short im6o_max_memberships; /* max memberships this socket */
112 struct in6_multi **im6o_membership; /* group memberships */
113 struct in6_mfilter *im6o_mfilters; /* source filters */
106};
107
108/*
109 * Control options for outgoing packets
110 */
111
112/* Routing header related info */
113struct ip6po_rhinfo {
114 struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
115 struct route_in6 ip6po_rhi_route; /* Route to the 1st hop */
116};
117#define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr
118#define ip6po_route ip6po_rhinfo.ip6po_rhi_route
119
120/* Nexthop related info */
121struct ip6po_nhinfo {
122 struct sockaddr *ip6po_nhi_nexthop;
123 struct route_in6 ip6po_nhi_route; /* Route to the nexthop */
124};
125#define ip6po_nexthop ip6po_nhinfo.ip6po_nhi_nexthop
126#define ip6po_nextroute ip6po_nhinfo.ip6po_nhi_route
127
128struct ip6_pktopts {
129 struct mbuf *ip6po_m; /* Pointer to mbuf storing the data */
130 int ip6po_hlim; /* Hoplimit for outgoing packets */
131
132 /* Outgoing IF/address information */
133 struct in6_pktinfo *ip6po_pktinfo;
134
135 /* Next-hop address information */
136 struct ip6po_nhinfo ip6po_nhinfo;
137
138 struct ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
139
140 /* Destination options header (before a routing header) */
141 struct ip6_dest *ip6po_dest1;
142
143 /* Routing header related info. */
144 struct ip6po_rhinfo ip6po_rhinfo;
145
146 /* Destination options header (after a routing header) */
147 struct ip6_dest *ip6po_dest2;
148
149 int ip6po_tclass; /* traffic class */
150
151 int ip6po_minmtu; /* fragment vs PMTU discovery policy */
152#define IP6PO_MINMTU_MCASTONLY -1 /* default; send at min MTU for multicast*/
153#define IP6PO_MINMTU_DISABLE 0 /* always perform pmtu disc */
154#define IP6PO_MINMTU_ALL 1 /* always send at min MTU */
155
156 int ip6po_prefer_tempaddr; /* whether temporary addresses are
157 preferred as source address */
158#define IP6PO_TEMPADDR_SYSTEM -1 /* follow the system default */
159#define IP6PO_TEMPADDR_NOTPREFER 0 /* not prefer temporary address */
160#define IP6PO_TEMPADDR_PREFER 1 /* prefer temporary address */
161
162 int ip6po_flags;
163#if 0 /* parameters in this block is obsolete. do not reuse the values. */
164#define IP6PO_REACHCONF 0x01 /* upper-layer reachability confirmation. */
165#define IP6PO_MINMTU 0x02 /* use minimum MTU (IPV6_USE_MIN_MTU) */
166#endif
167#define IP6PO_DONTFRAG 0x04 /* disable fragmentation (IPV6_DONTFRAG) */
168#define IP6PO_USECOA 0x08 /* use care of address */
169};
170
171/*
172 * Control options for incoming packets
173 */
174
175struct ip6stat {
176 u_quad_t ip6s_total; /* total packets received */
177 u_quad_t ip6s_tooshort; /* packet too short */
178 u_quad_t ip6s_toosmall; /* not enough data */
179 u_quad_t ip6s_fragments; /* fragments received */
180 u_quad_t ip6s_fragdropped; /* frags dropped(dups, out of space) */
181 u_quad_t ip6s_fragtimeout; /* fragments timed out */
182 u_quad_t ip6s_fragoverflow; /* fragments that exceeded limit */
183 u_quad_t ip6s_forward; /* packets forwarded */
184 u_quad_t ip6s_cantforward; /* packets rcvd for unreachable dest */
185 u_quad_t ip6s_redirectsent; /* packets forwarded on same net */
186 u_quad_t ip6s_delivered; /* datagrams delivered to upper level*/
187 u_quad_t ip6s_localout; /* total ip packets generated here */
188 u_quad_t ip6s_odropped; /* lost packets due to nobufs, etc. */
189 u_quad_t ip6s_reassembled; /* total packets reassembled ok */
190 u_quad_t ip6s_fragmented; /* datagrams successfully fragmented */
191 u_quad_t ip6s_ofragments; /* output fragments created */
192 u_quad_t ip6s_cantfrag; /* don't fragment flag was set, etc. */
193 u_quad_t ip6s_badoptions; /* error in option processing */
194 u_quad_t ip6s_noroute; /* packets discarded due to no route */
195 u_quad_t ip6s_badvers; /* ip6 version != 6 */
196 u_quad_t ip6s_rawout; /* total raw ip packets generated */
197 u_quad_t ip6s_badscope; /* scope error */
198 u_quad_t ip6s_notmember; /* don't join this multicast group */
199 u_quad_t ip6s_nxthist[256]; /* next header history */
200 u_quad_t ip6s_m1; /* one mbuf */
201 u_quad_t ip6s_m2m[32]; /* two or more mbuf */
202 u_quad_t ip6s_mext1; /* one ext mbuf */
203 u_quad_t ip6s_mext2m; /* two or more ext mbuf */
204 u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */
205 u_quad_t ip6s_nogif; /* no match gif found */
206 u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */
207
208 /*
209 * statistics for improvement of the source address selection
210 * algorithm:
211 * XXX: hardcoded 16 = # of ip6 multicast scope types + 1
212 */
213 /* number of times that address selection fails */
214 u_quad_t ip6s_sources_none;
215 /* number of times that an address on the outgoing I/F is chosen */
216 u_quad_t ip6s_sources_sameif[16];
217 /* number of times that an address on a non-outgoing I/F is chosen */
218 u_quad_t ip6s_sources_otherif[16];
219 /*
220 * number of times that an address that has the same scope
221 * from the destination is chosen.
222 */
223 u_quad_t ip6s_sources_samescope[16];
224 /*
225 * number of times that an address that has a different scope
226 * from the destination is chosen.
227 */
228 u_quad_t ip6s_sources_otherscope[16];
229 /* number of times that a deprecated address is chosen */
230 u_quad_t ip6s_sources_deprecated[16];
231
232 /* number of times that each rule of source selection is applied. */
233 u_quad_t ip6s_sources_rule[16];
234};
235
236#ifdef _KERNEL
114};
115
116/*
117 * Control options for outgoing packets
118 */
119
120/* Routing header related info */
121struct ip6po_rhinfo {
122 struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
123 struct route_in6 ip6po_rhi_route; /* Route to the 1st hop */
124};
125#define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr
126#define ip6po_route ip6po_rhinfo.ip6po_rhi_route
127
128/* Nexthop related info */
129struct ip6po_nhinfo {
130 struct sockaddr *ip6po_nhi_nexthop;
131 struct route_in6 ip6po_nhi_route; /* Route to the nexthop */
132};
133#define ip6po_nexthop ip6po_nhinfo.ip6po_nhi_nexthop
134#define ip6po_nextroute ip6po_nhinfo.ip6po_nhi_route
135
136struct ip6_pktopts {
137 struct mbuf *ip6po_m; /* Pointer to mbuf storing the data */
138 int ip6po_hlim; /* Hoplimit for outgoing packets */
139
140 /* Outgoing IF/address information */
141 struct in6_pktinfo *ip6po_pktinfo;
142
143 /* Next-hop address information */
144 struct ip6po_nhinfo ip6po_nhinfo;
145
146 struct ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
147
148 /* Destination options header (before a routing header) */
149 struct ip6_dest *ip6po_dest1;
150
151 /* Routing header related info. */
152 struct ip6po_rhinfo ip6po_rhinfo;
153
154 /* Destination options header (after a routing header) */
155 struct ip6_dest *ip6po_dest2;
156
157 int ip6po_tclass; /* traffic class */
158
159 int ip6po_minmtu; /* fragment vs PMTU discovery policy */
160#define IP6PO_MINMTU_MCASTONLY -1 /* default; send at min MTU for multicast*/
161#define IP6PO_MINMTU_DISABLE 0 /* always perform pmtu disc */
162#define IP6PO_MINMTU_ALL 1 /* always send at min MTU */
163
164 int ip6po_prefer_tempaddr; /* whether temporary addresses are
165 preferred as source address */
166#define IP6PO_TEMPADDR_SYSTEM -1 /* follow the system default */
167#define IP6PO_TEMPADDR_NOTPREFER 0 /* not prefer temporary address */
168#define IP6PO_TEMPADDR_PREFER 1 /* prefer temporary address */
169
170 int ip6po_flags;
171#if 0 /* parameters in this block is obsolete. do not reuse the values. */
172#define IP6PO_REACHCONF 0x01 /* upper-layer reachability confirmation. */
173#define IP6PO_MINMTU 0x02 /* use minimum MTU (IPV6_USE_MIN_MTU) */
174#endif
175#define IP6PO_DONTFRAG 0x04 /* disable fragmentation (IPV6_DONTFRAG) */
176#define IP6PO_USECOA 0x08 /* use care of address */
177};
178
179/*
180 * Control options for incoming packets
181 */
182
183struct ip6stat {
184 u_quad_t ip6s_total; /* total packets received */
185 u_quad_t ip6s_tooshort; /* packet too short */
186 u_quad_t ip6s_toosmall; /* not enough data */
187 u_quad_t ip6s_fragments; /* fragments received */
188 u_quad_t ip6s_fragdropped; /* frags dropped(dups, out of space) */
189 u_quad_t ip6s_fragtimeout; /* fragments timed out */
190 u_quad_t ip6s_fragoverflow; /* fragments that exceeded limit */
191 u_quad_t ip6s_forward; /* packets forwarded */
192 u_quad_t ip6s_cantforward; /* packets rcvd for unreachable dest */
193 u_quad_t ip6s_redirectsent; /* packets forwarded on same net */
194 u_quad_t ip6s_delivered; /* datagrams delivered to upper level*/
195 u_quad_t ip6s_localout; /* total ip packets generated here */
196 u_quad_t ip6s_odropped; /* lost packets due to nobufs, etc. */
197 u_quad_t ip6s_reassembled; /* total packets reassembled ok */
198 u_quad_t ip6s_fragmented; /* datagrams successfully fragmented */
199 u_quad_t ip6s_ofragments; /* output fragments created */
200 u_quad_t ip6s_cantfrag; /* don't fragment flag was set, etc. */
201 u_quad_t ip6s_badoptions; /* error in option processing */
202 u_quad_t ip6s_noroute; /* packets discarded due to no route */
203 u_quad_t ip6s_badvers; /* ip6 version != 6 */
204 u_quad_t ip6s_rawout; /* total raw ip packets generated */
205 u_quad_t ip6s_badscope; /* scope error */
206 u_quad_t ip6s_notmember; /* don't join this multicast group */
207 u_quad_t ip6s_nxthist[256]; /* next header history */
208 u_quad_t ip6s_m1; /* one mbuf */
209 u_quad_t ip6s_m2m[32]; /* two or more mbuf */
210 u_quad_t ip6s_mext1; /* one ext mbuf */
211 u_quad_t ip6s_mext2m; /* two or more ext mbuf */
212 u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */
213 u_quad_t ip6s_nogif; /* no match gif found */
214 u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */
215
216 /*
217 * statistics for improvement of the source address selection
218 * algorithm:
219 * XXX: hardcoded 16 = # of ip6 multicast scope types + 1
220 */
221 /* number of times that address selection fails */
222 u_quad_t ip6s_sources_none;
223 /* number of times that an address on the outgoing I/F is chosen */
224 u_quad_t ip6s_sources_sameif[16];
225 /* number of times that an address on a non-outgoing I/F is chosen */
226 u_quad_t ip6s_sources_otherif[16];
227 /*
228 * number of times that an address that has the same scope
229 * from the destination is chosen.
230 */
231 u_quad_t ip6s_sources_samescope[16];
232 /*
233 * number of times that an address that has a different scope
234 * from the destination is chosen.
235 */
236 u_quad_t ip6s_sources_otherscope[16];
237 /* number of times that a deprecated address is chosen */
238 u_quad_t ip6s_sources_deprecated[16];
239
240 /* number of times that each rule of source selection is applied. */
241 u_quad_t ip6s_sources_rule[16];
242};
243
244#ifdef _KERNEL
245#define IP6STAT_ADD(name, val) V_ip6stat.name += (val)
246#define IP6STAT_SUB(name, val) V_ip6stat.name -= (val)
247#define IP6STAT_INC(name) IP6STAT_ADD(name, 1)
248#define IP6STAT_DEC(name) IP6STAT_SUB(name, 1)
249#endif
250
251#ifdef _KERNEL
237/*
238 * IPv6 onion peeling state.
239 * it will be initialized when we come into ip6_input().
240 * XXX do not make it a kitchen sink!
241 */
242struct ip6aux {
243 u_int32_t ip6a_flags;
244#define IP6A_SWAP 0x01 /* swapped home/care-of on packet */
245#define IP6A_HASEEN 0x02 /* HA was present */
246#define IP6A_BRUID 0x04 /* BR Unique Identifier was present */
247#define IP6A_RTALERTSEEN 0x08 /* rtalert present */
248
249 /* ip6.ip6_src */
250 struct in6_addr ip6a_careof; /* care-of address of the peer */
251 struct in6_addr ip6a_home; /* home address of the peer */
252 u_int16_t ip6a_bruid; /* BR unique identifier */
253
254 /* ip6.ip6_dst */
255 struct in6_ifaddr *ip6a_dstia6; /* my ifaddr that matches ip6_dst */
256
257 /* rtalert */
258 u_int16_t ip6a_rtalert; /* rtalert option value */
259
260 /*
261 * decapsulation history will be here.
262 * with IPsec it may not be accurate.
263 */
264};
265#endif
266
267#ifdef _KERNEL
268/* flags passed to ip6_output as last parameter */
269#define IPV6_UNSPECSRC 0x01 /* allow :: as the source address */
270#define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */
271#define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */
272
273#ifdef __NO_STRICT_ALIGNMENT
274#define IP6_HDR_ALIGNED_P(ip) 1
275#else
276#define IP6_HDR_ALIGNED_P(ip) ((((intptr_t) (ip)) & 3) == 0)
277#endif
278
279#ifdef VIMAGE_GLOBALS
280extern struct ip6stat ip6stat; /* statistics */
281extern int ip6_defhlim; /* default hop limit */
282extern int ip6_defmcasthlim; /* default multicast hop limit */
283extern int ip6_forwarding; /* act as router? */
284extern int ip6_gif_hlim; /* Hop limit for gif encap packet */
285extern int ip6_use_deprecated; /* allow deprecated addr as source */
286extern int ip6_rr_prune; /* router renumbering prefix
287 * walk list every 5 sec. */
288extern int ip6_mcast_pmtu; /* enable pMTU discovery for multicast? */
289extern int ip6_v6only;
252/*
253 * IPv6 onion peeling state.
254 * it will be initialized when we come into ip6_input().
255 * XXX do not make it a kitchen sink!
256 */
257struct ip6aux {
258 u_int32_t ip6a_flags;
259#define IP6A_SWAP 0x01 /* swapped home/care-of on packet */
260#define IP6A_HASEEN 0x02 /* HA was present */
261#define IP6A_BRUID 0x04 /* BR Unique Identifier was present */
262#define IP6A_RTALERTSEEN 0x08 /* rtalert present */
263
264 /* ip6.ip6_src */
265 struct in6_addr ip6a_careof; /* care-of address of the peer */
266 struct in6_addr ip6a_home; /* home address of the peer */
267 u_int16_t ip6a_bruid; /* BR unique identifier */
268
269 /* ip6.ip6_dst */
270 struct in6_ifaddr *ip6a_dstia6; /* my ifaddr that matches ip6_dst */
271
272 /* rtalert */
273 u_int16_t ip6a_rtalert; /* rtalert option value */
274
275 /*
276 * decapsulation history will be here.
277 * with IPsec it may not be accurate.
278 */
279};
280#endif
281
282#ifdef _KERNEL
283/* flags passed to ip6_output as last parameter */
284#define IPV6_UNSPECSRC 0x01 /* allow :: as the source address */
285#define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */
286#define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */
287
288#ifdef __NO_STRICT_ALIGNMENT
289#define IP6_HDR_ALIGNED_P(ip) 1
290#else
291#define IP6_HDR_ALIGNED_P(ip) ((((intptr_t) (ip)) & 3) == 0)
292#endif
293
294#ifdef VIMAGE_GLOBALS
295extern struct ip6stat ip6stat; /* statistics */
296extern int ip6_defhlim; /* default hop limit */
297extern int ip6_defmcasthlim; /* default multicast hop limit */
298extern int ip6_forwarding; /* act as router? */
299extern int ip6_gif_hlim; /* Hop limit for gif encap packet */
300extern int ip6_use_deprecated; /* allow deprecated addr as source */
301extern int ip6_rr_prune; /* router renumbering prefix
302 * walk list every 5 sec. */
303extern int ip6_mcast_pmtu; /* enable pMTU discovery for multicast? */
304extern int ip6_v6only;
290#endif /* VIMAGE_GLOBALS */
291
292extern struct socket *ip6_mrouter; /* multicast routing daemon */
305extern struct socket *ip6_mrouter; /* multicast routing daemon */
293#ifdef VIMAGE_GLOBALS
294extern int ip6_sendredirects; /* send IP redirects when forwarding? */
295extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */
296extern int ip6_maxfrags; /* Maximum fragments in reassembly queue */
297extern int ip6_accept_rtadv; /* Acts as a host not a router */
298extern int ip6_keepfaith; /* Firewall Aided Internet Translator */
299extern int ip6_log_interval;
300extern time_t ip6_log_time;
301extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */
302extern int ip6_dad_count; /* DupAddrDetectionTransmits */
303
304extern int ip6_auto_flowlabel;
305extern int ip6_auto_linklocal;
306
307extern int ip6_use_tempaddr; /* whether to use temporary addresses. */
308extern int ip6_prefer_tempaddr; /* whether to prefer temporary addresses
309 in the source address selection */
310
311#ifdef IPSTEALTH
312extern int ip6stealth;
313#endif
314
315extern int ip6_use_defzone; /* whether to use the default scope zone
316 when unspecified */
317#endif /* VIMAGE_GLOBALS */
318
319extern struct pfil_head inet6_pfil_hook; /* packet filter hooks */
320
321extern struct pr_usrreqs rip6_usrreqs;
322struct sockopt;
323
324struct inpcb;
325
326int icmp6_ctloutput __P((struct socket *, struct sockopt *sopt));
327
328struct in6_ifaddr;
329void ip6_init __P((void));
330void ip6_input __P((struct mbuf *));
331struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *));
332void ip6_freepcbopts __P((struct ip6_pktopts *));
306extern int ip6_sendredirects; /* send IP redirects when forwarding? */
307extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */
308extern int ip6_maxfrags; /* Maximum fragments in reassembly queue */
309extern int ip6_accept_rtadv; /* Acts as a host not a router */
310extern int ip6_keepfaith; /* Firewall Aided Internet Translator */
311extern int ip6_log_interval;
312extern time_t ip6_log_time;
313extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */
314extern int ip6_dad_count; /* DupAddrDetectionTransmits */
315
316extern int ip6_auto_flowlabel;
317extern int ip6_auto_linklocal;
318
319extern int ip6_use_tempaddr; /* whether to use temporary addresses. */
320extern int ip6_prefer_tempaddr; /* whether to prefer temporary addresses
321 in the source address selection */
322
323#ifdef IPSTEALTH
324extern int ip6stealth;
325#endif
326
327extern int ip6_use_defzone; /* whether to use the default scope zone
328 when unspecified */
329#endif /* VIMAGE_GLOBALS */
330
331extern struct pfil_head inet6_pfil_hook; /* packet filter hooks */
332
333extern struct pr_usrreqs rip6_usrreqs;
334struct sockopt;
335
336struct inpcb;
337
338int icmp6_ctloutput __P((struct socket *, struct sockopt *sopt));
339
340struct in6_ifaddr;
341void ip6_init __P((void));
342void ip6_input __P((struct mbuf *));
343struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *));
344void ip6_freepcbopts __P((struct ip6_pktopts *));
333void ip6_freemoptions __P((struct ip6_moptions *));
345
334int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int));
335char * ip6_get_prevhdr __P((struct mbuf *, int));
336int ip6_nexthdr __P((struct mbuf *, int, int, int *));
337int ip6_lasthdr __P((struct mbuf *, int, int, int *));
338
339struct ip6aux *ip6_addaux __P((struct mbuf *));
340struct ip6aux *ip6_findaux __P((struct mbuf *));
341void ip6_delaux __P((struct mbuf *));
342
343extern int (*ip6_mforward)(struct ip6_hdr *, struct ifnet *,
344 struct mbuf *);
345
346int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *,
347 u_int32_t *));
348struct mbuf **ip6_savecontrol_v4(struct inpcb *, struct mbuf *,
349 struct mbuf **, int *);
350void ip6_savecontrol __P((struct inpcb *, struct mbuf *, struct mbuf **));
351void ip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *,
352 u_int32_t *));
353int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
354
355void ip6_forward __P((struct mbuf *, int));
356
357void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *));
358int ip6_output __P((struct mbuf *, struct ip6_pktopts *,
359 struct route_in6 *,
360 int,
361 struct ip6_moptions *, struct ifnet **,
362 struct inpcb *));
363int ip6_ctloutput __P((struct socket *, struct sockopt *));
364int ip6_raw_ctloutput __P((struct socket *, struct sockopt *));
365void ip6_initpktopts __P((struct ip6_pktopts *));
366int ip6_setpktopts __P((struct mbuf *, struct ip6_pktopts *,
367 struct ip6_pktopts *, struct ucred *, int));
368void ip6_clearpktopts __P((struct ip6_pktopts *, int));
369struct ip6_pktopts *ip6_copypktopts __P((struct ip6_pktopts *, int));
370int ip6_optlen __P((struct inpcb *));
371
372int route6_input __P((struct mbuf **, int *, int));
373
374void frag6_init __P((void));
375int frag6_input __P((struct mbuf **, int *, int));
376void frag6_slowtimo __P((void));
377void frag6_drain __P((void));
378
379void rip6_init __P((void));
380int rip6_input __P((struct mbuf **, int *, int));
381void rip6_ctlinput __P((int, struct sockaddr *, void *));
382int rip6_ctloutput __P((struct socket *, struct sockopt *));
383int rip6_output __P((struct mbuf *, ...));
384int rip6_usrreq __P((struct socket *,
385 int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *));
386
387int dest6_input __P((struct mbuf **, int *, int));
388int none_input __P((struct mbuf **, int *, int));
389
390struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *, struct ip6_pktopts *,
391 struct inpcb *inp, struct route_in6 *, struct ucred *cred,
392 struct ifnet **, int *));
393int in6_selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *,
394 struct ip6_moptions *, struct route_in6 *, struct ifnet **,
395 struct rtentry **));
396u_int32_t ip6_randomid __P((void));
397u_int32_t ip6_randomflowlabel __P((void));
398#endif /* _KERNEL */
399
400#endif /* !_NETINET6_IP6_VAR_H_ */
346int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int));
347char * ip6_get_prevhdr __P((struct mbuf *, int));
348int ip6_nexthdr __P((struct mbuf *, int, int, int *));
349int ip6_lasthdr __P((struct mbuf *, int, int, int *));
350
351struct ip6aux *ip6_addaux __P((struct mbuf *));
352struct ip6aux *ip6_findaux __P((struct mbuf *));
353void ip6_delaux __P((struct mbuf *));
354
355extern int (*ip6_mforward)(struct ip6_hdr *, struct ifnet *,
356 struct mbuf *);
357
358int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *,
359 u_int32_t *));
360struct mbuf **ip6_savecontrol_v4(struct inpcb *, struct mbuf *,
361 struct mbuf **, int *);
362void ip6_savecontrol __P((struct inpcb *, struct mbuf *, struct mbuf **));
363void ip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *,
364 u_int32_t *));
365int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
366
367void ip6_forward __P((struct mbuf *, int));
368
369void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *));
370int ip6_output __P((struct mbuf *, struct ip6_pktopts *,
371 struct route_in6 *,
372 int,
373 struct ip6_moptions *, struct ifnet **,
374 struct inpcb *));
375int ip6_ctloutput __P((struct socket *, struct sockopt *));
376int ip6_raw_ctloutput __P((struct socket *, struct sockopt *));
377void ip6_initpktopts __P((struct ip6_pktopts *));
378int ip6_setpktopts __P((struct mbuf *, struct ip6_pktopts *,
379 struct ip6_pktopts *, struct ucred *, int));
380void ip6_clearpktopts __P((struct ip6_pktopts *, int));
381struct ip6_pktopts *ip6_copypktopts __P((struct ip6_pktopts *, int));
382int ip6_optlen __P((struct inpcb *));
383
384int route6_input __P((struct mbuf **, int *, int));
385
386void frag6_init __P((void));
387int frag6_input __P((struct mbuf **, int *, int));
388void frag6_slowtimo __P((void));
389void frag6_drain __P((void));
390
391void rip6_init __P((void));
392int rip6_input __P((struct mbuf **, int *, int));
393void rip6_ctlinput __P((int, struct sockaddr *, void *));
394int rip6_ctloutput __P((struct socket *, struct sockopt *));
395int rip6_output __P((struct mbuf *, ...));
396int rip6_usrreq __P((struct socket *,
397 int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *));
398
399int dest6_input __P((struct mbuf **, int *, int));
400int none_input __P((struct mbuf **, int *, int));
401
402struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *, struct ip6_pktopts *,
403 struct inpcb *inp, struct route_in6 *, struct ucred *cred,
404 struct ifnet **, int *));
405int in6_selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *,
406 struct ip6_moptions *, struct route_in6 *, struct ifnet **,
407 struct rtentry **));
408u_int32_t ip6_randomid __P((void));
409u_int32_t ip6_randomflowlabel __P((void));
410#endif /* _KERNEL */
411
412#endif /* !_NETINET6_IP6_VAR_H_ */