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