Kea  1.9.9-git
dhcp6.h
Go to the documentation of this file.
1 // Copyright (C) 2006-2020 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef DHCP6_H
8 #define DHCP6_H
9 
10 #include <stdint.h>
11 
18 
19 /* DHCPv6 Option codes: */
21  D6O_CLIENTID = 1, /* RFC8415 */
23  D6O_IA_NA = 3,
24  D6O_IA_TA = 4,
26  D6O_ORO = 6,
30  // Option code 10 is unassigned.
31  D6O_AUTH = 11,
41  D6O_SIP_SERVERS_DNS = 21, /* RFC3319 */
42  D6O_SIP_SERVERS_ADDR = 22, /* RFC3319 */
43  D6O_NAME_SERVERS = 23, /* RFC3646 */
44  D6O_DOMAIN_SEARCH = 24, /* RFC3646 */
45  D6O_IA_PD = 25, /* RFC8415 */
46  D6O_IAPREFIX = 26, /* RFC8415 */
47  D6O_NIS_SERVERS = 27, /* RFC3898 */
48  D6O_NISP_SERVERS = 28, /* RFC3898 */
49  D6O_NIS_DOMAIN_NAME = 29, /* RFC3898 */
50  D6O_NISP_DOMAIN_NAME = 30, /* RFC3898 */
51  D6O_SNTP_SERVERS = 31, /* RFC4075 */
52  D6O_INFORMATION_REFRESH_TIME = 32, /* RFC8415 */
53  D6O_BCMCS_SERVER_D = 33, /* RFC4280 */
54  D6O_BCMCS_SERVER_A = 34, /* RFC4280 */
55  // Option code 35 is unassigned.
56  D6O_GEOCONF_CIVIC = 36, /* RFC4776 */
57  D6O_REMOTE_ID = 37, /* RFC4649 */
58  D6O_SUBSCRIBER_ID = 38, /* RFC4580 */
59  D6O_CLIENT_FQDN = 39, /* RFC4704 */
60  D6O_PANA_AGENT = 40, /* RFC5192 */
61  D6O_NEW_POSIX_TIMEZONE = 41, /* RFC4833 */
62  D6O_NEW_TZDB_TIMEZONE = 42, /* RFC4833 */
63  D6O_ERO = 43, /* RFC4994 */
64  D6O_LQ_QUERY = 44, /* RFC5007 */
65  D6O_CLIENT_DATA = 45, /* RFC5007 */
66  D6O_CLT_TIME = 46, /* RFC5007 */
67  D6O_LQ_RELAY_DATA = 47, /* RFC5007 */
68  D6O_LQ_CLIENT_LINK = 48, /* RFC5007 */
69 // D6O_MIP6_HNIDF = 49, /* RFC6610 */
70 // D6O_MIP6_VDINF = 50, /* RFC6610 */
71  D6O_V6_LOST = 51, /* RFC5223 */
72  D6O_CAPWAP_AC_V6 = 52, /* RFC5417 */
73  D6O_RELAY_ID = 53, /* RFC5460 */
74 // D6O_IPV6_ADDRESS_MOS = 54, /* RFC5678 */
75 // D6O_IPV6_FQDN_MOS = 55, /* RFC5678 */
76 // D6O_NTP_SERVER = 56, /* RFC5908 */
77  D6O_V6_ACCESS_DOMAIN = 57, /* RFC5986 */
78  D6O_SIP_UA_CS_LIST = 58, /* RFC6011 */
79  D6O_BOOTFILE_URL = 59, /* RFC5970 */
80  D6O_BOOTFILE_PARAM = 60, /* RFC5970 */
81  D6O_CLIENT_ARCH_TYPE = 61, /* RFC5970 */
82  D6O_NII = 62, /* RFC5970 */
83 // D6O_GEOLOCATION = 63, /* RFC6225 */
84  D6O_AFTR_NAME = 64, /* RFC6334 */
85  D6O_ERP_LOCAL_DOMAIN_NAME = 65, /* RFC6440 */
86  D6O_RSOO = 66, /* RFC6422 */
87  D6O_PD_EXCLUDE = 67, /* RFC6603 */
88 // D6O_VSS = 68, /* RFC6607 */
89 // D6O_MIP6_IDINF = 69, /* RFC6610 */
90 // D6O_MIP6_UDINF = 70, /* RFC6610 */
91 // D6O_MIP6_HNP = 71, /* RFC6610 */
92 // D6O_MIP6_HAA = 72, /* RFC6610 */
93 // D6O_MIP6_HAF = 73, /* RFC6610 */
94  D6O_RDNSS_SELECTION = 74, /* RFC6731 */
95 // D6O_KRB_PRINCIPAL_NAME = 75, /* RFC6784 */
96 // D6O_KRB_REALM_NAME = 76, /* RFC6784 */
97 // D6O_KRB_DEFAULT_REALM_NAME = 77, /* RFC6784 */
98 // D6O_KRB_KDC = 78, /* RFC6784 */
99  D6O_CLIENT_LINKLAYER_ADDR = 79, /* RFC6939 */
100  D6O_LINK_ADDRESS = 80, /* RFC6977 */
101 // D6O_RADIUS = 81, /* RFC7037 */
102  D6O_SOL_MAX_RT = 82, /* RFC8415 */
103  D6O_INF_MAX_RT = 83, /* RFC8415 */
104 // D6O_ADDRSEL = 84, /* RFC7078 */
105 // D6O_ADDRSEL_TABLE = 85, /* RFC7078 */
106 // D6O_V6_PCP_SERVER = 86, /* RFC7291 */
107  D6O_DHCPV4_MSG = 87, /* RFC7341 */
108  D6O_DHCPV4_O_DHCPV6_SERVER = 88, /* RFC7341 */
109  D6O_S46_RULE = 89, /* RFC7598 */
110  D6O_S46_BR = 90, /* RFC7598 */
111  D6O_S46_DMR = 91, /* RFC7598 */
112  D6O_S46_V4V6BIND = 92, /* RFC7598 */
113  D6O_S46_PORTPARAMS = 93, /* RFC7598 */
114  D6O_S46_CONT_MAPE = 94, /* RFC7598 */
115  D6O_S46_CONT_MAPT = 95, /* RFC7598 */
116  D6O_S46_CONT_LW = 96, /* RFC7598 */
117 // D6O_4RD = 97, /* RFC7600 */
118 // D6O_4RD_MAP_RULE = 98, /* RFC7600 */
119 // D6O_4RD_NON_MAP_RULE = 99, /* RFC7600 */
120 // D6O_LQ_BASE_TIME = 100, /* RFC7653 */
121 // D6O_LQ_START_TIME = 101, /* RFC7653 */
122 // D6O_LQ_END_TIME = 102, /* RFC7653 */
123  D6O_V6_CAPTIVE_PORTAL = 103, /* RFC7710 */
124 // D6O_MPL_PARAMETERS = 104, /* RFC7774 */
125 // D6O_ANI_ATT = 105, /* RFC7839 */
126 // D6O_ANI_NETWORK_NAME = 106, /* RFC7839 */
127 // D6O_ANI_AP_NAME = 107, /* RFC7839 */
128 // D6O_ANI_AP_BSSID = 108, /* RFC7839 */
129 // D6O_ANI_OPERATOR_ID = 109, /* RFC7839 */
130 // D6O_ANI_OPERATOR_REALM = 110, /* RFC7839 */
131 // D6O_S46_PRIORITY = 111, /* RFC8026 */
132  // Option code 112 is unassigned.
133 // D6O_V6_PREFIX64 = 113, /* RFC8115 */
134 // D6O_F_BINDING_STATUS = 114, /* RFC8156 */
135 // D6O_F_CONNECT_FLAGS = 115, /* RFC8156 */
136 // D6O_F_DNS_REMOVAL_INFO = 116, /* RFC8156 */
137 // D6O_F_DNS_HOST_NAME = 117, /* RFC8156 */
138 // D6O_F_DNS_ZONE_NAME = 118, /* RFC8156 */
139 // D6O_F_DNS_FLAGS = 119, /* RFC8156 */
140 // D6O_F_EXPIRATION_TIME = 120, /* RFC8156 */
141 // D6O_F_MAX_UNACKED_BNDUPD = 121, /* RFC8156 */
142 // D6O_F_MCLT = 122, /* RFC8156 */
143 // D6O_F_PARTNER_LIFETIME = 123, /* RFC8156 */
144 // D6O_F_PARTNER_LIFETIME_SENT = 124, /* RFC8156 */
145 // D6O_F_PARTNER_DOWN_TIME = 125, /* RFC8156 */
146 // D6O_F_PARTNER_RAW_CLT_TIME = 126, /* RFC8156 */
147 // D6O_F_PROTOCOL_VERSION = 127, /* RFC8156 */
148 // D6O_F_KEEPALIVE_TIME = 128, /* RFC8156 */
149 // D6O_F_RECONFIGURE_DATA = 129, /* RFC8156 */
150 // D6O_F_RELATIONSHIP_NAME = 130, /* RFC8156 */
151 // D6O_F_SERVER_FLAGS = 131, /* RFC8156 */
152 // D6O_F_SERVER_STATE = 132, /* RFC8156 */
153 // D6O_F_START_TIME_OF_STATE = 133, /* RFC8156 */
154 // D6O_F_STATE_EXPIRATION_TIME = 134, /* RFC8156 */
155  D6O_RELAY_SOURCE_PORT = 135, /* RFC8357 */
156  // Option codes 136-142 are unassigned.
157  D6O_IPV6_ADDRESS_ANDSF = 143 /* RFC6153 */
158 };
159 
160 /*
161  * Status Codes, from RFC 8415 section 21.13, 5007, 5460.
162  */
175 // STATUS_QueryTerminated = 11,
176 /* RFC7653 */
177 // STATUS_DataMissing = 12,
178 // STATUS_CatchUpComplete = 13,
179 // STATUS_NotSupported = 14,
180 // STATUS_TLSConnectionRefused = 15,
181 /* RFC8156 */
182 // STATUS_AddressInUse = 16,
183 // STATUS_ConfigurationConflict = 17,
184 // STATUS_MissingBindingInformation = 18,
185 // STATUS_OutdatedBindingInformation = 19,
186 // STATUS_ServerShuttingDown = 20,
187 // STATUS_DNSUpdateNotSupported = 21,
188 // STATUS_ExcessiveTimeSkew = 22,
189 
190 // The following are EXPERIMENTAL and may change when IANA assigns official
191 // values.
192 /* secure DHCPv6 (draft-ietf-dhc-sedhcpv6-08) */
193 /* temporary values for hackathon 93 */
198 };
199 
200 /*
201  * DHCPv6 message types, defined in section 7.3 of RFC 8415
202  */
217  /* RFC 5007 */
220  /* RFC 5460 */
221 // DHCPV6_LEASEQUERY_DONE = 16,
222 // DHCPV6_LEASEQUERY_DATA = 17,
223  /* RFC 6977 */
224 // DHCPV6_RECONFIGURE_REQUEST = 18,
225 // DHCPV6_RECONFIGURE_REPLY = 19,
226  /* RFC 7341 */
229  /* RFC 7653 */
230 // DHCPV6_ACTIVELEASEQUERY = 22,
231 // DHCPV6_STARTTLS = 23,
232  /* RFC 8156 */
233 // DHCPV6_BNDUPD = 24,
234 // DHCPV6_BNDREPLY = 25,
235 // DHCPV6_POOLREQ = 26,
236 // DHCPV6_POOLRESP = 27,
237 // DHCPV6_UPDREQ = 28,
238 // DHCPV6_UPDREQALL = 29,
239 // DHCPV6_UPDDONE = 30,
240 // DHCPV6_CONNECT = 31,
241 // DHCPV6_CONNECTREPLY = 32,
242 // DHCPV6_DISCONNECT = 33,
243 // DHCPV6_STATE = 34,
244 // DHCPV6_CONTACT = 35
245 };
246 
247 extern const char *dhcpv6_type_names[];
248 extern const int dhcpv6_type_name_max;
249 
250 // DUID type definitions (RFC 8415 section 11).
251 // see isc::dhcp::DUID::DUIDType enum in dhcp/duid.h
252 
253 // Define hardware types
254 // Taken from http://www.iana.org/assignments/arp-parameters/
255 static const uint16_t HWTYPE_ETHERNET = 0x0001;
256 static const uint16_t HWTYPE_INFINIBAND = 0x0020;
257 
258 // The following are EXPERIMENTAL and may change when IANA assigns official
259 // values.
260 // Secure DHCPv6 (draft-ietf-dhc-sedhcpv6-08.txt)
261 // (can't use an enum because HashAlgorithm name is already taken)
262 #define SHA_256 1
263 #define SHA_512 2
264 #define RSASSA_PKCS1v1_5 1
265 
266 // Taken from http://www.iana.org/assignments/enterprise-numbers
267 static const uint32_t ENTERPRISE_ID_ISC = 2495;
268 
269 /* DHCPv4-over-DHCPv6 (RFC 7341) inter-process communication. These are option
270  codes for the ISC vendor specific options used in 4o6 */
271 static const uint16_t ISC_V6_4O6_INTERFACE = 60000;
272 static const uint16_t ISC_V6_4O6_SRC_ADDRESS = 60001;
273 static const uint16_t ISC_V6_4O6_SRC_PORT = 60002;
274 
275 /* Offsets into IA_*'s where Option spaces commence. */
276 static const uint16_t IA_NA_OFFSET = 12; /* IAID, T1, T2, all 4 octets each */
277 static const uint16_t IA_TA_OFFSET = 4; /* IAID only, 4 octets */
278 static const uint16_t IA_PD_OFFSET = 12; /* IAID, T1, T2, all 4 octets each */
279 
280 /* Offset into IAADDR's where Option spaces commence. */
281 static const uint16_t IAADDR_OFFSET = 24;
282 
283 /* Offset into IAPREFIX's where Option spaces commence. */
284 static const uint16_t IAPREFIX_OFFSET = 25;
285 
286 /* Offset into LQ_QUERY's where Option spaces commence. */
287 static const uint16_t LQ_QUERY_OFFSET = 17;
288 
289 /*
290  * DHCPv6 well-known multicast addresses, from section 7.1 of RFC 8415
291  */
292 // TODO
293 #define ALL_DHCP_RELAY_AGENTS_AND_SERVERS "ff02::1:2"
294 #define ALL_DHCP_SERVERS "ff05::1:3"
295 
296 static const uint16_t DHCP6_CLIENT_PORT = 546;
297 static const uint16_t DHCP6_SERVER_PORT = 547;
298 
299 /*
300  * DHCPv6 Retransmission Constants (RFC 8415 section 7.6, RFC 5007)
301  */
302 
303 // TODO
304 #define SOL_MAX_DELAY 1
305 #define SOL_TIMEOUT 1
306 #define SOL_MAX_RT 120
307 #define REQ_TIMEOUT 1
308 #define REQ_MAX_RT 30
309 #define REQ_MAX_RC 10
310 #define CNF_MAX_DELAY 1
311 #define CNF_TIMEOUT 1
312 #define CNF_MAX_RT 4
313 #define CNF_MAX_RD 10
314 #define REN_TIMEOUT 10
315 #define REN_MAX_RT 600
316 #define REB_TIMEOUT 10
317 #define REB_MAX_RT 600
318 #define INF_MAX_DELAY 1
319 #define INF_TIMEOUT 1
320 #define INF_MAX_RT 120
321 #define REL_TIMEOUT 1
322 #define REL_MAX_RC 5
323 #define DEC_TIMEOUT 1
324 #define DEC_MAX_RC 5
325 #define REC_TIMEOUT 2
326 #define REC_MAX_RC 8
327 #define HOP_COUNT_LIMIT 32
328 #define LQ6_TIMEOUT 1
329 #define LQ6_MAX_RT 10
330 #define LQ6_MAX_RC 5
331 
332 /* Leasequery query-types (RFC 5007, RFC 5460) */
333 
334 #define LQ6QT_BY_ADDRESS 1
335 #define LQ6QT_BY_CLIENTID 2
336 //#define LQ6QT_BY_RELAY_ID 3
337 //#define LQ6QT_BY_LINK_ADDRESS 4
338 //#define LQ6QT_BY_REMOTE_ID 5
339 
340 /*
341  * DUID time starts 2000-01-01.
342  * This constant is the number of seconds since 1970-01-01,
343  * when the Unix epoch began.
344  */
345 #define DUID_TIME_EPOCH 946684800
346 
347 /* Information-Request Time option (RFC 8415) */
348 
349 #define IRT_DEFAULT 86400
350 #define IRT_MINIMUM 600
351 
352 /* DHCPv4-query message flags (see RFC7341) */
353 #define DHCPV4_QUERY_FLAGS_UNICAST (1 << 23)
354 
355 #endif /* DHCP6_H */
DHCPv6StatusCode
Definition: dhcp6.h:163
const int dhcpv6_type_name_max
const char * dhcpv6_type_names[]
Definition: dhcp6.h:31
Definition: dhcp6.h:82
Definition: dhcp6.h:26
DHCPv6OptionType
Definition: dhcp6.h:20
Definition: dhcp6.h:63
DHCPv6MessageType
Definition: dhcp6.h:203
Definition: dhcp6.h:86