26 #define BOOTPS_PORT 67 29 #define BOOTPC_PORT 68 40 #define DHCP_ENCAP_OPT( encapsulator, encapsulated ) \ 41 ( ( (encapsulator) << 8 ) | (encapsulated) ) 43 #define DHCP_ENCAPSULATOR( encap_opt ) ( (encap_opt) >> 8 ) 45 #define DHCP_ENCAPSULATED( encap_opt ) ( (encap_opt) & 0xff ) 47 #define DHCP_IS_ENCAP_OPT( opt ) DHCP_ENCAPSULATOR( opt ) 62 #define DHCP_MIN_OPTION 1 65 #define DHCP_SUBNET_MASK 1 68 #define DHCP_ROUTERS 3 71 #define DHCP_DNS_SERVERS 6 74 #define DHCP_LOG_SERVERS 7 77 #define DHCP_HOST_NAME 12 80 #define DHCP_DOMAIN_NAME 15 83 #define DHCP_ROOT_PATH 17 89 #define DHCP_NTP_SERVERS 42 92 #define DHCP_VENDOR_ENCAP 43 95 #define DHCP_PXE_DISCOVERY_CONTROL DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 6 ) 110 #define DHCP_PXE_BOOT_SERVER_MCAST DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 7 ) 113 #define DHCP_PXE_BOOT_SERVERS DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 8 ) 126 #define DHCP_PXE_BOOT_MENU DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 9 ) 139 #define DHCP_PXE_BOOT_MENU_PROMPT DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 10 ) 158 #define DHCP_PXE_BOOT_MENU_ITEM DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 71 ) 176 #define DHCP_REQUESTED_ADDRESS 50 179 #define DHCP_LEASE_TIME 51 186 #define DHCP_OPTION_OVERLOAD 52 189 #define DHCP_OPTION_OVERLOAD_FILE 1 192 #define DHCP_OPTION_OVERLOAD_SNAME 2 195 #define DHCP_MESSAGE_TYPE 53 197 #define DHCPDISCOVER 1 199 #define DHCPREQUEST 3 200 #define DHCPDECLINE 4 203 #define DHCPRELEASE 7 207 #define DHCP_SERVER_IDENTIFIER 54 210 #define DHCP_PARAMETER_REQUEST_LIST 55 213 #define DHCP_MAX_MESSAGE_SIZE 57 216 #define DHCP_VENDOR_CLASS_ID 60 219 #define DHCP_VENDOR_PXECLIENT( arch, ndi ) \ 220 'P', 'X', 'E', 'C', 'l', 'i', 'e', 'n', 't', ':', \ 221 'A', 'r', 'c', 'h', ':', DHCP_VENDOR_PXECLIENT_ARCH ( arch ), \ 222 ':', 'U', 'N', 'D', 'I', ':', DHCP_VENDOR_PXECLIENT_UNDI ( ndi ) 225 #define DHCP_VENDOR_PXECLIENT_ARCH( arch ) \ 226 ( '0' + ( ( (arch) / 10000 ) % 10 ) ), \ 227 ( '0' + ( ( (arch) / 1000 ) % 10 ) ), \ 228 ( '0' + ( ( (arch) / 100 ) % 10 ) ), \ 229 ( '0' + ( ( (arch) / 10 ) % 10 ) ), \ 230 ( '0' + ( ( (arch) / 1 ) % 10 ) ) 233 #define DHCP_VENDOR_PXECLIENT_UNDI( type, major, minor ) \ 234 DHCP_VENDOR_PXECLIENT_UNDI_VERSION ( major ), \ 235 DHCP_VENDOR_PXECLIENT_UNDI_VERSION ( minor ) 236 #define DHCP_VENDOR_PXECLIENT_UNDI_VERSION( version ) \ 237 ( '0' + ( ( (version) / 100 ) % 10 ) ), \ 238 ( '0' + ( ( (version) / 10 ) % 10 ) ), \ 239 ( '0' + ( ( (version) / 1 ) % 10 ) ) 242 #define DHCP_CLIENT_ID 61 257 #define DHCP_TFTP_SERVER_NAME 66 264 #define DHCP_BOOTFILE_NAME 67 267 #define DHCP_USER_CLASS_ID 77 270 #define DHCP_CLIENT_ARCHITECTURE 93 329 #define DHCP_CLIENT_NDI 94 332 #define DHCP_CLIENT_UUID 97 342 #define DHCP_CLIENT_UUID_TYPE 0 345 #define DHCP_DOMAIN_SEARCH 119 348 #define DHCP_STATIC_ROUTES 121 356 #define DHCP_EB_ENCAP 175 365 #define DHCP_EB_PRIORITY DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x01 ) 373 #define DHCP_EB_YIADDR DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x02 ) 381 #define DHCP_EB_SIADDR DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x03 ) 389 #define DHCP_EB_KEEP_SAN DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x08 ) 398 #define DHCP_EB_SKIP_SAN_BOOT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x09 ) 410 #define DHCP_EB_SCRIPTLET DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x51 ) 413 #define DHCP_EB_SYSLOGS_SERVER DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x55 ) 416 #define DHCP_EB_TRUST DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5a ) 419 #define DHCP_EB_CERT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5b ) 422 #define DHCP_EB_KEY DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5c ) 425 #define DHCP_EB_CROSS_CERT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5d ) 432 #define DHCP_EB_NO_PXEDHCP DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb0 ) 445 #define DHCP_EB_BUS_ID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb1 ) 458 #define DHCP_EB_USE_CACHED DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb2 ) 465 #define DHCP_EB_SAN_RETRY DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbb ) 471 #define DHCP_EB_SAN_FILENAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbc ) 478 #define DHCP_EB_SAN_DRIVE DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbd ) 487 #define DHCP_EB_USERNAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbe ) 496 #define DHCP_EB_PASSWORD DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbf ) 505 #define DHCP_EB_REVERSE_USERNAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc0 ) 514 #define DHCP_EB_REVERSE_PASSWORD DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc1 ) 520 #define DHCP_EB_UID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc2 ) 526 #define DHCP_EB_GID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc3 ) 529 #define DHCP_EB_VERSION DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xeb ) 532 #define DHCP_ISCSI_PRIMARY_TARGET_IQN 201 535 #define DHCP_ISCSI_SECONDARY_TARGET_IQN 202 538 #define DHCP_ISCSI_INITIATOR_IQN 203 541 #define DHCP_MAX_OPTION 254 553 #define DHCP_OPTION( ... ) VA_ARG_COUNT ( __VA_ARGS__ ), __VA_ARGS__ 556 #define DHCP_STRING( ... ) DHCP_OPTION ( __VA_ARGS__ ) 559 #define DHCP_BYTE( value ) DHCP_OPTION ( value ) 562 #define DHCP_WORD( value ) DHCP_OPTION ( ( ( (value) >> 8 ) & 0xff ), \ 563 ( ( (value) >> 0 ) & 0xff ) ) 566 #define DHCP_DWORD( value ) DHCP_OPTION ( ( ( (value) >> 24 ) & 0xff ), \ 567 ( ( (value) >> 16 ) & 0xff ), \ 568 ( ( (value) >> 8 ) & 0xff ), \ 569 ( ( (value) >> 0 ) & 0xff ) ) 572 #define DHCP_ENCAP( ... ) DHCP_OPTION ( __VA_ARGS__, DHCP_END ) 606 #define DHCP_OPTION_HEADER_LEN ( offsetof ( struct dhcp_option, data ) ) 609 #define DHCP_MAX_LEN 0xff 687 #define BOOTP_REQUEST 1 690 #define BOOTP_REPLY 2 697 #define BOOTP_FL_BROADCAST 0x8000 700 #define DHCP_MAGIC_COOKIE 0x63825363UL 707 #define DHCP_MIN_LEN 552 710 #define DHCP_SETTINGS_NAME "dhcp" 713 #define PROXYDHCP_SETTINGS_NAME "proxydhcp" 716 #define PXEBS_SETTINGS_NAME "pxebs" 722 size_t options_len,
void *
data,
728 void *
data,
size_t max_len );
731 unsigned int pxe_type );
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
DHCP client architecture.
uint8_t data[0]
Option data.
uint8_t num_ip
Number of IPv4 addresses.
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.
uint8_t htype
Hardware address type.
dhcp_client_architecture_values
DHCP client architecture values.
uint8_t options[0]
DHCP options.
uint32_t xid
Transaction ID.
uint16_t secs
Seconds since start of acquisition.
int start_dhcp(struct interface *job, struct net_device *netdev)
Start DHCP state machine on a network device.
dhcp_pxe_discovery_control
PXE boot server discovery control bits.
#define MAX_LL_ADDR_LEN
Maximum length of a link-layer address.
uint32_t dhcp_last_xid
Most recent DHCP transaction ID.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
static struct net_device * netdev
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.
struct in_addr ciaddr
"Client" IP address
struct in_addr siaddr
"Server" IP address
struct in_addr ip[0]
IPv4 addresses.
int start_pxebs(struct interface *job, struct net_device *netdev, unsigned int pxe_type)
Start PXE Boot Server Discovery on a network device.
uint8_t chaddr[16]
Client hardware address.
uint16_t device
Device ID.
Network device descriptor.
struct in_addr yiaddr
"Your" IP address
Accept only servers in DHCP_PXE_BOOT_SERVERS list.
uint8_t hops
Number of hops from server.
Inhibit broadcast discovery.
Network device management.
uint8_t type
Identifier type.
Skip discovery if filename present.
char sname[64]
Server host name (null terminated)
uint8_t data[48]
Additional event data.
char file[128]
Boot file name (null terminated)
uint32_t magic
DHCP magic cookie.
uint16_t vendor
Vendor ID.
uint8_t hlen
Hardware address length.
struct in_addr giaddr
"Gateway" IP address
Inhibit multicast discovery.
uint8_t ll_proto
Link-layer protocol.