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