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

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