iPXE
dhcp.h
Go to the documentation of this file.
1 #ifndef _IPXE_DHCP_H
2 #define _IPXE_DHCP_H
3 
4 /** @file
5  *
6  * Dynamic Host Configuration Protocol
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <stdarg.h>
14 #include <ipxe/in.h>
15 #include <ipxe/list.h>
16 #include <ipxe/refcnt.h>
17 #include <ipxe/tables.h>
18 #include <ipxe/uuid.h>
19 #include <ipxe/netdevice.h>
20 #include <ipxe/uaccess.h>
21 
22 struct interface;
23 struct dhcp_options;
24 struct dhcp_packet;
25 
26 /** BOOTP/DHCP server port */
27 #define BOOTPS_PORT 67
28 
29 /** BOOTP/DHCP client port */
30 #define BOOTPC_PORT 68
31 
32 /** PXE server port */
33 #define PXE_PORT 4011
34 
35 /** Construct a tag value for an encapsulated option
36  *
37  * This tag value can be passed to Etherboot functions when searching
38  * for DHCP options in order to search for a tag within an
39  * encapsulated options block.
40  */
41 #define DHCP_ENCAP_OPT( encapsulator, encapsulated ) \
42  ( ( (encapsulator) << 8 ) | (encapsulated) )
43 /** Extract encapsulating option block tag from encapsulated tag value */
44 #define DHCP_ENCAPSULATOR( encap_opt ) ( (encap_opt) >> 8 )
45 /** Extract encapsulated option tag from encapsulated tag value */
46 #define DHCP_ENCAPSULATED( encap_opt ) ( (encap_opt) & 0xff )
47 /** Option is encapsulated */
48 #define DHCP_IS_ENCAP_OPT( opt ) DHCP_ENCAPSULATOR( opt )
49 
50 /**
51  * @defgroup dhcpopts DHCP option tags
52  * @{
53  */
54 
55 /** Padding
56  *
57  * This tag does not have a length field; it is always only a single
58  * byte in length.
59  */
60 #define DHCP_PAD 0
61 
62 /** Minimum normal DHCP option */
63 #define DHCP_MIN_OPTION 1
64 
65 /** Subnet mask */
66 #define DHCP_SUBNET_MASK 1
67 
68 /** Routers */
69 #define DHCP_ROUTERS 3
70 
71 /** DNS servers */
72 #define DHCP_DNS_SERVERS 6
73 
74 /** Syslog servers */
75 #define DHCP_LOG_SERVERS 7
76 
77 /** Host name */
78 #define DHCP_HOST_NAME 12
79 
80 /** Domain name */
81 #define DHCP_DOMAIN_NAME 15
82 
83 /** Root path */
84 #define DHCP_ROOT_PATH 17
85 
86 /** Maximum transmission unit */
87 #define DHCP_MTU 26
88 
89 /** NTP servers */
90 #define DHCP_NTP_SERVERS 42
91 
92 /** Vendor encapsulated options */
93 #define DHCP_VENDOR_ENCAP 43
94 
95 /** PXE boot server discovery control */
96 #define DHCP_PXE_DISCOVERY_CONTROL DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 6 )
97 
98 /** PXE boot server discovery control bits */
100  /** Inhibit broadcast discovery */
102  /** Inhibit multicast discovery */
104  /** Accept only servers in DHCP_PXE_BOOT_SERVERS list */
106  /** Skip discovery if filename present */
108 };
109 
110 /** PXE boot server multicast address */
111 #define DHCP_PXE_BOOT_SERVER_MCAST DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 7 )
112 
113 /** PXE boot servers */
114 #define DHCP_PXE_BOOT_SERVERS DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 8 )
115 
116 /** PXE boot server */
118  /** "Type" */
120  /** Number of IPv4 addresses */
122  /** IPv4 addresses */
123  struct in_addr ip[0];
124 } __attribute__ (( packed ));
125 
126 /** PXE boot menu */
127 #define DHCP_PXE_BOOT_MENU DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 9 )
128 
129 /** PXE boot menu */
131  /** "Type" */
133  /** Description length */
135  /** Description */
136  char desc[0];
137 } __attribute__ (( packed ));
138 
139 /** PXE boot menu prompt */
140 #define DHCP_PXE_BOOT_MENU_PROMPT DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 10 )
141 
142 /** PXE boot menu prompt */
144  /** Timeout
145  *
146  * A value of 0 means "time out immediately and select first
147  * boot item, without displaying the prompt". A value of 255
148  * means "display menu immediately with no timeout". Any
149  * other value means "display prompt, wait this many seconds
150  * for keypress, if key is F8, display menu, otherwise select
151  * first boot item".
152  */
154  /** Prompt to press F8 */
155  char prompt[0];
156 } __attribute__ (( packed ));
157 
158 /** PXE boot menu item */
159 #define DHCP_PXE_BOOT_MENU_ITEM DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 71 )
160 
161 /** PXE boot menu item */
163  /** "Type"
164  *
165  * This field actually identifies the specific boot server (or
166  * cluster of boot servers offering identical boot files).
167  */
169  /** "Layer"
170  *
171  * Just don't ask.
172  */
174 } __attribute__ (( packed ));
175 
176 /** Requested IP address */
177 #define DHCP_REQUESTED_ADDRESS 50
178 
179 /** Lease time */
180 #define DHCP_LEASE_TIME 51
181 
182 /** Option overloading
183  *
184  * The value of this option is the bitwise-OR of zero or more
185  * DHCP_OPTION_OVERLOAD_XXX constants.
186  */
187 #define DHCP_OPTION_OVERLOAD 52
188 
189 /** The "file" field is overloaded to contain extra DHCP options */
190 #define DHCP_OPTION_OVERLOAD_FILE 1
191 
192 /** The "sname" field is overloaded to contain extra DHCP options */
193 #define DHCP_OPTION_OVERLOAD_SNAME 2
194 
195 /** DHCP message type */
196 #define DHCP_MESSAGE_TYPE 53
197 #define DHCPNONE 0
198 #define DHCPDISCOVER 1
199 #define DHCPOFFER 2
200 #define DHCPREQUEST 3
201 #define DHCPDECLINE 4
202 #define DHCPACK 5
203 #define DHCPNAK 6
204 #define DHCPRELEASE 7
205 #define DHCPINFORM 8
206 
207 /** DHCP server identifier */
208 #define DHCP_SERVER_IDENTIFIER 54
209 
210 /** Parameter request list */
211 #define DHCP_PARAMETER_REQUEST_LIST 55
212 
213 /** Maximum DHCP message size */
214 #define DHCP_MAX_MESSAGE_SIZE 57
215 
216 /** Vendor class identifier */
217 #define DHCP_VENDOR_CLASS_ID 60
218 
219 /** Vendor class identifier for PXE clients */
220 #define DHCP_VENDOR_PXECLIENT( arch, ndi ) \
221  'P', 'X', 'E', 'C', 'l', 'i', 'e', 'n', 't', ':', \
222  'A', 'r', 'c', 'h', ':', DHCP_VENDOR_PXECLIENT_ARCH ( arch ), \
223  ':', 'U', 'N', 'D', 'I', ':', DHCP_VENDOR_PXECLIENT_UNDI ( ndi )
224 
225 /** Vendor class identifier architecture for PXE clients */
226 #define DHCP_VENDOR_PXECLIENT_ARCH( arch ) \
227  ( '0' + ( ( (arch) / 10000 ) % 10 ) ), \
228  ( '0' + ( ( (arch) / 1000 ) % 10 ) ), \
229  ( '0' + ( ( (arch) / 100 ) % 10 ) ), \
230  ( '0' + ( ( (arch) / 10 ) % 10 ) ), \
231  ( '0' + ( ( (arch) / 1 ) % 10 ) )
232 
233 /** Vendor class identifier UNDI version for PXE clients */
234 #define DHCP_VENDOR_PXECLIENT_UNDI( type, major, minor ) \
235  DHCP_VENDOR_PXECLIENT_UNDI_VERSION ( major ), \
236  DHCP_VENDOR_PXECLIENT_UNDI_VERSION ( minor )
237 #define DHCP_VENDOR_PXECLIENT_UNDI_VERSION( version ) \
238  ( '0' + ( ( (version) / 100 ) % 10 ) ), \
239  ( '0' + ( ( (version) / 10 ) % 10 ) ), \
240  ( '0' + ( ( (version) / 1 ) % 10 ) )
241 
242 /** Client identifier */
243 #define DHCP_CLIENT_ID 61
244 
245 /** Client identifier */
247  /** Link-layer protocol */
249  /** Link-layer address */
251 } __attribute__ (( packed ));
252 
253 /** TFTP server name
254  *
255  * This option replaces the fixed "sname" field, when that field is
256  * used to contain overloaded options.
257  */
258 #define DHCP_TFTP_SERVER_NAME 66
259 
260 /** Bootfile name
261  *
262  * This option replaces the fixed "file" field, when that field is
263  * used to contain overloaded options.
264  */
265 #define DHCP_BOOTFILE_NAME 67
266 
267 /** User class identifier */
268 #define DHCP_USER_CLASS_ID 77
269 
270 /** Client system architecture */
271 #define DHCP_CLIENT_ARCHITECTURE 93
272 
273 /** DHCP client architecture */
276 } __attribute__ (( packed ));
277 
278 /** DHCP client architecture values
279  *
280  * These are originally defined by the PXE specification, redefined by
281  * RFC4578, redefined again by RFC5970, and now maintained in the IANA
282  * DHCPv6 parameters registry.
283  */
285  /** Intel x86 PC */
287  /** NEC/PC98 */
289  /** EFI Itanium */
291  /** DEC Alpha */
293  /** Arc x86 */
295  /** Intel Lean Client */
297  /** EFI IA32 */
299  /** EFI x86-64 */
301  /** EFI Xscale */
303  /** EFI BC */
305  /** EFI 32-bit ARM */
307  /** EFI 64-bit ARM */
309  /** EFI 32-bit RISC-V */
311  /** EFI 64-bit RISC-V */
313  /** EFI 128-bit RISC-V */
315  /** EFI 32-bit MIPS */
317  /** EFI 64-bit MIPS */
319  /** EFI 32-bit Sunway */
321  /** EFI 64-bit Sunway */
323  /** EFI 32-bit LoongArch */
325  /** EFI 64-bit LoongArch */
327 };
328 
329 /** Client network device interface */
330 #define DHCP_CLIENT_NDI 94
331 
332 /** UUID client identifier */
333 #define DHCP_CLIENT_UUID 97
334 
335 /** UUID client identifier */
337  /** Identifier type */
339  /** UUID */
340  union uuid uuid;
341 } __attribute__ (( packed ));
342 
343 #define DHCP_CLIENT_UUID_TYPE 0
344 
345 /** DNS domain search list */
346 #define DHCP_DOMAIN_SEARCH 119
347 
348 /** Etherboot-specific encapsulated options
349  *
350  * This encapsulated options field is used to contain all options
351  * specific to Etherboot (i.e. not assigned by IANA or other standards
352  * bodies).
353  */
354 #define DHCP_EB_ENCAP 175
355 
356 /** Priority of this options block
357  *
358  * This is a signed 8-bit integer field indicating the priority of
359  * this block of options. It can be used to specify the relative
360  * priority of multiple option blocks (e.g. options from non-volatile
361  * storage versus options from a DHCP server).
362  */
363 #define DHCP_EB_PRIORITY DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x01 )
364 
365 /** "Your" IP address
366  *
367  * This option is used internally to contain the value of the "yiaddr"
368  * field, in order to provide a consistent approach to storing and
369  * processing options. It should never be present in a DHCP packet.
370  */
371 #define DHCP_EB_YIADDR DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x02 )
372 
373 /** "Server" IP address
374  *
375  * This option is used internally to contain the value of the "siaddr"
376  * field, in order to provide a consistent approach to storing and
377  * processing options. It should never be present in a DHCP packet.
378  */
379 #define DHCP_EB_SIADDR DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x03 )
380 
381 /** Keep SAN drive registered
382  *
383  * If set to a non-zero value, iPXE will not detach any SAN drive
384  * after failing to boot from it. (This option is required in order
385  * to perform an installation direct to an iSCSI target.)
386  */
387 #define DHCP_EB_KEEP_SAN DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x08 )
388 
389 /** Skip booting from SAN drive
390  *
391  * If set to a non-zero value, iPXE will skip booting from any SAN
392  * drive. (This option is sometimes required in conjunction with @c
393  * DHCP_EB_KEEP_SAN in order to perform an installation direct to an
394  * iSCSI target.)
395  */
396 #define DHCP_EB_SKIP_SAN_BOOT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x09 )
397 
398 /*
399  * Tags in the range 0x10-0x4f are reserved for feature markers
400  *
401  */
402 
403 /** Scriptlet
404  *
405  * If a scriptlet exists, it will be executed in place of the usual
406  * call to autoboot()
407  */
408 #define DHCP_EB_SCRIPTLET DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x51 )
409 
410 /** Encrypted syslog server */
411 #define DHCP_EB_SYSLOGS_SERVER DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x55 )
412 
413 /** Trusted root certficate fingerprints */
414 #define DHCP_EB_TRUST DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5a )
415 
416 /** Client certficate */
417 #define DHCP_EB_CERT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5b )
418 
419 /** Client private key */
420 #define DHCP_EB_KEY DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5c )
421 
422 /** Cross-signed certificate source */
423 #define DHCP_EB_CROSS_CERT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5d )
424 
425 /** Skip PXE DHCP protocol extensions such as ProxyDHCP
426  *
427  * If set to a non-zero value, iPXE will not wait for ProxyDHCP offers
428  * and will ignore any PXE-specific DHCP options that it receives.
429  */
430 #define DHCP_EB_NO_PXEDHCP DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb0 )
431 
432 /** Network device descriptor
433  *
434  * Byte 0 is the bus type ID; remaining bytes depend on the bus type.
435  *
436  * PCI devices:
437  * Byte 0 : 1 (PCI)
438  * Byte 1 : PCI vendor ID MSB
439  * Byte 2 : PCI vendor ID LSB
440  * Byte 3 : PCI device ID MSB
441  * Byte 4 : PCI device ID LSB
442  */
443 #define DHCP_EB_BUS_ID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb1 )
444 
445 /** Network device descriptor */
447  /** Bus type ID */
449  /** Vendor ID */
451  /** Device ID */
453 } __attribute__ (( packed ));
454 
455 /** Use cached network settings (obsolete; do not reuse this value) */
456 #define DHCP_EB_USE_CACHED DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb2 )
457 
458 /** SAN retry count
459  *
460  * This is the maximum number of times that SAN operations will be
461  * retried.
462  */
463 #define DHCP_EB_SAN_RETRY DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbb )
464 
465 /** SAN filename
466  *
467  * This is the path of the bootloader within the SAN device.
468  */
469 #define DHCP_EB_SAN_FILENAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbc )
470 
471 /** SAN drive number
472  *
473  * This is the drive number for a SAN-hooked drive. For BIOS, 0x80 is
474  * the first hard disk, 0x81 is the second hard disk, etc.
475  */
476 #define DHCP_EB_SAN_DRIVE DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbd )
477 
478 /** Username
479  *
480  * This will be used as the username for any required authentication.
481  * It is expected that this option's value will be held in
482  * non-volatile storage, rather than transmitted as part of a DHCP
483  * packet.
484  */
485 #define DHCP_EB_USERNAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbe )
486 
487 /** Password
488  *
489  * This will be used as the password for any required authentication.
490  * It is expected that this option's value will be held in
491  * non-volatile storage, rather than transmitted as part of a DHCP
492  * packet.
493  */
494 #define DHCP_EB_PASSWORD DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbf )
495 
496 /** Reverse username
497  *
498  * This will be used as the reverse username (i.e. the username
499  * provided by the server) for any required authentication. It is
500  * expected that this option's value will be held in non-volatile
501  * storage, rather than transmitted as part of a DHCP packet.
502  */
503 #define DHCP_EB_REVERSE_USERNAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc0 )
504 
505 /** Reverse password
506  *
507  * This will be used as the reverse password (i.e. the password
508  * provided by the server) for any required authentication. It is
509  * expected that this option's value will be held in non-volatile
510  * storage, rather than transmitted as part of a DHCP packet.
511  */
512 #define DHCP_EB_REVERSE_PASSWORD DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc1 )
513 
514 /** User ID
515  *
516  * This will be used as the user id for AUTH_SYS based authentication in NFS.
517  */
518 #define DHCP_EB_UID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc2 )
519 
520 /** Group ID
521  *
522  * This will be used as the group id for AUTH_SYS based authentication in NFS.
523  */
524 #define DHCP_EB_GID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc3 )
525 
526 /** iPXE version number */
527 #define DHCP_EB_VERSION DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xeb )
528 
529 /** iSCSI primary target IQN */
530 #define DHCP_ISCSI_PRIMARY_TARGET_IQN 201
531 
532 /** iSCSI secondary target IQN */
533 #define DHCP_ISCSI_SECONDARY_TARGET_IQN 202
534 
535 /** iSCSI initiator IQN */
536 #define DHCP_ISCSI_INITIATOR_IQN 203
537 
538 /** Maximum normal DHCP option */
539 #define DHCP_MAX_OPTION 254
540 
541 /** End of options
542  *
543  * This tag does not have a length field; it is always only a single
544  * byte in length.
545  */
546 #define DHCP_END 255
547 
548 /** @} */
549 
550 /** Construct a DHCP option from a list of bytes */
551 #define DHCP_OPTION( ... ) VA_ARG_COUNT ( __VA_ARGS__ ), __VA_ARGS__
552 
553 /** Construct a DHCP option from a list of characters */
554 #define DHCP_STRING( ... ) DHCP_OPTION ( __VA_ARGS__ )
555 
556 /** Construct a byte-valued DHCP option */
557 #define DHCP_BYTE( value ) DHCP_OPTION ( value )
558 
559 /** Construct a word-valued DHCP option */
560 #define DHCP_WORD( value ) DHCP_OPTION ( ( ( (value) >> 8 ) & 0xff ), \
561  ( ( (value) >> 0 ) & 0xff ) )
562 
563 /** Construct a dword-valued DHCP option */
564 #define DHCP_DWORD( value ) DHCP_OPTION ( ( ( (value) >> 24 ) & 0xff ), \
565  ( ( (value) >> 16 ) & 0xff ), \
566  ( ( (value) >> 8 ) & 0xff ), \
567  ( ( (value) >> 0 ) & 0xff ) )
568 
569 /** Construct a DHCP encapsulated options field */
570 #define DHCP_ENCAP( ... ) DHCP_OPTION ( __VA_ARGS__, DHCP_END )
571 
572 /**
573  * A DHCP option
574  *
575  * DHCP options consist of a mandatory tag, a length field that is
576  * mandatory for all options except @c DHCP_PAD and @c DHCP_END, and a
577  * payload.
578  */
579 struct dhcp_option {
580  /** Tag
581  *
582  * Must be a @c DHCP_XXX value.
583  */
585  /** Length
586  *
587  * This is the length of the data field (i.e. excluding the
588  * tag and length fields). For the two tags @c DHCP_PAD and
589  * @c DHCP_END, the length field is implicitly zero and is
590  * also missing, i.e. these DHCP options are only a single
591  * byte in length.
592  */
594  /** Option data */
596 } __attribute__ (( packed ));
597 
598 /**
599  * Length of a DHCP option header
600  *
601  * The header is the portion excluding the data, i.e. the tag and the
602  * length.
603  */
604 #define DHCP_OPTION_HEADER_LEN ( offsetof ( struct dhcp_option, data ) )
605 
606 /** Maximum length for a single DHCP option */
607 #define DHCP_MAX_LEN 0xff
608 
609 /**
610  * A DHCP header
611  *
612  */
613 struct dhcphdr {
614  /** Operation
615  *
616  * This must be either @c BOOTP_REQUEST or @c BOOTP_REPLY.
617  */
619  /** Hardware address type
620  *
621  * This is an ARPHRD_XXX constant. Note that ARPHRD_XXX
622  * constants are nominally 16 bits wide; this could be
623  * considered to be a bug in the BOOTP/DHCP specification.
624  */
626  /** Hardware address length */
628  /** Number of hops from server */
630  /** Transaction ID */
632  /** Seconds since start of acquisition */
634  /** Flags */
636  /** "Client" IP address
637  *
638  * This is filled in if the client already has an IP address
639  * assigned and can respond to ARP requests.
640  */
641  struct in_addr ciaddr;
642  /** "Your" IP address
643  *
644  * This is the IP address assigned by the server to the client.
645  */
646  struct in_addr yiaddr;
647  /** "Server" IP address
648  *
649  * This is the IP address of the next server to be used in the
650  * boot process.
651  */
652  struct in_addr siaddr;
653  /** "Gateway" IP address
654  *
655  * This is the IP address of the DHCP relay agent, if any.
656  */
657  struct in_addr giaddr;
658  /** Client hardware address */
660  /** Server host name (null terminated)
661  *
662  * This field may be overridden and contain DHCP options
663  */
664  char sname[64];
665  /** Boot file name (null terminated)
666  *
667  * This field may be overridden and contain DHCP options
668  */
669  char file[128];
670  /** DHCP magic cookie
671  *
672  * Must have the value @c DHCP_MAGIC_COOKIE.
673  */
675  /** DHCP options
676  *
677  * Variable length; extends to the end of the packet. Minimum
678  * length (for the sake of sanity) is 1, to allow for a single
679  * @c DHCP_END tag.
680  */
682 };
683 
684 /** Opcode for a request from client to server */
685 #define BOOTP_REQUEST 1
686 
687 /** Opcode for a reply from server to client */
688 #define BOOTP_REPLY 2
689 
690 /** BOOTP reply must be broadcast
691  *
692  * Clients that cannot accept unicast BOOTP replies must set this
693  * flag.
694  */
695 #define BOOTP_FL_BROADCAST 0x8000
696 
697 /** DHCP magic cookie */
698 #define DHCP_MAGIC_COOKIE 0x63825363UL
699 
700 /** DHCP minimum packet length
701  *
702  * This is the mandated minimum packet length that a DHCP participant
703  * must be prepared to receive.
704  */
705 #define DHCP_MIN_LEN 552
706 
707 /** Settings block name used for DHCP responses */
708 #define DHCP_SETTINGS_NAME "dhcp"
709 
710 /** Settings block name used for ProxyDHCP responses */
711 #define PROXYDHCP_SETTINGS_NAME "proxydhcp"
712 
713 /** Setting block name used for BootServerDHCP responses */
714 #define PXEBS_SETTINGS_NAME "pxebs"
715 
716 extern uint32_t dhcp_last_xid;
717 extern int dhcp_create_packet ( struct dhcp_packet *dhcppkt,
718  struct net_device *netdev, uint8_t msgtype,
719  uint32_t xid, const void *options,
720  size_t options_len, void *data,
721  size_t max_len );
722 extern int dhcp_create_request ( struct dhcp_packet *dhcppkt,
723  struct net_device *netdev,
724  unsigned int msgtype, uint32_t xid,
725  struct in_addr ciaddr,
726  void *data, size_t max_len );
727 extern int start_dhcp ( struct interface *job, struct net_device *netdev );
728 extern int start_pxebs ( struct interface *job, struct net_device *netdev,
729  unsigned int pxe_type );
730 
731 #endif /* _IPXE_DHCP_H */
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
EFI 64-bit RISC-V.
Definition: dhcp.h:312
#define __attribute__(x)
Definition: compiler.h:10
EFI 32-bit LoongArch.
Definition: dhcp.h:324
unsigned short uint16_t
Definition: stdint.h:11
DHCP client architecture.
Definition: dhcp.h:274
A DHCP packet.
Definition: dhcppkt.h:20
uint8_t timeout
Timeout.
Definition: dhcp.h:153
uint8_t data[0]
Option data.
Definition: dhcp.h:595
uint8_t num_ip
Number of IPv4 addresses.
Definition: dhcp.h:121
uint8_t type
Bus type ID.
Definition: dhcp.h:448
uint16_t type
"Type"
Definition: dhcp.h:119
A universally unique ID.
Definition: uuid.h:15
PXE boot menu prompt.
Definition: dhcp.h:143
uint16_t max_len
Maximum length (in bytes)
Definition: ntlm.h:18
int dhcp_create_request(struct dhcp_packet *dhcppkt, struct net_device *netdev, unsigned int msgtype, uint32_t xid, struct in_addr ciaddr, void *data, size_t max_len)
Create DHCP request packet.
Definition: dhcp.c:1007
uint8_t htype
Hardware address type.
Definition: dhcp.h:625
Universally unique IDs.
dhcp_client_architecture_values
DHCP client architecture values.
Definition: dhcp.h:284
uint8_t options[0]
DHCP options.
Definition: dhcp.h:681
uint32_t xid
Transaction ID.
Definition: dhcp.h:631
uint16_t secs
Seconds since start of acquisition.
Definition: dhcp.h:633
EFI 64-bit MIPS.
Definition: dhcp.h:318
Access to external ("user") memory.
int start_dhcp(struct interface *job, struct net_device *netdev)
Start DHCP state machine on a network device.
Definition: dhcp.c:1357
uint8_t tag
Tag.
Definition: dhcp.h:584
uint16_t layer
"Layer"
Definition: dhcp.h:173
uint8_t len
Length.
Definition: dhcp.h:593
uint16_t type
"Type"
Definition: dhcp.h:132
dhcp_pxe_discovery_control
PXE boot server discovery control bits.
Definition: dhcp.h:99
uint16_t type
"Type"
Definition: dhcp.h:168
EFI 64-bit Sunway.
Definition: dhcp.h:322
uint16_t flags
Flags.
Definition: dhcp.h:635
#define MAX_LL_ADDR_LEN
Maximum length of a link-layer address.
Definition: netdevice.h:36
uint8_t op
Operation.
Definition: dhcp.h:618
An object interface.
Definition: interface.h:124
uint32_t dhcp_last_xid
Most recent DHCP transaction ID.
Definition: dhcp.c:124
static int options
Definition: 3c515.c:286
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: dhcp.h:250
static struct net_device * netdev
Definition: gdbudp.c:52
int dhcp_create_packet(struct dhcp_packet *dhcppkt, struct net_device *netdev, uint8_t msgtype, uint32_t xid, const void *options, size_t options_len, void *data, size_t max_len)
Create a DHCP packet.
Definition: dhcp.c:944
struct in_addr ciaddr
"Client" IP address
Definition: dhcp.h:641
struct in_addr siaddr
"Server" IP address
Definition: dhcp.h:652
EFI 64-bit LoongArch.
Definition: dhcp.h:326
Linked lists.
struct in_addr ip[0]
IPv4 addresses.
Definition: dhcp.h:123
EFI 32-bit MIPS.
Definition: dhcp.h:316
IP address structure.
Definition: in.h:39
Client identifier.
Definition: dhcp.h:246
int start_pxebs(struct interface *job, struct net_device *netdev, unsigned int pxe_type)
Start PXE Boot Server Discovery on a network device.
Definition: dhcp.c:1447
uint8_t chaddr[16]
Client hardware address.
Definition: dhcp.h:659
uint16_t device
Device ID.
Definition: dhcp.h:452
char prompt[0]
Prompt to press F8.
Definition: dhcp.h:155
A network device.
Definition: netdevice.h:352
Network device descriptor.
Definition: dhcp.h:446
char desc[0]
Description.
Definition: dhcp.h:136
unsigned char uint8_t
Definition: stdint.h:10
struct in_addr yiaddr
"Your" IP address
Definition: dhcp.h:646
Intel Lean Client.
Definition: dhcp.h:296
unsigned int uint32_t
Definition: stdint.h:12
Accept only servers in DHCP_PXE_BOOT_SERVERS list.
Definition: dhcp.h:105
uint8_t hops
Number of hops from server.
Definition: dhcp.h:629
Inhibit broadcast discovery.
Definition: dhcp.h:101
EFI 32-bit ARM.
Definition: dhcp.h:306
EFI 64-bit ARM.
Definition: dhcp.h:308
UUID client identifier.
Definition: dhcp.h:336
A DHCP header.
Definition: dhcp.h:613
Network device management.
PXE boot menu item.
Definition: dhcp.h:162
uint8_t type
Identifier type.
Definition: dhcp.h:338
Skip discovery if filename present.
Definition: dhcp.h:107
A DHCP option.
Definition: dhcp.h:579
char sname[64]
Server host name (null terminated)
Definition: dhcp.h:664
Reference counting.
uint8_t data[48]
Additional event data.
Definition: ena.h:22
char file[128]
Boot file name (null terminated)
Definition: dhcp.h:669
uint32_t magic
DHCP magic cookie.
Definition: dhcp.h:674
Linker tables.
EFI 128-bit RISC-V.
Definition: dhcp.h:314
EFI 32-bit RISC-V.
Definition: dhcp.h:310
uint16_t vendor
Vendor ID.
Definition: dhcp.h:450
uint8_t hlen
Hardware address length.
Definition: dhcp.h:627
PXE boot menu.
Definition: dhcp.h:130
struct in_addr giaddr
"Gateway" IP address
Definition: dhcp.h:657
PXE boot server.
Definition: dhcp.h:117
uint8_t desc_len
Description length.
Definition: dhcp.h:134
EFI 32-bit Sunway.
Definition: dhcp.h:320
Inhibit multicast discovery.
Definition: dhcp.h:103
uint8_t ll_proto
Link-layer protocol.
Definition: dhcp.h:248
A DHCP options block.
Definition: dhcpopts.h:15