3 DHCPv6 Protocol structures... */
6 * Copyright (c) 2006-2010 by Internet Systems Consortium, Inc. ("ISC")
8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
18 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 * Internet Systems Consortium, Inc.
22 * Redwood City, CA 94063
24 * https://www.isc.org/
28 /* DHCPv6 Option codes: */
30 #define D6O_CLIENTID 1 /* RFC3315 */
31 #define D6O_SERVERID 2
36 #define D6O_PREFERENCE 7
37 #define D6O_ELAPSED_TIME 8
38 #define D6O_RELAY_MSG 9
39 /* Option code 10 unassigned. */
41 #define D6O_UNICAST 12
42 #define D6O_STATUS_CODE 13
43 #define D6O_RAPID_COMMIT 14
44 #define D6O_USER_CLASS 15
45 #define D6O_VENDOR_CLASS 16
46 #define D6O_VENDOR_OPTS 17
47 #define D6O_INTERFACE_ID 18
48 #define D6O_RECONF_MSG 19
49 #define D6O_RECONF_ACCEPT 20
50 #define D6O_SIP_SERVERS_DNS 21 /* RFC3319 */
51 #define D6O_SIP_SERVERS_ADDR 22 /* RFC3319 */
52 #define D6O_NAME_SERVERS 23 /* RFC3646 */
53 #define D6O_DOMAIN_SEARCH 24 /* RFC3646 */
54 #define D6O_IA_PD 25 /* RFC3633 */
55 #define D6O_IAPREFIX 26 /* RFC3633 */
56 #define D6O_NIS_SERVERS 27 /* RFC3898 */
57 #define D6O_NISP_SERVERS 28 /* RFC3898 */
58 #define D6O_NIS_DOMAIN_NAME 29 /* RFC3898 */
59 #define D6O_NISP_DOMAIN_NAME 30 /* RFC3898 */
60 #define D6O_SNTP_SERVERS 31 /* RFC4075 */
61 #define D6O_INFORMATION_REFRESH_TIME 32 /* RFC4242 */
62 #define D6O_BCMCS_SERVER_D 33 /* RFC4280 */
63 #define D6O_BCMCS_SERVER_A 34 /* RFC4280 */
64 /* 35 is unassigned */
65 #define D6O_GEOCONF_CIVIC 36 /* RFC4776 */
66 #define D6O_REMOTE_ID 37 /* RFC4649 */
67 #define D6O_SUBSCRIBER_ID 38 /* RFC4580 */
68 #define D6O_CLIENT_FQDN 39 /* RFC4704 */
69 #define D6O_PANA_AGENT 40 /* paa-option */
70 #define D6O_NEW_POSIX_TIMEZONE 41 /* RFC4833 */
71 #define D6O_NEW_TZDB_TIMEZONE 42 /* RFC4833 */
72 #define D6O_ERO 43 /* RFC4994 */
73 #define D6O_LQ_QUERY 44 /* RFC5007 */
74 #define D6O_CLIENT_DATA 45 /* RFC5007 */
75 #define D6O_CLT_TIME 46 /* RFC5007 */
76 #define D6O_LQ_RELAY_DATA 47 /* RFC5007 */
77 #define D6O_LQ_CLIENT_LINK 48 /* RFC5007 */
80 * Status Codes, from RFC 3315 section 24.4, and RFC 3633, 5007.
82 #define STATUS_Success 0
83 #define STATUS_UnspecFail 1
84 #define STATUS_NoAddrsAvail 2
85 #define STATUS_NoBinding 3
86 #define STATUS_NotOnLink 4
87 #define STATUS_UseMulticast 5
88 #define STATUS_NoPrefixAvail 6
89 #define STATUS_UnknownQueryType 7
90 #define STATUS_MalformedQuery 8
91 #define STATUS_NotConfigured 9
92 #define STATUS_NotAllowed 10
95 * DHCPv6 message types, defined in section 5.3 of RFC 3315
97 #define DHCPV6_SOLICIT 1
98 #define DHCPV6_ADVERTISE 2
99 #define DHCPV6_REQUEST 3
100 #define DHCPV6_CONFIRM 4
101 #define DHCPV6_RENEW 5
102 #define DHCPV6_REBIND 6
103 #define DHCPV6_REPLY 7
104 #define DHCPV6_RELEASE 8
105 #define DHCPV6_DECLINE 9
106 #define DHCPV6_RECONFIGURE 10
107 #define DHCPV6_INFORMATION_REQUEST 11
108 #define DHCPV6_RELAY_FORW 12
109 #define DHCPV6_RELAY_REPL 13
110 #define DHCPV6_LEASEQUERY 14
111 #define DHCPV6_LEASEQUERY_REPLY 15
113 extern const char *dhcpv6_type_names[];
114 extern const int dhcpv6_type_name_max;
116 /* DUID type definitions (RFC3315 section 9).
122 /* Offsets into IA_*'s where Option spaces commence. */
123 #define IA_NA_OFFSET 12 /* IAID, T1, T2, all 4 octets each */
124 #define IA_TA_OFFSET 4 /* IAID only, 4 octets */
125 #define IA_PD_OFFSET 12 /* IAID, T1, T2, all 4 octets each */
127 /* Offset into IAADDR's where Option spaces commence. */
128 #define IAADDR_OFFSET 24
130 /* Offset into IAPREFIX's where Option spaces commence. */
131 #define IAPREFIX_OFFSET 25
133 /* Offset into LQ_QUERY's where Option spaces commence. */
134 #define LQ_QUERY_OFFSET 17
137 * DHCPv6 well-known multicast addressess, from section 5.1 of RFC 3315
139 #define All_DHCP_Relay_Agents_and_Servers "FF02::1:2"
140 #define All_DHCP_Servers "FF05::1:3"
143 * DHCPv6 Retransmission Constants (RFC3315 section 5.5, RFC 5007)
146 #define SOL_MAX_DELAY 1
147 #define SOL_TIMEOUT 1
148 #define SOL_MAX_RT 120
149 #define REQ_TIMEOUT 1
150 #define REQ_MAX_RT 30
151 #define REQ_MAX_RC 10
152 #define CNF_MAX_DELAY 1
153 #define CNF_TIMEOUT 1
155 #define CNF_MAX_RD 10
156 #define REN_TIMEOUT 10
157 #define REN_MAX_RT 600
158 #define REB_TIMEOUT 10
159 #define REB_MAX_RT 600
160 #define INF_MAX_DELAY 1
161 #define INF_TIMEOUT 1
162 #define INF_MAX_RT 120
163 #define REL_TIMEOUT 1
165 #define DEC_TIMEOUT 1
167 #define REC_TIMEOUT 2
169 #define HOP_COUNT_LIMIT 32
170 #define LQ6_TIMEOUT 1
171 #define LQ6_MAX_RT 10
175 * Normal packet format, defined in section 6 of RFC 3315
177 struct dhcpv6_packet {
178 unsigned char msg_type;
179 unsigned char transaction_id[3];
180 unsigned char options[FLEXIBLE_ARRAY_MEMBER];
183 /* Offset into DHCPV6 Reply packets where Options spaces commence. */
184 #define REPLY_OPTIONS_INDEX 4
187 * Relay packet format, defined in section 7 of RFC 3315
189 struct dhcpv6_relay_packet {
190 unsigned char msg_type;
191 unsigned char hop_count;
192 unsigned char link_address[16];
193 unsigned char peer_address[16];
194 unsigned char options[FLEXIBLE_ARRAY_MEMBER];
197 /* Leasequery query-types (RFC 5007) */
199 #define LQ6QT_BY_ADDRESS 1
200 #define LQ6QT_BY_CLIENTID 2
203 * DUID time starts 2000-01-01.
204 * This constant is the number of seconds since 1970-01-01,
205 * when the Unix epoch began.
207 #define DUID_TIME_EPOCH 946684800
209 /* Information-Request Time option (RFC 4242) */
211 #define IRT_DEFAULT 86400
212 #define IRT_MINIMUM 600