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

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