ISC DHCP  4.3.6
A reference DHCPv4 and DHCPv6 implementation
dhcp6.h
Go to the documentation of this file.
1 /* dhcp6.h
2 
3  DHCPv6 Protocol structures... */
4 
5 /*
6  * Copyright (c) 2006-2016 by Internet Systems Consortium, Inc. ("ISC")
7  *
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.
11  *
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.
19  *
20  * Internet Systems Consortium, Inc.
21  * 950 Charter Street
22  * Redwood City, CA 94063
23  * <info@isc.org>
24  * https://www.isc.org/
25  */
26 
27 
28 /* DHCPv6 Option codes: */
29 
30 #define D6O_CLIENTID 1 /* RFC3315 */
31 #define D6O_SERVERID 2
32 #define D6O_IA_NA 3
33 #define D6O_IA_TA 4
34 #define D6O_IAADDR 5
35 #define D6O_ORO 6
36 #define D6O_PREFERENCE 7
37 #define D6O_ELAPSED_TIME 8
38 #define D6O_RELAY_MSG 9
39 /* Option code 10 unassigned. */
40 #define D6O_AUTH 11
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 */
78 #define D6O_MIP6_HNIDF 49 /* RFC6610 */
79 #define D6O_MIP6_VDINF 50 /* RFC6610 */
80 #define D6O_V6_LOST 51 /* RFC5223 */
81 #define D6O_CAPWAP_AC_V6 52 /* RFC5417 */
82 #define D6O_RELAY_ID 53 /* RFC5460 */
83 #define D6O_IPV6_ADDRESS_MOS 54 /* RFC5678 */
84 #define D6O_IPV6_FQDN_MOS 55 /* RFC5678 */
85 #define D6O_NTP_SERVER 56 /* RFC5908 */
86 #define D6O_V6_ACCESS_DOMAIN 57 /* RFC5986 */
87 #define D6O_SIP_UA_CS_LIST 58 /* RFC6011 */
88 #define D6O_BOOTFILE_URL 59 /* RFC5970 */
89 #define D6O_BOOTFILE_PARAM 60 /* RFC5970 */
90 #define D6O_CLIENT_ARCH_TYPE 61 /* RFC5970 */
91 #define D6O_NII 62 /* RFC5970 */
92 #define D6O_GEOLOCATION 63 /* RFC6225 */
93 #define D6O_AFTR_NAME 64 /* RFC6334 */
94 #define D6O_ERP_LOCAL_DOMAIN_NAME 65 /* RFC6440 */
95 #define D6O_RSOO 66 /* RFC6422 */
96 #define D6O_PD_EXCLUDE 67 /* RFC6603 */
97 #define D6O_VSS 68 /* RFC6607 */
98 #define D6O_MIP6_IDINF 69 /* RFC6610 */
99 #define D6O_MIP6_UDINF 70 /* RFC6610 */
100 #define D6O_MIP6_HNP 71 /* RFC6610 */
101 #define D6O_MIP6_HAA 72 /* RFC6610 */
102 #define D6O_MIP6_HAF 73 /* RFC6610 */
103 #define D6O_RDNSS_SELECTION 74 /* RFC6731 */
104 #define D6O_KRB_PRINCIPAL_NAME 75 /* RFC6784 */
105 #define D6O_KRB_REALM_NAME 76 /* RFC6784 */
106 #define D6O_KRB_DEFAULT_REALM_NAME 77 /* RFC6784 */
107 #define D6O_KRB_KDC 78 /* RFC6784 */
108 #define D6O_CLIENT_LINKLAYER_ADDR 79 /* RFC6939 */
109 #define D6O_LINK_ADDRESS 80 /* RFC6977 */
110 #define D6O_RADIUS 81 /* RFC7037 */
111 #define D6O_SOL_MAX_RT 82 /* RFC7083 */
112 #define D6O_INF_MAX_RT 83 /* RFC7083 */
113 #define D6O_ADDRSEL 84 /* RFC7078 */
114 #define D6O_ADDRSEL_TABLE 85 /* RFC7078 */
115 #define D6O_V6_PCP_SERVER 86 /* RFC7291 */
116 #define D6O_DHCPV4_MSG 87 /* RFC7341 */
117 #define D6O_DHCP4_O_DHCP6_SERVER 88 /* RFC7341 */
118 
119 /*
120  * Status Codes, from RFC 3315 section 24.4, and RFC 3633, 5007, 5460.
121  */
122 #define STATUS_Success 0
123 #define STATUS_UnspecFail 1
124 #define STATUS_NoAddrsAvail 2
125 #define STATUS_NoBinding 3
126 #define STATUS_NotOnLink 4
127 #define STATUS_UseMulticast 5
128 #define STATUS_NoPrefixAvail 6
129 #define STATUS_UnknownQueryType 7
130 #define STATUS_MalformedQuery 8
131 #define STATUS_NotConfigured 9
132 #define STATUS_NotAllowed 10
133 #define STATUS_QueryTerminated 11
134 
135 /*
136  * DHCPv6 message types, defined in section 5.3 of RFC 3315
137  */
138 #define DHCPV6_SOLICIT 1
139 #define DHCPV6_ADVERTISE 2
140 #define DHCPV6_REQUEST 3
141 #define DHCPV6_CONFIRM 4
142 #define DHCPV6_RENEW 5
143 #define DHCPV6_REBIND 6
144 #define DHCPV6_REPLY 7
145 #define DHCPV6_RELEASE 8
146 #define DHCPV6_DECLINE 9
147 #define DHCPV6_RECONFIGURE 10
148 #define DHCPV6_INFORMATION_REQUEST 11
149 #define DHCPV6_RELAY_FORW 12
150 #define DHCPV6_RELAY_REPL 13
151 #define DHCPV6_LEASEQUERY 14 /* RFC5007 */
152 #define DHCPV6_LEASEQUERY_REPLY 15 /* RFC5007 */
153 #define DHCPV6_LEASEQUERY_DONE 16 /* RFC5460 */
154 #define DHCPV6_LEASEQUERY_DATA 17 /* RFC5460 */
155 #define DHCPV6_RECONFIGURE_REQUEST 18 /* RFC6977 */
156 #define DHCPV6_RECONFIGURE_REPLY 19 /* RFC6977 */
157 #define DHCPV6_DHCPV4_QUERY 20 /* RFC7341 */
158 #define DHCPV6_DHCPV4_RESPONSE 21 /* RFC7341 */
159 
160 extern const char *dhcpv6_type_names[];
161 extern const int dhcpv6_type_name_max;
162 
163 /* DUID type definitions (RFC3315 section 9).
164  */
165 #define DUID_LLT 1
166 #define DUID_EN 2
167 #define DUID_LL 3
168 #define DUID_UUID 4 /* RFC6355 */
169 
170 /* Offsets into IA_*'s where Option spaces commence. */
171 #define IA_NA_OFFSET 12 /* IAID, T1, T2, all 4 octets each */
172 #define IA_TA_OFFSET 4 /* IAID only, 4 octets */
173 #define IA_PD_OFFSET 12 /* IAID, T1, T2, all 4 octets each */
174 
175 /* Offset into IAADDR's where Option spaces commence. */
176 #define IAADDR_OFFSET 24
177 
178 /* Offset into IAPREFIX's where Option spaces commence. */
179 #define IAPREFIX_OFFSET 25
180 
181 /* Offset into LQ_QUERY's where Option spaces commence. */
182 #define LQ_QUERY_OFFSET 17
183 
184 /*
185  * DHCPv6 well-known multicast addressess, from section 5.1 of RFC 3315
186  */
187 #define All_DHCP_Relay_Agents_and_Servers "FF02::1:2"
188 #define All_DHCP_Servers "FF05::1:3"
189 
190 /*
191  * DHCPv6 Retransmission Constants (RFC3315 section 5.5, RFC 5007)
192  */
193 
194 #define SOL_MAX_DELAY 1
195 #define SOL_TIMEOUT 1
196 #define SOL_MAX_RT 120
197 #define REQ_TIMEOUT 1
198 #define REQ_MAX_RT 30
199 #define REQ_MAX_RC 10
200 #define CNF_MAX_DELAY 1
201 #define CNF_TIMEOUT 1
202 #define CNF_MAX_RT 4
203 #define CNF_MAX_RD 10
204 #define REN_TIMEOUT 10
205 #define REN_MAX_RT 600
206 #define REB_TIMEOUT 10
207 #define REB_MAX_RT 600
208 #define INF_MAX_DELAY 1
209 #define INF_TIMEOUT 1
210 #define INF_MAX_RT 120
211 #define REL_TIMEOUT 1
212 #define REL_MAX_RC 5
213 #define DEC_TIMEOUT 1
214 #define DEC_MAX_RC 5
215 #define REC_TIMEOUT 2
216 #define REC_MAX_RC 8
217 #define HOP_COUNT_LIMIT 32
218 #define LQ6_TIMEOUT 1
219 #define LQ6_MAX_RT 10
220 #define LQ6_MAX_RC 5
221 
222 /*
223  * Normal packet format, defined in section 6 of RFC 3315
224  */
226  unsigned char msg_type;
227  unsigned char transaction_id[3];
229 };
230 
231 /* Offset into DHCPV6 Reply packets where Options spaces commence. */
232 #define REPLY_OPTIONS_INDEX 4
233 
234 /*
235  * Relay packet format, defined in section 7 of RFC 3315
236  */
238  unsigned char msg_type;
239  unsigned char hop_count;
240  unsigned char link_address[16];
241  unsigned char peer_address[16];
243 };
244 #define MAX_V6RELAY_HOPS 32
245 
246 /*
247  * DHCPv4-over-DHCPv6 packet format, defined in RFC 4731
248  */
250  unsigned char msg_type;
251  unsigned char flags[3];
253 };
254 #define DHCP4O6_QUERY_UNICAST 128
255 
256 /* DHCPv4-over-DHCPv6 ISC vendor suboptions */
257 #define D4O6_INTERFACE 60000
258 #define D4O6_SRC_ADDRESS 60001
259 
260 /* Leasequery query-types (RFC 5007, 5460) */
261 
262 #define LQ6QT_BY_ADDRESS 1
263 #define LQ6QT_BY_CLIENTID 2
264 #define LQ6QT_BY_RELAY_ID 3
265 #define LQ6QT_BY_LINK_ADDRESS 4
266 #define LQ6QT_BY_REMOTE_ID 5
267 
268 /*
269  * DUID time starts 2000-01-01.
270  * This constant is the number of seconds since 1970-01-01,
271  * when the Unix epoch began.
272  */
273 #define DUID_TIME_EPOCH 946684800
274 
275 /* Information-Request Time option (RFC 4242) */
276 
277 #define IRT_DEFAULT 86400
278 #define IRT_MINIMUM 600
279 
unsigned char peer_address[16]
Definition: dhcp6.h:241
unsigned char options[FLEXIBLE_ARRAY_MEMBER]
Definition: dhcp6.h:242
unsigned char msg_type
Definition: dhcp6.h:226
const int dhcpv6_type_name_max
Definition: tables.c:680
unsigned char msg_type
Definition: dhcp6.h:250
unsigned char msg_type
Definition: dhcp6.h:238
unsigned char flags[3]
Definition: dhcp6.h:251
const char * dhcpv6_type_names[]
Definition: tables.c:656
unsigned char link_address[16]
Definition: dhcp6.h:240
#define FLEXIBLE_ARRAY_MEMBER
Definition: config.h:42
unsigned char hop_count
Definition: dhcp6.h:239
unsigned char transaction_id[3]
Definition: dhcp6.h:227
unsigned char options[FLEXIBLE_ARRAY_MEMBER]
Definition: dhcp6.h:252
unsigned char options[FLEXIBLE_ARRAY_MEMBER]
Definition: dhcp6.h:228