|
|
4fe85b |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
4fe85b |
From: Peter Jones <pjones@redhat.com>
|
|
|
4fe85b |
Date: Mon, 30 Jul 2018 16:39:57 -0400
|
|
|
4fe85b |
Subject: [PATCH] Make root_url reflect the protocol+hostname of our boot url.
|
|
|
4fe85b |
|
|
|
4fe85b |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
4fe85b |
---
|
|
|
4fe85b |
grub-core/net/efi/http.c | 19 +++++++++++++++++++
|
|
|
4fe85b |
1 file changed, 19 insertions(+)
|
|
|
4fe85b |
|
|
|
4fe85b |
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
|
|
|
4fe85b |
index 3f61fd2fa5b..243acbaa35b 100644
|
|
|
4fe85b |
--- a/grub-core/net/efi/http.c
|
|
|
4fe85b |
+++ b/grub-core/net/efi/http.c
|
|
|
4fe85b |
@@ -4,6 +4,7 @@
|
|
|
4fe85b |
#include <grub/misc.h>
|
|
|
4fe85b |
#include <grub/net/efi.h>
|
|
|
4fe85b |
#include <grub/charset.h>
|
|
|
4fe85b |
+#include <grub/env.h>
|
|
|
4fe85b |
|
|
|
4fe85b |
static void
|
|
|
4fe85b |
http_configure (struct grub_efi_net_device *dev, int prefer_ip6)
|
|
|
4fe85b |
@@ -351,6 +352,24 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
|
|
|
4fe85b |
grub_err_t err;
|
|
|
4fe85b |
grub_off_t size;
|
|
|
4fe85b |
char *buf;
|
|
|
4fe85b |
+ char *root_url;
|
|
|
4fe85b |
+ grub_efi_ipv6_address_t address;
|
|
|
4fe85b |
+ const char *rest;
|
|
|
4fe85b |
+
|
|
|
4fe85b |
+ if (grub_efi_string_to_ip6_address (file->device->net->server, &address, &rest) && *rest == 0)
|
|
|
4fe85b |
+ root_url = grub_xasprintf ("%s://[%s]", type ? "https" : "http", file->device->net->server);
|
|
|
4fe85b |
+ else
|
|
|
4fe85b |
+ root_url = grub_xasprintf ("%s://%s", type ? "https" : "http", file->device->net->server);
|
|
|
4fe85b |
+ if (root_url)
|
|
|
4fe85b |
+ {
|
|
|
4fe85b |
+ grub_env_unset ("root_url");
|
|
|
4fe85b |
+ grub_env_set ("root_url", root_url);
|
|
|
4fe85b |
+ grub_free (root_url);
|
|
|
4fe85b |
+ }
|
|
|
4fe85b |
+ else
|
|
|
4fe85b |
+ {
|
|
|
4fe85b |
+ return grub_errno;
|
|
|
4fe85b |
+ }
|
|
|
4fe85b |
|
|
|
4fe85b |
err = efihttp_request (dev->http, file->device->net->server, file->device->net->name, type, 1, 0);
|
|
|
4fe85b |
if (err != GRUB_ERR_NONE)
|