|
#define | BOOTPS_PORT 67 |
| BOOTP/DHCP server port. More...
|
|
#define | BOOTPC_PORT 68 |
| BOOTP/DHCP client port. More...
|
|
#define | PXE_PORT 4011 |
| PXE server port. More...
|
|
#define | DHCP_ENCAP_OPT(encapsulator, encapsulated) ( ( (encapsulator) << 8 ) | (encapsulated) ) |
| Construct a tag value for an encapsulated option. More...
|
|
#define | DHCP_ENCAPSULATOR(encap_opt) ( (encap_opt) >> 8 ) |
| Extract encapsulating option block tag from encapsulated tag value. More...
|
|
#define | DHCP_ENCAPSULATED(encap_opt) ( (encap_opt) & 0xff ) |
| Extract encapsulated option tag from encapsulated tag value. More...
|
|
#define | DHCP_IS_ENCAP_OPT(opt) DHCP_ENCAPSULATOR( opt ) |
| Option is encapsulated. More...
|
|
#define | DHCP_PAD 0 |
| Padding. More...
|
|
#define | DHCP_MIN_OPTION 1 |
| Minimum normal DHCP option. More...
|
|
#define | DHCP_SUBNET_MASK 1 |
| Subnet mask. More...
|
|
#define | DHCP_ROUTERS 3 |
| Routers. More...
|
|
#define | DHCP_DNS_SERVERS 6 |
| DNS servers. More...
|
|
#define | DHCP_LOG_SERVERS 7 |
| Syslog servers. More...
|
|
#define | DHCP_HOST_NAME 12 |
| Host name. More...
|
|
#define | DHCP_DOMAIN_NAME 15 |
| Domain name. More...
|
|
#define | DHCP_ROOT_PATH 17 |
| Root path. More...
|
|
#define | DHCP_MTU 26 |
| Maximum transmission unit. More...
|
|
#define | DHCP_NTP_SERVERS 42 |
| NTP servers. More...
|
|
#define | DHCP_VENDOR_ENCAP 43 |
| Vendor encapsulated options. More...
|
|
#define | DHCP_PXE_DISCOVERY_CONTROL DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 6 ) |
| PXE boot server discovery control. More...
|
|
#define | DHCP_PXE_BOOT_SERVER_MCAST DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 7 ) |
| PXE boot server multicast address. More...
|
|
#define | DHCP_PXE_BOOT_SERVERS DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 8 ) |
| PXE boot servers. More...
|
|
#define | DHCP_PXE_BOOT_MENU DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 9 ) |
| PXE boot menu. More...
|
|
#define | DHCP_PXE_BOOT_MENU_PROMPT DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 10 ) |
| PXE boot menu prompt. More...
|
|
#define | DHCP_PXE_BOOT_MENU_ITEM DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 71 ) |
| PXE boot menu item. More...
|
|
#define | DHCP_REQUESTED_ADDRESS 50 |
| Requested IP address. More...
|
|
#define | DHCP_LEASE_TIME 51 |
| Lease time. More...
|
|
#define | DHCP_OPTION_OVERLOAD 52 |
| Option overloading. More...
|
|
#define | DHCP_OPTION_OVERLOAD_FILE 1 |
| The "file" field is overloaded to contain extra DHCP options. More...
|
|
#define | DHCP_OPTION_OVERLOAD_SNAME 2 |
| The "sname" field is overloaded to contain extra DHCP options. More...
|
|
#define | DHCP_MESSAGE_TYPE 53 |
| DHCP message type. More...
|
|
#define | DHCPNONE 0 |
|
#define | DHCPDISCOVER 1 |
|
#define | DHCPOFFER 2 |
|
#define | DHCPREQUEST 3 |
|
#define | DHCPDECLINE 4 |
|
#define | DHCPACK 5 |
|
#define | DHCPNAK 6 |
|
#define | DHCPRELEASE 7 |
|
#define | DHCPINFORM 8 |
|
#define | DHCP_SERVER_IDENTIFIER 54 |
| DHCP server identifier. More...
|
|
#define | DHCP_PARAMETER_REQUEST_LIST 55 |
| Parameter request list. More...
|
|
#define | DHCP_MAX_MESSAGE_SIZE 57 |
| Maximum DHCP message size. More...
|
|
#define | DHCP_VENDOR_CLASS_ID 60 |
| Vendor class identifier. More...
|
|
#define | DHCP_VENDOR_PXECLIENT(arch, ndi) |
| Vendor class identifier for PXE clients. More...
|
|
#define | DHCP_VENDOR_PXECLIENT_ARCH(arch) |
| Vendor class identifier architecture for PXE clients. More...
|
|
#define | DHCP_VENDOR_PXECLIENT_UNDI(type, major, minor) |
| Vendor class identifier UNDI version for PXE clients. More...
|
|
#define | DHCP_VENDOR_PXECLIENT_UNDI_VERSION(version) |
|
#define | DHCP_CLIENT_ID 61 |
| Client identifier. More...
|
|
#define | DHCP_TFTP_SERVER_NAME 66 |
| TFTP server name. More...
|
|
#define | DHCP_BOOTFILE_NAME 67 |
| Bootfile name. More...
|
|
#define | DHCP_USER_CLASS_ID 77 |
| User class identifier. More...
|
|
#define | DHCP_CLIENT_ARCHITECTURE 93 |
| Client system architecture. More...
|
|
#define | DHCP_CLIENT_NDI 94 |
| Client network device interface. More...
|
|
#define | DHCP_CLIENT_UUID 97 |
| UUID client identifier. More...
|
|
#define | DHCP_CLIENT_UUID_TYPE 0 |
|
#define | DHCP_DOMAIN_SEARCH 119 |
| DNS domain search list. More...
|
|
#define | DHCP_EB_ENCAP 175 |
| Etherboot-specific encapsulated options. More...
|
|
#define | DHCP_EB_PRIORITY DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x01 ) |
| Priority of this options block. More...
|
|
#define | DHCP_EB_YIADDR DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x02 ) |
| "Your" IP address More...
|
|
#define | DHCP_EB_SIADDR DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x03 ) |
| "Server" IP address More...
|
|
#define | DHCP_EB_KEEP_SAN DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x08 ) |
| Keep SAN drive registered. More...
|
|
#define | DHCP_EB_SKIP_SAN_BOOT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x09 ) |
| Skip booting from SAN drive. More...
|
|
#define | DHCP_EB_SCRIPTLET DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x51 ) |
| Scriptlet. More...
|
|
#define | DHCP_EB_SYSLOGS_SERVER DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x55 ) |
| Encrypted syslog server. More...
|
|
#define | DHCP_EB_TRUST DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5a ) |
| Trusted root certficate fingerprints. More...
|
|
#define | DHCP_EB_CERT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5b ) |
| Client certficate. More...
|
|
#define | DHCP_EB_KEY DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5c ) |
| Client private key. More...
|
|
#define | DHCP_EB_CROSS_CERT DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x5d ) |
| Cross-signed certificate source. More...
|
|
#define | DHCP_EB_NO_PXEDHCP DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb0 ) |
| Skip PXE DHCP protocol extensions such as ProxyDHCP. More...
|
|
#define | DHCP_EB_BUS_ID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb1 ) |
| Network device descriptor. More...
|
|
#define | DHCP_EB_USE_CACHED DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb2 ) |
| Use cached network settings (obsolete; do not reuse this value) More...
|
|
#define | DHCP_EB_SAN_RETRY DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbb ) |
| SAN retry count. More...
|
|
#define | DHCP_EB_SAN_FILENAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbc ) |
| SAN filename. More...
|
|
#define | DHCP_EB_SAN_DRIVE DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbd ) |
| SAN drive number. More...
|
|
#define | DHCP_EB_USERNAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbe ) |
| Username. More...
|
|
#define | DHCP_EB_PASSWORD DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbf ) |
| Password. More...
|
|
#define | DHCP_EB_REVERSE_USERNAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc0 ) |
| Reverse username. More...
|
|
#define | DHCP_EB_REVERSE_PASSWORD DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc1 ) |
| Reverse password. More...
|
|
#define | DHCP_EB_UID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc2 ) |
| User ID. More...
|
|
#define | DHCP_EB_GID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc3 ) |
| Group ID. More...
|
|
#define | DHCP_EB_VERSION DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xeb ) |
| iPXE version number More...
|
|
#define | DHCP_ISCSI_PRIMARY_TARGET_IQN 201 |
| iSCSI primary target IQN More...
|
|
#define | DHCP_ISCSI_SECONDARY_TARGET_IQN 202 |
| iSCSI secondary target IQN More...
|
|
#define | DHCP_ISCSI_INITIATOR_IQN 203 |
| iSCSI initiator IQN More...
|
|
#define | DHCP_MAX_OPTION 254 |
| Maximum normal DHCP option. More...
|
|
#define | DHCP_END 255 |
| End of options. More...
|
|
#define | DHCP_OPTION(...) VA_ARG_COUNT ( __VA_ARGS__ ), __VA_ARGS__ |
| Construct a DHCP option from a list of bytes. More...
|
|
#define | DHCP_STRING(...) DHCP_OPTION ( __VA_ARGS__ ) |
| Construct a DHCP option from a list of characters. More...
|
|
#define | DHCP_BYTE(value) DHCP_OPTION ( value ) |
| Construct a byte-valued DHCP option. More...
|
|
#define | DHCP_WORD(value) |
| Construct a word-valued DHCP option. More...
|
|
#define | DHCP_DWORD(value) |
| Construct a dword-valued DHCP option. More...
|
|
#define | DHCP_ENCAP(...) DHCP_OPTION ( __VA_ARGS__, DHCP_END ) |
| Construct a DHCP encapsulated options field. More...
|
|
#define | DHCP_OPTION_HEADER_LEN ( offsetof ( struct dhcp_option, data ) ) |
| Length of a DHCP option header. More...
|
|
#define | DHCP_MAX_LEN 0xff |
| Maximum length for a single DHCP option. More...
|
|
#define | BOOTP_REQUEST 1 |
| Opcode for a request from client to server. More...
|
|
#define | BOOTP_REPLY 2 |
| Opcode for a reply from server to client. More...
|
|
#define | BOOTP_FL_BROADCAST 0x8000 |
| BOOTP reply must be broadcast. More...
|
|
#define | DHCP_MAGIC_COOKIE 0x63825363UL |
| DHCP magic cookie. More...
|
|
#define | DHCP_MIN_LEN 552 |
| DHCP minimum packet length. More...
|
|
#define | DHCP_SETTINGS_NAME "dhcp" |
| Settings block name used for DHCP responses. More...
|
|
#define | PROXYDHCP_SETTINGS_NAME "proxydhcp" |
| Settings block name used for ProxyDHCP responses. More...
|
|
#define | PXEBS_SETTINGS_NAME "pxebs" |
| Setting block name used for BootServerDHCP responses. More...
|
|
Dynamic Host Configuration Protocol.
Definition in file dhcp.h.
Create DHCP request packet.
- Parameters
-
dhcppkt | DHCP packet structure to fill in |
netdev | Network device |
msgtype | DHCP message type |
xid | Transaction ID (in network-endian order) |
ciaddr | Client IP address |
data | Buffer for DHCP packet |
max_len | Size of DHCP packet buffer |
- Return values
-
Creates a DHCP request packet in the specified buffer, and initialise a DHCP packet structure.
Definition at line 1007 of file dhcp.c.
1016 size_t dhcp_features_len;
1027 data, max_len ) ) != 0 ) {
1028 DBG (
"DHCP could not create DHCP packet: %s\n",
1030 goto err_create_packet;
1040 dhcp_features_len ) ) != 0 ) {
1041 DBG (
"DHCP could not set features list option: %s\n",
1043 goto err_store_features;
1048 &dhcp_desc,
sizeof ( dhcp_desc ) );
1050 sizeof ( dhcp_desc ) ) ) != 0 ) {
1051 DBG (
"DHCP could not set bus ID option: %s\n",
1053 goto err_store_busid;
1061 assert ( ll_addr_len <=
sizeof ( client_id.ll_addr ) );
1064 ( ll_addr_len + 1 ) ) ) != 0 ) {
1065 DBG (
"DHCP could not set client ID: %s\n",
1067 goto err_store_client_id;
1077 &client_uuid.uuid ) ) >= 0 ) {
1081 sizeof ( client_uuid ) ) ) != 0 ) {
1082 DBG (
"DHCP could not set client UUID: %s\n",
1084 goto err_store_client_uuid;
1097 DBG (
"DHCP could not set %s: %s\n",
1105 err_store_client_uuid:
1106 err_store_client_id:
#define DHCP_FEATURES
DHCP feature table.
#define DHCP_CLIENT_UUID
UUID client identifier.
struct arbelprm_rc_send_wqe rc
uint8_t ll_addr_len
Link-layer address length.
#define table_start(table)
Get start of linker table.
#define DHCP_EB_ENCAP
Etherboot-specific encapsulated options.
static const struct setting * dhcp_request_settings[]
Settings copied in to all DHCP requests.
int fetch_raw_setting_copy(struct settings *settings, const struct setting *setting, void **data)
Fetch value of setting.
int fetch_raw_setting(struct settings *settings, const struct setting *setting, void *data, size_t len)
Fetch value of setting.
static uint8_t dhcp_request_options_data[]
Raw option data for options common to all DHCP requests.
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
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.
static void uuid_mangle(union uuid *uuid)
Change UUID endianness.
uint64_t tag
Setting tag, if applicable.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static struct net_device * netdev
struct in_addr ciaddr
"Client" IP address
#define DHCP_CLIENT_UUID_TYPE
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
Network device descriptor.
int dhcppkt_store(struct dhcp_packet *dhcppkt, unsigned int tag, const void *data, size_t len)
Store value of DHCP packet setting.
uint16_t ll_proto
Link-layer protocol.
#define DHCP_CLIENT_ID
Client identifier.
struct dhcphdr * dhcphdr
The DHCP packet contents.
uint8_t data[48]
Additional event data.
int fetch_uuid_setting(struct settings *settings, const struct setting *setting, union uuid *uuid)
Fetch value of UUID setting.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
#define DBG(...)
Print a debugging message.
#define DHCP_EB_BUS_ID
Network device descriptor.
#define NULL
NULL pointer (VOID *)
struct ll_protocol * ll_protocol
Link-layer protocol.
#define table_num_entries(table)
Get number of entries in linker table.
References assert(), dhcphdr::ciaddr, data, DBG, DHCP_CLIENT_ID, DHCP_CLIENT_UUID, DHCP_CLIENT_UUID_TYPE, dhcp_create_packet(), DHCP_EB_BUS_ID, DHCP_EB_ENCAP, DHCP_FEATURES, dhcp_request_options_data, dhcp_request_settings, dhcp_packet::dhcphdr, dhcppkt_store(), fetch_raw_setting(), fetch_raw_setting_copy(), fetch_uuid_setting(), free, len, dhcp_client_id::ll_addr, net_device::ll_addr, ll_protocol::ll_addr_len, ll_protocol::ll_proto, dhcp_client_id::ll_proto, net_device::ll_protocol, memcpy(), setting::name, netdev, netdev_settings(), ntohs, NULL, raw, rc, strerror(), table_num_entries, table_start, setting::tag, dhcp_client_uuid::type, dhcp_client_uuid::uuid, and uuid_mangle().
Referenced by create_fakedhcpdiscover(), and dhcp_tx().
Start PXE Boot Server Discovery on a network device.
- Parameters
-
job | Job control interface |
netdev | Network device |
pxe_type | PXE server type |
- Return values
-
Starts PXE Boot Server Discovery on the specified network device. If successful, the Boot Server ACK will be registered as an option source.
Definition at line 1447 of file dhcp.c.
1449 struct setting pxe_discovery_control_setting =
1451 struct setting pxe_boot_servers_setting =
1453 struct setting pxe_boot_server_mcast_setting =
1458 unsigned int pxe_discovery_control;
1464 if ( pxebs_list_len < 0 )
1468 dhcp =
zalloc (
sizeof ( *dhcp ) +
sizeof ( *
ip ) +
1469 sizeof ( *
ip ) + pxebs_list_len +
1485 pxe_discovery_control =
1487 ip = ( ( (
void * ) dhcp ) +
sizeof ( *dhcp ) );
1498 if ( pxebs_list_len ) {
1502 buf,
sizeof ( buf ) );
1506 DBGC ( dhcp,
"DHCP %p has no PXE boot servers for type %04x\n",
1513 DBGC ( dhcp,
"DHCP %p attempting", dhcp );
1516 DBGC ( dhcp,
"\n" );
1518 DBGC ( dhcp,
"DHCP %p accepting", dhcp );
1521 DBGC ( dhcp,
"\n" );
#define EINVAL
Invalid argument.
static void dhcp_set_state(struct dhcp_session *dhcp, struct dhcp_session_state *state)
Transition to new DHCP session state.
static void dhcp_free(struct refcnt *refcnt)
Free DHCP session.
struct arbelprm_rc_send_wqe rc
static void dhcp_timer_expired(struct retry_timer *timer, int fail)
Handle DHCP retry timer expiry.
static void dhcp_finished(struct dhcp_session *dhcp, int rc)
Mark DHCP session as complete.
struct retry_timer timer
Retransmission timer.
static struct interface_descriptor dhcp_job_desc
DHCP job control interface descriptor.
#define ref_init(refcnt, free)
Initialise a reference counter.
int xfer_open_socket(struct interface *intf, int semantics, struct sockaddr *peer, struct sockaddr *local)
Open socket.
int fetch_ipv4_setting(struct settings *settings, const struct setting *setting, struct in_addr *inp)
Fetch value of IPv4 address setting.
static struct sockaddr dhcp_peer
DHCP peer address for socket opening.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
int fetch_raw_setting(struct settings *settings, const struct setting *setting, void *data, size_t len)
Fetch value of setting.
struct refcnt refcnt
Reference counter.
struct interface job
Job control interface.
sa_family_t sin_family
Socket address family (part of struct sockaddr)
static void pxebs_list(struct dhcp_session *dhcp, void *raw, size_t raw_len, struct in_addr *ip)
Retrieve list of PXE boot servers for a given server type.
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
uint64_t tag
Setting tag, if applicable.
struct sockaddr_in local
Local socket address.
#define ENOMEM
Not enough space.
static struct interface_descriptor dhcp_xfer_desc
DHCP data transfer interface descriptor.
uint16_t pxe_type
PXE Boot Server type.
static struct net_device * netdev
Generalized socket address structure.
struct interface xfer
Data transfer interface.
void * zalloc(size_t size)
Allocate cleared memory.
uint16_t sin_port
TCP/IP port (part of struct sockaddr_tcpip)
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
IP4_t ip
Destination IP address.
unsigned long fetch_uintz_setting(struct settings *settings, const struct setting *setting)
Fetch value of unsigned integer setting, or zero.
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
Accept only servers in DHCP_PXE_BOOT_SERVERS list.
Inhibit broadcast discovery.
struct in_addr sin_addr
IPv4 address.
#define BOOTPC_PORT
BOOTP/DHCP client port.
struct in_addr * pxe_attempt
List of PXE Boot Servers to attempt.
static struct dhcp_session_state dhcp_state_pxebs
PXE Boot Server Discovery state operations.
#define cpu_to_le16(value)
struct in_addr * pxe_accept
List of PXE Boot Servers to accept.
#define DHCP_PXE_DISCOVERY_CONTROL
PXE boot server discovery control.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define NULL
NULL pointer (VOID *)
#define DHCP_PXE_BOOT_SERVER_MCAST
PXE boot server multicast address.
#define DHCP_PXE_BOOT_SERVERS
PXE boot servers.
Inhibit multicast discovery.
#define AF_INET
IPv4 Internet addresses.
#define ref_put(refcnt)
Drop reference to object.
struct net_device * netdev
Network device being configured.
References AF_INET, BOOTPC_PORT, cpu_to_le16, DBGC, dhcp_finished(), dhcp_free(), dhcp_job_desc, dhcp_peer, DHCP_PXE_BOOT_SERVER_MCAST, DHCP_PXE_BOOT_SERVERS, DHCP_PXE_DISCOVERY_CONTROL, dhcp_set_state(), dhcp_state_pxebs, dhcp_timer_expired(), dhcp_xfer_desc, EINVAL, ENOMEM, fetch_ipv4_setting(), fetch_raw_setting(), fetch_uintz_setting(), htons, INADDR_BROADCAST, inet_ntoa(), intf_init(), intf_plug_plug(), ip, dhcp_session::job, dhcp_session::local, netdev, dhcp_session::netdev, netdev_get(), netdev_settings(), NULL, dhcp_session::pxe_accept, dhcp_session::pxe_attempt, dhcp_session::pxe_type, pxebs_list(), PXEBS_NO_BROADCAST, PXEBS_NO_MULTICAST, PXEBS_NO_UNKNOWN_SERVERS, rc, ref_init, ref_put, dhcp_session::refcnt, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, SOCK_DGRAM, setting::tag, dhcp_session::timer, dhcp_session::xfer, xfer_open_socket(), and zalloc().
Referenced by pxebs().