summaryrefslogtreecommitdiff
path: root/sys/netinet6/nd6_protocol.h
blob: df20abcd66ccf7ff84e22215794aa48a18103bce (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
%%% portions-copyright-nrl-97
Portions of this software are Copyright 1997-1998 by Randall Atkinson,
Ronald Lee, Daniel McDonald, Bao Phan, and Chris Winters. All Rights
Reserved. All rights under this copyright have been assigned to the US
Naval Research Laboratory (NRL). The NRL Copyright Notice and License
Agreement Version 1.1 (January 17, 1995) applies to these portions of the
software.
You should have received a copy of the license with this software. If you
didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.

*/

#ifndef _NETINET6_ND6_PROTOCOL_H
#define _NETINET6_ND6_PROTOCOL_H 1

#include <netinet6/icmpv6.h>

#define ND6_ROUTER_SOLICITATION         133
#define ND6_ROUTER_ADVERTISEMENT        134
#define ND6_NEIGHBOR_SOLICITATION       135
#define ND6_NEIGHBOR_ADVERTISEMENT      136
#define ND6_REDIRECT                    137

enum nd6_option {
  ND6_OPT_SOURCE_LINKADDR=1,
  ND6_OPT_TARGET_LINKADDR=2,
  ND6_OPT_PREFIX_INFORMATION=3,
  ND6_OPT_REDIRECTED_HEADER=4,
  ND6_OPT_MTU=5,
  ND6_OPT_ENDOFLIST=256
};

struct nd_router_solicit {     /* router solicitation */
  struct icmpv6hdr rsol_hdr;
};

#define rsol_type               rsol_hdr.icmpv6_type
#define rsol_code               rsol_hdr.icmpv6_code
#define rsol_cksum              rsol_hdr.icmpv6_cksum
#define rsol_reserved           rsol_hdr.icmpv6_data32[0]

struct nd_router_advert {       /* router advertisement */
  struct icmpv6hdr radv_hdr;
  uint32_t   radv_reachable;   /* reachable time */
  uint32_t   radv_retransmit;  /* reachable retransmit time */
};

#define radv_type               radv_hdr.icmpv6_type
#define radv_code               radv_hdr.icmpv6_code
#define radv_cksum              radv_hdr.icmpv6_cksum
#define radv_maxhoplimit        radv_hdr.icmpv6_data8[0]
#define radv_m_o_res            radv_hdr.icmpv6_data8[1]
#define ND6_RADV_M_BIT          0x80
#define ND6_RADV_O_BIT          0x40
#define radv_router_lifetime    radv_hdr.icmpv6_data16[1]

struct nd6_nsolicitation {      /* neighbor solicitation */
  struct icmpv6hdr  nsol6_hdr;
  struct in6_addr   nsol6_target;
};

struct nd6_nadvertisement {     /* neighbor advertisement */
  struct icmpv6hdr  nadv6_hdr;
  struct in6_addr   nadv6_target;
};

#define nadv6_flags nadv6_hdr.icmpv6_data32[0]
#define ND6_NADVERFLAG_ISROUTER      0x80
#define ND6_NADVERFLAG_SOLICITED     0x40
#define ND6_NADVERFLAG_OVERRIDE      0x20

struct nd6_redirect {           /* redirect */
  struct icmpv6hdr  redirect_hdr;
  struct in6_addr   redirect_target;
  struct in6_addr   redirect_destination;
};

struct nd6_opt_prefix_info {    /* prefix information */
  uint8_t    opt_type;
  uint8_t    opt_length;
  uint8_t    opt_prefix_length;
  uint8_t    opt_l_a_res;
  uint32_t   opt_valid_life;
  uint32_t   opt_preferred_life;
  uint32_t   opt_reserved2;
  struct in6_addr  opt_prefix;
};

#define ND6_OPT_PI_L_BIT        0x80
#define ND6_OPT_PI_A_BIT        0x40

struct nd6_opt_mtu {            /* MTU option */
  uint8_t   opt_type;
  uint8_t   opt_length;
  uint16_t  opt_reserved;
  uint32_t  opt_mtu;
};

#endif /* _NETINET6_ND6_PROTOCOL_H */