iPXE
Functions
efi_cachedhcp.h File Reference

EFI cached DHCP packet. More...

#include <ipxe/efi/efi.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
int efi_cachedhcp_record (EFI_HANDLE device, EFI_DEVICE_PATH_PROTOCOL *path)
 Record cached DHCP packet. More...
 

Detailed Description

EFI cached DHCP packet.

Definition in file efi_cachedhcp.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ efi_cachedhcp_record()

int efi_cachedhcp_record ( EFI_HANDLE  device,
EFI_DEVICE_PATH_PROTOCOL path 
)

Record cached DHCP packet.

Parameters
deviceDevice handle
pathDevice path
Return values
rcReturn status code

Definition at line 47 of file efi_cachedhcp.c.

48  {
49  unsigned int vlan;
52  int rc;
53 
54  /* Get VLAN tag, if any */
55  vlan = efi_path_vlan ( path );
56 
57  /* Look for a PXE base code instance on the image's device handle */
59  &pxe ) ) != 0 ) {
60  DBGC ( device, "EFI %s has no PXE base code instance: %s\n",
61  efi_handle_name ( device ), strerror ( rc ) );
62  return rc;
63  }
64 
65  /* Do not attempt to cache IPv6 packets */
66  mode = pxe->Mode;
67  if ( mode->UsingIpv6 ) {
68  DBGC ( device, "EFI %s has IPv6 PXE base code\n",
69  efi_handle_name ( device ) );
70  return -ENOTSUP;
71  }
72 
73  /* Record DHCPACK, if present */
74  if ( mode->DhcpAckReceived &&
75  ( ( rc = cachedhcp_record ( &cached_dhcpack, vlan, &mode->DhcpAck,
76  sizeof ( mode->DhcpAck ) ) ) != 0 ) ) {
77  DBGC ( device, "EFI %s could not record DHCPACK: %s\n",
78  efi_handle_name ( device ), strerror ( rc ) );
79  return rc;
80  }
81 
82  /* Record ProxyDHCPOFFER, if present */
83  if ( mode->ProxyOfferReceived &&
84  ( ( rc = cachedhcp_record ( &cached_proxydhcp, vlan,
85  &mode->ProxyOffer,
86  sizeof ( mode->ProxyOffer ) ) ) != 0)){
87  DBGC ( device, "EFI %s could not record ProxyDHCPOFFER: %s\n",
88  efi_handle_name ( device ), strerror ( rc ) );
89  return rc;
90  }
91 
92  /* Record PxeBSACK, if present */
93  if ( mode->PxeReplyReceived &&
94  ( ( rc = cachedhcp_record ( &cached_pxebs, vlan, &mode->PxeReply,
95  sizeof ( mode->PxeReply ) ) ) != 0 )){
96  DBGC ( device, "EFI %s could not record PXEBSACK: %s\n",
97  efi_handle_name ( device ), strerror ( rc ) );
98  return rc;
99  }
100 
101  return 0;
102 }
EFI_PXE_BASE_CODE_MODE.
Definition: PxeBaseCode.h:269
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
unsigned int efi_path_vlan(EFI_DEVICE_PATH_PROTOCOL *path)
Get VLAN tag from device path.
Definition: efi_path.c:236
struct cached_dhcp_packet cached_proxydhcp
Cached ProxyDHCPOFFER.
Definition: cachedhcp.c:68
uint16_t mode
Acceleration mode.
Definition: ena.h:26
#define DBGC(...)
Definition: compiler.h:505
EFI_GUID efi_pxe_base_code_protocol_guid
PXE base code protocol GUID.
Definition: efi_guid.c:320
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
A hardware device.
Definition: device.h:76
int cachedhcp_record(struct cached_dhcp_packet *cache, unsigned int vlan, const void *data, size_t max_len)
Record cached DHCP packet.
Definition: cachedhcp.c:202
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
Definition: efi.h:443
struct cached_dhcp_packet cached_dhcpack
Cached DHCPACK.
Definition: cachedhcp.c:62
struct cached_dhcp_packet cached_pxebs
Cached PXEBSACK.
Definition: cachedhcp.c:73
EFI_PXE_BASE_CODE_MODE * Mode
The pointer to the EFI_PXE_BASE_CODE_MODE data for this device.
Definition: PxeBaseCode.h:928
The EFI_PXE_BASE_CODE_PROTOCOL is used to control PXE-compatible devices.
Definition: PxeBaseCode.h:906

References cached_dhcpack, cached_proxydhcp, cached_pxebs, cachedhcp_record(), DBGC, efi_handle_name(), efi_open, efi_path_vlan(), efi_pxe_base_code_protocol_guid, ENOTSUP, mode, _EFI_PXE_BASE_CODE_PROTOCOL::Mode, rc, and strerror().

Referenced by efi_init_application().