nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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