summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_net.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-12-04 10:01:48 -0500
committerTom Rini <trini@konsulko.com>2022-12-04 10:01:48 -0500
commitd2c5607edde2544e059fa871927877213f6bd532 (patch)
treee57d7db3425ccc950a1b0d5f3d4332eb7be84d54 /lib/efi_loader/efi_net.c
parenta32f6341ccf2ea69f64fe87b9d07fd87325a2056 (diff)
parent30124c2bb96decd737963c043b26407791859faf (diff)
Merge tag 'efi-2023-01-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2023-01-rc3 Documentation: * describe DM firmware needed for j721e_evm * describe management of UEFI security data base with eficonfig UEFI: * code clean-up for eficonfig command * fix handling of DHCP aknowledge * correct EFI memory type used for U-Boot code * unit test for FatToStr() truncation * add an EFI binary to print boot hart ID Other: * improve parameter checks in console functions * fix variable initialization in blk_get_device_part_str
Diffstat (limited to 'lib/efi_loader/efi_net.c')
-rw-r--r--lib/efi_loader/efi_net.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index 69276b275d9..96a5bcca275 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -30,6 +30,7 @@ static uchar **receive_buffer;
static size_t *receive_lengths;
static int rx_packet_idx;
static int rx_packet_num;
+static struct efi_net_obj *netobj;
/*
* The notification function of this event is called in every timer cycle
@@ -660,10 +661,16 @@ void efi_net_set_dhcp_ack(void *pkt, int len)
{
int maxsize = sizeof(*dhcp_ack);
- if (!dhcp_ack)
+ if (!dhcp_ack) {
dhcp_ack = malloc(maxsize);
-
+ if (!dhcp_ack)
+ return;
+ }
+ memset(dhcp_ack, 0, maxsize);
memcpy(dhcp_ack, pkt, min(len, maxsize));
+
+ if (netobj)
+ netobj->pxe_mode.dhcp_ack = *dhcp_ack;
}
/**
@@ -853,7 +860,6 @@ static efi_status_t EFIAPI efi_pxe_base_code_set_packets(
*/
efi_status_t efi_net_register(void)
{
- struct efi_net_obj *netobj = NULL;
efi_status_t r;
int i;
@@ -982,6 +988,7 @@ failure_to_add_protocol:
return r;
out_of_resources:
free(netobj);
+ netobj = NULL;
free(transmit_buffer);
if (receive_buffer)
for (i = 0; i < ETH_PACKETS_BATCH_RECV; i++)