[ipv6] Change return code handling from router solicits
[gpxe.git] / src / include / gpxe / dhcp6.h
blobd43f98f16defde4f9e066bddba30dea2868dcbe2
1 #ifndef _GPXE_DHCP6_H
2 #define _GPXE_DHCP6_H
4 /** @file
6 * Dynamic Host Configuration Protocol for IPv6, as per RFC3315
8 */
10 FILE_LICENCE ( GPL2_OR_LATER );
12 #include <stdint.h>
14 /** DHCPv6 server port */
15 #define DHCP6S_PORT 547
17 /** DHCPv6 client port */
18 #define DHCP6C_PORT 546
20 /** DHCPv6 Status Codes */
21 #define DHCP6_SUCCESS 0
22 #define DHCP6_UNSPEC 1
23 #define DHCP6_NOADDRS 2
24 #define DHCP6_NOBIND 3
25 #define DHCP6_NOTLINK 4
26 #define DHCP6_MCAST 5
28 /** DHCPv6 message types */
29 #define DHCP6_SOLICIT 1
30 #define DHCP6_ADVERTISE 2
31 #define DHCP6_REQUEST 3
32 #define DHCP6_CONFIRM 4
33 #define DHCP6_RENEW 5
34 #define DHCP6_REBIND 6
35 #define DHCP6_REPLY 7
36 #define DHCP6_RELEASE 8
37 #define DHCP6_DECLINE 9
38 #define DHCP6_RECONF 10
39 #define DHCP6_INFOREQ 11
41 /** DHCPv6 message type. DHCPv6 options follow this header. */
42 struct dhcp6_msg {
43 uint32_t type_id;
46 /** DHCP option header type. */
47 struct dhcp6_opt_hdr {
48 uint16_t code;
49 uint16_t len;
50 /** variable-length option data. */
53 /** DHCPv6 option types */
54 #define DHCP6_OPT_CLIENTID 1
55 #define DHCP6_OPT_SERVERID 2
56 #define DHCP6_OPT_IA_NA 3
57 #define DHCP6_OPT_IA_TA 4
58 #define DHCP6_OPT_IAADDR 5
59 #define DHCP6_OPT_ORO 6
60 #define DHCP6_OPT_PREFERENCE 7
61 #define DHCP6_OPT_ELAPSED 8
62 #define DHCP6_OPT_UNICAST 12
63 #define DHCP6_OPT_STATUS 13
64 #define DHCP6_OPT_RCOMMIT 14
65 #define DHCP6_OPT_USER_CLASS 15
66 #define DHCP6_OPT_VENDOR_CLASS 16
67 #define DHCP6_OPT_VENDOR_INFO 17
68 #define DHCP6_OPT_IFACE_ID 18
69 #define DHCP6_OPT_RECONF_MSG 19
70 #define DHCP6_OPT_RECONF_ACCEPT 20
72 #define DHCP6_OPT_DNS_SERVERS 23
73 #define DHCP6_OPT_DNS_DOMAINS 24
75 /** Identity association for non-temporary address option */
76 struct dhcp6_opt_ia_na {
77 uint16_t code;
78 uint16_t len;
79 uint32_t iaid;
80 uint32_t t1;
81 uint32_t t2;
82 /** IA-NA options follow. */
85 /** Identity association for temporary addresses option */
86 struct dhcp6_opt_ia_ta {
87 uint16_t code;
88 uint16_t len;
89 uint32_t iaid;
90 /** IA-TA options follow. */
93 /** Identity association, Address option. */
94 struct dhcp6_opt_iaaddr {
95 uint16_t code;
96 uint16_t len;
97 struct in6_addr addr;
98 uint32_t pref_lifetime;
99 uint32_t valid_lifetime;
100 /** IAddr options follow. */
103 /** Option request option. */
104 struct dhcp6_opt_oro {
105 uint16_t code;
106 uint16_t len;
107 uint16_t optcodes[];
110 /** Preference option. */
111 struct dhcp6_opt_pref {
112 uint16_t code;
113 uint16_t len;
114 uint8_t pref_value;
117 /** Elapsed Time option. */
118 struct dhcp6_opt_elapsed {
119 uint16_t code;
120 uint16_t len;
121 uint16_t time;
124 /** Server Unicast option. */
125 struct dhcp6_opt_unicast {
126 uint16_t code;
127 uint16_t len;
128 struct in6_addr addr;
131 /** Status Code option. */
132 struct dhcp6_opt_status_code {
133 uint16_t code;
134 uint16_t len;
135 uint16_t status;
136 uint8_t utf8_message[]; /** UTF-8, for display to the user. */
139 /** User Class option. */
140 struct dhcp6_opt_user_class {
141 uint16_t code;
142 uint16_t len;
143 char user_class_data[];
146 /** Vendor Class option. */
147 struct dhcp6_opt_vendor_class {
148 uint16_t code;
149 uint16_t len;
150 uint32_t enterprise_number;
151 char vendor_class_data[];
154 /** Vendor-Specific Information option. */
155 struct dhcp6_opt_vendor_specific_info {
156 uint16_t code;
157 uint16_t len;
158 uint32_t enterprise_number;
159 char option_data[]; /** Interpreted by vendor-specific code. */
162 /** Interface-ID option. */
163 struct dhcp6_opt_interface_id {
164 uint16_t code;
165 uint16_t len;
166 char interface_id[];
169 /** Reconfigure Message option. */
170 struct dhcp6_opt_reconfigure {
171 uint16_t code;
172 uint16_t len;
173 uint8_t msg_type;
176 /** DHCPv6 DUID types */
177 #define DHCP6_DUID_LLT 1
178 #define DHCP6_DUID_EN 2
179 #define DHCP6_DUID_LL 3
181 /** Common header for the DHCPv6 DUID. */
182 struct dhcp6_duid {
183 uint16_t code;
186 /** DUID based on link layer address plus time (DUID-LLT) */
187 struct dhcp6_duid_llt {
188 uint16_t code; /** 1 for LLT */
189 uint16_t hwtype;
190 uint32_t time;
191 /** variable length link-layer address follows */
194 /** DUID assigned by vendor based on enterprise number (DUID-EN) */
195 struct dhcp6_duid_en {
196 uint16_t code; /** 2 for EN */
197 uint32_t enterprise;
198 /** variable length for identifier, defined by the vendor */
201 /** DUID based on link layer address */
202 struct dhcp6_duid_ll {
203 uint16_t code; /** 3 for LL */
204 uint16_t hwtype;
205 /** variable length for link layer address */
208 /** Start a DHCP6 transaction. */
209 int start_dhcp6 ( struct job_interface *job, struct net_device *netdev,
210 int onlyinfo, struct rsolicit_info *router );
212 #endif