6 * Dynamic Host Configuration Protocol for IPv6
10 FILE_LICENCE ( GPL2_OR_LATER );
14 #include <ipxe/uuid.h>
16 /** DHCPv6 server port */
17 #define DHCPV6_SERVER_PORT 547
19 /** DHCPv6 client port */
20 #define DHCPV6_CLIENT_PORT 546
26 struct dhcpv6_option {
29 /** Length of the data field */
33 } __attribute__ (( packed ));
35 /** DHCP unique identifier based on UUID (DUID-UUID) */
36 struct dhcpv6_duid_uuid {
41 } __attribute__ (( packed ));
43 /** DHCP unique identifier based on UUID (DUID-UUID) */
44 #define DHCPV6_DUID_UUID 4
46 /** DHCPv6 client or server identifier option */
47 struct dhcpv6_duid_option {
49 struct dhcpv6_option header;
50 /** DHCP unique identifier (DUID) */
52 } __attribute__ (( packed ));
54 /** DHCPv6 client identifier option */
55 #define DHCPV6_CLIENT_ID 1
57 /** DHCPv6 server identifier option */
58 #define DHCPV6_SERVER_ID 2
60 /** DHCPv6 identity association for non-temporary address (IA_NA) option */
61 struct dhcpv6_ia_na_option {
63 struct dhcpv6_option header;
64 /** Identity association identifier (IAID) */
66 /** Renew time (in seconds) */
68 /** Rebind time (in seconds) */
71 struct dhcpv6_option options[0];
72 } __attribute__ (( packed ));
74 /** DHCPv6 identity association for non-temporary address (IA_NA) option */
75 #define DHCPV6_IA_NA 3
77 /** DHCPv6 identity association address (IAADDR) option */
78 struct dhcpv6_iaaddr_option {
80 struct dhcpv6_option header;
82 struct in6_addr address;
83 /** Preferred lifetime (in seconds) */
85 /** Valid lifetime (in seconds) */
88 struct dhcpv6_option options[0];
89 } __attribute__ (( packed ));
91 /** DHCPv6 identity association address (IAADDR) option */
92 #define DHCPV6_IAADDR 5
94 /** DHCPv6 option request option */
95 struct dhcpv6_option_request_option {
97 struct dhcpv6_option header;
98 /** Requested options */
99 uint16_t requested[0];
100 } __attribute__ (( packed ));
102 /** DHCPv6 option request option */
103 #define DHCPV6_OPTION_REQUEST 6
105 /** DHCPv6 elapsed time option */
106 struct dhcpv6_elapsed_time_option {
108 struct dhcpv6_option header;
109 /** Elapsed time, in centiseconds */
111 } __attribute__ (( packed ));
113 /** DHCPv6 elapsed time option */
114 #define DHCPV6_ELAPSED_TIME 8
116 /** DHCPv6 status code option */
117 struct dhcpv6_status_code_option {
119 struct dhcpv6_option header;
122 /** Status message */
124 } __attribute__ (( packed ));
126 /** DHCPv6 status code option */
127 #define DHCPV6_STATUS_CODE 13
129 /** DHCPv6 user class */
130 struct dhcpv6_user_class {
133 /** User class string */
135 } __attribute__ (( packed ));
137 /** DHCPv6 user class option */
138 struct dhcpv6_user_class_option {
140 struct dhcpv6_option header;
142 struct dhcpv6_user_class user_class[0];
143 } __attribute__ (( packed ));
145 /** DHCPv6 user class option */
146 #define DHCPV6_USER_CLASS 15
148 /** DHCPv6 DNS recursive name server option */
149 #define DHCPV6_DNS_SERVERS 23
151 /** DHCPv6 domain search list option */
152 #define DHCPV6_DOMAIN_LIST 24
154 /** DHCPv6 bootfile URI option */
155 #define DHCPV6_BOOTFILE_URL 59
157 /** DHCPv6 bootfile parameters option */
158 #define DHCPV6_BOOTFILE_PARAM 60
160 /** DHCPv6 syslog server option
162 * This option code has not yet been assigned by IANA. Please update
163 * this definition once an option code has been assigned.
165 #define DHCPV6_LOG_SERVERS 0xffffffffUL
171 union dhcpv6_any_option {
172 struct dhcpv6_option header;
173 struct dhcpv6_duid_option duid;
174 struct dhcpv6_ia_na_option ia_na;
175 struct dhcpv6_iaaddr_option iaaddr;
176 struct dhcpv6_option_request_option option_request;
177 struct dhcpv6_elapsed_time_option elapsed_time;
178 struct dhcpv6_status_code_option status_code;
179 struct dhcpv6_user_class_option user_class;
186 struct dhcpv6_header {
189 /** Transaction ID */
192 struct dhcpv6_option options[0];
193 } __attribute__ (( packed ));
195 /** DHCPv6 solicitation */
196 #define DHCPV6_SOLICIT 1
198 /** DHCPv6 advertisement */
199 #define DHCPV6_ADVERTISE 2
201 /** DHCPv6 request */
202 #define DHCPV6_REQUEST 3
205 #define DHCPV6_REPLY 7
207 /** DHCPv6 information request */
208 #define DHCPV6_INFORMATION_REQUEST 11
210 /** DHCPv6 settings block name */
211 #define DHCPV6_SETTINGS_NAME "dhcpv6"
214 * Construct all-DHCP-relay-agents-and-servers multicast address
216 * @v addr Zeroed address to construct
218 static inline void ipv6_all_dhcp_relay_and_servers ( struct in6_addr *addr ) {
219 addr->s6_addr16[0] = htons ( 0xff02 );
220 addr->s6_addr[13] = 1;
221 addr->s6_addr[15] = 2;
224 extern int start_dhcpv6 ( struct interface *job, struct net_device *netdev,
227 #endif /* _IPXE_DHCPV6_H */