iPXE
|
Cached DHCP packet. More...
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <ipxe/dhcppkt.h>
#include <ipxe/init.h>
#include <ipxe/netdevice.h>
#include <ipxe/vlan.h>
#include <ipxe/cachedhcp.h>
Go to the source code of this file.
Data Structures | |
struct | cached_dhcp_packet |
A cached DHCP packet. More... | |
Macros | |
#define | CACHEDHCP_RETAIN 0x0001 |
Cached DHCP packet should be retained. More... | |
#define | CACHEDHCP_USED 0x0002 |
Cached DHCP packet has been used. More... | |
#define | colour &cached_dhcpack |
Colour for debug messages. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | cachedhcp_free (struct cached_dhcp_packet *cache) |
Free cached DHCP packet. More... | |
static int | cachedhcp_apply (struct cached_dhcp_packet *cache, struct net_device *netdev) |
Apply cached DHCP packet settings. More... | |
int | cachedhcp_record (struct cached_dhcp_packet *cache, unsigned int vlan, userptr_t data, size_t max_len) |
Record cached DHCP packet. More... | |
static void | cachedhcp_startup_early (void) |
Cached DHCP packet early startup function. More... | |
static void | cachedhcp_startup_late (void) |
Cache DHCP packet late startup function. More... | |
static void | cachedhcp_shutdown (int booting __unused) |
Cached DHCP packet shutdown function. More... | |
struct startup_fn cachedhcp_early_fn | __startup_fn (STARTUP_EARLY) |
Cached DHCP packet early startup function. More... | |
struct startup_fn cachedhcp_late_fn | __startup_fn (STARTUP_LATE) |
Cached DHCP packet late startup function. More... | |
static int | cachedhcp_probe (struct net_device *netdev, void *priv __unused) |
Apply cached DHCPACK to network device, if applicable. More... | |
void | cachedhcp_recycle (struct net_device *netdev) |
Recycle cached DHCPACK. More... | |
Variables | |
struct cached_dhcp_packet | cached_dhcpack |
Cached DHCPACK. More... | |
struct cached_dhcp_packet | cached_proxydhcp |
Cached ProxyDHCPOFFER. More... | |
struct cached_dhcp_packet | cached_pxebs |
Cached PXEBSACK. More... | |
static struct cached_dhcp_packet * | cached_packets [] |
List of cached DHCP packets. More... | |
struct net_driver cachedhcp_driver | __net_driver |
Cached DHCP packet network device driver. More... | |
Cached DHCP packet.
Definition in file cachedhcp.c.
#define CACHEDHCP_RETAIN 0x0001 |
Cached DHCP packet should be retained.
Definition at line 54 of file cachedhcp.c.
#define CACHEDHCP_USED 0x0002 |
Cached DHCP packet has been used.
Definition at line 57 of file cachedhcp.c.
#define colour &cached_dhcpack |
Colour for debug messages.
Definition at line 83 of file cachedhcp.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Free cached DHCP packet.
cache | Cached DHCP packet |
Definition at line 90 of file cachedhcp.c.
References cached_dhcp_packet::dhcppkt, dhcppkt_put(), and NULL.
Referenced by cachedhcp_apply(), cachedhcp_record(), cachedhcp_shutdown(), cachedhcp_startup_early(), and cachedhcp_startup_late().
|
static |
Apply cached DHCP packet settings.
cache | Cached DHCP packet |
netdev | Network device, or NULL |
rc | Return status code |
Definition at line 103 of file cachedhcp.c.
References cachedhcp_free(), CACHEDHCP_RETAIN, CACHEDHCP_USED, dhcphdr::chaddr, colour, DBGC, dhcp_packet::dhcphdr, cached_dhcp_packet::dhcppkt, cached_dhcp_packet::flags, net_device::hw_addr, net_device::ll_addr, ll_protocol::ll_addr_len, net_device::ll_protocol, memcmp(), memcpy(), cached_dhcp_packet::name, net_device::name, netdev, netdev_settings(), ll_protocol::ntoa, NULL, rc, register_settings(), dhcp_packet::settings, strerror(), cached_dhcp_packet::vlan, and vlan_tag().
Referenced by cachedhcp_probe(), and cachedhcp_startup_early().
int cachedhcp_record | ( | struct cached_dhcp_packet * | cache, |
unsigned int | vlan, | ||
userptr_t | data, | ||
size_t | max_len | ||
) |
Record cached DHCP packet.
cache | Cached DHCP packet |
vlan | VLAN tag, if any |
data | DHCPACK packet buffer |
max_len | Maximum possible length |
rc | Return status code |
Definition at line 200 of file cachedhcp.c.
References assert(), cached_packets, cachedhcp_free(), colour, copy_from_user(), data, DBGC, dhcp_packet::dhcphdr, cached_dhcp_packet::dhcppkt, dhcppkt_init(), dhcppkt_len(), dhcppkt_put(), EEXIST, ENOMEM, len, memcmp(), cached_dhcp_packet::name, realloc(), tmp, user_to_phys(), cached_dhcp_packet::vlan, and zalloc().
Referenced by cachedhcp_init(), and efi_cachedhcp_record().
|
static |
Cached DHCP packet early startup function.
Definition at line 265 of file cachedhcp.c.
References cached_proxydhcp, cached_pxebs, cachedhcp_apply(), cachedhcp_free(), and NULL.
|
static |
Cache DHCP packet late startup function.
Definition at line 280 of file cachedhcp.c.
References cached_dhcpack, cachedhcp_free(), CACHEDHCP_RETAIN, CACHEDHCP_USED, colour, DBGC, cached_dhcp_packet::dhcppkt, cached_dhcp_packet::flags, and cached_dhcp_packet::name.
|
static |
Cached DHCP packet shutdown function.
booting | System is shutting down for OS boot |
Definition at line 304 of file cachedhcp.c.
References cached_dhcpack, cachedhcp_free(), colour, DBGC, cached_dhcp_packet::dhcppkt, and cached_dhcp_packet::name.
struct startup_fn cachedhcp_early_fn __startup_fn | ( | STARTUP_EARLY | ) |
Cached DHCP packet early startup function.
struct startup_fn cachedhcp_late_fn __startup_fn | ( | STARTUP_LATE | ) |
Cached DHCP packet late startup function.
|
static |
Apply cached DHCPACK to network device, if applicable.
netdev | Network device |
priv | Private data |
rc | Return status code |
Definition at line 334 of file cachedhcp.c.
References cached_dhcpack, cachedhcp_apply(), and netdev.
void cachedhcp_recycle | ( | struct net_device * | netdev | ) |
Recycle cached DHCPACK.
netdev | Network device |
priv | Private data |
Definition at line 352 of file cachedhcp.c.
References assert(), cached_dhcpack, CACHEDHCP_USED, colour, DBGC, cached_dhcp_packet::dhcppkt, find_child_settings(), cached_dhcp_packet::flags, cached_dhcp_packet::name, net_device::name, netdev, netdev_settings(), dhcp_packet::settings, and unregister_settings().
Referenced by mnptemp_destroy().
struct cached_dhcp_packet cached_dhcpack |
Cached DHCPACK.
Definition at line 60 of file cachedhcp.c.
Referenced by cachedhcp_init(), cachedhcp_probe(), cachedhcp_recycle(), cachedhcp_shutdown(), cachedhcp_startup_late(), and efi_cachedhcp_record().
struct cached_dhcp_packet cached_proxydhcp |
Cached ProxyDHCPOFFER.
Definition at line 66 of file cachedhcp.c.
Referenced by cachedhcp_startup_early(), and efi_cachedhcp_record().
struct cached_dhcp_packet cached_pxebs |
Cached PXEBSACK.
Definition at line 71 of file cachedhcp.c.
Referenced by cachedhcp_startup_early(), and efi_cachedhcp_record().
|
static |
List of cached DHCP packets.
Definition at line 76 of file cachedhcp.c.
Referenced by cachedhcp_record().
struct net_driver cachedhcp_driver __net_driver |
Cached DHCP packet network device driver.
Definition at line 341 of file cachedhcp.c.