5 Star 0 Fork 16

OpenCloudOS Stream/grub2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0219-efi-http-Make-root_url-reflect-the-protocol-hostname.patch 1.60 KB
一键复制 编辑 原始数据 按行查看 历史
nilusyi 提交于 2024-04-07 16:45 . update patches
From 6a6023148735e2ff05869448fe6eed08de1d91d1 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 30 Jul 2018 16:39:57 -0400
Subject: [PATCH 219/272] efi/http: Make root_url reflect the protocol+hostname
of our boot url.
This lets you write config files that don't know urls.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/efi/http.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
index 70affd8ed..9f860fc04 100644
--- a/grub-core/net/efi/http.c
+++ b/grub-core/net/efi/http.c
@@ -5,6 +5,7 @@
#include <grub/net/efi.h>
#include <grub/charset.h>
#include <grub/safemath.h>
+#include <grub/env.h>
static void
http_configure (struct grub_efi_net_device *dev, int prefer_ip6)
@@ -356,6 +357,24 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
grub_err_t err;
grub_off_t size;
char *buf;
+ char *root_url;
+ grub_efi_ipv6_address_t address;
+ const char *rest;
+
+ if (grub_efi_string_to_ip6_address (file->device->net->server, &address, &rest) && *rest == 0)
+ root_url = grub_xasprintf ("%s://[%s]", type ? "https" : "http", file->device->net->server);
+ else
+ root_url = grub_xasprintf ("%s://%s", type ? "https" : "http", file->device->net->server);
+ if (root_url)
+ {
+ grub_env_unset ("root_url");
+ grub_env_set ("root_url", root_url);
+ grub_free (root_url);
+ }
+ else
+ {
+ return grub_errno;
+ }
err = efihttp_request (dev->http, file->device->net->server, file->device->net->name, type, 1, 0);
if (err != GRUB_ERR_NONE)
--
2.41.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/opencloudos-stream/grub2.git
git@gitee.com:opencloudos-stream/grub2.git
opencloudos-stream
grub2
grub2
master

搜索帮助