|
iPXE
|
Cached DHCP packet. More...
#include <stdint.h>#include <stdlib.h>#include <string.h>#include <errno.h>#include <ipxe/dhcppkt.h>#include <ipxe/init.h>#include <ipxe/netdevice.h>#include <ipxe/vlan.h>#include <ipxe/uaccess.h>#include <ipxe/uri.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. | |
| #define | CACHEDHCP_USED 0x0002 |
| Cached DHCP packet has been used. | |
| #define | colour &cached_dhcpack |
| Colour for debug messages. | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| static void | cachedhcp_free (struct cached_dhcp_packet *cache) |
| Free cached DHCP packet. | |
| static int | cachedhcp_apply (struct cached_dhcp_packet *cache, struct net_device *netdev) |
| Apply cached DHCP packet settings. | |
| static struct uri * | cachedhcp_uri (struct cached_dhcp_packet *cache) |
| Get URI from cached DHCP packet. | |
| int | cachedhcp_record (struct cached_dhcp_packet *cache, unsigned int vlan, const void *data, size_t max_len) |
| Record cached DHCP packet. | |
| static void | cachedhcp_startup_early (void) |
| Cached DHCP packet early startup function. | |
| static void | cachedhcp_startup_late (void) |
| Cache DHCP packet late startup function. | |
| static void | cachedhcp_shutdown (int booting __unused) |
| Cached DHCP packet shutdown function. | |
| 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 int | cachedhcp_probe (struct net_device *netdev, void *priv __unused) |
| Apply cached DHCPACK to network device, if applicable. | |
| void | cachedhcp_recycle (struct net_device *netdev) |
| Recycle cached DHCPACK. | |
Variables | |
| struct cached_dhcp_packet | cached_dhcpack |
| Cached DHCPACK. | |
| struct cached_dhcp_packet | cached_proxydhcp |
| Cached ProxyDHCPOFFER. | |
| struct cached_dhcp_packet | cached_pxebs |
| Cached PXEBSACK. | |
| static struct cached_dhcp_packet * | cached_packets [] |
| List of cached DHCP packets. | |
| struct net_driver cachedhcp_driver | __net_driver |
| Cached DHCP packet network device driver. | |
Cached DHCP packet.
Definition in file cachedhcp.c.
| #define CACHEDHCP_RETAIN 0x0001 |
Cached DHCP packet should be retained.
Definition at line 58 of file cachedhcp.c.
Referenced by cachedhcp_apply(), and cachedhcp_startup_late().
| #define CACHEDHCP_USED 0x0002 |
Cached DHCP packet has been used.
Definition at line 61 of file cachedhcp.c.
Referenced by cachedhcp_apply(), cachedhcp_recycle(), and cachedhcp_startup_late().
| #define colour &cached_dhcpack |
Colour for debug messages.
Definition at line 87 of file cachedhcp.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
static |
Free cached DHCP packet.
| cache | Cached DHCP packet |
Definition at line 94 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 107 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, ll_protocol::ll_addr_len, memcmp(), memcpy(), cached_dhcp_packet::name, netdev, NETDEV_AUTO_OPEN, 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().
|
static |
Get URI from cached DHCP packet.
| cache | Cached DHCP packet |
| uri | URI, or NULL if not defined |
Definition at line 204 of file cachedhcp.c.
References AF_INET, colour, DBGC, cached_dhcp_packet::dhcppkt, fetch_ipv4_setting(), fetch_string_setting_copy(), free, inet_ntoa(), memset(), cached_dhcp_packet::name, NULL, pxe_uri(), sa, dhcp_packet::settings, and sin.
Referenced by cachedhcp_record().
| int cachedhcp_record | ( | struct cached_dhcp_packet * | cache, |
| unsigned int | vlan, | ||
| const void * | 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 251 of file cachedhcp.c.
References assert, cached_packets, cachedhcp_free(), cachedhcp_uri(), churi(), colour, data, DBGC, dhcp_packet::dhcphdr, cached_dhcp_packet::dhcppkt, dhcppkt_init(), dhcppkt_len(), dhcppkt_put(), EEXIST, ENOMEM, len, memcmp(), memcpy(), cached_dhcp_packet::name, realloc(), tmp, uri_put(), cached_dhcp_packet::vlan, and zalloc().
Referenced by cachedhcp_init(), and efi_cachedhcp_record().
|
static |
Cached DHCP packet early startup function.
Definition at line 323 of file cachedhcp.c.
References cached_proxydhcp, cached_pxebs, cachedhcp_apply(), cachedhcp_free(), and NULL.
Referenced by __startup_fn().
|
static |
Cache DHCP packet late startup function.
Definition at line 338 of file cachedhcp.c.
References cached_dhcpack, cachedhcp_free(), CACHEDHCP_RETAIN, CACHEDHCP_USED, colour, and DBGC.
Referenced by __startup_fn().
|
static |
Cached DHCP packet shutdown function.
| booting | System is shutting down for OS boot |
Definition at line 362 of file cachedhcp.c.
References __unused, cached_dhcpack, cachedhcp_free(), colour, and DBGC.
Referenced by __startup_fn().
| struct startup_fn cachedhcp_early_fn __startup_fn | ( | STARTUP_EARLY | ) |
Cached DHCP packet early startup function.
References __startup_fn, cachedhcp_startup_early(), and STARTUP_EARLY.
| struct startup_fn cachedhcp_late_fn __startup_fn | ( | STARTUP_LATE | ) |
Cached DHCP packet late startup function.
References __startup_fn, cachedhcp_shutdown(), cachedhcp_startup_late(), and STARTUP_LATE.
|
static |
Apply cached DHCPACK to network device, if applicable.
| netdev | Network device |
| priv | Private data |
| rc | Return status code |
Definition at line 392 of file cachedhcp.c.
References __unused, cached_dhcpack, cachedhcp_apply(), netdev, and priv.
| void cachedhcp_recycle | ( | struct net_device * | netdev | ) |
Recycle cached DHCPACK.
| netdev | Network device |
| priv | Private data |
Definition at line 410 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, netdev, netdev_settings(), dhcp_packet::settings, and unregister_settings().
Referenced by mnptemp_destroy().
| struct cached_dhcp_packet cached_dhcpack |
Cached DHCPACK.
Definition at line 64 of file cachedhcp.c.
Referenced by cachedhcp_init(), cachedhcp_probe(), cachedhcp_recycle(), cachedhcp_shutdown(), cachedhcp_startup_late(), efi_cachedhcp_record(), and FILE_SECBOOT().
| struct cached_dhcp_packet cached_proxydhcp |
Cached ProxyDHCPOFFER.
Definition at line 70 of file cachedhcp.c.
Referenced by cachedhcp_startup_early(), efi_cachedhcp_record(), and FILE_SECBOOT().
| struct cached_dhcp_packet cached_pxebs |
Cached PXEBSACK.
Definition at line 75 of file cachedhcp.c.
Referenced by cachedhcp_startup_early(), efi_cachedhcp_record(), and FILE_SECBOOT().
|
static |
List of cached DHCP packets.
Definition at line 80 of file cachedhcp.c.
Referenced by cachedhcp_record().
| struct net_driver cachedhcp_driver __net_driver |
Cached DHCP packet network device driver.
Definition at line 399 of file cachedhcp.c.