iPXE
|
Fake DHCP packets. More...
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <ipxe/settings.h>
#include <ipxe/netdevice.h>
#include <ipxe/dhcppkt.h>
#include <ipxe/fakedhcp.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | copy_encap_settings (struct dhcp_packet *dest, struct settings *source, unsigned int encapsulator) |
Copy settings to DHCP packet. More... | |
static int | copy_settings (struct dhcp_packet *dest, struct settings *source) |
Copy settings to DHCP packet. More... | |
int | create_fakedhcpdiscover (struct net_device *netdev, void *data, size_t max_len) |
Create fake DHCPDISCOVER packet. More... | |
int | create_fakedhcpack (struct net_device *netdev, void *data, size_t max_len) |
Create fake DHCPACK packet. More... | |
int | create_fakepxebsack (struct net_device *netdev, void *data, size_t max_len) |
Create fake PXE Boot Server ACK packet. More... | |
Fake DHCP packets.
Definition in file fakedhcp.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Copy settings to DHCP packet.
dest | Destination DHCP packet |
source | Source settings block |
encapsulator | Encapsulating setting tag number, or zero |
rc | Return status code |
Definition at line 50 of file fakedhcp.c.
References data, dest, DHCP_EB_ENCAP, DHCP_ENCAP_OPT, DHCP_MAX_OPTION, DHCP_MIN_OPTION, DHCP_VENDOR_ENCAP, dhcppkt_store(), fetch_raw_setting_copy(), free, len, setting::name, rc, tag, and setting::tag.
Referenced by copy_settings().
|
static |
Copy settings to DHCP packet.
dest | Destination DHCP packet |
source | Source settings block |
rc | Return status code |
Definition at line 94 of file fakedhcp.c.
References copy_encap_settings(), and dest.
Referenced by create_fakedhcpack(), and create_fakepxebsack().
int create_fakedhcpdiscover | ( | struct net_device * | netdev, |
void * | data, | ||
size_t | max_len | ||
) |
Create fake DHCPDISCOVER packet.
netdev | Network device |
data | Buffer for DHCP packet |
max_len | Size of DHCP packet buffer |
rc | Return status code |
Used by external code.
Definition at line 109 of file fakedhcp.c.
References data, DBG, dhcp_create_request(), dhcp_last_xid, DHCPDISCOVER, netdev, rc, and strerror().
Referenced by efi_pxe_fake_all().
int create_fakedhcpack | ( | struct net_device * | netdev, |
void * | data, | ||
size_t | max_len | ||
) |
Create fake DHCPACK packet.
netdev | Network device |
data | Buffer for DHCP packet |
max_len | Size of DHCP packet buffer |
rc | Return status code |
Used by external code.
Definition at line 136 of file fakedhcp.c.
References copy_settings(), data, DBG, dhcp_create_packet(), dhcp_last_xid, DHCPACK, netdev, netdev_settings(), NULL, rc, and strerror().
Referenced by create_fakepxebsack(), efi_pxe_fake_all(), and nbi_prepare_dhcp().
int create_fakepxebsack | ( | struct net_device * | netdev, |
void * | data, | ||
size_t | max_len | ||
) |
Create fake PXE Boot Server ACK packet.
netdev | Network device |
data | Buffer for DHCP packet |
max_len | Size of DHCP packet buffer |
rc | Return status code |
Used by external code.
Definition at line 178 of file fakedhcp.c.
References dhcphdr::ciaddr, copy_settings(), create_fakedhcpack(), data, DBG, dhcp_create_packet(), dhcp_last_xid, DHCPACK, dhcp_packet::dhcphdr, fetch_ipv4_setting(), find_settings(), netdev, netdev_settings(), NULL, PROXYDHCP_SETTINGS_NAME, PXEBS_SETTINGS_NAME, rc, and strerror().
Referenced by efi_pxe_fake_all().