1 Star 0 Fork 49

mgb01105731 / grub2_2

forked from src-anolis-os / grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0490-efinet-Add-DHCP-proxy-support.patch 2.19 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2022-05-11 18:31 . update to grub2-2.02-123.el8.src.rpm
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ian Page Hands <iphands@gmail.com>
Date: Tue, 8 Jun 2021 13:48:56 -0400
Subject: [PATCH] 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. Currently that case is not handled, add support for it.
(cherry picked from commit 9cd94b23fe366b87ef25c13c95a531325af9016f)
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
grub-core/net/drivers/efi/efinet.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index df7760ad2..25809050b 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -850,10 +850,31 @@ 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 = &pxe_mode->dhcp_ack;
+
+ if (pxe_mode->proxy_offer_received)
+ {
+ grub_dprintf ("efinet", "proxy offer receive");
+ struct grub_net_bootp_packet *proxy_offer = &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;
+ }
+ }
+
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);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mgb01105731/grub2_2.git
git@gitee.com:mgb01105731/grub2_2.git
mgb01105731
grub2_2
grub2_2
a8

搜索帮助

344bd9b3 5694891 D2dac590 5694891