Blame SOURCES/0490-efinet-Add-DHCP-proxy-support.patch

b71686
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b71686
From: Ian Page Hands <iphands@gmail.com>
b71686
Date: Tue, 8 Jun 2021 13:48:56 -0400
b71686
Subject: [PATCH] efinet: Add DHCP proxy support
b71686
b71686
If a proxyDHCP configuration is used, the server name, server IP and boot
b71686
file values should be taken from the DHCP proxy offer instead of the DHCP
b71686
server ack packet. Currently that case is not handled, add support for it.
b71686
b71686
(cherry picked from commit 9cd94b23fe366b87ef25c13c95a531325af9016f)
b71686
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
b71686
---
b71686
 grub-core/net/drivers/efi/efinet.c | 25 +++++++++++++++++++++++--
b71686
 1 file changed, 23 insertions(+), 2 deletions(-)
b71686
b71686
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
b71686
index df7760ad2..25809050b 100644
b71686
--- a/grub-core/net/drivers/efi/efinet.c
b71686
+++ b/grub-core/net/drivers/efi/efinet.c
b71686
@@ -850,10 +850,31 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
b71686
     else
b71686
       {
b71686
 	grub_dprintf ("efinet", "using ipv4 and dhcp\n");
b71686
+
b71686
+        struct grub_net_bootp_packet *dhcp_ack = &pxe_mode->dhcp_ack;
b71686
+
b71686
+        if (pxe_mode->proxy_offer_received)
b71686
+          {
b71686
+            grub_dprintf ("efinet", "proxy offer receive");
b71686
+            struct grub_net_bootp_packet *proxy_offer = &pxe_mode->proxy_offer;
b71686
+
b71686
+            if (proxy_offer && dhcp_ack->boot_file[0] == '\0')
b71686
+              {
b71686
+                grub_dprintf ("efinet", "setting values from proxy offer");
b71686
+                /* Here we got a proxy offer and the dhcp_ack has a nil boot_file
b71686
+                 * Copy the proxy DHCP offer details into the bootp_packet we are
b71686
+                 * sending forward as they are the deatils we need.
b71686
+                 */
b71686
+                *dhcp_ack->server_name = *proxy_offer->server_name;
b71686
+                *dhcp_ack->boot_file   = *proxy_offer->boot_file;
b71686
+                dhcp_ack->server_ip    = proxy_offer->server_ip;
b71686
+              }
b71686
+          }
b71686
+
b71686
 	grub_net_configure_by_dhcp_ack (card->name, card, 0,
b71686
 					(struct grub_net_bootp_packet *)
b71686
-					packet_buf,
b71686
-					packet_bufsz,
b71686
+					&pxe_mode->dhcp_ack,
b71686
+					sizeof (pxe_mode->dhcp_ack),
b71686
 					1, device, path);
b71686
 	grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
b71686
       }