iPXE
|
Dynamic Host Configuration Protocol. More...
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include <byteswap.h>
#include <ipxe/if_ether.h>
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include <ipxe/device.h>
#include <ipxe/xfer.h>
#include <ipxe/open.h>
#include <ipxe/job.h>
#include <ipxe/retry.h>
#include <ipxe/tcpip.h>
#include <ipxe/ip.h>
#include <ipxe/uuid.h>
#include <ipxe/timer.h>
#include <ipxe/settings.h>
#include <ipxe/dhcp.h>
#include <ipxe/dhcpopts.h>
#include <ipxe/dhcppkt.h>
#include <ipxe/dhcparch.h>
#include <ipxe/features.h>
#include <config/dhcp.h>
Go to the source code of this file.
Data Structures | |
struct | dhcp_session_state |
DHCP session state operations. More... | |
struct | dhcp_session |
A DHCP session. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | dhcp_tx (struct dhcp_session *dhcp) |
Transmit DHCP request. More... | |
const struct setting dhcp_server_setting | __setting (SETTING_MISC, dhcp-server) |
DHCP server address setting. More... | |
static const char * | dhcp_msgtype_name (unsigned int msgtype) |
Name a DHCP packet type. More... | |
static void | dhcp_free (struct refcnt *refcnt) |
Free DHCP session. More... | |
static void | dhcp_finished (struct dhcp_session *dhcp, int rc) |
Mark DHCP session as complete. More... | |
static void | dhcp_set_state (struct dhcp_session *dhcp, struct dhcp_session_state *state) |
Transition to new DHCP session state. More... | |
static int | dhcp_has_pxeopts (struct dhcp_packet *dhcppkt) |
Check if DHCP packet contains PXE options. More... | |
static int | dhcp_discovery_tx (struct dhcp_session *dhcp, struct dhcp_packet *dhcppkt __unused, struct sockaddr_in *peer) |
Construct transmitted packet for DHCP discovery. More... | |
static void | dhcp_discovery_rx (struct dhcp_session *dhcp, struct dhcp_packet *dhcppkt, struct sockaddr_in *peer, uint8_t msgtype, struct in_addr server_id, struct in_addr pseudo_id) |
Handle received packet during DHCP discovery. More... | |
static void | dhcp_defer (struct dhcp_session *dhcp) |
Defer DHCP discovery. More... | |
static void | dhcp_discovery_expired (struct dhcp_session *dhcp) |
Handle timer expiry during DHCP discovery. More... | |
static int | dhcp_request_tx (struct dhcp_session *dhcp, struct dhcp_packet *dhcppkt, struct sockaddr_in *peer) |
Construct transmitted packet for DHCP request. More... | |
static void | dhcp_request_rx (struct dhcp_session *dhcp, struct dhcp_packet *dhcppkt, struct sockaddr_in *peer, uint8_t msgtype, struct in_addr server_id, struct in_addr pseudo_id) |
Handle received packet during DHCP request. More... | |
static void | dhcp_request_expired (struct dhcp_session *dhcp) |
Handle timer expiry during DHCP discovery. More... | |
static int | dhcp_proxy_tx (struct dhcp_session *dhcp, struct dhcp_packet *dhcppkt, struct sockaddr_in *peer) |
Construct transmitted packet for ProxyDHCP request. More... | |
static void | dhcp_proxy_rx (struct dhcp_session *dhcp, struct dhcp_packet *dhcppkt, struct sockaddr_in *peer, uint8_t msgtype, struct in_addr server_id, struct in_addr pseudo_id) |
Handle received packet during ProxyDHCP request. More... | |
static void | dhcp_proxy_expired (struct dhcp_session *dhcp) |
Handle timer expiry during ProxyDHCP request. More... | |
static int | dhcp_pxebs_tx (struct dhcp_session *dhcp, struct dhcp_packet *dhcppkt, struct sockaddr_in *peer) |
Construct transmitted packet for PXE Boot Server Discovery. More... | |
static int | dhcp_pxebs_accept (struct dhcp_session *dhcp, struct in_addr bs) |
Check to see if PXE Boot Server address is acceptable. More... | |
static void | dhcp_pxebs_rx (struct dhcp_session *dhcp, struct dhcp_packet *dhcppkt, struct sockaddr_in *peer, uint8_t msgtype, struct in_addr server_id, struct in_addr pseudo_id) |
Handle received packet during PXE Boot Server Discovery. More... | |
static void | dhcp_pxebs_expired (struct dhcp_session *dhcp) |
Handle timer expiry during PXE Boot Server Discovery. More... | |
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. More... | |
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. More... | |
static int | dhcp_deliver (struct dhcp_session *dhcp, struct io_buffer *iobuf, struct xfer_metadata *meta) |
Receive new data. More... | |
static void | dhcp_timer_expired (struct retry_timer *timer, int fail) |
Handle DHCP retry timer expiry. More... | |
int | start_dhcp (struct interface *job, struct net_device *netdev) |
Start DHCP state machine on a network device. More... | |
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. More... | |
int | start_pxebs (struct interface *job, struct net_device *netdev, unsigned int pxe_type) |
Start PXE Boot Server Discovery on a network device. More... | |
Variables | |
static const uint8_t | dhcp_op [] |
DHCP operation types. More... | |
static uint8_t | dhcp_request_options_data [] |
Raw option data for options common to all DHCP requests. More... | |
static const struct setting * | dhcp_request_settings [] |
Settings copied in to all DHCP requests. More... | |
uint32_t | dhcp_last_xid |
Most recent DHCP transaction ID. More... | |
static struct dhcp_session_state | dhcp_state_discover |
DHCP discovery state operations. More... | |
static struct dhcp_session_state | dhcp_state_request |
DHCP request state operations. More... | |
static struct dhcp_session_state | dhcp_state_proxy |
ProxyDHCP request state operations. More... | |
static struct dhcp_session_state | dhcp_state_pxebs |
PXE Boot Server Discovery state operations. More... | |
static struct interface_operation | dhcp_xfer_operations [] |
DHCP data transfer interface operations. More... | |
static struct interface_descriptor | dhcp_xfer_desc |
DHCP data transfer interface descriptor. More... | |
static struct interface_operation | dhcp_job_op [] |
DHCP job control interface operations. More... | |
static struct interface_descriptor | dhcp_job_desc |
DHCP job control interface descriptor. More... | |
static struct sockaddr | dhcp_peer |
DHCP peer address for socket opening. More... | |
struct net_device_configurator dhcp_configurator | __net_device_configurator |
DHCP network device configurator. More... | |
Dynamic Host Configuration Protocol.
Definition in file dhcp.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Transmit DHCP request.
dhcp | DHCP session |
rc | Return status code |
Definition at line 1125 of file dhcp.c.
References AF_INET, dhcp_session::count, io_buffer::data, DBGC, dhcp_create_request(), DHCP_MIN_LEN, dhcp_packet::dhcphdr, dhcppkt_len(), done, ENOMEM, free_iob(), htons, iob_disown, iob_put, iob_tailroom(), dhcp_session::local, meta(), dhcp_session::netdev, dhcp_session::offer, peer, dhcp_session::proxy_offer, rc, in_addr::s_addr, dhcphdr::secs, sockaddr_in::sin_addr, start_timer(), dhcp_session::state, strerror(), dhcp_session::timer, dhcp_session_state::tx, dhcp_session_state::tx_msgtype, dhcp_session::xfer, xfer_alloc_iob(), xfer_deliver(), and dhcp_session::xid.
Referenced by dhcp_discovery_expired(), dhcp_proxy_expired(), dhcp_pxebs_expired(), and dhcp_request_expired().
const struct setting dhcp_server_setting __setting | ( | SETTING_MISC | , |
dhcp- | server | ||
) |
DHCP server address setting.
|
inlinestatic |
Name a DHCP packet type.
msgtype | DHCP message type |
string | DHCP mesasge type name |
Definition at line 132 of file dhcp.c.
References DHCPACK, DHCPDECLINE, DHCPDISCOVER, DHCPINFORM, DHCPNAK, DHCPNONE, DHCPOFFER, DHCPRELEASE, and DHCPREQUEST.
Referenced by dhcp_deliver(), dhcp_discovery_rx(), dhcp_proxy_rx(), dhcp_pxebs_rx(), and dhcp_request_rx().
|
static |
Free DHCP session.
refcnt | Reference counter |
Definition at line 253 of file dhcp.c.
References container_of, dhcppkt_put(), free, dhcp_session::netdev, netdev_put(), and dhcp_session::proxy_offer.
Referenced by start_dhcp(), and start_pxebs().
|
static |
Mark DHCP session as complete.
dhcp | DHCP session |
rc | Return status code |
Definition at line 268 of file dhcp.c.
References intf_shutdown(), dhcp_session::job, rc, stop_timer(), dhcp_session::timer, and dhcp_session::xfer.
Referenced by dhcp_proxy_expired(), dhcp_proxy_rx(), dhcp_pxebs_expired(), dhcp_pxebs_rx(), dhcp_request_rx(), dhcp_timer_expired(), start_dhcp(), and start_pxebs().
|
static |
Transition to new DHCP session state.
dhcp | DHCP session |
state | New session state |
Definition at line 284 of file dhcp.c.
References currticks(), DBGC, dhcp_session::start, start_timer_nodelay(), state, dhcp_session::state, stop_timer(), TICKS_PER_SEC, and dhcp_session::timer.
Referenced by dhcp_defer(), dhcp_discovery_expired(), dhcp_discovery_rx(), dhcp_pxebs_expired(), dhcp_request_rx(), start_dhcp(), and start_pxebs().
|
static |
Check if DHCP packet contains PXE options.
dhcppkt | DHCP packet |
has_pxeopts | DHCP packet contains PXE options |
It is assumed that the packet is already known to contain option 60 set to "PXEClient".
Definition at line 306 of file dhcp.c.
References DHCP_BOOTFILE_NAME, DHCP_PXE_BOOT_MENU, dhcp_packet::dhcphdr, dhcppkt_fetch(), NULL, in_addr::s_addr, and dhcphdr::siaddr.
Referenced by dhcp_discovery_rx(), dhcp_proxy_rx(), and dhcp_request_rx().
|
static |
Construct transmitted packet for DHCP discovery.
dhcp | DHCP session |
dhcppkt | DHCP packet |
peer | Destination address |
Definition at line 333 of file dhcp.c.
References BOOTPS_PORT, DBGC, htons, INADDR_BROADCAST, and peer.
|
static |
Handle received packet during DHCP discovery.
dhcp | DHCP session |
dhcppkt | DHCP packet |
peer | DHCP server address |
msgtype | DHCP message type |
server_id | DHCP server ID |
pseudo_id | DHCP server pseudo-ID |
Definition at line 356 of file dhcp.c.
References BOOTPS_PORT, currticks(), DBGC, DHCP_DISC_PROXY_TIMEOUT_SEC, DHCP_EB_NO_PXEDHCP, DHCP_EB_PRIORITY, dhcp_has_pxeopts(), dhcp_msgtype_name(), dhcp_set_state(), dhcp_state_request, DHCP_VENDOR_CLASS_ID, dhcp_packet::dhcphdr, DHCPOFFER, dhcppkt_fetch(), dhcppkt_get(), dhcppkt_put(), htons, inet_ntoa(), ip, dhcp_session::no_pxedhcp, ntohs, dhcp_session::offer, peer, priority, dhcp_session::priority, dhcp_session::proxy_offer, dhcp_session::proxy_priority, dhcp_session::proxy_server, in_addr::s_addr, dhcp_session::server, dhcp_session::start, strncmp(), TICKS_PER_SEC, and dhcphdr::yiaddr.
|
static |
Defer DHCP discovery.
dhcp | DHCP session |
Definition at line 452 of file dhcp.c.
References dhcp_session::count, DBGC, DHCP_DISC_MAX_DEFERRALS, DHCP_DISC_START_TIMEOUT_SEC, dhcp_set_state(), dhcp_state_discover, start_timer_fixed(), TICKS_PER_SEC, and dhcp_session::timer.
Referenced by dhcp_discovery_expired(), and dhcp_request_rx().
|
static |
Handle timer expiry during DHCP discovery.
dhcp | DHCP session |
Definition at line 472 of file dhcp.c.
References currticks(), dhcp_defer(), DHCP_DISC_PROXY_TIMEOUT_SEC, dhcp_set_state(), dhcp_state_request, dhcp_tx(), dhcp_session::netdev, netdev_link_blocked(), dhcp_session::offer, in_addr::s_addr, dhcp_session::start, and TICKS_PER_SEC.
|
static |
Construct transmitted packet for DHCP request.
dhcp | DHCP session |
dhcppkt | DHCP packet |
peer | Destination address |
Definition at line 508 of file dhcp.c.
References BOOTPS_PORT, DBGC, DHCP_REQUESTED_ADDRESS, DHCP_SERVER_IDENTIFIER, dhcppkt_store(), htons, INADDR_BROADCAST, inet_ntoa(), dhcp_session::offer, peer, rc, and dhcp_session::server.
|
static |
Handle received packet during DHCP request.
dhcp | DHCP session |
dhcppkt | DHCP packet |
peer | DHCP server address |
msgtype | DHCP message type |
server_id | DHCP server ID |
pseudo_id | DHCP server pseudo-ID |
Definition at line 546 of file dhcp.c.
References BOOTPS_PORT, DBGC, dhcp_defer(), dhcp_finished(), dhcp_has_pxeopts(), dhcp_msgtype_name(), dhcp_set_state(), DHCP_SETTINGS_NAME, dhcp_state_proxy, DHCPACK, dhcp_packet::dhcphdr, DHCPNAK, find_settings(), htons, inet_ntoa(), ip, dhcp_session::local, dhcp_session::netdev, netdev_settings(), dhcp_session::no_pxedhcp, ntohs, NULL, dhcp_session::offer, settings::parent, peer, dhcp_session::proxy_offer, PROXYDHCP_SETTINGS_NAME, PXEBS_SETTINGS_NAME, rc, register_settings(), in_addr::s_addr, dhcp_session::server, dhcp_packet::settings, sockaddr_in::sin_addr, strerror(), unregister_settings(), and dhcphdr::yiaddr.
|
static |
|
static |
Construct transmitted packet for ProxyDHCP request.
dhcp | DHCP session |
dhcppkt | DHCP packet |
peer | Destination address |
Definition at line 667 of file dhcp.c.
References DBGC, DHCP_SERVER_IDENTIFIER, dhcppkt_store(), htons, inet_ntoa(), peer, dhcp_session::proxy_server, PXE_PORT, and rc.
|
static |
Handle received packet during ProxyDHCP request.
dhcp | DHCP session |
dhcppkt | DHCP packet |
peer | DHCP server address |
msgtype | DHCP message type |
server_id | DHCP server ID |
pseudo_id | DHCP server pseudo-ID |
Definition at line 698 of file dhcp.c.
References DBGC, dhcp_finished(), dhcp_has_pxeopts(), dhcp_msgtype_name(), DHCPACK, DHCPOFFER, inet_ntoa(), ntohs, NULL, peer, dhcp_session::proxy_server, PROXYDHCP_SETTINGS_NAME, PXE_PORT, rc, register_settings(), in_addr::s_addr, dhcp_packet::settings, and strerror().
|
static |
Handle timer expiry during ProxyDHCP request.
dhcp | DHCP session |
Definition at line 746 of file dhcp.c.
References currticks(), dhcp_finished(), DHCP_REQ_PROXY_TIMEOUT_SEC, dhcp_tx(), dhcp_session::start, and TICKS_PER_SEC.
|
static |
Construct transmitted packet for PXE Boot Server Discovery.
dhcp | DHCP session |
dhcppkt | DHCP packet |
peer | Destination address |
Definition at line 777 of file dhcp.c.
References BOOTPS_PORT, DBGC, DHCP_PXE_BOOT_MENU_ITEM, dhcppkt_store(), htons, INADDR_BROADCAST, inet_ntoa(), le16_to_cpu, ntohs, peer, dhcp_session::pxe_attempt, PXE_PORT, dhcp_session::pxe_type, rc, and dhcp_pxe_boot_menu_item::type.
|
static |
Check to see if PXE Boot Server address is acceptable.
dhcp | DHCP session |
bs | Boot Server address |
accept | Boot Server is acceptable |
Definition at line 808 of file dhcp.c.
References DBGC, inet_ntoa(), dhcp_session::pxe_accept, and in_addr::s_addr.
Referenced by dhcp_pxebs_rx().
|
static |
Handle received packet during PXE Boot Server Discovery.
dhcp | DHCP session |
dhcppkt | DHCP packet |
peer | DHCP server address |
msgtype | DHCP message type |
server_id | DHCP server ID |
pseudo_id | DHCP server pseudo-ID |
Definition at line 837 of file dhcp.c.
References BOOTPS_PORT, DBGC, dhcp_finished(), dhcp_msgtype_name(), DHCP_PXE_BOOT_MENU_ITEM, dhcp_pxebs_accept(), DHCPACK, dhcppkt_fetch(), htons, inet_ntoa(), ntohs, NULL, peer, PXE_PORT, dhcp_session::pxe_type, PXEBS_SETTINGS_NAME, rc, register_settings(), in_addr::s_addr, dhcp_packet::settings, strerror(), and dhcp_pxe_boot_menu_item::type.
|
static |
Handle timer expiry during PXE Boot Server Discovery.
dhcp | DHCP session |
Definition at line 890 of file dhcp.c.
References currticks(), dhcp_finished(), dhcp_set_state(), dhcp_state_pxebs, dhcp_tx(), ETIMEDOUT, dhcp_session::pxe_attempt, PXEBS_MAX_TIMEOUT_SEC, in_addr::s_addr, dhcp_session::start, and TICKS_PER_SEC.
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.
dhcppkt | DHCP packet structure to fill in |
netdev | Network device |
msgtype | DHCP message type |
xid | Transaction ID (in network-endian order) |
options | Initial options to include (or NULL) |
options_len | Length of initial options |
data | Buffer for DHCP packet |
max_len | Size of DHCP packet buffer |
rc | Return status code |
Creates a DHCP packet in the specified buffer, and initialise a DHCP packet structure.
Definition at line 944 of file dhcp.c.
References BOOTP_FL_BROADCAST, dhcphdr::chaddr, data, DHCP_MAGIC_COOKIE, DHCP_MESSAGE_TYPE, dhcp_op, dhcppkt_init(), dhcppkt_store(), ENOSPC, ll_protocol::flags, dhcphdr::flags, dhcphdr::hlen, htonl, htons, dhcphdr::htype, ipv4_has_any_addr(), net_device::ll_addr, ll_protocol::ll_addr_len, LL_NAME_ONLY, ll_protocol::ll_proto, net_device::ll_protocol, dhcphdr::magic, memcpy(), memset(), netdev, ntohs, dhcphdr::op, options, dhcphdr::options, rc, and dhcphdr::xid.
Referenced by create_fakedhcpack(), create_fakepxebsack(), and dhcp_create_request().
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.
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 |
rc | Return status code |
Creates a DHCP request packet in the specified buffer, and initialise a DHCP packet structure.
Definition at line 1007 of file dhcp.c.
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().
|
static |
Receive new data.
dhcp | DHCP session |
iobuf | I/O buffer |
meta | Transfer metadata |
rc | Return status code |
Definition at line 1196 of file dhcp.c.
References dhcphdr::chaddr, io_buffer::data, data_len, DBGC, DHCP_MESSAGE_TYPE, dhcp_msgtype_name(), DHCP_SERVER_IDENTIFIER, dhcp_packet::dhcphdr, dhcppkt_fetch(), dhcppkt_init(), dhcppkt_put(), EINVAL, ENOMEM, free_iob(), inet_ntoa(), iob_len(), net_device::ll_addr, ll_protocol::ll_addr_len, net_device::ll_protocol, memcmp(), memcpy(), meta(), netdev, dhcp_session::netdev, ll_protocol::ntoa, ntohs, peer, rc, dhcp_session_state::rx, in_addr::s_addr, dhcphdr::siaddr, dhcp_session::state, dhcp_session::xid, dhcphdr::xid, and zalloc().
|
static |
Handle DHCP retry timer expiry.
timer | DHCP retry timer |
fail | Failure indicator |
Definition at line 1297 of file dhcp.c.
References container_of, dhcp_session::count, dhcp_finished(), ETIMEDOUT, dhcp_session_state::expired, and dhcp_session::state.
Referenced by start_dhcp(), and start_pxebs().
int start_dhcp | ( | struct interface * | job, |
struct net_device * | netdev | ||
) |
Start DHCP state machine on a network device.
job | Job control interface |
netdev | Network device |
rc | Return status code |
Starts DHCP on the specified network device. If successful, the DHCPACK (and ProxyDHCPACK, if applicable) will be registered as option sources.
Definition at line 1357 of file dhcp.c.
References AF_INET, BOOTPC_PORT, dhcp_finished(), dhcp_free(), dhcp_job_desc, dhcp_last_xid, dhcp_peer, dhcp_set_state(), dhcp_state_discover, dhcp_timer_expired(), dhcp_xfer_desc, ENOMEM, htons, intf_init(), intf_plug_plug(), dhcp_session::job, dhcp_session::local, netdev, dhcp_session::netdev, netdev_get(), random(), rc, ref_init, ref_put, dhcp_session::refcnt, sockaddr_in::sin_family, sockaddr_in::sin_port, SOCK_DGRAM, dhcp_session::timer, dhcp_session::xfer, xfer_open_socket(), dhcp_session::xid, and zalloc().
|
static |
Retrieve list of PXE boot servers for a given server type.
dhcp | DHCP session |
raw | DHCP PXE boot server list |
raw_len | Length of DHCP PXE boot server list |
ip | IP address list to fill in |
The caller must ensure that the IP address list has sufficient space.
Definition at line 1407 of file dhcp.c.
References DBGC, ip, dhcp_pxe_boot_server::ip, dhcp_pxe_boot_server::num_ip, offsetof, dhcp_session::pxe_type, raw, raw_len, dhcp_pxe_boot_server::type, and typeof().
Referenced by start_pxebs().
int start_pxebs | ( | struct interface * | job, |
struct net_device * | netdev, | ||
unsigned int | pxe_type | ||
) |
Start PXE Boot Server Discovery on a network device.
job | Job control interface |
netdev | Network device |
pxe_type | PXE server type |
rc | Return status code |
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.
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().
|
static |
DHCP operation types.
This table maps from DHCP message types (i.e. values of the DHCP_MESSAGE_TYPE
option) to values of the "op" field within a DHCP packet.
Definition at line 69 of file dhcp.c.
Referenced by dhcp_create_packet().
|
static |
Raw option data for options common to all DHCP requests.
Definition at line 81 of file dhcp.c.
Referenced by dhcp_create_request().
|
static |
Settings copied in to all DHCP requests.
Definition at line 104 of file dhcp.c.
Referenced by dhcp_create_request().
uint32_t dhcp_last_xid |
Most recent DHCP transaction ID.
This is exposed for use by the fakedhcp code when reconstructing DHCP packets for PXE NBPs.
Definition at line 124 of file dhcp.c.
Referenced by create_fakedhcpack(), create_fakedhcpdiscover(), create_fakepxebsack(), and start_dhcp().
|
static |
DHCP discovery state operations.
Definition at line 194 of file dhcp.c.
Referenced by dhcp_defer(), and start_dhcp().
|
static |
DHCP request state operations.
Definition at line 195 of file dhcp.c.
Referenced by dhcp_discovery_expired(), and dhcp_discovery_rx().
|
static |
ProxyDHCP request state operations.
Definition at line 196 of file dhcp.c.
Referenced by dhcp_request_rx().
|
static |
PXE Boot Server Discovery state operations.
Definition at line 197 of file dhcp.c.
Referenced by dhcp_pxebs_expired(), and start_pxebs().
|
static |
DHCP data transfer interface operations.
|
static |
DHCP data transfer interface descriptor.
Definition at line 1288 of file dhcp.c.
Referenced by start_dhcp(), and start_pxebs().
|
static |
DHCP job control interface operations.
|
static |
DHCP job control interface descriptor.
Definition at line 1326 of file dhcp.c.
Referenced by start_dhcp(), and start_pxebs().
|
static |
DHCP peer address for socket opening.
This is a dummy address; the only useful portion is the socket family (so that we get a UDP connection). The DHCP client will set the IP address and source port explicitly on each transmission.
Definition at line 1342 of file dhcp.c.
Referenced by start_dhcp(), and start_pxebs().
struct net_device_configurator dhcp_configurator __net_device_configurator |
DHCP network device configurator.