1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 #ifndef _NETINET_ICMP6_H_
65 #define _NETINET_ICMP6_H_
66
67 #define ICMPV6_PLD_MAXLEN 1232
68
69
70 struct icmp6_hdr {
71 u_int8_t icmp6_type;
72 u_int8_t icmp6_code;
73 u_int16_t icmp6_cksum;
74 union {
75 u_int32_t icmp6_un_data32[1];
76 u_int16_t icmp6_un_data16[2];
77 u_int8_t icmp6_un_data8[4];
78 } icmp6_dataun;
79 } __packed;
80
81 #define icmp6_data32 icmp6_dataun.icmp6_un_data32
82 #define icmp6_data16 icmp6_dataun.icmp6_un_data16
83 #define icmp6_data8 icmp6_dataun.icmp6_un_data8
84 #define icmp6_pptr icmp6_data32[0]
85 #define icmp6_mtu icmp6_data32[0]
86 #define icmp6_id icmp6_data16[0]
87 #define icmp6_seq icmp6_data16[1]
88 #define icmp6_maxdelay icmp6_data16[0]
89
90 #define ICMP6_DST_UNREACH 1
91 #define ICMP6_PACKET_TOO_BIG 2
92 #define ICMP6_TIME_EXCEEDED 3
93 #define ICMP6_PARAM_PROB 4
94
95 #define ICMP6_ECHO_REQUEST 128
96 #define ICMP6_ECHO_REPLY 129
97 #define MLD_LISTENER_QUERY 130
98 #define MLD_LISTENER_REPORT 131
99 #define MLD_LISTENER_DONE 132
100
101
102 #define ICMP6_MEMBERSHIP_QUERY 130
103 #define ICMP6_MEMBERSHIP_REPORT 131
104 #define ICMP6_MEMBERSHIP_REDUCTION 132
105
106 #ifndef _KERNEL
107
108 #define MLD6_LISTENER_QUERY MLD_LISTENER_QUERY
109 #define MLD6_LISTENER_REPORT MLD_LISTENER_REPORT
110 #define MLD6_LISTENER_DONE MLD_LISTENER_DONE
111 #endif
112
113 #define ND_ROUTER_SOLICIT 133
114 #define ND_ROUTER_ADVERT 134
115 #define ND_NEIGHBOR_SOLICIT 135
116 #define ND_NEIGHBOR_ADVERT 136
117 #define ND_REDIRECT 137
118
119 #define ICMP6_ROUTER_RENUMBERING 138
120
121 #define ICMP6_WRUREQUEST 139
122 #define ICMP6_WRUREPLY 140
123 #define ICMP6_FQDN_QUERY 139
124 #define ICMP6_FQDN_REPLY 140
125 #define ICMP6_NI_QUERY 139
126 #define ICMP6_NI_REPLY 140
127
128
129 #define MLD_MTRACE_RESP 200
130 #define MLD_MTRACE 201
131
132 #ifndef _KERNEL
133
134 #define MLD6_MTRACE_RESP MLD_MTRACE_RESP
135 #define MLD6_MTRACE MLD_MTRACE
136 #endif
137
138 #define ICMP6_MAXTYPE 201
139
140 #define ICMP6_DST_UNREACH_NOROUTE 0
141 #define ICMP6_DST_UNREACH_ADMIN 1
142 #define ICMP6_DST_UNREACH_NOTNEIGHBOR 2
143 #define ICMP6_DST_UNREACH_BEYONDSCOPE 2
144 #define ICMP6_DST_UNREACH_ADDR 3
145 #define ICMP6_DST_UNREACH_NOPORT 4
146
147 #define ICMP6_TIME_EXCEED_TRANSIT 0
148 #define ICMP6_TIME_EXCEED_REASSEMBLY 1
149
150 #define ICMP6_PARAMPROB_HEADER 0
151 #define ICMP6_PARAMPROB_NEXTHEADER 1
152 #define ICMP6_PARAMPROB_OPTION 2
153
154 #define ICMP6_INFOMSG_MASK 0x80
155
156 #define ICMP6_NI_SUBJ_IPV6 0
157 #define ICMP6_NI_SUBJ_FQDN 1
158 #define ICMP6_NI_SUBJ_IPV4 2
159
160 #define ICMP6_NI_SUCCESS 0
161 #define ICMP6_NI_REFUSED 1
162 #define ICMP6_NI_UNKNOWN 2
163
164 #define ICMP6_ROUTER_RENUMBERING_COMMAND 0
165 #define ICMP6_ROUTER_RENUMBERING_RESULT 1
166 #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255
167
168
169 #define ND_REDIRECT_ONLINK 0
170 #define ND_REDIRECT_ROUTER 1
171
172
173
174
175 struct mld_hdr {
176 struct icmp6_hdr mld_icmp6_hdr;
177 struct in6_addr mld_addr;
178 } __packed;
179
180
181 #ifndef _KERNEL
182 #define mld6_hdr mld_hdr
183 #define mld6_type mld_type
184 #define mld6_code mld_code
185 #define mld6_cksum mld_cksum
186 #define mld6_maxdelay mld_maxdelay
187 #define mld6_reserved mld_reserved
188 #define mld6_addr mld_addr
189 #endif
190
191
192 #define mld_type mld_icmp6_hdr.icmp6_type
193 #define mld_code mld_icmp6_hdr.icmp6_code
194 #define mld_cksum mld_icmp6_hdr.icmp6_cksum
195 #define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0]
196 #define mld_reserved mld_icmp6_hdr.icmp6_data16[1]
197
198
199
200
201
202 struct nd_router_solicit {
203 struct icmp6_hdr nd_rs_hdr;
204
205 } __packed;
206
207 #define nd_rs_type nd_rs_hdr.icmp6_type
208 #define nd_rs_code nd_rs_hdr.icmp6_code
209 #define nd_rs_cksum nd_rs_hdr.icmp6_cksum
210 #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0]
211
212 struct nd_router_advert {
213 struct icmp6_hdr nd_ra_hdr;
214 u_int32_t nd_ra_reachable;
215 u_int32_t nd_ra_retransmit;
216
217 } __packed;
218
219 #define nd_ra_type nd_ra_hdr.icmp6_type
220 #define nd_ra_code nd_ra_hdr.icmp6_code
221 #define nd_ra_cksum nd_ra_hdr.icmp6_cksum
222 #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0]
223 #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]
224 #define ND_RA_FLAG_MANAGED 0x80
225 #define ND_RA_FLAG_OTHER 0x40
226 #define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]
227
228 struct nd_neighbor_solicit {
229 struct icmp6_hdr nd_ns_hdr;
230 struct in6_addr nd_ns_target;
231
232 } __packed;
233
234 #define nd_ns_type nd_ns_hdr.icmp6_type
235 #define nd_ns_code nd_ns_hdr.icmp6_code
236 #define nd_ns_cksum nd_ns_hdr.icmp6_cksum
237 #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
238
239 struct nd_neighbor_advert {
240 struct icmp6_hdr nd_na_hdr;
241 struct in6_addr nd_na_target;
242
243 } __packed;
244
245 #define nd_na_type nd_na_hdr.icmp6_type
246 #define nd_na_code nd_na_hdr.icmp6_code
247 #define nd_na_cksum nd_na_hdr.icmp6_cksum
248 #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
249 #if _BYTE_ORDER == _BIG_ENDIAN
250 #define ND_NA_FLAG_ROUTER 0x80000000
251 #define ND_NA_FLAG_SOLICITED 0x40000000
252 #define ND_NA_FLAG_OVERRIDE 0x20000000
253 #else
254 #if _BYTE_ORDER == _LITTLE_ENDIAN
255 #define ND_NA_FLAG_ROUTER 0x80
256 #define ND_NA_FLAG_SOLICITED 0x40
257 #define ND_NA_FLAG_OVERRIDE 0x20
258 #endif
259 #endif
260
261 struct nd_redirect {
262 struct icmp6_hdr nd_rd_hdr;
263 struct in6_addr nd_rd_target;
264 struct in6_addr nd_rd_dst;
265
266 } __packed;
267
268 #define nd_rd_type nd_rd_hdr.icmp6_type
269 #define nd_rd_code nd_rd_hdr.icmp6_code
270 #define nd_rd_cksum nd_rd_hdr.icmp6_cksum
271 #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
272
273 struct nd_opt_hdr {
274 u_int8_t nd_opt_type;
275 u_int8_t nd_opt_len;
276
277 } __packed;
278
279 #define ND_OPT_SOURCE_LINKADDR 1
280 #define ND_OPT_TARGET_LINKADDR 2
281 #define ND_OPT_PREFIX_INFORMATION 3
282 #define ND_OPT_REDIRECTED_HEADER 4
283 #define ND_OPT_MTU 5
284
285 struct nd_opt_prefix_info {
286 u_int8_t nd_opt_pi_type;
287 u_int8_t nd_opt_pi_len;
288 u_int8_t nd_opt_pi_prefix_len;
289 u_int8_t nd_opt_pi_flags_reserved;
290 u_int32_t nd_opt_pi_valid_time;
291 u_int32_t nd_opt_pi_preferred_time;
292 u_int32_t nd_opt_pi_reserved2;
293 struct in6_addr nd_opt_pi_prefix;
294 } __packed;
295
296 #define ND_OPT_PI_FLAG_ONLINK 0x80
297 #define ND_OPT_PI_FLAG_AUTO 0x40
298
299 struct nd_opt_rd_hdr {
300 u_int8_t nd_opt_rh_type;
301 u_int8_t nd_opt_rh_len;
302 u_int16_t nd_opt_rh_reserved1;
303 u_int32_t nd_opt_rh_reserved2;
304
305 } __packed;
306
307 struct nd_opt_mtu {
308 u_int8_t nd_opt_mtu_type;
309 u_int8_t nd_opt_mtu_len;
310 u_int16_t nd_opt_mtu_reserved;
311 u_int32_t nd_opt_mtu_mtu;
312 } __packed;
313
314
315
316
317
318 struct icmp6_namelookup {
319 struct icmp6_hdr icmp6_nl_hdr;
320 u_int8_t icmp6_nl_nonce[8];
321 int32_t icmp6_nl_ttl;
322 #if 0
323 u_int8_t icmp6_nl_len;
324 u_int8_t icmp6_nl_name[3];
325 #endif
326
327 } __packed;
328
329
330
331
332 struct icmp6_nodeinfo {
333 struct icmp6_hdr icmp6_ni_hdr;
334 u_int8_t icmp6_ni_nonce[8];
335
336 } __packed;
337
338 #define ni_type icmp6_ni_hdr.icmp6_type
339 #define ni_code icmp6_ni_hdr.icmp6_code
340 #define ni_cksum icmp6_ni_hdr.icmp6_cksum
341 #define ni_qtype icmp6_ni_hdr.icmp6_data16[0]
342 #define ni_flags icmp6_ni_hdr.icmp6_data16[1]
343
344 #define NI_QTYPE_NOOP 0
345 #define NI_QTYPE_SUPTYPES 1
346 #define NI_QTYPE_FQDN 2
347 #define NI_QTYPE_DNSNAME 2
348 #define NI_QTYPE_NODEADDR 3
349 #define NI_QTYPE_IPV4ADDR 4
350
351 #if _BYTE_ORDER == _BIG_ENDIAN
352 #define NI_SUPTYPE_FLAG_COMPRESS 0x1
353 #define NI_FQDN_FLAG_VALIDTTL 0x1
354 #elif _BYTE_ORDER == _LITTLE_ENDIAN
355 #define NI_SUPTYPE_FLAG_COMPRESS 0x0100
356 #define NI_FQDN_FLAG_VALIDTTL 0x0100
357 #endif
358
359 #ifdef NAME_LOOKUPS_04
360 #if _BYTE_ORDER == _BIG_ENDIAN
361 #define NI_NODEADDR_FLAG_LINKLOCAL 0x1
362 #define NI_NODEADDR_FLAG_SITELOCAL 0x2
363 #define NI_NODEADDR_FLAG_GLOBAL 0x4
364 #define NI_NODEADDR_FLAG_ALL 0x8
365 #define NI_NODEADDR_FLAG_TRUNCATE 0x10
366 #define NI_NODEADDR_FLAG_ANYCAST 0x20
367 #elif _BYTE_ORDER == _LITTLE_ENDIAN
368 #define NI_NODEADDR_FLAG_LINKLOCAL 0x0100
369 #define NI_NODEADDR_FLAG_SITELOCAL 0x0200
370 #define NI_NODEADDR_FLAG_GLOBAL 0x0400
371 #define NI_NODEADDR_FLAG_ALL 0x0800
372 #define NI_NODEADDR_FLAG_TRUNCATE 0x1000
373 #define NI_NODEADDR_FLAG_ANYCAST 0x2000
374 #endif
375 #else
376 #if _BYTE_ORDER == _BIG_ENDIAN
377 #define NI_NODEADDR_FLAG_TRUNCATE 0x1
378 #define NI_NODEADDR_FLAG_ALL 0x2
379 #define NI_NODEADDR_FLAG_COMPAT 0x4
380 #define NI_NODEADDR_FLAG_LINKLOCAL 0x8
381 #define NI_NODEADDR_FLAG_SITELOCAL 0x10
382 #define NI_NODEADDR_FLAG_GLOBAL 0x20
383 #define NI_NODEADDR_FLAG_ANYCAST 0x40
384 #elif _BYTE_ORDER == _LITTLE_ENDIAN
385 #define NI_NODEADDR_FLAG_TRUNCATE 0x0100
386 #define NI_NODEADDR_FLAG_ALL 0x0200
387 #define NI_NODEADDR_FLAG_COMPAT 0x0400
388 #define NI_NODEADDR_FLAG_LINKLOCAL 0x0800
389 #define NI_NODEADDR_FLAG_SITELOCAL 0x1000
390 #define NI_NODEADDR_FLAG_GLOBAL 0x2000
391 #define NI_NODEADDR_FLAG_ANYCAST 0x4000
392 #endif
393 #endif
394
395 struct ni_reply_fqdn {
396 u_int32_t ni_fqdn_ttl;
397 u_int8_t ni_fqdn_namelen;
398 u_int8_t ni_fqdn_name[3];
399 } __packed;
400
401
402
403
404 struct icmp6_router_renum {
405 struct icmp6_hdr rr_hdr;
406 u_int8_t rr_segnum;
407 u_int8_t rr_flags;
408 u_int16_t rr_maxdelay;
409 u_int32_t rr_reserved;
410 } __packed;
411
412 #define ICMP6_RR_FLAGS_TEST 0x80
413 #define ICMP6_RR_FLAGS_REQRESULT 0x40
414 #define ICMP6_RR_FLAGS_FORCEAPPLY 0x20
415 #define ICMP6_RR_FLAGS_SPECSITE 0x10
416 #define ICMP6_RR_FLAGS_PREVDONE 0x08
417
418 #define rr_type rr_hdr.icmp6_type
419 #define rr_code rr_hdr.icmp6_code
420 #define rr_cksum rr_hdr.icmp6_cksum
421 #define rr_seqnum rr_hdr.icmp6_data32[0]
422
423 struct rr_pco_match {
424 u_int8_t rpm_code;
425 u_int8_t rpm_len;
426 u_int8_t rpm_ordinal;
427 u_int8_t rpm_matchlen;
428 u_int8_t rpm_minlen;
429 u_int8_t rpm_maxlen;
430 u_int16_t rpm_reserved;
431 struct in6_addr rpm_prefix;
432 } __packed;
433
434 #define RPM_PCO_ADD 1
435 #define RPM_PCO_CHANGE 2
436 #define RPM_PCO_SETGLOBAL 3
437 #define RPM_PCO_MAX 4
438
439 struct rr_pco_use {
440 u_int8_t rpu_uselen;
441 u_int8_t rpu_keeplen;
442 u_int8_t rpu_ramask;
443 u_int8_t rpu_raflags;
444 u_int32_t rpu_vltime;
445 u_int32_t rpu_pltime;
446 u_int32_t rpu_flags;
447 struct in6_addr rpu_prefix;
448 } __packed;
449 #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80
450 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40
451
452 #if _BYTE_ORDER == _BIG_ENDIAN
453 #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
454 #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
455 #elif _BYTE_ORDER == _LITTLE_ENDIAN
456 #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
457 #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
458 #endif
459
460 struct rr_result {
461 u_int16_t rrr_flags;
462 u_int8_t rrr_ordinal;
463 u_int8_t rrr_matchedlen;
464 u_int32_t rrr_ifid;
465 struct in6_addr rrr_prefix;
466 } __packed;
467 #if _BYTE_ORDER == _BIG_ENDIAN
468 #define ICMP6_RR_RESULT_FLAGS_OOB 0x0002
469 #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
470 #elif _BYTE_ORDER == _LITTLE_ENDIAN
471 #define ICMP6_RR_RESULT_FLAGS_OOB 0x0200
472 #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
473 #endif
474
475
476
477
478
479 struct icmp6_filter {
480 u_int32_t icmp6_filt[8];
481 };
482
483 #ifdef _KERNEL
484 #define ICMP6_FILTER_SETPASSALL(filterp) \
485 do { \
486 int i; u_char *p; \
487 p = (u_char *)filterp; \
488 for (i = 0; i < sizeof(struct icmp6_filter); i++) \
489 p[i] = 0xff; \
490 } while (0)
491 #define ICMP6_FILTER_SETBLOCKALL(filterp) \
492 bzero(filterp, sizeof(struct icmp6_filter))
493 #else
494 #define ICMP6_FILTER_SETPASSALL(filterp) \
495 memset(filterp, 0xff, sizeof(struct icmp6_filter))
496 #define ICMP6_FILTER_SETBLOCKALL(filterp) \
497 memset(filterp, 0x00, sizeof(struct icmp6_filter))
498 #endif
499
500 #define ICMP6_FILTER_SETPASS(type, filterp) \
501 (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
502 #define ICMP6_FILTER_SETBLOCK(type, filterp) \
503 (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
504 #define ICMP6_FILTER_WILLPASS(type, filterp) \
505 ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
506 #define ICMP6_FILTER_WILLBLOCK(type, filterp) \
507 ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
508
509
510
511
512
513 struct icmp6errstat {
514 u_int64_t icp6errs_dst_unreach_noroute;
515 u_int64_t icp6errs_dst_unreach_admin;
516 u_int64_t icp6errs_dst_unreach_beyondscope;
517 u_int64_t icp6errs_dst_unreach_addr;
518 u_int64_t icp6errs_dst_unreach_noport;
519 u_int64_t icp6errs_packet_too_big;
520 u_int64_t icp6errs_time_exceed_transit;
521 u_int64_t icp6errs_time_exceed_reassembly;
522 u_int64_t icp6errs_paramprob_header;
523 u_int64_t icp6errs_paramprob_nextheader;
524 u_int64_t icp6errs_paramprob_option;
525 u_int64_t icp6errs_redirect;
526 u_int64_t icp6errs_unknown;
527 };
528
529 struct icmp6stat {
530
531 u_int64_t icp6s_error;
532 u_int64_t icp6s_canterror;
533 u_int64_t icp6s_toofreq;
534 u_int64_t icp6s_outhist[256];
535
536 u_int64_t icp6s_badcode;
537 u_int64_t icp6s_tooshort;
538 u_int64_t icp6s_checksum;
539 u_int64_t icp6s_badlen;
540
541
542
543
544 u_int64_t icp6s_reflect;
545 u_int64_t icp6s_inhist[256];
546 u_int64_t icp6s_nd_toomanyopt;
547 struct icmp6errstat icp6s_outerrhist;
548 #define icp6s_odst_unreach_noroute \
549 icp6s_outerrhist.icp6errs_dst_unreach_noroute
550 #define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin
551 #define icp6s_odst_unreach_beyondscope \
552 icp6s_outerrhist.icp6errs_dst_unreach_beyondscope
553 #define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr
554 #define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport
555 #define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big
556 #define icp6s_otime_exceed_transit \
557 icp6s_outerrhist.icp6errs_time_exceed_transit
558 #define icp6s_otime_exceed_reassembly \
559 icp6s_outerrhist.icp6errs_time_exceed_reassembly
560 #define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header
561 #define icp6s_oparamprob_nextheader \
562 icp6s_outerrhist.icp6errs_paramprob_nextheader
563 #define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option
564 #define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect
565 #define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown
566 u_int64_t icp6s_pmtuchg;
567 u_int64_t icp6s_nd_badopt;
568 u_int64_t icp6s_badns;
569 u_int64_t icp6s_badna;
570 u_int64_t icp6s_badrs;
571 u_int64_t icp6s_badra;
572 u_int64_t icp6s_badredirect;
573 };
574
575
576
577
578 #define ICMPV6CTL_STATS 1
579 #define ICMPV6CTL_REDIRACCEPT 2
580 #define ICMPV6CTL_REDIRTIMEOUT 3
581 #if 0
582 #define ICMPV6CTL_ERRRATELIMIT 5
583 #endif
584 #define ICMPV6CTL_ND6_PRUNE 6
585 #define ICMPV6CTL_ND6_DELAY 8
586 #define ICMPV6CTL_ND6_UMAXTRIES 9
587 #define ICMPV6CTL_ND6_MMAXTRIES 10
588 #define ICMPV6CTL_ND6_USELOOPBACK 11
589
590 #define ICMPV6CTL_NODEINFO 13
591 #define ICMPV6CTL_ERRPPSLIMIT 14
592 #define ICMPV6CTL_ND6_MAXNUDHINT 15
593 #define ICMPV6CTL_MTUDISC_HIWAT 16
594 #define ICMPV6CTL_MTUDISC_LOWAT 17
595 #define ICMPV6CTL_ND6_DEBUG 18
596 #define ICMPV6CTL_ND6_DRLIST 19
597 #define ICMPV6CTL_ND6_PRLIST 20
598 #define ICMPV6CTL_MAXID 21
599
600 #define ICMPV6CTL_NAMES { \
601 { 0, 0 }, \
602 { 0, 0 }, \
603 { "rediraccept", CTLTYPE_INT }, \
604 { "redirtimeout", CTLTYPE_INT }, \
605 { 0, 0 }, \
606 { 0, 0 }, \
607 { "nd6_prune", CTLTYPE_INT }, \
608 { 0, 0 }, \
609 { "nd6_delay", CTLTYPE_INT }, \
610 { "nd6_umaxtries", CTLTYPE_INT }, \
611 { "nd6_mmaxtries", CTLTYPE_INT }, \
612 { "nd6_useloopback", CTLTYPE_INT }, \
613 { 0, 0 }, \
614 { "nodeinfo", CTLTYPE_INT }, \
615 { "errppslimit", CTLTYPE_INT }, \
616 { "nd6_maxnudhint", CTLTYPE_INT }, \
617 { "mtudisc_hiwat", CTLTYPE_INT }, \
618 { "mtudisc_lowat", CTLTYPE_INT }, \
619 { "nd6_debug", CTLTYPE_INT }, \
620 { 0, 0 }, \
621 { 0, 0 }, \
622 }
623
624 #define ICMPV6CTL_VARS { \
625 NULL, \
626 NULL, \
627 &icmp6_rediraccept, \
628 &icmp6_redirtimeout, \
629 NULL, \
630 NULL, \
631 &nd6_prune, \
632 NULL, \
633 &nd6_delay, \
634 &nd6_umaxtries, \
635 &nd6_mmaxtries, \
636 &nd6_useloopback, \
637 NULL, \
638 &icmp6_nodeinfo, \
639 &icmp6errppslim, \
640 &nd6_maxnudhint, \
641 &icmp6_mtudisc_hiwat, \
642 &icmp6_mtudisc_lowat, \
643 &nd6_debug, \
644 NULL, \
645 NULL, \
646 }
647
648 #define RTF_PROBEMTU RTF_PROTO1
649
650 #ifdef _KERNEL
651 # ifdef __STDC__
652 struct rtentry;
653 struct rttimer;
654 struct in6_multi;
655 # endif
656 void icmp6_init(void);
657 void icmp6_paramerror(struct mbuf *, int);
658 void icmp6_error(struct mbuf *, int, int, int);
659 int icmp6_input(struct mbuf **, int *, int);
660 void icmp6_fasttimo(void);
661 void icmp6_reflect(struct mbuf *, size_t);
662 void icmp6_prepare(struct mbuf *);
663 void icmp6_redirect_input(struct mbuf *, int);
664 void icmp6_redirect_output(struct mbuf *, struct rtentry *);
665 int icmp6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
666
667 struct ip6ctlparam;
668 void icmp6_mtudisc_update(struct ip6ctlparam *, int);
669 void icmp6_mtudisc_callback_register(void (*)(struct in6_addr *));
670
671
672 #define icmp6_ifstat_inc(ifp, tag) \
673 do { \
674 if (ifp) \
675 ((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat->tag++; \
676 } while (0)
677
678 #define icmp6_ifoutstat_inc(ifp, type, code) \
679 do { \
680 icmp6_ifstat_inc(ifp, ifs6_out_msg); \
681 switch(type) { \
682 case ICMP6_DST_UNREACH: \
683 icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
684 if (code == ICMP6_DST_UNREACH_ADMIN) \
685 icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
686 break; \
687 case ICMP6_PACKET_TOO_BIG: \
688 icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
689 break; \
690 case ICMP6_TIME_EXCEEDED: \
691 icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
692 break; \
693 case ICMP6_PARAM_PROB: \
694 icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
695 break; \
696 case ICMP6_ECHO_REQUEST: \
697 icmp6_ifstat_inc(ifp, ifs6_out_echo); \
698 break; \
699 case ICMP6_ECHO_REPLY: \
700 icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
701 break; \
702 case MLD_LISTENER_QUERY: \
703 icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
704 break; \
705 case MLD_LISTENER_REPORT: \
706 icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
707 break; \
708 case MLD_LISTENER_DONE: \
709 icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
710 break; \
711 case ND_ROUTER_SOLICIT: \
712 icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
713 break; \
714 case ND_ROUTER_ADVERT: \
715 icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
716 break; \
717 case ND_NEIGHBOR_SOLICIT: \
718 icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
719 break; \
720 case ND_NEIGHBOR_ADVERT: \
721 icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
722 break; \
723 case ND_REDIRECT: \
724 icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
725 break; \
726 } \
727 } while (0)
728
729 extern int icmp6_rediraccept;
730 extern int icmp6_redirtimeout;
731 #endif
732 #endif