1 |
207 |
jeremybenn |
/* $FreeBSD: src/sys/netinet/icmp6.h,v 1.8 2002/05/06 16:28:25 ume Exp $ */
|
2 |
|
|
/* $KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $ */
|
3 |
|
|
|
4 |
|
|
/*
|
5 |
|
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
6 |
|
|
* All rights reserved.
|
7 |
|
|
*
|
8 |
|
|
* Redistribution and use in source and binary forms, with or without
|
9 |
|
|
* modification, are permitted provided that the following conditions
|
10 |
|
|
* are met:
|
11 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
12 |
|
|
* notice, this list of conditions and the following disclaimer.
|
13 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
14 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
15 |
|
|
* documentation and/or other materials provided with the distribution.
|
16 |
|
|
* 3. Neither the name of the project nor the names of its contributors
|
17 |
|
|
* may be used to endorse or promote products derived from this software
|
18 |
|
|
* without specific prior written permission.
|
19 |
|
|
*
|
20 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
21 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
23 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
24 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
26 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
27 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
28 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
29 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
30 |
|
|
* SUCH DAMAGE.
|
31 |
|
|
*/
|
32 |
|
|
|
33 |
|
|
/*
|
34 |
|
|
* Copyright (c) 1982, 1986, 1993
|
35 |
|
|
* The Regents of the University of California. All rights reserved.
|
36 |
|
|
*
|
37 |
|
|
* Redistribution and use in source and binary forms, with or without
|
38 |
|
|
* modification, are permitted provided that the following conditions
|
39 |
|
|
* are met:
|
40 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
41 |
|
|
* notice, this list of conditions and the following disclaimer.
|
42 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
43 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
44 |
|
|
* documentation and/or other materials provided with the distribution.
|
45 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
46 |
|
|
* must display the following acknowledgement:
|
47 |
|
|
* This product includes software developed by the University of
|
48 |
|
|
* California, Berkeley and its contributors.
|
49 |
|
|
* 4. Neither the name of the University nor the names of its contributors
|
50 |
|
|
* may be used to endorse or promote products derived from this software
|
51 |
|
|
* without specific prior written permission.
|
52 |
|
|
*
|
53 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
54 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
55 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
56 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
57 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
58 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
59 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
60 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
61 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
62 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
63 |
|
|
* SUCH DAMAGE.
|
64 |
|
|
*
|
65 |
|
|
* @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
|
66 |
|
|
*/
|
67 |
|
|
|
68 |
|
|
#ifndef _NETINET_ICMP6_H_
|
69 |
|
|
#define _NETINET_ICMP6_H_
|
70 |
|
|
|
71 |
|
|
#define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr)
|
72 |
|
|
- sizeof(struct icmp6_hdr) */
|
73 |
|
|
|
74 |
|
|
struct icmp6_hdr {
|
75 |
|
|
u_int8_t icmp6_type; /* type field */
|
76 |
|
|
u_int8_t icmp6_code; /* code field */
|
77 |
|
|
u_int16_t icmp6_cksum; /* checksum field */
|
78 |
|
|
union {
|
79 |
|
|
u_int32_t icmp6_un_data32[1]; /* type-specific field */
|
80 |
|
|
u_int16_t icmp6_un_data16[2]; /* type-specific field */
|
81 |
|
|
u_int8_t icmp6_un_data8[4]; /* type-specific field */
|
82 |
|
|
} icmp6_dataun;
|
83 |
|
|
} __attribute__((__packed__));
|
84 |
|
|
|
85 |
|
|
#define icmp6_data32 icmp6_dataun.icmp6_un_data32
|
86 |
|
|
#define icmp6_data16 icmp6_dataun.icmp6_un_data16
|
87 |
|
|
#define icmp6_data8 icmp6_dataun.icmp6_un_data8
|
88 |
|
|
#define icmp6_pptr icmp6_data32[0] /* parameter prob */
|
89 |
|
|
#define icmp6_mtu icmp6_data32[0] /* packet too big */
|
90 |
|
|
#define icmp6_id icmp6_data16[0] /* echo request/reply */
|
91 |
|
|
#define icmp6_seq icmp6_data16[1] /* echo request/reply */
|
92 |
|
|
#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
|
93 |
|
|
|
94 |
|
|
#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */
|
95 |
|
|
#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */
|
96 |
|
|
#define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */
|
97 |
|
|
#define ICMP6_PARAM_PROB 4 /* ip6 header bad */
|
98 |
|
|
|
99 |
|
|
#define ICMP6_ECHO_REQUEST 128 /* echo service */
|
100 |
|
|
#define ICMP6_ECHO_REPLY 129 /* echo reply */
|
101 |
|
|
#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */
|
102 |
|
|
#define MLD_LISTENER_QUERY 130 /* multicast listener query */
|
103 |
|
|
#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */
|
104 |
|
|
#define MLD_LISTENER_REPORT 131 /* multicast listener report */
|
105 |
|
|
#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */
|
106 |
|
|
#define MLD_LISTENER_DONE 132 /* multicast listener done */
|
107 |
|
|
|
108 |
|
|
#ifndef _KERNEL
|
109 |
|
|
/* the followings are for backward compatibility to old KAME apps. */
|
110 |
|
|
#define MLD6_LISTENER_QUERY MLD_LISTENER_QUERY
|
111 |
|
|
#define MLD6_LISTENER_REPORT MLD_LISTENER_REPORT
|
112 |
|
|
#define MLD6_LISTENER_DONE MLD_LISTENER_DONE
|
113 |
|
|
#endif
|
114 |
|
|
|
115 |
|
|
#define ND_ROUTER_SOLICIT 133 /* router solicitation */
|
116 |
|
|
#define ND_ROUTER_ADVERT 134 /* router advertisment */
|
117 |
|
|
#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */
|
118 |
|
|
#define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisment */
|
119 |
|
|
#define ND_REDIRECT 137 /* redirect */
|
120 |
|
|
|
121 |
|
|
#define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */
|
122 |
|
|
|
123 |
|
|
#define ICMP6_WRUREQUEST 139 /* who are you request */
|
124 |
|
|
#define ICMP6_WRUREPLY 140 /* who are you reply */
|
125 |
|
|
#define ICMP6_FQDN_QUERY 139 /* FQDN query */
|
126 |
|
|
#define ICMP6_FQDN_REPLY 140 /* FQDN reply */
|
127 |
|
|
#define ICMP6_NI_QUERY 139 /* node information request */
|
128 |
|
|
#define ICMP6_NI_REPLY 140 /* node information reply */
|
129 |
|
|
|
130 |
|
|
/* The definitions below are experimental. TBA */
|
131 |
|
|
#define MLD_MTRACE_RESP 200 /* mtrace resp (to sender) */
|
132 |
|
|
#define MLD_MTRACE 201 /* mtrace messages */
|
133 |
|
|
|
134 |
|
|
#define ICMP6_HADISCOV_REQUEST 202 /* XXX To be defined */
|
135 |
|
|
#define ICMP6_HADISCOV_REPLY 203 /* XXX To be defined */
|
136 |
|
|
|
137 |
|
|
#ifndef _KERNEL
|
138 |
|
|
#define MLD6_MTRACE_RESP MLD_MTRACE_RESP
|
139 |
|
|
#define MLD6_MTRACE MLD_MTRACE
|
140 |
|
|
#endif
|
141 |
|
|
|
142 |
|
|
#define ICMP6_MAXTYPE 203
|
143 |
|
|
|
144 |
|
|
#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
|
145 |
|
|
#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */
|
146 |
|
|
#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */
|
147 |
|
|
#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */
|
148 |
|
|
#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */
|
149 |
|
|
#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */
|
150 |
|
|
|
151 |
|
|
#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */
|
152 |
|
|
#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */
|
153 |
|
|
|
154 |
|
|
#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
|
155 |
|
|
#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */
|
156 |
|
|
#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */
|
157 |
|
|
|
158 |
|
|
#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */
|
159 |
|
|
|
160 |
|
|
#define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */
|
161 |
|
|
#define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */
|
162 |
|
|
#define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */
|
163 |
|
|
|
164 |
|
|
#define ICMP6_NI_SUCCESS 0 /* node information successful reply */
|
165 |
|
|
#define ICMP6_NI_REFUSED 1 /* node information request is refused */
|
166 |
|
|
#define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */
|
167 |
|
|
|
168 |
|
|
#define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */
|
169 |
|
|
#define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */
|
170 |
|
|
#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */
|
171 |
|
|
|
172 |
|
|
/* Used in kernel only */
|
173 |
|
|
#define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */
|
174 |
|
|
#define ND_REDIRECT_ROUTER 1 /* redirect to a better router */
|
175 |
|
|
|
176 |
|
|
/*
|
177 |
|
|
* Multicast Listener Discovery
|
178 |
|
|
*/
|
179 |
|
|
struct mld_hdr {
|
180 |
|
|
struct icmp6_hdr mld_icmp6_hdr;
|
181 |
|
|
struct in6_addr mld_addr; /* multicast address */
|
182 |
|
|
} __attribute__((__packed__));
|
183 |
|
|
|
184 |
|
|
/* definitions to provide backward compatibility to old KAME applications */
|
185 |
|
|
#ifndef _KERNEL
|
186 |
|
|
#define mld6_hdr mld_hdr
|
187 |
|
|
#define mld6_type mld_type
|
188 |
|
|
#define mld6_code mld_code
|
189 |
|
|
#define mld6_cksum mld_cksum
|
190 |
|
|
#define mld6_maxdelay mld_maxdelay
|
191 |
|
|
#define mld6_reserved mld_reserved
|
192 |
|
|
#define mld6_addr mld_addr
|
193 |
|
|
#endif
|
194 |
|
|
|
195 |
|
|
/* shortcut macro definitions */
|
196 |
|
|
#define mld_type mld_icmp6_hdr.icmp6_type
|
197 |
|
|
#define mld_code mld_icmp6_hdr.icmp6_code
|
198 |
|
|
#define mld_cksum mld_icmp6_hdr.icmp6_cksum
|
199 |
|
|
#define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0]
|
200 |
|
|
#define mld_reserved mld_icmp6_hdr.icmp6_data16[1]
|
201 |
|
|
|
202 |
|
|
/*
|
203 |
|
|
* Neighbor Discovery
|
204 |
|
|
*/
|
205 |
|
|
|
206 |
|
|
struct nd_router_solicit { /* router solicitation */
|
207 |
|
|
struct icmp6_hdr nd_rs_hdr;
|
208 |
|
|
/* could be followed by options */
|
209 |
|
|
} __attribute__((__packed__));
|
210 |
|
|
|
211 |
|
|
#define nd_rs_type nd_rs_hdr.icmp6_type
|
212 |
|
|
#define nd_rs_code nd_rs_hdr.icmp6_code
|
213 |
|
|
#define nd_rs_cksum nd_rs_hdr.icmp6_cksum
|
214 |
|
|
#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0]
|
215 |
|
|
|
216 |
|
|
struct nd_router_advert { /* router advertisement */
|
217 |
|
|
struct icmp6_hdr nd_ra_hdr;
|
218 |
|
|
u_int32_t nd_ra_reachable; /* reachable time */
|
219 |
|
|
u_int32_t nd_ra_retransmit; /* retransmit timer */
|
220 |
|
|
/* could be followed by options */
|
221 |
|
|
} __attribute__((__packed__));
|
222 |
|
|
|
223 |
|
|
#define nd_ra_type nd_ra_hdr.icmp6_type
|
224 |
|
|
#define nd_ra_code nd_ra_hdr.icmp6_code
|
225 |
|
|
#define nd_ra_cksum nd_ra_hdr.icmp6_cksum
|
226 |
|
|
#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0]
|
227 |
|
|
#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]
|
228 |
|
|
#define ND_RA_FLAG_MANAGED 0x80
|
229 |
|
|
#define ND_RA_FLAG_OTHER 0x40
|
230 |
|
|
#define ND_RA_FLAG_HA 0x20
|
231 |
|
|
|
232 |
|
|
/*
|
233 |
|
|
* Router preference values based on draft-draves-ipngwg-router-selection-01.
|
234 |
|
|
* These are non-standard definitions.
|
235 |
|
|
*/
|
236 |
|
|
#define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */
|
237 |
|
|
|
238 |
|
|
#define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */
|
239 |
|
|
#define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */
|
240 |
|
|
#define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */
|
241 |
|
|
#define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */
|
242 |
|
|
|
243 |
|
|
#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]
|
244 |
|
|
|
245 |
|
|
struct nd_neighbor_solicit { /* neighbor solicitation */
|
246 |
|
|
struct icmp6_hdr nd_ns_hdr;
|
247 |
|
|
struct in6_addr nd_ns_target; /*target address */
|
248 |
|
|
/* could be followed by options */
|
249 |
|
|
} __attribute__((__packed__));
|
250 |
|
|
|
251 |
|
|
#define nd_ns_type nd_ns_hdr.icmp6_type
|
252 |
|
|
#define nd_ns_code nd_ns_hdr.icmp6_code
|
253 |
|
|
#define nd_ns_cksum nd_ns_hdr.icmp6_cksum
|
254 |
|
|
#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
|
255 |
|
|
|
256 |
|
|
struct nd_neighbor_advert { /* neighbor advertisement */
|
257 |
|
|
struct icmp6_hdr nd_na_hdr;
|
258 |
|
|
struct in6_addr nd_na_target; /* target address */
|
259 |
|
|
/* could be followed by options */
|
260 |
|
|
} __attribute__((__packed__));
|
261 |
|
|
|
262 |
|
|
#define nd_na_type nd_na_hdr.icmp6_type
|
263 |
|
|
#define nd_na_code nd_na_hdr.icmp6_code
|
264 |
|
|
#define nd_na_cksum nd_na_hdr.icmp6_cksum
|
265 |
|
|
#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
|
266 |
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
267 |
|
|
#define ND_NA_FLAG_ROUTER 0x80000000
|
268 |
|
|
#define ND_NA_FLAG_SOLICITED 0x40000000
|
269 |
|
|
#define ND_NA_FLAG_OVERRIDE 0x20000000
|
270 |
|
|
#else
|
271 |
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
272 |
|
|
#define ND_NA_FLAG_ROUTER 0x80
|
273 |
|
|
#define ND_NA_FLAG_SOLICITED 0x40
|
274 |
|
|
#define ND_NA_FLAG_OVERRIDE 0x20
|
275 |
|
|
#endif
|
276 |
|
|
#endif
|
277 |
|
|
|
278 |
|
|
struct nd_redirect { /* redirect */
|
279 |
|
|
struct icmp6_hdr nd_rd_hdr;
|
280 |
|
|
struct in6_addr nd_rd_target; /* target address */
|
281 |
|
|
struct in6_addr nd_rd_dst; /* destination address */
|
282 |
|
|
/* could be followed by options */
|
283 |
|
|
} __attribute__((__packed__));
|
284 |
|
|
|
285 |
|
|
#define nd_rd_type nd_rd_hdr.icmp6_type
|
286 |
|
|
#define nd_rd_code nd_rd_hdr.icmp6_code
|
287 |
|
|
#define nd_rd_cksum nd_rd_hdr.icmp6_cksum
|
288 |
|
|
#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
|
289 |
|
|
|
290 |
|
|
struct nd_opt_hdr { /* Neighbor discovery option header */
|
291 |
|
|
u_int8_t nd_opt_type;
|
292 |
|
|
u_int8_t nd_opt_len;
|
293 |
|
|
/* followed by option specific data*/
|
294 |
|
|
} __attribute__((__packed__));
|
295 |
|
|
|
296 |
|
|
#define ND_OPT_SOURCE_LINKADDR 1
|
297 |
|
|
#define ND_OPT_TARGET_LINKADDR 2
|
298 |
|
|
#define ND_OPT_PREFIX_INFORMATION 3
|
299 |
|
|
#define ND_OPT_REDIRECTED_HEADER 4
|
300 |
|
|
#define ND_OPT_MTU 5
|
301 |
|
|
|
302 |
|
|
#define ND_OPT_ROUTE_INFO 200 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */
|
303 |
|
|
|
304 |
|
|
struct nd_opt_prefix_info { /* prefix information */
|
305 |
|
|
u_int8_t nd_opt_pi_type;
|
306 |
|
|
u_int8_t nd_opt_pi_len;
|
307 |
|
|
u_int8_t nd_opt_pi_prefix_len;
|
308 |
|
|
u_int8_t nd_opt_pi_flags_reserved;
|
309 |
|
|
u_int32_t nd_opt_pi_valid_time;
|
310 |
|
|
u_int32_t nd_opt_pi_preferred_time;
|
311 |
|
|
u_int32_t nd_opt_pi_reserved2;
|
312 |
|
|
struct in6_addr nd_opt_pi_prefix;
|
313 |
|
|
} __attribute__((__packed__));
|
314 |
|
|
|
315 |
|
|
#define ND_OPT_PI_FLAG_ONLINK 0x80
|
316 |
|
|
#define ND_OPT_PI_FLAG_AUTO 0x40
|
317 |
|
|
|
318 |
|
|
struct nd_opt_rd_hdr { /* redirected header */
|
319 |
|
|
u_int8_t nd_opt_rh_type;
|
320 |
|
|
u_int8_t nd_opt_rh_len;
|
321 |
|
|
u_int16_t nd_opt_rh_reserved1;
|
322 |
|
|
u_int32_t nd_opt_rh_reserved2;
|
323 |
|
|
/* followed by IP header and data */
|
324 |
|
|
} __attribute__((__packed__));
|
325 |
|
|
|
326 |
|
|
struct nd_opt_mtu { /* MTU option */
|
327 |
|
|
u_int8_t nd_opt_mtu_type;
|
328 |
|
|
u_int8_t nd_opt_mtu_len;
|
329 |
|
|
u_int16_t nd_opt_mtu_reserved;
|
330 |
|
|
u_int32_t nd_opt_mtu_mtu;
|
331 |
|
|
} __attribute__((__packed__));
|
332 |
|
|
|
333 |
|
|
struct nd_opt_route_info { /* route info */
|
334 |
|
|
u_int8_t nd_opt_rti_type;
|
335 |
|
|
u_int8_t nd_opt_rti_len;
|
336 |
|
|
u_int8_t nd_opt_rti_prefixlen;
|
337 |
|
|
u_int8_t nd_opt_rti_flags;
|
338 |
|
|
u_int32_t nd_opt_rti_lifetime;
|
339 |
|
|
/* prefix follows */
|
340 |
|
|
} __attribute__((__packed__));
|
341 |
|
|
|
342 |
|
|
/*
|
343 |
|
|
* icmp6 namelookup
|
344 |
|
|
*/
|
345 |
|
|
|
346 |
|
|
struct icmp6_namelookup {
|
347 |
|
|
struct icmp6_hdr icmp6_nl_hdr;
|
348 |
|
|
u_int8_t icmp6_nl_nonce[8];
|
349 |
|
|
int32_t icmp6_nl_ttl;
|
350 |
|
|
#if 0
|
351 |
|
|
u_int8_t icmp6_nl_len;
|
352 |
|
|
u_int8_t icmp6_nl_name[3];
|
353 |
|
|
#endif
|
354 |
|
|
/* could be followed by options */
|
355 |
|
|
} __attribute__((__packed__));
|
356 |
|
|
|
357 |
|
|
/*
|
358 |
|
|
* icmp6 node information
|
359 |
|
|
*/
|
360 |
|
|
struct icmp6_nodeinfo {
|
361 |
|
|
struct icmp6_hdr icmp6_ni_hdr;
|
362 |
|
|
u_int8_t icmp6_ni_nonce[8];
|
363 |
|
|
/* could be followed by reply data */
|
364 |
|
|
} __attribute__((__packed__));
|
365 |
|
|
|
366 |
|
|
#define ni_type icmp6_ni_hdr.icmp6_type
|
367 |
|
|
#define ni_code icmp6_ni_hdr.icmp6_code
|
368 |
|
|
#define ni_cksum icmp6_ni_hdr.icmp6_cksum
|
369 |
|
|
#define ni_qtype icmp6_ni_hdr.icmp6_data16[0]
|
370 |
|
|
#define ni_flags icmp6_ni_hdr.icmp6_data16[1]
|
371 |
|
|
|
372 |
|
|
#define NI_QTYPE_NOOP 0 /* NOOP */
|
373 |
|
|
#define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */
|
374 |
|
|
#define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */
|
375 |
|
|
#define NI_QTYPE_DNSNAME 2 /* DNS Name */
|
376 |
|
|
#define NI_QTYPE_NODEADDR 3 /* Node Addresses */
|
377 |
|
|
#define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */
|
378 |
|
|
|
379 |
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
380 |
|
|
#define NI_SUPTYPE_FLAG_COMPRESS 0x1
|
381 |
|
|
#define NI_FQDN_FLAG_VALIDTTL 0x1
|
382 |
|
|
#elif BYTE_ORDER == LITTLE_ENDIAN
|
383 |
|
|
#define NI_SUPTYPE_FLAG_COMPRESS 0x0100
|
384 |
|
|
#define NI_FQDN_FLAG_VALIDTTL 0x0100
|
385 |
|
|
#endif
|
386 |
|
|
|
387 |
|
|
#ifdef NAME_LOOKUPS_04
|
388 |
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
389 |
|
|
#define NI_NODEADDR_FLAG_LINKLOCAL 0x1
|
390 |
|
|
#define NI_NODEADDR_FLAG_SITELOCAL 0x2
|
391 |
|
|
#define NI_NODEADDR_FLAG_GLOBAL 0x4
|
392 |
|
|
#define NI_NODEADDR_FLAG_ALL 0x8
|
393 |
|
|
#define NI_NODEADDR_FLAG_TRUNCATE 0x10
|
394 |
|
|
#define NI_NODEADDR_FLAG_ANYCAST 0x20 /* just experimental. not in spec */
|
395 |
|
|
#elif BYTE_ORDER == LITTLE_ENDIAN
|
396 |
|
|
#define NI_NODEADDR_FLAG_LINKLOCAL 0x0100
|
397 |
|
|
#define NI_NODEADDR_FLAG_SITELOCAL 0x0200
|
398 |
|
|
#define NI_NODEADDR_FLAG_GLOBAL 0x0400
|
399 |
|
|
#define NI_NODEADDR_FLAG_ALL 0x0800
|
400 |
|
|
#define NI_NODEADDR_FLAG_TRUNCATE 0x1000
|
401 |
|
|
#define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */
|
402 |
|
|
#endif
|
403 |
|
|
#else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
|
404 |
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
405 |
|
|
#define NI_NODEADDR_FLAG_TRUNCATE 0x1
|
406 |
|
|
#define NI_NODEADDR_FLAG_ALL 0x2
|
407 |
|
|
#define NI_NODEADDR_FLAG_COMPAT 0x4
|
408 |
|
|
#define NI_NODEADDR_FLAG_LINKLOCAL 0x8
|
409 |
|
|
#define NI_NODEADDR_FLAG_SITELOCAL 0x10
|
410 |
|
|
#define NI_NODEADDR_FLAG_GLOBAL 0x20
|
411 |
|
|
#define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */
|
412 |
|
|
#elif BYTE_ORDER == LITTLE_ENDIAN
|
413 |
|
|
#define NI_NODEADDR_FLAG_TRUNCATE 0x0100
|
414 |
|
|
#define NI_NODEADDR_FLAG_ALL 0x0200
|
415 |
|
|
#define NI_NODEADDR_FLAG_COMPAT 0x0400
|
416 |
|
|
#define NI_NODEADDR_FLAG_LINKLOCAL 0x0800
|
417 |
|
|
#define NI_NODEADDR_FLAG_SITELOCAL 0x1000
|
418 |
|
|
#define NI_NODEADDR_FLAG_GLOBAL 0x2000
|
419 |
|
|
#define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */
|
420 |
|
|
#endif
|
421 |
|
|
#endif
|
422 |
|
|
|
423 |
|
|
struct ni_reply_fqdn {
|
424 |
|
|
u_int32_t ni_fqdn_ttl; /* TTL */
|
425 |
|
|
u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
|
426 |
|
|
u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
|
427 |
|
|
} __attribute__((__packed__));
|
428 |
|
|
|
429 |
|
|
/*
|
430 |
|
|
* Router Renumbering. as router-renum-08.txt
|
431 |
|
|
*/
|
432 |
|
|
struct icmp6_router_renum { /* router renumbering header */
|
433 |
|
|
struct icmp6_hdr rr_hdr;
|
434 |
|
|
u_int8_t rr_segnum;
|
435 |
|
|
u_int8_t rr_flags;
|
436 |
|
|
u_int16_t rr_maxdelay;
|
437 |
|
|
u_int32_t rr_reserved;
|
438 |
|
|
} __attribute__((__packed__));
|
439 |
|
|
|
440 |
|
|
#define ICMP6_RR_FLAGS_TEST 0x80
|
441 |
|
|
#define ICMP6_RR_FLAGS_REQRESULT 0x40
|
442 |
|
|
#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20
|
443 |
|
|
#define ICMP6_RR_FLAGS_SPECSITE 0x10
|
444 |
|
|
#define ICMP6_RR_FLAGS_PREVDONE 0x08
|
445 |
|
|
|
446 |
|
|
#define rr_type rr_hdr.icmp6_type
|
447 |
|
|
#define rr_code rr_hdr.icmp6_code
|
448 |
|
|
#define rr_cksum rr_hdr.icmp6_cksum
|
449 |
|
|
#define rr_seqnum rr_hdr.icmp6_data32[0]
|
450 |
|
|
|
451 |
|
|
struct rr_pco_match { /* match prefix part */
|
452 |
|
|
u_int8_t rpm_code;
|
453 |
|
|
u_int8_t rpm_len;
|
454 |
|
|
u_int8_t rpm_ordinal;
|
455 |
|
|
u_int8_t rpm_matchlen;
|
456 |
|
|
u_int8_t rpm_minlen;
|
457 |
|
|
u_int8_t rpm_maxlen;
|
458 |
|
|
u_int16_t rpm_reserved;
|
459 |
|
|
struct in6_addr rpm_prefix;
|
460 |
|
|
} __attribute__((__packed__));
|
461 |
|
|
|
462 |
|
|
#define RPM_PCO_ADD 1
|
463 |
|
|
#define RPM_PCO_CHANGE 2
|
464 |
|
|
#define RPM_PCO_SETGLOBAL 3
|
465 |
|
|
#define RPM_PCO_MAX 4
|
466 |
|
|
|
467 |
|
|
struct rr_pco_use { /* use prefix part */
|
468 |
|
|
u_int8_t rpu_uselen;
|
469 |
|
|
u_int8_t rpu_keeplen;
|
470 |
|
|
u_int8_t rpu_ramask;
|
471 |
|
|
u_int8_t rpu_raflags;
|
472 |
|
|
u_int32_t rpu_vltime;
|
473 |
|
|
u_int32_t rpu_pltime;
|
474 |
|
|
u_int32_t rpu_flags;
|
475 |
|
|
struct in6_addr rpu_prefix;
|
476 |
|
|
} __attribute__((__packed__));
|
477 |
|
|
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80
|
478 |
|
|
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40
|
479 |
|
|
|
480 |
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
481 |
|
|
#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
|
482 |
|
|
#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
|
483 |
|
|
#elif BYTE_ORDER == LITTLE_ENDIAN
|
484 |
|
|
#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
|
485 |
|
|
#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
|
486 |
|
|
#endif
|
487 |
|
|
|
488 |
|
|
struct rr_result { /* router renumbering result message */
|
489 |
|
|
u_int16_t rrr_flags;
|
490 |
|
|
u_int8_t rrr_ordinal;
|
491 |
|
|
u_int8_t rrr_matchedlen;
|
492 |
|
|
u_int32_t rrr_ifid;
|
493 |
|
|
struct in6_addr rrr_prefix;
|
494 |
|
|
} __attribute__((__packed__));
|
495 |
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
496 |
|
|
#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002
|
497 |
|
|
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
|
498 |
|
|
#elif BYTE_ORDER == LITTLE_ENDIAN
|
499 |
|
|
#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200
|
500 |
|
|
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
|
501 |
|
|
#endif
|
502 |
|
|
|
503 |
|
|
/*
|
504 |
|
|
* icmp6 filter structures.
|
505 |
|
|
*/
|
506 |
|
|
|
507 |
|
|
struct icmp6_filter {
|
508 |
|
|
u_int32_t icmp6_filt[8];
|
509 |
|
|
};
|
510 |
|
|
|
511 |
|
|
#ifdef _KERNEL
|
512 |
|
|
#define ICMP6_FILTER_SETPASSALL(filterp) \
|
513 |
|
|
do { \
|
514 |
|
|
int i; u_char *p; \
|
515 |
|
|
p = (u_char *)filterp; \
|
516 |
|
|
for (i = 0; i < sizeof(struct icmp6_filter); i++) \
|
517 |
|
|
p[i] = 0xff; \
|
518 |
|
|
} while (0)
|
519 |
|
|
#define ICMP6_FILTER_SETBLOCKALL(filterp) \
|
520 |
|
|
bzero(filterp, sizeof(struct icmp6_filter))
|
521 |
|
|
#else /* _KERNEL */
|
522 |
|
|
#define ICMP6_FILTER_SETPASSALL(filterp) \
|
523 |
|
|
memset(filterp, 0xff, sizeof(struct icmp6_filter))
|
524 |
|
|
#define ICMP6_FILTER_SETBLOCKALL(filterp) \
|
525 |
|
|
memset(filterp, 0x00, sizeof(struct icmp6_filter))
|
526 |
|
|
#endif /* _KERNEL */
|
527 |
|
|
|
528 |
|
|
#define ICMP6_FILTER_SETPASS(type, filterp) \
|
529 |
|
|
(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
|
530 |
|
|
#define ICMP6_FILTER_SETBLOCK(type, filterp) \
|
531 |
|
|
(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
|
532 |
|
|
#define ICMP6_FILTER_WILLPASS(type, filterp) \
|
533 |
|
|
((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
|
534 |
|
|
#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
|
535 |
|
|
((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
|
536 |
|
|
|
537 |
|
|
/*
|
538 |
|
|
* Variables related to this implementation
|
539 |
|
|
* of the internet control message protocol version 6.
|
540 |
|
|
*/
|
541 |
|
|
struct icmp6errstat {
|
542 |
|
|
u_quad_t icp6errs_dst_unreach_noroute;
|
543 |
|
|
u_quad_t icp6errs_dst_unreach_admin;
|
544 |
|
|
u_quad_t icp6errs_dst_unreach_beyondscope;
|
545 |
|
|
u_quad_t icp6errs_dst_unreach_addr;
|
546 |
|
|
u_quad_t icp6errs_dst_unreach_noport;
|
547 |
|
|
u_quad_t icp6errs_packet_too_big;
|
548 |
|
|
u_quad_t icp6errs_time_exceed_transit;
|
549 |
|
|
u_quad_t icp6errs_time_exceed_reassembly;
|
550 |
|
|
u_quad_t icp6errs_paramprob_header;
|
551 |
|
|
u_quad_t icp6errs_paramprob_nextheader;
|
552 |
|
|
u_quad_t icp6errs_paramprob_option;
|
553 |
|
|
u_quad_t icp6errs_redirect; /* we regard redirect as an error here */
|
554 |
|
|
u_quad_t icp6errs_unknown;
|
555 |
|
|
};
|
556 |
|
|
|
557 |
|
|
struct icmp6stat {
|
558 |
|
|
/* statistics related to icmp6 packets generated */
|
559 |
|
|
u_quad_t icp6s_error; /* # of calls to icmp6_error */
|
560 |
|
|
u_quad_t icp6s_canterror; /* no error 'cuz old was icmp */
|
561 |
|
|
u_quad_t icp6s_toofreq; /* no error 'cuz rate limitation */
|
562 |
|
|
u_quad_t icp6s_outhist[256];
|
563 |
|
|
/* statistics related to input message processed */
|
564 |
|
|
u_quad_t icp6s_badcode; /* icmp6_code out of range */
|
565 |
|
|
u_quad_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */
|
566 |
|
|
u_quad_t icp6s_checksum; /* bad checksum */
|
567 |
|
|
u_quad_t icp6s_badlen; /* calculated bound mismatch */
|
568 |
|
|
/*
|
569 |
|
|
* number of responses: this member is inherited from netinet code, but
|
570 |
|
|
* for netinet6 code, it is already available in icp6s_outhist[].
|
571 |
|
|
*/
|
572 |
|
|
u_quad_t icp6s_reflect;
|
573 |
|
|
u_quad_t icp6s_inhist[256];
|
574 |
|
|
u_quad_t icp6s_nd_toomanyopt; /* too many ND options */
|
575 |
|
|
struct icmp6errstat icp6s_outerrhist;
|
576 |
|
|
#define icp6s_odst_unreach_noroute \
|
577 |
|
|
icp6s_outerrhist.icp6errs_dst_unreach_noroute
|
578 |
|
|
#define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin
|
579 |
|
|
#define icp6s_odst_unreach_beyondscope \
|
580 |
|
|
icp6s_outerrhist.icp6errs_dst_unreach_beyondscope
|
581 |
|
|
#define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr
|
582 |
|
|
#define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport
|
583 |
|
|
#define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big
|
584 |
|
|
#define icp6s_otime_exceed_transit \
|
585 |
|
|
icp6s_outerrhist.icp6errs_time_exceed_transit
|
586 |
|
|
#define icp6s_otime_exceed_reassembly \
|
587 |
|
|
icp6s_outerrhist.icp6errs_time_exceed_reassembly
|
588 |
|
|
#define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header
|
589 |
|
|
#define icp6s_oparamprob_nextheader \
|
590 |
|
|
icp6s_outerrhist.icp6errs_paramprob_nextheader
|
591 |
|
|
#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option
|
592 |
|
|
#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect
|
593 |
|
|
#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown
|
594 |
|
|
u_quad_t icp6s_pmtuchg; /* path MTU changes */
|
595 |
|
|
u_quad_t icp6s_nd_badopt; /* bad ND options */
|
596 |
|
|
u_quad_t icp6s_badns; /* bad neighbor solicitation */
|
597 |
|
|
u_quad_t icp6s_badna; /* bad neighbor advertisement */
|
598 |
|
|
u_quad_t icp6s_badrs; /* bad router advertisement */
|
599 |
|
|
u_quad_t icp6s_badra; /* bad router advertisement */
|
600 |
|
|
u_quad_t icp6s_badredirect; /* bad redirect message */
|
601 |
|
|
};
|
602 |
|
|
|
603 |
|
|
/*
|
604 |
|
|
* Names for ICMP sysctl objects
|
605 |
|
|
*/
|
606 |
|
|
#define ICMPV6CTL_STATS 1
|
607 |
|
|
#define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */
|
608 |
|
|
#define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */
|
609 |
|
|
#if 0 /*obsoleted*/
|
610 |
|
|
#define ICMPV6CTL_ERRRATELIMIT 5 /* ICMPv6 error rate limitation */
|
611 |
|
|
#endif
|
612 |
|
|
#define ICMPV6CTL_ND6_PRUNE 6
|
613 |
|
|
#define ICMPV6CTL_ND6_DELAY 8
|
614 |
|
|
#define ICMPV6CTL_ND6_UMAXTRIES 9
|
615 |
|
|
#define ICMPV6CTL_ND6_MMAXTRIES 10
|
616 |
|
|
#define ICMPV6CTL_ND6_USELOOPBACK 11
|
617 |
|
|
/*#define ICMPV6CTL_ND6_PROXYALL 12 obsoleted, do not reuse here */
|
618 |
|
|
#define ICMPV6CTL_NODEINFO 13
|
619 |
|
|
#define ICMPV6CTL_ERRPPSLIMIT 14 /* ICMPv6 error pps limitation */
|
620 |
|
|
#define ICMPV6CTL_ND6_MAXNUDHINT 15
|
621 |
|
|
#define ICMPV6CTL_MTUDISC_HIWAT 16
|
622 |
|
|
#define ICMPV6CTL_MTUDISC_LOWAT 17
|
623 |
|
|
#define ICMPV6CTL_ND6_DEBUG 18
|
624 |
|
|
#define ICMPV6CTL_ND6_DRLIST 19
|
625 |
|
|
#define ICMPV6CTL_ND6_PRLIST 20
|
626 |
|
|
#define ICMPV6CTL_MAXID 21
|
627 |
|
|
|
628 |
|
|
#define ICMPV6CTL_NAMES { \
|
629 |
|
|
{ 0, 0 }, \
|
630 |
|
|
{ 0, 0 }, \
|
631 |
|
|
{ "rediraccept", CTLTYPE_INT }, \
|
632 |
|
|
{ "redirtimeout", CTLTYPE_INT }, \
|
633 |
|
|
{ 0, 0 }, \
|
634 |
|
|
{ 0, 0 }, \
|
635 |
|
|
{ "nd6_prune", CTLTYPE_INT }, \
|
636 |
|
|
{ 0, 0 }, \
|
637 |
|
|
{ "nd6_delay", CTLTYPE_INT }, \
|
638 |
|
|
{ "nd6_umaxtries", CTLTYPE_INT }, \
|
639 |
|
|
{ "nd6_mmaxtries", CTLTYPE_INT }, \
|
640 |
|
|
{ "nd6_useloopback", CTLTYPE_INT }, \
|
641 |
|
|
{ 0, 0 }, \
|
642 |
|
|
{ "nodeinfo", CTLTYPE_INT }, \
|
643 |
|
|
{ "errppslimit", CTLTYPE_INT }, \
|
644 |
|
|
{ "nd6_maxnudhint", CTLTYPE_INT }, \
|
645 |
|
|
{ "mtudisc_hiwat", CTLTYPE_INT }, \
|
646 |
|
|
{ "mtudisc_lowat", CTLTYPE_INT }, \
|
647 |
|
|
{ "nd6_debug", CTLTYPE_INT }, \
|
648 |
|
|
{ 0, 0 }, \
|
649 |
|
|
{ 0, 0 }, \
|
650 |
|
|
}
|
651 |
|
|
|
652 |
|
|
#define RTF_PROBEMTU RTF_PROTO1
|
653 |
|
|
|
654 |
|
|
#ifdef _KERNEL
|
655 |
|
|
# ifdef __STDC__
|
656 |
|
|
struct rtentry;
|
657 |
|
|
struct rttimer;
|
658 |
|
|
struct in6_multi;
|
659 |
|
|
# endif
|
660 |
|
|
void icmp6_init(void);
|
661 |
|
|
void icmp6_paramerror(struct mbuf *, int);
|
662 |
|
|
void icmp6_error(struct mbuf *, int, int, int);
|
663 |
|
|
int icmp6_input(struct mbuf **, int *, int);
|
664 |
|
|
void icmp6_fasttimo(void);
|
665 |
|
|
void icmp6_reflect(struct mbuf *, size_t);
|
666 |
|
|
void icmp6_prepare(struct mbuf *);
|
667 |
|
|
void icmp6_redirect_input(struct mbuf *, int);
|
668 |
|
|
void icmp6_redirect_output(struct mbuf *, struct rtentry *);
|
669 |
|
|
|
670 |
|
|
struct ip6ctlparam;
|
671 |
|
|
void icmp6_mtudisc_update(struct ip6ctlparam *, int);
|
672 |
|
|
|
673 |
|
|
/* XXX: is this the right place for these macros? */
|
674 |
|
|
#define icmp6_ifstat_inc(ifp, tag) \
|
675 |
|
|
do { \
|
676 |
|
|
if ((ifp) && (ifp)->if_index <= if_index \
|
677 |
|
|
&& (ifp)->if_index < icmp6_ifstatmax \
|
678 |
|
|
&& icmp6_ifstat && icmp6_ifstat[(ifp)->if_index]) { \
|
679 |
|
|
icmp6_ifstat[(ifp)->if_index]->tag++; \
|
680 |
|
|
} \
|
681 |
|
|
} while (0)
|
682 |
|
|
|
683 |
|
|
#define icmp6_ifoutstat_inc(ifp, type, code) \
|
684 |
|
|
do { \
|
685 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_msg); \
|
686 |
|
|
if (type < ICMP6_INFOMSG_MASK) \
|
687 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_error); \
|
688 |
|
|
switch(type) { \
|
689 |
|
|
case ICMP6_DST_UNREACH: \
|
690 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
|
691 |
|
|
if (code == ICMP6_DST_UNREACH_ADMIN) \
|
692 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
|
693 |
|
|
break; \
|
694 |
|
|
case ICMP6_PACKET_TOO_BIG: \
|
695 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
|
696 |
|
|
break; \
|
697 |
|
|
case ICMP6_TIME_EXCEEDED: \
|
698 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
|
699 |
|
|
break; \
|
700 |
|
|
case ICMP6_PARAM_PROB: \
|
701 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
|
702 |
|
|
break; \
|
703 |
|
|
case ICMP6_ECHO_REQUEST: \
|
704 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_echo); \
|
705 |
|
|
break; \
|
706 |
|
|
case ICMP6_ECHO_REPLY: \
|
707 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
|
708 |
|
|
break; \
|
709 |
|
|
case MLD_LISTENER_QUERY: \
|
710 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
|
711 |
|
|
break; \
|
712 |
|
|
case MLD_LISTENER_REPORT: \
|
713 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
|
714 |
|
|
break; \
|
715 |
|
|
case MLD_LISTENER_DONE: \
|
716 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
|
717 |
|
|
break; \
|
718 |
|
|
case ND_ROUTER_SOLICIT: \
|
719 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
|
720 |
|
|
break; \
|
721 |
|
|
case ND_ROUTER_ADVERT: \
|
722 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
|
723 |
|
|
break; \
|
724 |
|
|
case ND_NEIGHBOR_SOLICIT: \
|
725 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
|
726 |
|
|
break; \
|
727 |
|
|
case ND_NEIGHBOR_ADVERT: \
|
728 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
|
729 |
|
|
break; \
|
730 |
|
|
case ND_REDIRECT: \
|
731 |
|
|
icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
|
732 |
|
|
break; \
|
733 |
|
|
} \
|
734 |
|
|
} while (0)
|
735 |
|
|
|
736 |
|
|
extern int icmp6_rediraccept; /* accept/process redirects */
|
737 |
|
|
extern int icmp6_redirtimeout; /* cache time for redirect routes */
|
738 |
|
|
#endif /* _KERNEL */
|
739 |
|
|
|
740 |
|
|
#endif /* not _NETINET_ICMP6_H_ */
|