OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [bsd_tcpip/] [v2_0/] [include/] [netinet/] [icmp6.h] - Blame information for rev 174

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.