nalika / rpms / grub2

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