| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: icmp6.h,v 1.56 2020/06/15 23:41:35 roy Exp $ */ | | 1 | /* $NetBSD: icmp6.h,v 1.57 2020/07/27 14:52:55 roy Exp $ */ |
2 | /* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */ | | 2 | /* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */ |
3 | | | 3 | |
4 | | | 4 | |
5 | /* | | 5 | /* |
6 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | | 6 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
7 | * All rights reserved. | | 7 | * All rights reserved. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -67,27 +67,27 @@ | | | @@ -67,27 +67,27 @@ |
67 | | | 67 | |
68 | #define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) | | 68 | #define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) |
69 | - sizeof(struct icmp6_hdr) */ | | 69 | - sizeof(struct icmp6_hdr) */ |
70 | | | 70 | |
71 | struct icmp6_hdr { | | 71 | struct icmp6_hdr { |
72 | u_int8_t icmp6_type; /* type field */ | | 72 | u_int8_t icmp6_type; /* type field */ |
73 | u_int8_t icmp6_code; /* code field */ | | 73 | u_int8_t icmp6_code; /* code field */ |
74 | u_int16_t icmp6_cksum; /* checksum field */ | | 74 | u_int16_t icmp6_cksum; /* checksum field */ |
75 | union { | | 75 | union { |
76 | u_int32_t icmp6_un_data32[1]; /* type-specific field */ | | 76 | u_int32_t icmp6_un_data32[1]; /* type-specific field */ |
77 | u_int16_t icmp6_un_data16[2]; /* type-specific field */ | | 77 | u_int16_t icmp6_un_data16[2]; /* type-specific field */ |
78 | u_int8_t icmp6_un_data8[4]; /* type-specific field */ | | 78 | u_int8_t icmp6_un_data8[4]; /* type-specific field */ |
79 | } icmp6_dataun; | | 79 | } icmp6_dataun; |
80 | } __packed; | | 80 | }; |
81 | | | 81 | |
82 | #define icmp6_data32 icmp6_dataun.icmp6_un_data32 | | 82 | #define icmp6_data32 icmp6_dataun.icmp6_un_data32 |
83 | #define icmp6_data16 icmp6_dataun.icmp6_un_data16 | | 83 | #define icmp6_data16 icmp6_dataun.icmp6_un_data16 |
84 | #define icmp6_data8 icmp6_dataun.icmp6_un_data8 | | 84 | #define icmp6_data8 icmp6_dataun.icmp6_un_data8 |
85 | #define icmp6_pptr icmp6_data32[0] /* parameter prob */ | | 85 | #define icmp6_pptr icmp6_data32[0] /* parameter prob */ |
86 | #define icmp6_mtu icmp6_data32[0] /* packet too big */ | | 86 | #define icmp6_mtu icmp6_data32[0] /* packet too big */ |
87 | #define icmp6_id icmp6_data16[0] /* echo request/reply */ | | 87 | #define icmp6_id icmp6_data16[0] /* echo request/reply */ |
88 | #define icmp6_seq icmp6_data16[1] /* echo request/reply */ | | 88 | #define icmp6_seq icmp6_data16[1] /* echo request/reply */ |
89 | #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ | | 89 | #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ |
90 | | | 90 | |
91 | #define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ | | 91 | #define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ |
92 | #define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ | | 92 | #define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ |
93 | #define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ | | 93 | #define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ |
| @@ -172,27 +172,27 @@ struct icmp6_hdr { | | | @@ -172,27 +172,27 @@ struct icmp6_hdr { |
172 | #define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ | | 172 | #define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ |
173 | #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ | | 173 | #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ |
174 | | | 174 | |
175 | /* Used in kernel only */ | | 175 | /* Used in kernel only */ |
176 | #define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ | | 176 | #define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ |
177 | #define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ | | 177 | #define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ |
178 | | | 178 | |
179 | /* | | 179 | /* |
180 | * Multicast Listener Discovery | | 180 | * Multicast Listener Discovery |
181 | */ | | 181 | */ |
182 | struct mld_hdr { | | 182 | struct mld_hdr { |
183 | struct icmp6_hdr mld_icmp6_hdr; | | 183 | struct icmp6_hdr mld_icmp6_hdr; |
184 | struct in6_addr mld_addr; /* multicast address */ | | 184 | struct in6_addr mld_addr; /* multicast address */ |
185 | } __packed; | | 185 | }; |
186 | | | 186 | |
187 | /* definitions to provide backward compatibility to old KAME applications */ | | 187 | /* definitions to provide backward compatibility to old KAME applications */ |
188 | #ifndef _KERNEL | | 188 | #ifndef _KERNEL |
189 | #define mld6_hdr mld_hdr | | 189 | #define mld6_hdr mld_hdr |
190 | #define mld6_type mld_type | | 190 | #define mld6_type mld_type |
191 | #define mld6_code mld_code | | 191 | #define mld6_code mld_code |
192 | #define mld6_cksum mld_cksum | | 192 | #define mld6_cksum mld_cksum |
193 | #define mld6_maxdelay mld_maxdelay | | 193 | #define mld6_maxdelay mld_maxdelay |
194 | #define mld6_reserved mld_reserved | | 194 | #define mld6_reserved mld_reserved |
195 | #define mld6_addr mld_addr | | 195 | #define mld6_addr mld_addr |
196 | #endif | | 196 | #endif |
197 | | | 197 | |
198 | /* shortcut macro definitions */ | | 198 | /* shortcut macro definitions */ |
| @@ -201,39 +201,39 @@ struct mld_hdr { | | | @@ -201,39 +201,39 @@ struct mld_hdr { |
201 | #define mld_cksum mld_icmp6_hdr.icmp6_cksum | | 201 | #define mld_cksum mld_icmp6_hdr.icmp6_cksum |
202 | #define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] | | 202 | #define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] |
203 | #define mld_reserved mld_icmp6_hdr.icmp6_data16[1] | | 203 | #define mld_reserved mld_icmp6_hdr.icmp6_data16[1] |
204 | | | 204 | |
205 | #define MLD_MINLEN 24 | | 205 | #define MLD_MINLEN 24 |
206 | | | 206 | |
207 | /* | | 207 | /* |
208 | * Neighbor Discovery | | 208 | * Neighbor Discovery |
209 | */ | | 209 | */ |
210 | | | 210 | |
211 | struct nd_router_solicit { /* router solicitation */ | | 211 | struct nd_router_solicit { /* router solicitation */ |
212 | struct icmp6_hdr nd_rs_hdr; | | 212 | struct icmp6_hdr nd_rs_hdr; |
213 | /* could be followed by options */ | | 213 | /* could be followed by options */ |
214 | } __packed; | | 214 | }; |
215 | | | 215 | |
216 | #define nd_rs_type nd_rs_hdr.icmp6_type | | 216 | #define nd_rs_type nd_rs_hdr.icmp6_type |
217 | #define nd_rs_code nd_rs_hdr.icmp6_code | | 217 | #define nd_rs_code nd_rs_hdr.icmp6_code |
218 | #define nd_rs_cksum nd_rs_hdr.icmp6_cksum | | 218 | #define nd_rs_cksum nd_rs_hdr.icmp6_cksum |
219 | #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] | | 219 | #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] |
220 | | | 220 | |
221 | struct nd_router_advert { /* router advertisement */ | | 221 | struct nd_router_advert { /* router advertisement */ |
222 | struct icmp6_hdr nd_ra_hdr; | | 222 | struct icmp6_hdr nd_ra_hdr; |
223 | u_int32_t nd_ra_reachable; /* reachable time */ | | 223 | u_int32_t nd_ra_reachable; /* reachable time */ |
224 | u_int32_t nd_ra_retransmit; /* retransmit timer */ | | 224 | u_int32_t nd_ra_retransmit; /* retransmit timer */ |
225 | /* could be followed by options */ | | 225 | /* could be followed by options */ |
226 | } __packed; | | 226 | }; |
227 | | | 227 | |
228 | #define nd_ra_type nd_ra_hdr.icmp6_type | | 228 | #define nd_ra_type nd_ra_hdr.icmp6_type |
229 | #define nd_ra_code nd_ra_hdr.icmp6_code | | 229 | #define nd_ra_code nd_ra_hdr.icmp6_code |
230 | #define nd_ra_cksum nd_ra_hdr.icmp6_cksum | | 230 | #define nd_ra_cksum nd_ra_hdr.icmp6_cksum |
231 | #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] | | 231 | #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] |
232 | #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] | | 232 | #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] |
233 | #define ND_RA_FLAG_MANAGED 0x80 | | 233 | #define ND_RA_FLAG_MANAGED 0x80 |
234 | #define ND_RA_FLAG_OTHER 0x40 | | 234 | #define ND_RA_FLAG_OTHER 0x40 |
235 | #define ND_RA_FLAG_HOME_AGENT 0x20 | | 235 | #define ND_RA_FLAG_HOME_AGENT 0x20 |
236 | #define ND_RA_FLAG_PROXY 0x04 | | 236 | #define ND_RA_FLAG_PROXY 0x04 |
237 | | | 237 | |
238 | /* | | 238 | /* |
239 | * Router preference values based on RFC4191. | | 239 | * Router preference values based on RFC4191. |
| @@ -241,72 +241,72 @@ struct nd_router_advert { /* router adve | | | @@ -241,72 +241,72 @@ struct nd_router_advert { /* router adve |
241 | #define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ | | 241 | #define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ |
242 | | | 242 | |
243 | #define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */ | | 243 | #define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */ |
244 | #define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */ | | 244 | #define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */ |
245 | #define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */ | | 245 | #define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */ |
246 | #define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ | | 246 | #define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ |
247 | | | 247 | |
248 | #define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] | | 248 | #define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] |
249 | | | 249 | |
250 | struct nd_neighbor_solicit { /* neighbor solicitation */ | | 250 | struct nd_neighbor_solicit { /* neighbor solicitation */ |
251 | struct icmp6_hdr nd_ns_hdr; | | 251 | struct icmp6_hdr nd_ns_hdr; |
252 | struct in6_addr nd_ns_target; /*target address */ | | 252 | struct in6_addr nd_ns_target; /*target address */ |
253 | /* could be followed by options */ | | 253 | /* could be followed by options */ |
254 | } __packed; | | 254 | }; |
255 | | | 255 | |
256 | #define nd_ns_type nd_ns_hdr.icmp6_type | | 256 | #define nd_ns_type nd_ns_hdr.icmp6_type |
257 | #define nd_ns_code nd_ns_hdr.icmp6_code | | 257 | #define nd_ns_code nd_ns_hdr.icmp6_code |
258 | #define nd_ns_cksum nd_ns_hdr.icmp6_cksum | | 258 | #define nd_ns_cksum nd_ns_hdr.icmp6_cksum |
259 | #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] | | 259 | #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] |
260 | | | 260 | |
261 | struct nd_neighbor_advert { /* neighbor advertisement */ | | 261 | struct nd_neighbor_advert { /* neighbor advertisement */ |
262 | struct icmp6_hdr nd_na_hdr; | | 262 | struct icmp6_hdr nd_na_hdr; |
263 | struct in6_addr nd_na_target; /* target address */ | | 263 | struct in6_addr nd_na_target; /* target address */ |
264 | /* could be followed by options */ | | 264 | /* could be followed by options */ |
265 | } __packed; | | 265 | }; |
266 | | | 266 | |
267 | #define nd_na_type nd_na_hdr.icmp6_type | | 267 | #define nd_na_type nd_na_hdr.icmp6_type |
268 | #define nd_na_code nd_na_hdr.icmp6_code | | 268 | #define nd_na_code nd_na_hdr.icmp6_code |
269 | #define nd_na_cksum nd_na_hdr.icmp6_cksum | | 269 | #define nd_na_cksum nd_na_hdr.icmp6_cksum |
270 | #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] | | 270 | #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] |
271 | #if BYTE_ORDER == BIG_ENDIAN | | 271 | #if BYTE_ORDER == BIG_ENDIAN |
272 | #define ND_NA_FLAG_ROUTER 0x80000000 | | 272 | #define ND_NA_FLAG_ROUTER 0x80000000 |
273 | #define ND_NA_FLAG_SOLICITED 0x40000000 | | 273 | #define ND_NA_FLAG_SOLICITED 0x40000000 |
274 | #define ND_NA_FLAG_OVERRIDE 0x20000000 | | 274 | #define ND_NA_FLAG_OVERRIDE 0x20000000 |
275 | #else | | 275 | #else |
276 | #if BYTE_ORDER == LITTLE_ENDIAN | | 276 | #if BYTE_ORDER == LITTLE_ENDIAN |
277 | #define ND_NA_FLAG_ROUTER 0x80 | | 277 | #define ND_NA_FLAG_ROUTER 0x80 |
278 | #define ND_NA_FLAG_SOLICITED 0x40 | | 278 | #define ND_NA_FLAG_SOLICITED 0x40 |
279 | #define ND_NA_FLAG_OVERRIDE 0x20 | | 279 | #define ND_NA_FLAG_OVERRIDE 0x20 |
280 | #endif | | 280 | #endif |
281 | #endif | | 281 | #endif |
282 | | | 282 | |
283 | struct nd_redirect { /* redirect */ | | 283 | struct nd_redirect { /* redirect */ |
284 | struct icmp6_hdr nd_rd_hdr; | | 284 | struct icmp6_hdr nd_rd_hdr; |
285 | struct in6_addr nd_rd_target; /* target address */ | | 285 | struct in6_addr nd_rd_target; /* target address */ |
286 | struct in6_addr nd_rd_dst; /* destination address */ | | 286 | struct in6_addr nd_rd_dst; /* destination address */ |
287 | /* could be followed by options */ | | 287 | /* could be followed by options */ |
288 | } __packed; | | 288 | }; |
289 | | | 289 | |
290 | #define nd_rd_type nd_rd_hdr.icmp6_type | | 290 | #define nd_rd_type nd_rd_hdr.icmp6_type |
291 | #define nd_rd_code nd_rd_hdr.icmp6_code | | 291 | #define nd_rd_code nd_rd_hdr.icmp6_code |
292 | #define nd_rd_cksum nd_rd_hdr.icmp6_cksum | | 292 | #define nd_rd_cksum nd_rd_hdr.icmp6_cksum |
293 | #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] | | 293 | #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] |
294 | | | 294 | |
295 | struct nd_opt_hdr { /* Neighbor discovery option header */ | | 295 | struct nd_opt_hdr { /* Neighbor discovery option header */ |
296 | u_int8_t nd_opt_type; | | 296 | u_int8_t nd_opt_type; |
297 | u_int8_t nd_opt_len; | | 297 | u_int8_t nd_opt_len; |
298 | /* followed by option specific data*/ | | 298 | /* followed by option specific data*/ |
299 | } __packed; | | 299 | }; |
300 | | | 300 | |
301 | #define ND_OPT_SOURCE_LINKADDR 1 | | 301 | #define ND_OPT_SOURCE_LINKADDR 1 |
302 | #define ND_OPT_TARGET_LINKADDR 2 | | 302 | #define ND_OPT_TARGET_LINKADDR 2 |
303 | #define ND_OPT_PREFIX_INFORMATION 3 | | 303 | #define ND_OPT_PREFIX_INFORMATION 3 |
304 | #define ND_OPT_REDIRECTED_HEADER 4 | | 304 | #define ND_OPT_REDIRECTED_HEADER 4 |
305 | #define ND_OPT_MTU 5 | | 305 | #define ND_OPT_MTU 5 |
306 | #define ND_OPT_ADVINTERVAL 7 | | 306 | #define ND_OPT_ADVINTERVAL 7 |
307 | #define ND_OPT_HOMEAGENT_INFO 8 | | 307 | #define ND_OPT_HOMEAGENT_INFO 8 |
308 | #define ND_OPT_SOURCE_ADDRLIST 9 | | 308 | #define ND_OPT_SOURCE_ADDRLIST 9 |
309 | #define ND_OPT_TARGET_ADDRLIST 10 | | 309 | #define ND_OPT_TARGET_ADDRLIST 10 |
310 | #define ND_OPT_NONCE 14 /* RFC 3971 */ | | 310 | #define ND_OPT_NONCE 14 /* RFC 3971 */ |
311 | #define ND_OPT_MAP 23 /* RFC 5380 */ | | 311 | #define ND_OPT_MAP 23 /* RFC 5380 */ |
312 | #define ND_OPT_ROUTE_INFO 24 /* RFC 4191 */ | | 312 | #define ND_OPT_ROUTE_INFO 24 /* RFC 4191 */ |
| @@ -322,96 +322,96 @@ struct nd_opt_route_info { /* route info | | | @@ -322,96 +322,96 @@ struct nd_opt_route_info { /* route info |
322 | u_int32_t nd_opt_rti_lifetime; | | 322 | u_int32_t nd_opt_rti_lifetime; |
323 | /* prefix follows */ | | 323 | /* prefix follows */ |
324 | }; | | 324 | }; |
325 | | | 325 | |
326 | struct nd_opt_prefix_info { /* prefix information */ | | 326 | struct nd_opt_prefix_info { /* prefix information */ |
327 | u_int8_t nd_opt_pi_type; | | 327 | u_int8_t nd_opt_pi_type; |
328 | u_int8_t nd_opt_pi_len; | | 328 | u_int8_t nd_opt_pi_len; |
329 | u_int8_t nd_opt_pi_prefix_len; | | 329 | u_int8_t nd_opt_pi_prefix_len; |
330 | u_int8_t nd_opt_pi_flags_reserved; | | 330 | u_int8_t nd_opt_pi_flags_reserved; |
331 | u_int32_t nd_opt_pi_valid_time; | | 331 | u_int32_t nd_opt_pi_valid_time; |
332 | u_int32_t nd_opt_pi_preferred_time; | | 332 | u_int32_t nd_opt_pi_preferred_time; |
333 | u_int32_t nd_opt_pi_reserved2; | | 333 | u_int32_t nd_opt_pi_reserved2; |
334 | struct in6_addr nd_opt_pi_prefix; | | 334 | struct in6_addr nd_opt_pi_prefix; |
335 | } __packed; | | 335 | }; |
336 | | | 336 | |
337 | #define ND_OPT_PI_FLAG_ONLINK 0x80 | | 337 | #define ND_OPT_PI_FLAG_ONLINK 0x80 |
338 | #define ND_OPT_PI_FLAG_AUTO 0x40 | | 338 | #define ND_OPT_PI_FLAG_AUTO 0x40 |
339 | #define ND_OPT_PI_FLAG_ROUTER 0x20 | | 339 | #define ND_OPT_PI_FLAG_ROUTER 0x20 |
340 | | | 340 | |
341 | struct nd_opt_rd_hdr { /* redirected header */ | | 341 | struct nd_opt_rd_hdr { /* redirected header */ |
342 | u_int8_t nd_opt_rh_type; | | 342 | u_int8_t nd_opt_rh_type; |
343 | u_int8_t nd_opt_rh_len; | | 343 | u_int8_t nd_opt_rh_len; |
344 | u_int16_t nd_opt_rh_reserved1; | | 344 | u_int16_t nd_opt_rh_reserved1; |
345 | u_int32_t nd_opt_rh_reserved2; | | 345 | u_int32_t nd_opt_rh_reserved2; |
346 | /* followed by IP header and data */ | | 346 | /* followed by IP header and data */ |
347 | } __packed; | | 347 | }; |
348 | | | 348 | |
349 | struct nd_opt_mtu { /* MTU option */ | | 349 | struct nd_opt_mtu { /* MTU option */ |
350 | u_int8_t nd_opt_mtu_type; | | 350 | u_int8_t nd_opt_mtu_type; |
351 | u_int8_t nd_opt_mtu_len; | | 351 | u_int8_t nd_opt_mtu_len; |
352 | u_int16_t nd_opt_mtu_reserved; | | 352 | u_int16_t nd_opt_mtu_reserved; |
353 | u_int32_t nd_opt_mtu_mtu; | | 353 | u_int32_t nd_opt_mtu_mtu; |
354 | } __packed; | | 354 | }; |
355 | | | 355 | |
356 | #define ND_OPT_NONCE_LEN ((1 * 8) - 2) | | 356 | #define ND_OPT_NONCE_LEN ((1 * 8) - 2) |
357 | #if ((ND_OPT_NONCE_LEN + 2) % 8) != 0 | | 357 | #if ((ND_OPT_NONCE_LEN + 2) % 8) != 0 |
358 | #error "(ND_OPT_NONCE_LEN + 2) must be a multiple of 8." | | 358 | #error "(ND_OPT_NONCE_LEN + 2) must be a multiple of 8." |
359 | #endif | | 359 | #endif |
360 | struct nd_opt_nonce { | | 360 | struct nd_opt_nonce { |
361 | u_int8_t nd_opt_nonce_type; | | 361 | u_int8_t nd_opt_nonce_type; |
362 | u_int8_t nd_opt_nonce_len; | | 362 | u_int8_t nd_opt_nonce_len; |
363 | u_int8_t nd_opt_nonce[ND_OPT_NONCE_LEN]; | | 363 | u_int8_t nd_opt_nonce[ND_OPT_NONCE_LEN]; |
364 | } __packed; | | 364 | }; |
365 | | | 365 | |
366 | struct nd_opt_rdnss { /* RDNSS option RFC 6106 */ | | 366 | struct nd_opt_rdnss { /* RDNSS option RFC 6106 */ |
367 | u_int8_t nd_opt_rdnss_type; | | 367 | u_int8_t nd_opt_rdnss_type; |
368 | u_int8_t nd_opt_rdnss_len; | | 368 | u_int8_t nd_opt_rdnss_len; |
369 | u_int16_t nd_opt_rdnss_reserved; | | 369 | u_int16_t nd_opt_rdnss_reserved; |
370 | u_int32_t nd_opt_rdnss_lifetime; | | 370 | u_int32_t nd_opt_rdnss_lifetime; |
371 | /* followed by list of IP prefixes */ | | 371 | /* followed by list of IP prefixes */ |
372 | } __packed; | | 372 | }; |
373 | | | 373 | |
374 | struct nd_opt_dnssl { /* DNSSL option RFC 6106 */ | | 374 | struct nd_opt_dnssl { /* DNSSL option RFC 6106 */ |
375 | u_int8_t nd_opt_dnssl_type; | | 375 | u_int8_t nd_opt_dnssl_type; |
376 | u_int8_t nd_opt_dnssl_len; | | 376 | u_int8_t nd_opt_dnssl_len; |
377 | u_int16_t nd_opt_dnssl_reserved; | | 377 | u_int16_t nd_opt_dnssl_reserved; |
378 | u_int32_t nd_opt_dnssl_lifetime; | | 378 | u_int32_t nd_opt_dnssl_lifetime; |
379 | /* followed by list of IP prefixes */ | | 379 | /* followed by list of IP prefixes */ |
380 | } __packed; | | 380 | }; |
381 | | | 381 | |
382 | /* | | 382 | /* |
383 | * icmp6 namelookup | | 383 | * icmp6 namelookup |
384 | */ | | 384 | */ |
385 | | | 385 | |
386 | struct icmp6_namelookup { | | 386 | struct icmp6_namelookup { |
387 | struct icmp6_hdr icmp6_nl_hdr; | | 387 | struct icmp6_hdr icmp6_nl_hdr; |
388 | u_int8_t icmp6_nl_nonce[8]; | | 388 | u_int8_t icmp6_nl_nonce[8]; |
389 | int32_t icmp6_nl_ttl; | | 389 | int32_t icmp6_nl_ttl; |
390 | #if 0 | | 390 | #if 0 |
391 | u_int8_t icmp6_nl_len; | | 391 | u_int8_t icmp6_nl_len; |
392 | u_int8_t icmp6_nl_name[3]; | | 392 | u_int8_t icmp6_nl_name[3]; |
393 | #endif | | 393 | #endif |
394 | /* could be followed by options */ | | 394 | /* could be followed by options */ |
395 | } __packed; | | 395 | }; |
396 | | | 396 | |
397 | /* | | 397 | /* |
398 | * icmp6 node information | | 398 | * icmp6 node information |
399 | */ | | 399 | */ |
400 | struct icmp6_nodeinfo { | | 400 | struct icmp6_nodeinfo { |
401 | struct icmp6_hdr icmp6_ni_hdr; | | 401 | struct icmp6_hdr icmp6_ni_hdr; |
402 | u_int8_t icmp6_ni_nonce[8]; | | 402 | u_int8_t icmp6_ni_nonce[8]; |
403 | /* could be followed by reply data */ | | 403 | /* could be followed by reply data */ |
404 | } __packed; | | 404 | }; |
405 | | | 405 | |
406 | #define ni_type icmp6_ni_hdr.icmp6_type | | 406 | #define ni_type icmp6_ni_hdr.icmp6_type |
407 | #define ni_code icmp6_ni_hdr.icmp6_code | | 407 | #define ni_code icmp6_ni_hdr.icmp6_code |
408 | #define ni_cksum icmp6_ni_hdr.icmp6_cksum | | 408 | #define ni_cksum icmp6_ni_hdr.icmp6_cksum |
409 | #define ni_qtype icmp6_ni_hdr.icmp6_data16[0] | | 409 | #define ni_qtype icmp6_ni_hdr.icmp6_data16[0] |
410 | #define ni_flags icmp6_ni_hdr.icmp6_data16[1] | | 410 | #define ni_flags icmp6_ni_hdr.icmp6_data16[1] |
411 | | | 411 | |
412 | #define NI_QTYPE_NOOP 0 /* NOOP */ | | 412 | #define NI_QTYPE_NOOP 0 /* NOOP */ |
413 | #define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ | | 413 | #define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ |
414 | #define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ | | 414 | #define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ |
415 | #define NI_QTYPE_DNSNAME 2 /* DNS Name */ | | 415 | #define NI_QTYPE_DNSNAME 2 /* DNS Name */ |
416 | #define NI_QTYPE_NODEADDR 3 /* Node Addresses */ | | 416 | #define NI_QTYPE_NODEADDR 3 /* Node Addresses */ |
417 | #define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ | | 417 | #define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ |
| @@ -454,94 +454,94 @@ struct icmp6_nodeinfo { | | | @@ -454,94 +454,94 @@ struct icmp6_nodeinfo { |
454 | #define NI_NODEADDR_FLAG_ALL 0x0200 | | 454 | #define NI_NODEADDR_FLAG_ALL 0x0200 |
455 | #define NI_NODEADDR_FLAG_COMPAT 0x0400 | | 455 | #define NI_NODEADDR_FLAG_COMPAT 0x0400 |
456 | #define NI_NODEADDR_FLAG_LINKLOCAL 0x0800 | | 456 | #define NI_NODEADDR_FLAG_LINKLOCAL 0x0800 |
457 | #define NI_NODEADDR_FLAG_SITELOCAL 0x1000 | | 457 | #define NI_NODEADDR_FLAG_SITELOCAL 0x1000 |
458 | #define NI_NODEADDR_FLAG_GLOBAL 0x2000 | | 458 | #define NI_NODEADDR_FLAG_GLOBAL 0x2000 |
459 | #define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ | | 459 | #define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ |
460 | #endif | | 460 | #endif |
461 | #endif | | 461 | #endif |
462 | | | 462 | |
463 | struct ni_reply_fqdn { | | 463 | struct ni_reply_fqdn { |
464 | u_int32_t ni_fqdn_ttl; /* TTL */ | | 464 | u_int32_t ni_fqdn_ttl; /* TTL */ |
465 | u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ | | 465 | u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ |
466 | u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ | | 466 | u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ |
467 | } __packed; | | 467 | }; |
468 | | | 468 | |
469 | /* | | 469 | /* |
470 | * Router Renumbering. as router-renum-08.txt | | 470 | * Router Renumbering. as router-renum-08.txt |
471 | */ | | 471 | */ |
472 | struct icmp6_router_renum { /* router renumbering header */ | | 472 | struct icmp6_router_renum { /* router renumbering header */ |
473 | struct icmp6_hdr rr_hdr; | | 473 | struct icmp6_hdr rr_hdr; |
474 | u_int8_t rr_segnum; | | 474 | u_int8_t rr_segnum; |
475 | u_int8_t rr_flags; | | 475 | u_int8_t rr_flags; |
476 | u_int16_t rr_maxdelay; | | 476 | u_int16_t rr_maxdelay; |
477 | u_int32_t rr_reserved; | | 477 | u_int32_t rr_reserved; |
478 | } __packed; | | 478 | }; |
479 | | | 479 | |
480 | #define ICMP6_RR_FLAGS_TEST 0x80 | | 480 | #define ICMP6_RR_FLAGS_TEST 0x80 |
481 | #define ICMP6_RR_FLAGS_REQRESULT 0x40 | | 481 | #define ICMP6_RR_FLAGS_REQRESULT 0x40 |
482 | #define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 | | 482 | #define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 |
483 | #define ICMP6_RR_FLAGS_SPECSITE 0x10 | | 483 | #define ICMP6_RR_FLAGS_SPECSITE 0x10 |
484 | #define ICMP6_RR_FLAGS_PREVDONE 0x08 | | 484 | #define ICMP6_RR_FLAGS_PREVDONE 0x08 |
485 | | | 485 | |
486 | #define rr_type rr_hdr.icmp6_type | | 486 | #define rr_type rr_hdr.icmp6_type |
487 | #define rr_code rr_hdr.icmp6_code | | 487 | #define rr_code rr_hdr.icmp6_code |
488 | #define rr_cksum rr_hdr.icmp6_cksum | | 488 | #define rr_cksum rr_hdr.icmp6_cksum |
489 | #define rr_seqnum rr_hdr.icmp6_data32[0] | | 489 | #define rr_seqnum rr_hdr.icmp6_data32[0] |
490 | | | 490 | |
491 | struct rr_pco_match { /* match prefix part */ | | 491 | struct rr_pco_match { /* match prefix part */ |
492 | u_int8_t rpm_code; | | 492 | u_int8_t rpm_code; |
493 | u_int8_t rpm_len; | | 493 | u_int8_t rpm_len; |
494 | u_int8_t rpm_ordinal; | | 494 | u_int8_t rpm_ordinal; |
495 | u_int8_t rpm_matchlen; | | 495 | u_int8_t rpm_matchlen; |
496 | u_int8_t rpm_minlen; | | 496 | u_int8_t rpm_minlen; |
497 | u_int8_t rpm_maxlen; | | 497 | u_int8_t rpm_maxlen; |
498 | u_int16_t rpm_reserved; | | 498 | u_int16_t rpm_reserved; |
499 | struct in6_addr rpm_prefix; | | 499 | struct in6_addr rpm_prefix; |
500 | } __packed; | | 500 | }; |
501 | | | 501 | |
502 | #define RPM_PCO_ADD 1 | | 502 | #define RPM_PCO_ADD 1 |
503 | #define RPM_PCO_CHANGE 2 | | 503 | #define RPM_PCO_CHANGE 2 |
504 | #define RPM_PCO_SETGLOBAL 3 | | 504 | #define RPM_PCO_SETGLOBAL 3 |
505 | #define RPM_PCO_MAX 4 | | 505 | #define RPM_PCO_MAX 4 |
506 | | | 506 | |
507 | struct rr_pco_use { /* use prefix part */ | | 507 | struct rr_pco_use { /* use prefix part */ |
508 | u_int8_t rpu_uselen; | | 508 | u_int8_t rpu_uselen; |
509 | u_int8_t rpu_keeplen; | | 509 | u_int8_t rpu_keeplen; |
510 | u_int8_t rpu_ramask; | | 510 | u_int8_t rpu_ramask; |
511 | u_int8_t rpu_raflags; | | 511 | u_int8_t rpu_raflags; |
512 | u_int32_t rpu_vltime; | | 512 | u_int32_t rpu_vltime; |
513 | u_int32_t rpu_pltime; | | 513 | u_int32_t rpu_pltime; |
514 | u_int32_t rpu_flags; | | 514 | u_int32_t rpu_flags; |
515 | struct in6_addr rpu_prefix; | | 515 | struct in6_addr rpu_prefix; |
516 | } __packed; | | 516 | }; |
517 | #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 | | 517 | #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 |
518 | #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 | | 518 | #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 |
519 | | | 519 | |
520 | #if BYTE_ORDER == BIG_ENDIAN | | 520 | #if BYTE_ORDER == BIG_ENDIAN |
521 | #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 | | 521 | #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 |
522 | #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 | | 522 | #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 |
523 | #elif BYTE_ORDER == LITTLE_ENDIAN | | 523 | #elif BYTE_ORDER == LITTLE_ENDIAN |
524 | #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 | | 524 | #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 |
525 | #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 | | 525 | #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 |
526 | #endif | | 526 | #endif |
527 | | | 527 | |
528 | struct rr_result { /* router renumbering result message */ | | 528 | struct rr_result { /* router renumbering result message */ |
529 | u_int16_t rrr_flags; | | 529 | u_int16_t rrr_flags; |
530 | u_int8_t rrr_ordinal; | | 530 | u_int8_t rrr_ordinal; |
531 | u_int8_t rrr_matchedlen; | | 531 | u_int8_t rrr_matchedlen; |
532 | u_int32_t rrr_ifid; | | 532 | u_int32_t rrr_ifid; |
533 | struct in6_addr rrr_prefix; | | 533 | struct in6_addr rrr_prefix; |
534 | } __packed; | | 534 | }; |
535 | #if BYTE_ORDER == BIG_ENDIAN | | 535 | #if BYTE_ORDER == BIG_ENDIAN |
536 | #define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 | | 536 | #define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 |
537 | #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 | | 537 | #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 |
538 | #elif BYTE_ORDER == LITTLE_ENDIAN | | 538 | #elif BYTE_ORDER == LITTLE_ENDIAN |
539 | #define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 | | 539 | #define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 |
540 | #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 | | 540 | #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 |
541 | #endif | | 541 | #endif |
542 | | | 542 | |
543 | /* | | 543 | /* |
544 | * icmp6 filter structures. | | 544 | * icmp6 filter structures. |
545 | */ | | 545 | */ |
546 | | | 546 | |
547 | struct icmp6_filter { | | 547 | struct icmp6_filter { |