File: efinet-add-dhcp-proxy-support.patch

package info (click to toggle)
grub2 2.12-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie, trixie-proposed-updates, trixie-updates
  • size: 70,780 kB
  • sloc: ansic: 424,740; asm: 16,228; sh: 9,525; cpp: 2,095; makefile: 1,590; python: 1,468; sed: 431; lex: 393; yacc: 268; awk: 85; lisp: 54; perl: 31
file content (55 lines) | stat: -rw-r--r-- 2,463 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From: Ian Page Hands <iphands@gmail.com>
Date: Mon, 9 Jan 2023 18:30:45 -0500
Subject: efinet: Add DHCP proxy support

If a proxyDHCP configuration is used, the server name, server IP and
boot file values should be taken from the DHCP proxy offer instead of
the DHCP server ack packet.

Signed-off-by: Ian Page Hands <iphands@gmail.com>
Co-authored-by: Robbie Harwood <rharwood@redhat.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
 grub-core/net/drivers/efi/efinet.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 69004d5..4a8c38c 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -863,10 +863,33 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
     else
       {
 	grub_dprintf ("efinet", "using ipv4 and dhcp\n");
+
+        struct grub_net_bootp_packet *dhcp_ack = (void *) &pxe_mode->dhcp_ack;
+
+        if (pxe_mode->proxy_offer_received)
+          {
+            grub_dprintf ("efinet", "proxy offer receive");
+            struct grub_net_bootp_packet *proxy_offer = (void *) &pxe_mode->proxy_offer;
+
+            if (proxy_offer && dhcp_ack->boot_file[0] == '\0')
+              {
+                grub_dprintf ("efinet", "setting values from proxy offer");
+                /*
+                 * Here we got a proxy offer and the dhcp_ack has a nil
+                 * boot_file Copy the proxy DHCP offer details into the
+                 * bootp_packet we are sending forward as they are the deatils
+                 * we need.
+                 */
+                *dhcp_ack->server_name = *proxy_offer->server_name;
+                *dhcp_ack->boot_file = *proxy_offer->boot_file;
+                dhcp_ack->server_ip = proxy_offer->server_ip;
+              }
+          }
+
 	inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
                                                 (struct grub_net_bootp_packet *)
-                                                packet_buf,
-                                                packet_bufsz,
+                                                &pxe_mode->dhcp_ack,
+                                                sizeof (pxe_mode->dhcp_ack),
                                                 1, device, path);
 	grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
       }