54 #define CACHEDHCP_RETAIN 0x0001 57 #define CACHEDHCP_USED 0x0002 83 #define colour &cached_dhcpack 138 DBGC (
colour,
"CACHEDHCP %s resetting %s MAC " 151 DBGC (
colour,
"CACHEDHCP %s %s does not match %s\n",
161 DBGC (
colour,
"CACHEDHCP %s VLAN %d does not match " 175 cache->
name ) ) != 0 ) {
176 DBGC (
colour,
"CACHEDHCP %s could not register settings: %s\n",
212 dhcppkt =
zalloc (
sizeof ( *dhcppkt ) + max_len );
214 DBGC (
colour,
"CACHEDHCP %s could not allocate copy\n",
218 dhcphdr = ( ( (
void * ) dhcppkt ) +
sizeof ( *dhcppkt ) );
233 dhcphdr = ( ( (
void * ) dhcppkt ) +
sizeof ( *dhcppkt ) );
245 DBGC (
colour,
"CACHEDHCP %s duplicates %s\n",
308 DBGC (
colour,
"CACHEDHCP %s never claimed\n",
316 .
name =
"cachedhcp1",
322 .
name =
"cachedhcp2",
360 DBGC (
colour,
"CACHEDHCP %s recycled from %s\n",
#define colour
Colour for debug messages.
struct arbelprm_rc_send_wqe rc
uint8_t ll_addr_len
Link-layer address length.
void unregister_settings(struct settings *settings)
Unregister settings block.
unsigned int vlan
VLAN tag (if applicable)
#define EEXIST
File exists.
static int cachedhcp_probe(struct net_device *netdev, void *priv __unused)
Apply cached DHCPACK to network device, if applicable.
struct cached_dhcp_packet cached_proxydhcp
Cached ProxyDHCPOFFER.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
#define STARTUP_EARLY
Early startup.
unsigned long user_to_phys(userptr_t userptr, off_t offset)
Convert user pointer to physical address.
static void cachedhcp_startup_early(void)
Cached DHCP packet early startup function.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct net_driver cachedhcp_driver __net_driver
Cached DHCP packet network device driver.
A network upper-layer driver.
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
#define STARTUP_LATE
Late startup.
static struct cached_dhcp_packet * cached_packets[]
List of cached DHCP packets.
struct dhcp_packet * dhcppkt
DHCP packet (if any)
void cachedhcp_recycle(struct net_device *netdev)
Recycle cached DHCPACK.
static void cachedhcp_free(struct cached_dhcp_packet *cache)
Free cached DHCP packet.
A startup/shutdown function.
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
uint32_t userptr_t
A pointer to a user buffer.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define PROXYDHCP_SETTINGS_NAME
Settings block name used for ProxyDHCP responses.
#define __unused
Declare a variable or data structure as unused.
static int cachedhcp_apply(struct cached_dhcp_packet *cache, struct net_device *netdev)
Apply cached DHCP packet settings.
#define DHCP_SETTINGS_NAME
Settings block name used for DHCP responses.
static struct net_device * netdev
struct startup_fn cachedhcp_early_fn __startup_fn(STARTUP_EARLY)
Cached DHCP packet early startup function.
#define PXEBS_SETTINGS_NAME
Setting block name used for BootServerDHCP responses.
#define CACHEDHCP_RETAIN
Cached DHCP packet should be retained.
char * strerror(int errno)
Retrieve string representation of error number.
void * zalloc(size_t size)
Allocate cleared memory.
uint8_t chaddr[16]
Client hardware address.
int cachedhcp_record(struct cached_dhcp_packet *cache, unsigned int vlan, userptr_t data, size_t max_len)
Record cached DHCP packet.
static void cachedhcp_shutdown(int booting __unused)
Cached DHCP packet shutdown function.
struct cached_dhcp_packet cached_dhcpack
Cached DHCPACK.
struct settings settings
Settings interface.
Network device management.
void dhcppkt_init(struct dhcp_packet *dhcppkt, struct dhcphdr *data, size_t len)
Initialise DHCP packet.
char name[NETDEV_NAME_LEN]
Name of this network device.
struct dhcphdr * dhcphdr
The DHCP packet contents.
static struct tlan_private * priv
static void dhcppkt_put(struct dhcp_packet *dhcppkt)
Decrement reference count on DHCP packet.
static size_t dhcppkt_len(struct dhcp_packet *dhcppkt)
Get used length of DHCP packet.
const char * name
Settings block name.
uint8_t data[48]
Additional event data.
const char *(* ntoa)(const void *ll_addr)
Transcribe link-layer address.
void * realloc(void *old_ptr, size_t new_size)
Reallocate memory.
int register_settings(struct settings *settings, struct settings *parent, const char *name)
Register settings block.
struct cached_dhcp_packet cached_pxebs
Cached PXEBSACK.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
static unsigned int vlan_tag(struct net_device *netdev)
Get the VLAN tag.
struct settings * find_child_settings(struct settings *parent, const char *name)
Find child settings block.
#define CACHEDHCP_USED
Cached DHCP packet has been used.
static void cachedhcp_startup_late(void)
Cache DHCP packet late startup function.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
struct ll_protocol * ll_protocol
Link-layer protocol.