windows/netinet: Copy ip6.h and icmp6.h from netbsd.
[sliver-openvswitch.git] / include / windows / netinet / icmp6.h
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
30 /*
31  * Copyright (c) 1982, 1986, 1993
32  *      The Regents of the University of California.  All rights reserved.
33  *
34  * Redistribution and use in source and binary forms, with or without
35  * modification, are permitted provided that the following conditions
36  * are met:
37  * 1. Redistributions of source code must retain the above copyright
38  *    notice, this list of conditions and the following disclaimer.
39  * 2. Redistributions in binary form must reproduce the above copyright
40  *    notice, this list of conditions and the following disclaimer in the
41  *    documentation and/or other materials provided with the distribution.
42  * 3. Neither the name of the University nor the names of its contributors
43  *    may be used to endorse or promote products derived from this software
44  *    without specific prior written permission.
45  *
46  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
47  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
50  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56  * SUCH DAMAGE.
57  *
58  *      @(#)ip_icmp.h   8.1 (Berkeley) 6/10/93
59  */
60
61 #ifndef _NETINET_ICMP6_H_
62 #define _NETINET_ICMP6_H_
63
64 #include "byte-order.h"
65
66 #define ICMPV6_PLD_MAXLEN       1232    /* IPV6_MMTU - sizeof(struct ip6_hdr)
67                                            - sizeof(struct icmp6_hdr) */
68
69 struct icmp6_hdr {
70         u_int8_t        icmp6_type;     /* type field */
71         u_int8_t        icmp6_code;     /* code field */
72         u_int16_t       icmp6_cksum;    /* checksum field */
73         union {
74                 u_int32_t       icmp6_un_data32[1]; /* type-specific field */
75                 u_int16_t       icmp6_un_data16[2]; /* type-specific field */
76                 u_int8_t        icmp6_un_data8[4];  /* type-specific field */
77         } icmp6_dataun;
78 };
79
80 #define icmp6_data32    icmp6_dataun.icmp6_un_data32
81 #define icmp6_data16    icmp6_dataun.icmp6_un_data16
82 #define icmp6_data8     icmp6_dataun.icmp6_un_data8
83 #define icmp6_pptr      icmp6_data32[0]         /* parameter prob */
84 #define icmp6_mtu       icmp6_data32[0]         /* packet too big */
85 #define icmp6_id        icmp6_data16[0]         /* echo request/reply */
86 #define icmp6_seq       icmp6_data16[1]         /* echo request/reply */
87 #define icmp6_maxdelay  icmp6_data16[0]         /* mcast group membership */
88
89 #define ICMP6_DST_UNREACH               1       /* dest unreachable, codes: */
90 #define ICMP6_PACKET_TOO_BIG            2       /* packet too big */
91 #define ICMP6_TIME_EXCEEDED             3       /* time exceeded, code: */
92 #define ICMP6_PARAM_PROB                4       /* ip6 header bad */
93
94 #define ICMP6_ECHO_REQUEST              128     /* echo service */
95 #define ICMP6_ECHO_REPLY                129     /* echo reply */
96 #define MLD_LISTENER_QUERY              130     /* multicast listener query */
97 #define MLD_LISTENER_REPORT             131     /* multicast listener report */
98 #define MLD_LISTENER_DONE               132     /* multicast listener done */
99 #define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */
100
101 /* RFC2292 decls */
102 #define ICMP6_MEMBERSHIP_QUERY          130     /* group membership query */
103 #define ICMP6_MEMBERSHIP_REPORT         131     /* group membership report */
104 #define ICMP6_MEMBERSHIP_REDUCTION      132     /* group membership termination */
105
106 /* the followings are for backward compatibility to old KAME apps. */
107 #define MLD6_LISTENER_QUERY     MLD_LISTENER_QUERY
108 #define MLD6_LISTENER_REPORT    MLD_LISTENER_REPORT
109 #define MLD6_LISTENER_DONE      MLD_LISTENER_DONE
110
111 #define ND_ROUTER_SOLICIT               133     /* router solicitation */
112 #define ND_ROUTER_ADVERT                134     /* router advertisement */
113 #define ND_NEIGHBOR_SOLICIT             135     /* neighbor solicitation */
114 #define ND_NEIGHBOR_ADVERT              136     /* neighbor advertisement */
115 #define ND_REDIRECT                     137     /* redirect */
116
117 #define ICMP6_ROUTER_RENUMBERING        138     /* router renumbering */
118
119 #define ICMP6_WRUREQUEST                139     /* who are you request */
120 #define ICMP6_WRUREPLY                  140     /* who are you reply */
121 #define ICMP6_FQDN_QUERY                139     /* FQDN query */
122 #define ICMP6_FQDN_REPLY                140     /* FQDN reply */
123 #define ICMP6_NI_QUERY                  139     /* node information request */
124 #define ICMP6_NI_REPLY                  140     /* node information reply */
125 #define MLDV2_LISTENER_REPORT           143     /* RFC3810 listener report */
126
127 /* The definitions below are experimental. TBA */
128 #define MLD_MTRACE_RESP                 200     /* mtrace response(to sender) */
129 #define MLD_MTRACE                      201     /* mtrace messages */
130
131 /* the followings are for backward compatibility to old KAME apps. */
132 #define MLD6_MTRACE_RESP        MLD_MTRACE_RESP
133 #define MLD6_MTRACE             MLD_MTRACE
134
135 #define ICMP6_MAXTYPE                   201
136
137 #define ICMP6_DST_UNREACH_NOROUTE       0       /* no route to destination */
138 #define ICMP6_DST_UNREACH_ADMIN         1       /* administratively prohibited */
139 #define ICMP6_DST_UNREACH_NOTNEIGHBOR   2       /* not a neighbor(obsolete) */
140 #define ICMP6_DST_UNREACH_BEYONDSCOPE   2       /* beyond scope of source address */
141 #define ICMP6_DST_UNREACH_ADDR          3       /* address unreachable */
142 #define ICMP6_DST_UNREACH_NOPORT        4       /* port unreachable */
143 #define ICMP6_DST_UNREACH_POLICY        5       /* source address failed ingress/egress policy */
144 #define ICMP6_DST_UNREACH_REJROUTE      6       /* reject route to destination */
145 #define ICMP6_DST_UNREACH_SOURCERT      7       /* error in source routing header */
146
147 #define ICMP6_TIME_EXCEED_TRANSIT       0       /* ttl==0 in transit */
148 #define ICMP6_TIME_EXCEED_REASSEMBLY    1       /* ttl==0 in reass */
149
150 #define ICMP6_PARAMPROB_HEADER          0       /* erroneous header field */
151 #define ICMP6_PARAMPROB_NEXTHEADER      1       /* unrecognized next header */
152 #define ICMP6_PARAMPROB_OPTION          2       /* unrecognized option */
153
154 #define ICMP6_INFOMSG_MASK              0x80    /* all informational messages */
155
156 #define ICMP6_NI_SUBJ_IPV6      0       /* Query Subject is an IPv6 address */
157 #define ICMP6_NI_SUBJ_FQDN      1       /* Query Subject is a Domain name */
158 #define ICMP6_NI_SUBJ_IPV4      2       /* Query Subject is an IPv4 address */
159
160 #define ICMP6_NI_SUCCESS        0       /* node information successful reply */
161 #define ICMP6_NI_REFUSED        1       /* node information request is refused */
162 #define ICMP6_NI_UNKNOWN        2       /* unknown Qtype */
163
164 #define ICMP6_ROUTER_RENUMBERING_COMMAND  0     /* rr command */
165 #define ICMP6_ROUTER_RENUMBERING_RESULT   1     /* rr result */
166 #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255     /* rr seq num reset */
167
168 /* Used in kernel only */
169 #define ND_REDIRECT_ONLINK      0       /* redirect to an on-link node */
170 #define ND_REDIRECT_ROUTER      1       /* redirect to a better router */
171
172 /*
173  * Multicast Listener Discovery
174  */
175 struct mld_hdr {
176         struct icmp6_hdr        mld_icmp6_hdr;
177         struct in6_addr         mld_addr; /* multicast address */
178 };
179
180 /* definitions to provide backward compatibility to old KAME applications */
181 #define mld6_hdr        mld_hdr
182 #define mld6_type       mld_type
183 #define mld6_code       mld_code
184 #define mld6_cksum      mld_cksum
185 #define mld6_maxdelay   mld_maxdelay
186 #define mld6_reserved   mld_reserved
187 #define mld6_addr       mld_addr
188
189 /* shortcut macro definitions */
190 #define mld_type        mld_icmp6_hdr.icmp6_type
191 #define mld_code        mld_icmp6_hdr.icmp6_code
192 #define mld_cksum       mld_icmp6_hdr.icmp6_cksum
193 #define mld_maxdelay    mld_icmp6_hdr.icmp6_data16[0]
194 #define mld_reserved    mld_icmp6_hdr.icmp6_data16[1]
195
196 #define MLD_MINLEN                      24
197
198 /*
199  * Neighbor Discovery
200  */
201
202 struct nd_router_solicit {      /* router solicitation */
203         struct icmp6_hdr        nd_rs_hdr;
204         /* could be followed by options */
205 };
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 {       /* router advertisement */
213         struct icmp6_hdr        nd_ra_hdr;
214         u_int32_t               nd_ra_reachable;        /* reachable time */
215         u_int32_t               nd_ra_retransmit;       /* retransmit timer */
216         /* could be followed by options */
217 };
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_FLAG_HOME_AGENT   0x20
227
228 /*
229  * Router preference values based on RFC4191.
230  */
231 #define ND_RA_FLAG_RTPREF_MASK  0x18 /* 00011000 */
232
233 #define ND_RA_FLAG_RTPREF_HIGH  0x08 /* 00001000 */
234 #define ND_RA_FLAG_RTPREF_MEDIUM        0x00 /* 00000000 */
235 #define ND_RA_FLAG_RTPREF_LOW   0x18 /* 00011000 */
236 #define ND_RA_FLAG_RTPREF_RSV   0x10 /* 00010000 */
237
238 #define nd_ra_router_lifetime   nd_ra_hdr.icmp6_data16[1]
239
240 struct nd_neighbor_solicit {    /* neighbor solicitation */
241         struct icmp6_hdr        nd_ns_hdr;
242         struct in6_addr         nd_ns_target;   /*target address */
243         /* could be followed by options */
244 };
245
246 #define nd_ns_type              nd_ns_hdr.icmp6_type
247 #define nd_ns_code              nd_ns_hdr.icmp6_code
248 #define nd_ns_cksum             nd_ns_hdr.icmp6_cksum
249 #define nd_ns_reserved          nd_ns_hdr.icmp6_data32[0]
250
251 struct nd_neighbor_advert {     /* neighbor advertisement */
252         struct icmp6_hdr        nd_na_hdr;
253         struct in6_addr         nd_na_target;   /* target address */
254         /* could be followed by options */
255 };
256
257 #define nd_na_type              nd_na_hdr.icmp6_type
258 #define nd_na_code              nd_na_hdr.icmp6_code
259 #define nd_na_cksum             nd_na_hdr.icmp6_cksum
260 #define nd_na_flags_reserved    nd_na_hdr.icmp6_data32[0]
261 #define ND_NA_FLAG_ROUTER       CONSTANT_HTONL(0x80000000)
262 #define ND_NA_FLAG_SOLICITED    CONSTANT_HTONL(0x40000000)
263 #define ND_NA_FLAG_OVERRIDE     CONSTANT_HTONL(0x20000000)
264
265 struct nd_redirect {            /* redirect */
266         struct icmp6_hdr        nd_rd_hdr;
267         struct in6_addr         nd_rd_target;   /* target address */
268         struct in6_addr         nd_rd_dst;      /* destination address */
269         /* could be followed by options */
270 };
271
272 #define nd_rd_type              nd_rd_hdr.icmp6_type
273 #define nd_rd_code              nd_rd_hdr.icmp6_code
274 #define nd_rd_cksum             nd_rd_hdr.icmp6_cksum
275 #define nd_rd_reserved          nd_rd_hdr.icmp6_data32[0]
276
277 struct nd_opt_hdr {             /* Neighbor discovery option header */
278         u_int8_t        nd_opt_type;
279         u_int8_t        nd_opt_len;
280         /* followed by option specific data*/
281 };
282
283 #define ND_OPT_SOURCE_LINKADDR          1
284 #define ND_OPT_TARGET_LINKADDR          2
285 #define ND_OPT_PREFIX_INFORMATION       3
286 #define ND_OPT_REDIRECTED_HEADER        4
287 #define ND_OPT_MTU                      5
288 #define ND_OPT_ADVINTERVAL              7
289 #define ND_OPT_HOMEAGENT_INFO           8
290 #define ND_OPT_SOURCE_ADDRLIST          9
291 #define ND_OPT_TARGET_ADDRLIST          10
292 #define ND_OPT_MAP                      23      /* RFC 5380 */
293 #define ND_OPT_ROUTE_INFO               24      /* RFC 4191 */
294 #define ND_OPT_RDNSS                    25      /* RFC 6016 */
295 #define ND_OPT_DNSSL                    31      /* RFC 6016 */
296
297 struct nd_opt_route_info {      /* route info */
298         u_int8_t        nd_opt_rti_type;
299         u_int8_t        nd_opt_rti_len;
300         u_int8_t        nd_opt_rti_prefixlen;
301         u_int8_t        nd_opt_rti_flags;
302         u_int32_t       nd_opt_rti_lifetime;
303         /* prefix follows */
304 };
305
306 struct nd_opt_prefix_info {     /* prefix information */
307         u_int8_t        nd_opt_pi_type;
308         u_int8_t        nd_opt_pi_len;
309         u_int8_t        nd_opt_pi_prefix_len;
310         u_int8_t        nd_opt_pi_flags_reserved;
311         u_int32_t       nd_opt_pi_valid_time;
312         u_int32_t       nd_opt_pi_preferred_time;
313         u_int32_t       nd_opt_pi_reserved2;
314         struct in6_addr nd_opt_pi_prefix;
315 };
316
317 #define ND_OPT_PI_FLAG_ONLINK           0x80
318 #define ND_OPT_PI_FLAG_AUTO             0x40
319
320 struct nd_opt_rd_hdr {          /* redirected header */
321         u_int8_t        nd_opt_rh_type;
322         u_int8_t        nd_opt_rh_len;
323         u_int16_t       nd_opt_rh_reserved1;
324         u_int32_t       nd_opt_rh_reserved2;
325         /* followed by IP header and data */
326 };
327
328 struct nd_opt_mtu {             /* MTU option */
329         u_int8_t        nd_opt_mtu_type;
330         u_int8_t        nd_opt_mtu_len;
331         u_int16_t       nd_opt_mtu_reserved;
332         u_int32_t       nd_opt_mtu_mtu;
333 };
334
335 struct nd_opt_rdnss {           /* RDNSS option RFC 6106 */
336         u_int8_t        nd_opt_rdnss_type;
337         u_int8_t        nd_opt_rdnss_len;
338         u_int16_t       nd_opt_rdnss_reserved;
339         u_int32_t       nd_opt_rdnss_lifetime;
340         /* followed by list of IP prefixes */
341 };
342
343 struct nd_opt_dnssl {           /* DNSSL option RFC 6106 */
344         u_int8_t        nd_opt_dnssl_type;
345         u_int8_t        nd_opt_dnssl_len;
346         u_int16_t       nd_opt_dnssl_reserved;
347         u_int32_t       nd_opt_dnssl_lifetime;
348         /* followed by list of IP prefixes */
349 };
350
351 /*
352  * icmp6 namelookup
353  */
354
355 struct icmp6_namelookup {
356         struct icmp6_hdr        icmp6_nl_hdr;
357         u_int8_t        icmp6_nl_nonce[8];
358         int32_t         icmp6_nl_ttl;
359 #if 0
360         u_int8_t        icmp6_nl_len;
361         u_int8_t        icmp6_nl_name[3];
362 #endif
363         /* could be followed by options */
364 };
365
366 /*
367  * icmp6 node information
368  */
369 struct icmp6_nodeinfo {
370         struct icmp6_hdr icmp6_ni_hdr;
371         u_int8_t icmp6_ni_nonce[8];
372         /* could be followed by reply data */
373 };
374
375 #define ni_type         icmp6_ni_hdr.icmp6_type
376 #define ni_code         icmp6_ni_hdr.icmp6_code
377 #define ni_cksum        icmp6_ni_hdr.icmp6_cksum
378 #define ni_qtype        icmp6_ni_hdr.icmp6_data16[0]
379 #define ni_flags        icmp6_ni_hdr.icmp6_data16[1]
380
381 #define NI_QTYPE_NOOP           0 /* NOOP  */
382 #define NI_QTYPE_SUPTYPES       1 /* Supported Qtypes */
383 #define NI_QTYPE_FQDN           2 /* FQDN (draft 04) */
384 #define NI_QTYPE_DNSNAME        2 /* DNS Name */
385 #define NI_QTYPE_NODEADDR       3 /* Node Addresses */
386 #define NI_QTYPE_IPV4ADDR       4 /* IPv4 Addresses */
387
388 #define NI_SUPTYPE_FLAG_COMPRESS        CONSTANT_HTONS(0x1)
389 #define NI_FQDN_FLAG_VALIDTTL           CONSTANT_HTONS(0x1)
390
391 #ifdef NAME_LOOKUPS_04
392 #define NI_NODEADDR_FLAG_LINKLOCAL      CONSTANT_HTONS(0x1)
393 #define NI_NODEADDR_FLAG_SITELOCAL      CONSTANT_HTONS(0x2)
394 #define NI_NODEADDR_FLAG_GLOBAL         CONSTANT_HTONS(0x4)
395 #define NI_NODEADDR_FLAG_ALL            CONSTANT_HTONS(0x8)
396 #define NI_NODEADDR_FLAG_TRUNCATE       CONSTANT_HTONS(0x10)
397 #define NI_NODEADDR_FLAG_ANYCAST        CONSTANT_HTONS(0x20) /* just experimental. not in spec */
398 #else  /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
399 #define NI_NODEADDR_FLAG_TRUNCATE       CONSTANT_HTONS(0x1)
400 #define NI_NODEADDR_FLAG_ALL            CONSTANT_HTONS(0x2)
401 #define NI_NODEADDR_FLAG_COMPAT         CONSTANT_HTONS(0x4)
402 #define NI_NODEADDR_FLAG_LINKLOCAL      CONSTANT_HTONS(0x8)
403 #define NI_NODEADDR_FLAG_SITELOCAL      CONSTANT_HTONS(0x10)
404 #define NI_NODEADDR_FLAG_GLOBAL         CONSTANT_HTONS(0x20)
405 #define NI_NODEADDR_FLAG_ANYCAST        CONSTANT_HTONS(0x40) /* just experimental. not in spec */
406 #endif
407
408 struct ni_reply_fqdn {
409         u_int32_t ni_fqdn_ttl;  /* TTL */
410         u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
411         u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
412 };
413
414 /*
415  * Router Renumbering. as router-renum-08.txt
416  */
417 struct icmp6_router_renum {     /* router renumbering header */
418         struct icmp6_hdr        rr_hdr;
419         u_int8_t        rr_segnum;
420         u_int8_t        rr_flags;
421         u_int16_t       rr_maxdelay;
422         u_int32_t       rr_reserved;
423 };
424
425 #define ICMP6_RR_FLAGS_TEST             0x80
426 #define ICMP6_RR_FLAGS_REQRESULT        0x40
427 #define ICMP6_RR_FLAGS_FORCEAPPLY       0x20
428 #define ICMP6_RR_FLAGS_SPECSITE         0x10
429 #define ICMP6_RR_FLAGS_PREVDONE         0x08
430
431 #define rr_type         rr_hdr.icmp6_type
432 #define rr_code         rr_hdr.icmp6_code
433 #define rr_cksum        rr_hdr.icmp6_cksum
434 #define rr_seqnum       rr_hdr.icmp6_data32[0]
435
436 struct rr_pco_match {           /* match prefix part */
437         u_int8_t        rpm_code;
438         u_int8_t        rpm_len;
439         u_int8_t        rpm_ordinal;
440         u_int8_t        rpm_matchlen;
441         u_int8_t        rpm_minlen;
442         u_int8_t        rpm_maxlen;
443         u_int16_t       rpm_reserved;
444         struct  in6_addr        rpm_prefix;
445 };
446
447 #define RPM_PCO_ADD             1
448 #define RPM_PCO_CHANGE          2
449 #define RPM_PCO_SETGLOBAL       3
450 #define RPM_PCO_MAX             4
451
452 struct rr_pco_use {             /* use prefix part */
453         u_int8_t        rpu_uselen;
454         u_int8_t        rpu_keeplen;
455         u_int8_t        rpu_ramask;
456         u_int8_t        rpu_raflags;
457         u_int32_t       rpu_vltime;
458         u_int32_t       rpu_pltime;
459         u_int32_t       rpu_flags;
460         struct  in6_addr rpu_prefix;
461 };
462 #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK  0x80
463 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO    0x40
464
465 #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     CONSTANT_HTONL(0x80000000)
466 #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     CONSTANT_HTONL(0x40000000)
467
468 struct rr_result {              /* router renumbering result message */
469         u_int16_t       rrr_flags;
470         u_int8_t        rrr_ordinal;
471         u_int8_t        rrr_matchedlen;
472         u_int32_t       rrr_ifid;
473         struct  in6_addr rrr_prefix;
474 };
475 #define ICMP6_RR_RESULT_FLAGS_OOB               CONSTANT_HTONS(0x0002)
476 #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN         CONSTANT_HTONS(0x0001)
477
478 /*
479  * icmp6 filter structures.
480  */
481
482 struct icmp6_filter {
483         u_int32_t icmp6_filt[8];
484 };
485
486 #define ICMP6_FILTER_SETPASSALL(filterp) \
487         (void)memset(filterp, 0xff, sizeof(struct icmp6_filter))
488 #define ICMP6_FILTER_SETBLOCKALL(filterp) \
489         (void)memset(filterp, 0x00, sizeof(struct icmp6_filter))
490 #define ICMP6_FILTER_SETPASS(type, filterp) \
491         (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
492 #define ICMP6_FILTER_SETBLOCK(type, filterp) \
493         (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
494 #define ICMP6_FILTER_WILLPASS(type, filterp) \
495         ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
496 #define ICMP6_FILTER_WILLBLOCK(type, filterp) \
497         ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
498
499 /*
500  * Variables related to this implementation
501  * of the internet control message protocol version 6.
502  */
503
504 /*
505  * IPv6 ICMP statistics.
506  * Each counter is an unsigned 64-bit value.
507  */
508 #define ICMP6_STAT_ERROR        0       /* # of calls to icmp6_error */
509 #define ICMP6_STAT_CANTERROR    1       /* no error (old was icmp) */
510 #define ICMP6_STAT_TOOFREQ      2       /* no error (rate limitation) */
511 #define ICMP6_STAT_OUTHIST      3       /* # of output messages */
512                 /* space for 256 counters */
513 #define ICMP6_STAT_BADCODE      259     /* icmp6_code out of range */
514 #define ICMP6_STAT_TOOSHORT     260     /* packet < sizeof(struct icmp6_hdr) */
515 #define ICMP6_STAT_CHECKSUM     261     /* bad checksum */
516 #define ICMP6_STAT_BADLEN       262     /* calculated bound mismatch */
517         /*
518          * number of responses; this member is inherited from the netinet code,
519          * but for netinet6 code, it is already available in outhist[].
520          */
521 #define ICMP6_STAT_REFLECT      263
522 #define ICMP6_STAT_INHIST       264     /* # of input messages */
523                 /* space for 256 counters */
524 #define ICMP6_STAT_ND_TOOMANYOPT 520    /* too many ND options */
525 #define ICMP6_STAT_OUTERRHIST   521
526                 /* space for 13 counters */
527 #define ICMP6_STAT_PMTUCHG      534     /* path MTU changes */
528 #define ICMP6_STAT_ND_BADOPT    535     /* bad ND options */
529 #define ICMP6_STAT_BADNS        536     /* bad neighbor solicititation */
530 #define ICMP6_STAT_BADNA        537     /* bad neighbor advertisement */
531 #define ICMP6_STAT_BADRS        538     /* bad router solicitiation */
532 #define ICMP6_STAT_BADRA        539     /* bad router advertisement */
533 #define ICMP6_STAT_BADREDIRECT  540     /* bad redirect message */
534 #define ICMP6_STAT_DROPPED_RAROUTE 541  /* discarded routes from router advertisement */
535
536 #define ICMP6_NSTATS            542
537
538 #define ICMP6_ERRSTAT_DST_UNREACH_NOROUTE       0
539 #define ICMP6_ERRSTAT_DST_UNREACH_ADMIN         1
540 #define ICMP6_ERRSTAT_DST_UNREACH_BEYONDSCOPE   2
541 #define ICMP6_ERRSTAT_DST_UNREACH_ADDR          3
542 #define ICMP6_ERRSTAT_DST_UNREACH_NOPORT        4
543 #define ICMP6_ERRSTAT_PACKET_TOO_BIG            5
544 #define ICMP6_ERRSTAT_TIME_EXCEED_TRANSIT       6
545 #define ICMP6_ERRSTAT_TIME_EXCEED_REASSEMBLY    7
546 #define ICMP6_ERRSTAT_PARAMPROB_HEADER          8
547 #define ICMP6_ERRSTAT_PARAMPROB_NEXTHEADER      9
548 #define ICMP6_ERRSTAT_PARAMPROB_OPTION          10
549 #define ICMP6_ERRSTAT_REDIRECT                  11
550 #define ICMP6_ERRSTAT_UNKNOWN                   12
551
552 /*
553  * Names for ICMP sysctl objects
554  */
555 #define ICMPV6CTL_STATS         1
556 #define ICMPV6CTL_REDIRACCEPT   2       /* accept/process redirects */
557 #define ICMPV6CTL_REDIRTIMEOUT  3       /* redirect cache time */
558 #if 0   /*obsoleted*/
559 #define ICMPV6CTL_ERRRATELIMIT  5       /* ICMPv6 error rate limitation */
560 #endif
561 #define ICMPV6CTL_ND6_PRUNE     6
562 #define ICMPV6CTL_ND6_DELAY     8
563 #define ICMPV6CTL_ND6_UMAXTRIES 9
564 #define ICMPV6CTL_ND6_MMAXTRIES         10
565 #define ICMPV6CTL_ND6_USELOOPBACK       11
566 /*#define ICMPV6CTL_ND6_PROXYALL        12      obsoleted, do not reuse here */
567 #define ICMPV6CTL_NODEINFO      13
568 #define ICMPV6CTL_ERRPPSLIMIT   14      /* ICMPv6 error pps limitation */
569 #define ICMPV6CTL_ND6_MAXNUDHINT        15
570 #define ICMPV6CTL_MTUDISC_HIWAT 16
571 #define ICMPV6CTL_MTUDISC_LOWAT 17
572 #define ICMPV6CTL_ND6_DEBUG     18
573 #define ICMPV6CTL_ND6_DRLIST    19
574 #define ICMPV6CTL_ND6_PRLIST    20
575 #define ICMPV6CTL_ND6_MAXQLEN   24
576 #define ICMPV6CTL_MAXID         25
577
578 #define ICMPV6CTL_NAMES { \
579         { 0, 0 }, \
580         { 0, 0 }, \
581         { "rediraccept", CTLTYPE_INT }, \
582         { "redirtimeout", CTLTYPE_INT }, \
583         { 0, 0 }, \
584         { 0, 0 }, \
585         { "nd6_prune", CTLTYPE_INT }, \
586         { 0, 0 }, \
587         { "nd6_delay", CTLTYPE_INT }, \
588         { "nd6_umaxtries", CTLTYPE_INT }, \
589         { "nd6_mmaxtries", CTLTYPE_INT }, \
590         { "nd6_useloopback", CTLTYPE_INT }, \
591         { 0, 0 }, \
592         { "nodeinfo", CTLTYPE_INT }, \
593         { "errppslimit", CTLTYPE_INT }, \
594         { "nd6_maxnudhint", CTLTYPE_INT }, \
595         { "mtudisc_hiwat", CTLTYPE_INT }, \
596         { "mtudisc_lowat", CTLTYPE_INT }, \
597         { "nd6_debug", CTLTYPE_INT }, \
598         { 0, 0 }, \
599         { 0, 0 }, \
600         { 0, 0 }, \
601         { 0, 0 }, \
602         { 0, 0 }, \
603         { "nd6_maxqueuelen", CTLTYPE_INT }, \
604 }
605
606 #endif /* !_NETINET_ICMP6_H_ */