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