|
|
|
@ -33,18 +33,18 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
|
|
grub-core/net/drivers/efi/efinet.c | 27 +
|
|
|
|
|
grub-core/net/efi/dhcp.c | 397 ++++++++++
|
|
|
|
|
grub-core/net/efi/efi_netfs.c | 57 ++
|
|
|
|
|
grub-core/net/efi/http.c | 419 +++++++++++
|
|
|
|
|
grub-core/net/efi/http.c | 410 +++++++++++
|
|
|
|
|
grub-core/net/efi/ip4_config.c | 398 ++++++++++
|
|
|
|
|
grub-core/net/efi/ip6_config.c | 422 +++++++++++
|
|
|
|
|
grub-core/net/efi/net.c | 1428 ++++++++++++++++++++++++++++++++++++
|
|
|
|
|
grub-core/net/efi/pxe.c | 424 +++++++++++
|
|
|
|
|
grub-core/net/net.c | 74 ++
|
|
|
|
|
util/grub-mknetdir.c | 23 +-
|
|
|
|
|
include/grub/efi/api.h | 180 ++++-
|
|
|
|
|
include/grub/efi/api.h | 195 ++++-
|
|
|
|
|
include/grub/efi/dhcp.h | 343 +++++++++
|
|
|
|
|
include/grub/efi/http.h | 215 ++++++
|
|
|
|
|
include/grub/net/efi.h | 144 ++++
|
|
|
|
|
17 files changed, 4620 insertions(+), 41 deletions(-)
|
|
|
|
|
17 files changed, 4618 insertions(+), 49 deletions(-)
|
|
|
|
|
create mode 100644 grub-core/net/efi/dhcp.c
|
|
|
|
|
create mode 100644 grub-core/net/efi/efi_netfs.c
|
|
|
|
|
create mode 100644 grub-core/net/efi/http.c
|
|
|
|
@ -57,10 +57,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
|
|
create mode 100644 include/grub/net/efi.h
|
|
|
|
|
|
|
|
|
|
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
|
|
|
|
index 52ec0fafcd..12797336c9 100644
|
|
|
|
|
index 6645fbae34f..56eb6a828e8 100644
|
|
|
|
|
--- a/grub-core/Makefile.core.def
|
|
|
|
|
+++ b/grub-core/Makefile.core.def
|
|
|
|
|
@@ -2300,6 +2300,12 @@ module = {
|
|
|
|
|
@@ -2356,6 +2356,12 @@ module = {
|
|
|
|
|
common = hook/datehook.c;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -73,7 +73,7 @@ index 52ec0fafcd..12797336c9 100644
|
|
|
|
|
module = {
|
|
|
|
|
name = net;
|
|
|
|
|
common = net/net.c;
|
|
|
|
|
@@ -2313,6 +2319,12 @@ module = {
|
|
|
|
|
@@ -2369,6 +2375,12 @@ module = {
|
|
|
|
|
common = net/ethernet.c;
|
|
|
|
|
common = net/arp.c;
|
|
|
|
|
common = net/netbuff.c;
|
|
|
|
@ -87,7 +87,7 @@ index 52ec0fafcd..12797336c9 100644
|
|
|
|
|
|
|
|
|
|
module = {
|
|
|
|
|
diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c
|
|
|
|
|
index a458c3aca7..1637731535 100644
|
|
|
|
|
index a458c3aca78..1637731535e 100644
|
|
|
|
|
--- a/grub-core/io/bufio.c
|
|
|
|
|
+++ b/grub-core/io/bufio.c
|
|
|
|
|
@@ -139,7 +139,7 @@ grub_bufio_read (grub_file_t file, char *buf, grub_size_t len)
|
|
|
|
@ -100,10 +100,10 @@ index a458c3aca7..1637731535 100644
|
|
|
|
|
if (file->offset + res < next_buf)
|
|
|
|
|
{
|
|
|
|
|
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
|
|
|
|
index d6a2fb5778..2a446f5031 100644
|
|
|
|
|
index 2bb8a0e7a38..bf16c4307bc 100644
|
|
|
|
|
--- a/grub-core/kern/efi/efi.c
|
|
|
|
|
+++ b/grub-core/kern/efi/efi.c
|
|
|
|
|
@@ -755,7 +755,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
|
|
|
|
@@ -775,7 +775,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
|
|
|
|
{
|
|
|
|
|
grub_efi_ipv4_device_path_t *ipv4
|
|
|
|
|
= (grub_efi_ipv4_device_path_t *) dp;
|
|
|
|
@ -112,7 +112,7 @@ index d6a2fb5778..2a446f5031 100644
|
|
|
|
|
(unsigned) ipv4->local_ip_address[0],
|
|
|
|
|
(unsigned) ipv4->local_ip_address[1],
|
|
|
|
|
(unsigned) ipv4->local_ip_address[2],
|
|
|
|
|
@@ -768,33 +768,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
|
|
|
|
@@ -788,33 +788,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
|
|
|
|
(unsigned) ipv4->remote_port,
|
|
|
|
|
(unsigned) ipv4->protocol,
|
|
|
|
|
(unsigned) ipv4->static_ip_address);
|
|
|
|
@ -190,7 +190,7 @@ index d6a2fb5778..2a446f5031 100644
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE:
|
|
|
|
|
@@ -834,6 +861,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
|
|
|
|
@@ -861,6 +888,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
|
|
|
|
dump_vendor_path ("Messaging",
|
|
|
|
|
(grub_efi_vendor_device_path_t *) dp);
|
|
|
|
|
break;
|
|
|
|
@ -231,7 +231,7 @@ index d6a2fb5778..2a446f5031 100644
|
|
|
|
|
grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype);
|
|
|
|
|
break;
|
|
|
|
|
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
|
|
|
|
index 715a6168d7..e11d759f19 100644
|
|
|
|
|
index a91df09ee6d..225dc896da0 100644
|
|
|
|
|
--- a/grub-core/net/drivers/efi/efinet.c
|
|
|
|
|
+++ b/grub-core/net/drivers/efi/efinet.c
|
|
|
|
|
@@ -27,6 +27,7 @@
|
|
|
|
@ -242,7 +242,7 @@ index 715a6168d7..e11d759f19 100644
|
|
|
|
|
|
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
|
|
|
|
|
@@ -491,6 +492,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
|
|
|
|
@@ -508,6 +509,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
|
|
|
|
|
|
|
|
|
|
ldp = grub_efi_find_last_device_path (ddp);
|
|
|
|
|
|
|
|
|
@ -260,7 +260,7 @@ index 715a6168d7..e11d759f19 100644
|
|
|
|
|
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
|
|
|
|
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
|
|
|
|
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE))
|
|
|
|
|
@@ -760,6 +772,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
|
|
|
|
@@ -781,6 +793,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
|
|
|
|
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
|
|
|
|
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
|
|
|
|
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE
|
|
|
|
@ -268,7 +268,7 @@ index 715a6168d7..e11d759f19 100644
|
|
|
|
|
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE))
|
|
|
|
|
continue;
|
|
|
|
|
dup_dp = grub_efi_duplicate_device_path (dp);
|
|
|
|
|
@@ -774,6 +787,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
|
|
|
|
@@ -795,6 +808,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
|
|
|
|
dup_ldp->length = sizeof (*dup_ldp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -284,7 +284,7 @@ index 715a6168d7..e11d759f19 100644
|
|
|
|
|
dup_ldp = grub_efi_find_last_device_path (dup_dp);
|
|
|
|
|
dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
|
|
|
|
dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
|
|
|
|
@@ -845,6 +867,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
|
|
|
|
@@ -889,6 +911,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
|
|
|
|
|
|
|
|
|
GRUB_MOD_INIT(efinet)
|
|
|
|
|
{
|
|
|
|
@ -294,8 +294,8 @@ index 715a6168d7..e11d759f19 100644
|
|
|
|
|
grub_efinet_findcards ();
|
|
|
|
|
grub_efi_net_config = grub_efi_net_config_real;
|
|
|
|
|
}
|
|
|
|
|
@@ -856,5 +881,7 @@ GRUB_MOD_FINI(efinet)
|
|
|
|
|
FOR_NET_CARDS_SAFE (card, next)
|
|
|
|
|
@@ -900,5 +925,7 @@ GRUB_MOD_FINI(efinet)
|
|
|
|
|
FOR_NET_CARDS_SAFE (card, next)
|
|
|
|
|
if (card->driver == &efidriver)
|
|
|
|
|
grub_net_card_unregister (card);
|
|
|
|
|
+
|
|
|
|
@ -304,7 +304,7 @@ index 715a6168d7..e11d759f19 100644
|
|
|
|
|
|
|
|
|
|
diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..dbef63d8c0
|
|
|
|
|
index 00000000000..ca19902441b
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/grub-core/net/efi/dhcp.c
|
|
|
|
|
@@ -0,0 +1,397 @@
|
|
|
|
@ -385,7 +385,7 @@ index 0000000000..dbef63d8c0
|
|
|
|
|
+ grub_efi_uint32_t option_count = 0;
|
|
|
|
|
+ grub_efi_uint32_t i;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, NULL);
|
|
|
|
|
+ status = dhcp4->parse(dhcp4, reply_packet, &option_count, NULL);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_BUFFER_TOO_SMALL)
|
|
|
|
|
+ return NULL;
|
|
|
|
@ -394,7 +394,7 @@ index 0000000000..dbef63d8c0
|
|
|
|
|
+ if (!option_list)
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, option_list);
|
|
|
|
|
+ status = dhcp4->parse(dhcp4, reply_packet, &option_count, option_list);
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_free (option_list);
|
|
|
|
@ -443,13 +443,13 @@ index 0000000000..dbef63d8c0
|
|
|
|
|
+
|
|
|
|
|
+ if (!mode->started)
|
|
|
|
|
+ {
|
|
|
|
|
+ status = efi_call_2 (pxe->start, pxe, 0);
|
|
|
|
|
+ status = pxe->start(pxe, 0);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ grub_printf ("Couldn't start PXE\n");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_2 (pxe->dhcp, pxe, 0);
|
|
|
|
|
+ status = pxe->dhcp(pxe, 0);
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_printf ("dhcp4 configure failed, %d\n", (int)status);
|
|
|
|
@ -500,7 +500,7 @@ index 0000000000..dbef63d8c0
|
|
|
|
|
+ config.option_list = &options;
|
|
|
|
|
+
|
|
|
|
|
+ /* FIXME: What if the dhcp has bounded */
|
|
|
|
|
+ status = efi_call_2 (netdev->dhcp4->configure, netdev->dhcp4, &config);
|
|
|
|
|
+ status = netdev->dhcp4->configure(netdev->dhcp4, &config);
|
|
|
|
|
+ grub_free (options);
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
@ -508,14 +508,14 @@ index 0000000000..dbef63d8c0
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_2 (netdev->dhcp4->start, netdev->dhcp4, NULL);
|
|
|
|
|
+ status = netdev->dhcp4->start(netdev->dhcp4, NULL);
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_printf ("dhcp4 start failed, %d\n", (int)status);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_2 (netdev->dhcp4->get_mode_data, netdev->dhcp4, &mode);
|
|
|
|
|
+ status = netdev->dhcp4->get_mode_data(netdev->dhcp4, &mode);
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_printf ("dhcp4 get mode failed, %d\n", (int)status);
|
|
|
|
@ -616,21 +616,21 @@ index 0000000000..dbef63d8c0
|
|
|
|
|
+ config.rapid_commit = 0;
|
|
|
|
|
+ config.solicit_retransmission = &retrans;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_2 (dev->dhcp6->configure, dev->dhcp6, &config);
|
|
|
|
|
+ status = dev->dhcp6->configure(dev->dhcp6, &config);
|
|
|
|
|
+ grub_free (opt);
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_printf ("dhcp6 configure failed, %d\n", (int)status);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ status = efi_call_1 (dev->dhcp6->start, dev->dhcp6);
|
|
|
|
|
+ status = dev->dhcp6->start(dev->dhcp6);
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_printf ("dhcp6 start failed, %d\n", (int)status);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_3 (dev->dhcp6->get_mode_data, dev->dhcp6, &mode, NULL);
|
|
|
|
|
+ status = dev->dhcp6->get_mode_data(dev->dhcp6, &mode, NULL);
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_printf ("dhcp4 get mode failed, %d\n", (int)status);
|
|
|
|
@ -666,12 +666,12 @@ index 0000000000..dbef63d8c0
|
|
|
|
|
+ grub_efi_dhcp6_packet_option_t **options = NULL;
|
|
|
|
|
+ grub_efi_uint32_t i;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, NULL);
|
|
|
|
|
+ status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, NULL);
|
|
|
|
|
+
|
|
|
|
|
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL && count)
|
|
|
|
|
+ {
|
|
|
|
|
+ options = grub_malloc (count * sizeof(*options));
|
|
|
|
|
+ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, options);
|
|
|
|
|
+ status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, options);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
@ -696,8 +696,8 @@ index 0000000000..dbef63d8c0
|
|
|
|
|
+ grub_free (options);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ efi_call_1 (b->free_pool, mode.client_id);
|
|
|
|
|
+ efi_call_1 (b->free_pool, mode.ia);
|
|
|
|
|
+ b->free_pool(mode.client_id);
|
|
|
|
|
+ b->free_pool(mode.ia);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return GRUB_ERR_NONE;
|
|
|
|
@ -707,7 +707,7 @@ index 0000000000..dbef63d8c0
|
|
|
|
|
+grub_command_func_t grub_efi_net_bootp6 = grub_cmd_efi_bootp6;
|
|
|
|
|
diff --git a/grub-core/net/efi/efi_netfs.c b/grub-core/net/efi/efi_netfs.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..ef371d885e
|
|
|
|
|
index 00000000000..ef371d885ea
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/grub-core/net/efi/efi_netfs.c
|
|
|
|
|
@@ -0,0 +1,57 @@
|
|
|
|
@ -770,10 +770,10 @@ index 0000000000..ef371d885e
|
|
|
|
|
+}
|
|
|
|
|
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..3f61fd2fa5
|
|
|
|
|
index 00000000000..de28badccb0
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/grub-core/net/efi/http.c
|
|
|
|
|
@@ -0,0 +1,419 @@
|
|
|
|
|
@@ -0,0 +1,410 @@
|
|
|
|
|
+
|
|
|
|
|
+#include <grub/efi/api.h>
|
|
|
|
|
+#include <grub/efi/efi.h>
|
|
|
|
@ -802,9 +802,9 @@ index 0000000000..3f61fd2fa5
|
|
|
|
|
+
|
|
|
|
|
+ http_config.local_address_is_ipv6 = 1;
|
|
|
|
|
+ sz = sizeof (manual_address);
|
|
|
|
|
+ status = efi_call_4 (dev->ip6_config->get_data, dev->ip6_config,
|
|
|
|
|
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
|
|
|
|
+ &sz, &manual_address);
|
|
|
|
|
+ status = dev->ip6_config->get_data(dev->ip6_config,
|
|
|
|
|
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
|
|
|
|
+ &sz, &manual_address);
|
|
|
|
|
+
|
|
|
|
|
+ if (status == GRUB_EFI_NOT_FOUND)
|
|
|
|
|
+ {
|
|
|
|
@ -834,19 +834,19 @@ index 0000000000..3f61fd2fa5
|
|
|
|
|
+ http_config.access_point.ipv4_node = &httpv4_node;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_2 (http->configure, http, &http_config);
|
|
|
|
|
+ status = http->configure(http, &http_config);
|
|
|
|
|
+
|
|
|
|
|
+ if (status == GRUB_EFI_ALREADY_STARTED)
|
|
|
|
|
+ {
|
|
|
|
|
+ /* XXX: This hangs HTTPS boot */
|
|
|
|
|
+#if 0
|
|
|
|
|
+ if (efi_call_2 (http->configure, http, NULL) != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ if (http->configure(http, NULL) != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_error (GRUB_ERR_IO, N_("couldn't reset http instance"));
|
|
|
|
|
+ grub_print_error ();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ status = efi_call_2 (http->configure, http, &http_config);
|
|
|
|
|
+ status = http->configure(http, &http_config);
|
|
|
|
|
+#endif
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
@ -945,12 +945,9 @@ index 0000000000..3f61fd2fa5
|
|
|
|
|
+ request_token.message = &request_message;
|
|
|
|
|
+
|
|
|
|
|
+ request_callback_done = 0;
|
|
|
|
|
+ status = efi_call_5 (b->create_event,
|
|
|
|
|
+ GRUB_EFI_EVT_NOTIFY_SIGNAL,
|
|
|
|
|
+ GRUB_EFI_TPL_CALLBACK,
|
|
|
|
|
+ grub_efi_http_request_callback,
|
|
|
|
|
+ NULL,
|
|
|
|
|
+ &request_token.event);
|
|
|
|
|
+ status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
|
|
|
|
|
+ grub_efi_http_request_callback, NULL,
|
|
|
|
|
+ &request_token.event);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
@ -958,17 +955,17 @@ index 0000000000..3f61fd2fa5
|
|
|
|
|
+ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_2 (http->request, http, &request_token);
|
|
|
|
|
+ status = http->request(http, &request_token);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ efi_call_1 (b->close_event, request_token.event);
|
|
|
|
|
+ b->close_event(request_token.event);
|
|
|
|
|
+ grub_free (request_data.url);
|
|
|
|
|
+ return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", status);
|
|
|
|
|
+ }
|
|
|
|
|
+ /* TODO: Add Timeout */
|
|
|
|
|
+ while (!request_callback_done)
|
|
|
|
|
+ efi_call_1(http->poll, http);
|
|
|
|
|
+ http->poll(http);
|
|
|
|
|
+
|
|
|
|
|
+ response_data.status_code = GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS;
|
|
|
|
|
+ response_message.data.response = &response_data;
|
|
|
|
@ -981,16 +978,13 @@ index 0000000000..3f61fd2fa5
|
|
|
|
|
+ response_message.body = NULL;
|
|
|
|
|
+ response_token.event = NULL;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_5 (b->create_event,
|
|
|
|
|
+ GRUB_EFI_EVT_NOTIFY_SIGNAL,
|
|
|
|
|
+ GRUB_EFI_TPL_CALLBACK,
|
|
|
|
|
+ grub_efi_http_response_callback,
|
|
|
|
|
+ NULL,
|
|
|
|
|
+ &response_token.event);
|
|
|
|
|
+ status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
|
|
|
|
|
+ grub_efi_http_response_callback, NULL,
|
|
|
|
|
+ &response_token.event);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ efi_call_1 (b->close_event, request_token.event);
|
|
|
|
|
+ b->close_event(request_token.event);
|
|
|
|
|
+ grub_free (request_data.url);
|
|
|
|
|
+ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status);
|
|
|
|
|
+ }
|
|
|
|
@ -1000,28 +994,28 @@ index 0000000000..3f61fd2fa5
|
|
|
|
|
+
|
|
|
|
|
+ /* wait for HTTP response */
|
|
|
|
|
+ response_callback_done = 0;
|
|
|
|
|
+ status = efi_call_2 (http->response, http, &response_token);
|
|
|
|
|
+ status = http->response(http, &response_token);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ efi_call_1 (b->close_event, response_token.event);
|
|
|
|
|
+ efi_call_1 (b->close_event, request_token.event);
|
|
|
|
|
+ b->close_event(response_token.event);
|
|
|
|
|
+ b->close_event(request_token.event);
|
|
|
|
|
+ grub_free (request_data.url);
|
|
|
|
|
+ return grub_error (GRUB_ERR_IO, "Fail to receive a response! status=%d\n", (int)status);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* TODO: Add Timeout */
|
|
|
|
|
+ while (!response_callback_done)
|
|
|
|
|
+ efi_call_1 (http->poll, http);
|
|
|
|
|
+ http->poll(http);
|
|
|
|
|
+
|
|
|
|
|
+ if (response_message.data.response->status_code != GRUB_EFI_HTTP_STATUS_200_OK)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_efi_http_status_code_t status_code = response_message.data.response->status_code;
|
|
|
|
|
+
|
|
|
|
|
+ if (response_message.headers)
|
|
|
|
|
+ efi_call_1 (b->free_pool, response_message.headers);
|
|
|
|
|
+ efi_call_1 (b->close_event, response_token.event);
|
|
|
|
|
+ efi_call_1 (b->close_event, request_token.event);
|
|
|
|
|
+ b->free_pool(response_message.headers);
|
|
|
|
|
+ b->close_event(response_token.event);
|
|
|
|
|
+ b->close_event(request_token.event);
|
|
|
|
|
+ grub_free (request_data.url);
|
|
|
|
|
+ if (status_code == GRUB_EFI_HTTP_STATUS_404_NOT_FOUND)
|
|
|
|
|
+ {
|
|
|
|
@ -1049,9 +1043,9 @@ index 0000000000..3f61fd2fa5
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (response_message.headers)
|
|
|
|
|
+ efi_call_1 (b->free_pool, response_message.headers);
|
|
|
|
|
+ efi_call_1 (b->close_event, response_token.event);
|
|
|
|
|
+ efi_call_1 (b->close_event, request_token.event);
|
|
|
|
|
+ b->free_pool(response_message.headers);
|
|
|
|
|
+ b->close_event(response_token.event);
|
|
|
|
|
+ b->close_event(request_token.event);
|
|
|
|
|
+ grub_free (request_data.url);
|
|
|
|
|
+
|
|
|
|
|
+ return GRUB_ERR_NONE;
|
|
|
|
@ -1076,12 +1070,9 @@ index 0000000000..3f61fd2fa5
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ efi_call_5 (b->create_event,
|
|
|
|
|
+ GRUB_EFI_EVT_NOTIFY_SIGNAL,
|
|
|
|
|
+ GRUB_EFI_TPL_CALLBACK,
|
|
|
|
|
+ grub_efi_http_response_callback,
|
|
|
|
|
+ NULL,
|
|
|
|
|
+ &response_token.event);
|
|
|
|
|
+ b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
|
|
|
|
|
+ grub_efi_http_response_callback, NULL,
|
|
|
|
|
+ &response_token.event);
|
|
|
|
|
+
|
|
|
|
|
+ while (len)
|
|
|
|
|
+ {
|
|
|
|
@ -1096,23 +1087,23 @@ index 0000000000..3f61fd2fa5
|
|
|
|
|
+
|
|
|
|
|
+ response_callback_done = 0;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_2 (http->response, http, &response_token);
|
|
|
|
|
+ status = http->response(http, &response_token);
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ efi_call_1 (b->close_event, response_token.event);
|
|
|
|
|
+ b->close_event(response_token.event);
|
|
|
|
|
+ grub_error (GRUB_ERR_IO, "Error! status=%d\n", (int)status);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ while (!response_callback_done)
|
|
|
|
|
+ efi_call_1(http->poll, http);
|
|
|
|
|
+ http->poll(http);
|
|
|
|
|
+
|
|
|
|
|
+ sum += response_message.body_length;
|
|
|
|
|
+ buf += response_message.body_length;
|
|
|
|
|
+ len -= response_message.body_length;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ efi_call_1 (b->close_event, response_token.event);
|
|
|
|
|
+ b->close_event(response_token.event);
|
|
|
|
|
+
|
|
|
|
|
+ return sum;
|
|
|
|
|
+}
|
|
|
|
@ -1195,7 +1186,7 @@ index 0000000000..3f61fd2fa5
|
|
|
|
|
+ };
|
|
|
|
|
diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..b711a5d945
|
|
|
|
|
index 00000000000..1deba25e79e
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/grub-core/net/efi/ip4_config.c
|
|
|
|
|
@@ -0,0 +1,398 @@
|
|
|
|
@ -1305,17 +1296,17 @@ index 0000000000..b711a5d945
|
|
|
|
|
+ if (!interface_info)
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
|
|
|
|
|
+ &sz, interface_info);
|
|
|
|
|
+ status = ip4_config->get_data(ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
|
|
|
|
|
+ &sz, interface_info);
|
|
|
|
|
+
|
|
|
|
|
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_free (interface_info);
|
|
|
|
|
+ interface_info = grub_malloc (sz);
|
|
|
|
|
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
|
|
|
|
|
+ &sz, interface_info);
|
|
|
|
|
+ status = ip4_config->get_data(ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
|
|
|
|
|
+ &sz, interface_info);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
@ -1339,9 +1330,9 @@ index 0000000000..b711a5d945
|
|
|
|
|
+ if (!manual_address)
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
|
|
|
|
|
+ &sz, manual_address);
|
|
|
|
|
+ status = ip4_config->get_data(ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
|
|
|
|
|
+ &sz, manual_address);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
@ -1546,7 +1537,7 @@ index 0000000000..b711a5d945
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
|
|
|
|
|
+ status = dev->ip4_config->set_data(dev->ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
|
|
|
|
|
+ sizeof(*address), address);
|
|
|
|
|
+
|
|
|
|
@ -1562,9 +1553,9 @@ index 0000000000..b711a5d945
|
|
|
|
|
+{
|
|
|
|
|
+ grub_efi_status_t status;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY,
|
|
|
|
|
+ sizeof (address->ip4), &address->ip4);
|
|
|
|
|
+ status = dev->ip4_config->set_data(dev->ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY,
|
|
|
|
|
+ sizeof (address->ip4), &address->ip4);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ return 0;
|
|
|
|
@ -1578,9 +1569,9 @@ index 0000000000..b711a5d945
|
|
|
|
|
+{
|
|
|
|
|
+ grub_efi_status_t status;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
|
|
|
|
+ sizeof (address->ip4), &address->ip4);
|
|
|
|
|
+ status = dev->ip4_config->set_data(dev->ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
|
|
|
|
+ sizeof (address->ip4), &address->ip4);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ return 0;
|
|
|
|
@ -1599,7 +1590,7 @@ index 0000000000..b711a5d945
|
|
|
|
|
+ };
|
|
|
|
|
diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..017c4d05bc
|
|
|
|
|
index 00000000000..29a03973265
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/grub-core/net/efi/ip6_config.c
|
|
|
|
|
@@ -0,0 +1,422 @@
|
|
|
|
@ -1729,7 +1720,7 @@ index 0000000000..017c4d05bc
|
|
|
|
|
+ sz = sizeof (*interface_info) + sizeof (*interface_info->route_table);
|
|
|
|
|
+ interface_info = grub_malloc (sz);
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
|
|
|
|
|
+ status = ip6_config->get_data(ip6_config,
|
|
|
|
|
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
|
|
|
|
|
+ &sz, interface_info);
|
|
|
|
|
+
|
|
|
|
@ -1737,7 +1728,7 @@ index 0000000000..017c4d05bc
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_free (interface_info);
|
|
|
|
|
+ interface_info = grub_malloc (sz);
|
|
|
|
|
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
|
|
|
|
|
+ status = ip6_config->get_data(ip6_config,
|
|
|
|
|
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
|
|
|
|
|
+ &sz, interface_info);
|
|
|
|
|
+ }
|
|
|
|
@ -1763,7 +1754,7 @@ index 0000000000..017c4d05bc
|
|
|
|
|
+ if (!manual_address)
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
|
|
|
|
|
+ status = ip6_config->get_data(ip6_config,
|
|
|
|
|
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
|
|
|
|
+ &sz, manual_address);
|
|
|
|
|
+
|
|
|
|
@ -1974,7 +1965,7 @@ index 0000000000..017c4d05bc
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
|
|
|
|
|
+ status = dev->ip6_config->set_data(dev->ip6_config,
|
|
|
|
|
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
|
|
|
|
+ sizeof(*address), address);
|
|
|
|
|
+
|
|
|
|
@ -1990,7 +1981,7 @@ index 0000000000..017c4d05bc
|
|
|
|
|
+{
|
|
|
|
|
+ grub_efi_status_t status;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
|
|
|
|
|
+ status = dev->ip6_config->set_data(dev->ip6_config,
|
|
|
|
|
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_GATEWAY,
|
|
|
|
|
+ sizeof (address->ip6), &address->ip6);
|
|
|
|
|
+
|
|
|
|
@ -2006,7 +1997,7 @@ index 0000000000..017c4d05bc
|
|
|
|
|
+
|
|
|
|
|
+ grub_efi_status_t status;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
|
|
|
|
|
+ status = dev->ip6_config->set_data(dev->ip6_config,
|
|
|
|
|
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
|
|
|
|
|
+ sizeof (address->ip6), &address->ip6);
|
|
|
|
|
+
|
|
|
|
@ -2027,7 +2018,7 @@ index 0000000000..017c4d05bc
|
|
|
|
|
+ };
|
|
|
|
|
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..86bce6535d
|
|
|
|
|
index 00000000000..1a19ee27144
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/grub-core/net/efi/net.c
|
|
|
|
|
@@ -0,0 +1,1428 @@
|
|
|
|
@ -2050,15 +2041,15 @@ index 0000000000..86bce6535d
|
|
|
|
|
+
|
|
|
|
|
+#define GRUB_EFI_IP6_PREFIX_LENGTH 64
|
|
|
|
|
+
|
|
|
|
|
+static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
|
|
|
|
|
+static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
|
|
|
|
|
+static grub_efi_guid_t http_service_binding_guid = GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID;
|
|
|
|
|
+static grub_efi_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID;
|
|
|
|
|
+static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
|
|
|
|
|
+static grub_efi_guid_t dhcp4_service_binding_guid = GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID;
|
|
|
|
|
+static grub_efi_guid_t dhcp4_guid = GRUB_EFI_DHCP4_PROTOCOL_GUID;
|
|
|
|
|
+static grub_efi_guid_t dhcp6_service_binding_guid = GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID;
|
|
|
|
|
+static grub_efi_guid_t dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_GUID;
|
|
|
|
|
+static grub_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
|
|
|
|
|
+static grub_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
|
|
|
|
|
+static grub_guid_t http_service_binding_guid = GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID;
|
|
|
|
|
+static grub_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID;
|
|
|
|
|
+static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
|
|
|
|
|
+static grub_guid_t dhcp4_service_binding_guid = GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID;
|
|
|
|
|
+static grub_guid_t dhcp4_guid = GRUB_EFI_DHCP4_PROTOCOL_GUID;
|
|
|
|
|
+static grub_guid_t dhcp6_service_binding_guid = GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID;
|
|
|
|
|
+static grub_guid_t dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_GUID;
|
|
|
|
|
+
|
|
|
|
|
+struct grub_efi_net_device *net_devices;
|
|
|
|
|
+
|
|
|
|
@ -2073,13 +2064,13 @@ index 0000000000..86bce6535d
|
|
|
|
|
+#define efi_net_interface(m,...) efi_net_interface_ ## m (net_interface, ## __VA_ARGS__)
|
|
|
|
|
+
|
|
|
|
|
+static grub_efi_handle_t
|
|
|
|
|
+grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path,
|
|
|
|
|
+grub_efi_locate_device_path (grub_guid_t *protocol, grub_efi_device_path_t *device_path,
|
|
|
|
|
+ grub_efi_device_path_t **r_device_path)
|
|
|
|
|
+{
|
|
|
|
|
+ grub_efi_handle_t handle;
|
|
|
|
|
+ grub_efi_status_t status;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path,
|
|
|
|
|
+ status = grub_efi_system_table->boot_services->locate_device_path(
|
|
|
|
|
+ protocol, &device_path, &handle);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
@ -2721,7 +2712,7 @@ index 0000000000..86bce6535d
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static grub_efi_handle_t
|
|
|
|
|
+grub_efi_service_binding (grub_efi_handle_t dev, grub_efi_guid_t *service_binding_guid)
|
|
|
|
|
+grub_efi_service_binding (grub_efi_handle_t dev, grub_guid_t *service_binding_guid)
|
|
|
|
|
+{
|
|
|
|
|
+ grub_efi_service_binding_t *service;
|
|
|
|
|
+ grub_efi_status_t status;
|
|
|
|
@ -2734,7 +2725,7 @@ index 0000000000..86bce6535d
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_2 (service->create_child, service, &child_dev);
|
|
|
|
|
+ status = service->create_child(service, &child_dev);
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_error (GRUB_ERR_IO, N_("Failed to create child device of http service %x"), status);
|
|
|
|
@ -2944,7 +2935,7 @@ index 0000000000..86bce6535d
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_efi_ip4_config2_policy_t ip4_policy = GRUB_EFI_IP4_CONFIG2_POLICY_STATIC;
|
|
|
|
|
+
|
|
|
|
|
+ if (efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
|
|
|
|
|
+ if (dev->ip4_config->set_data(dev->ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_POLICY,
|
|
|
|
|
+ sizeof (ip4_policy), &ip4_policy) != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP4_CONFIG2_POLICY_STATIC on dev `%s'", dev->card_name);
|
|
|
|
@ -2953,7 +2944,7 @@ index 0000000000..86bce6535d
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_efi_ip6_config_policy_t ip6_policy = GRUB_EFI_IP6_CONFIG_POLICY_MANUAL;
|
|
|
|
|
+
|
|
|
|
|
+ if (efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
|
|
|
|
|
+ if (dev->ip6_config->set_data(dev->ip6_config,
|
|
|
|
|
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_POLICY,
|
|
|
|
|
+ sizeof (ip6_policy), &ip6_policy) != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP6_CONFIG_POLICY_MANUAL on dev `%s'", dev->card_name);
|
|
|
|
@ -3461,7 +3452,7 @@ index 0000000000..86bce6535d
|
|
|
|
|
+}
|
|
|
|
|
diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..531949cba5
|
|
|
|
|
index 00000000000..b84f86ea470
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/grub-core/net/efi/pxe.c
|
|
|
|
|
@@ -0,0 +1,424 @@
|
|
|
|
@ -3484,7 +3475,7 @@ index 0000000000..531949cba5
|
|
|
|
|
+ if (!manual_address)
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
|
|
|
|
|
+ status = ip6_config->get_data(ip6_config,
|
|
|
|
|
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
|
|
|
|
+ &sz, manual_address);
|
|
|
|
|
+
|
|
|
|
@ -3509,7 +3500,7 @@ index 0000000000..531949cba5
|
|
|
|
|
+ if (!manual_address)
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
|
|
|
|
|
+ status = ip4_config->get_data(ip4_config,
|
|
|
|
|
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
|
|
|
|
|
+ &sz, manual_address);
|
|
|
|
|
+
|
|
|
|
@ -3532,7 +3523,7 @@ index 0000000000..531949cba5
|
|
|
|
|
+ if (!mode->started)
|
|
|
|
|
+ {
|
|
|
|
|
+ grub_efi_status_t status;
|
|
|
|
|
+ status = efi_call_2 (pxe->start, pxe, prefer_ip6);
|
|
|
|
|
+ status = pxe->start(pxe, prefer_ip6);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ grub_printf ("Couldn't start PXE\n");
|
|
|
|
@ -3555,7 +3546,7 @@ index 0000000000..531949cba5
|
|
|
|
|
+ grub_efi_pxe_ip_address_t station_ip;
|
|
|
|
|
+
|
|
|
|
|
+ grub_memcpy (station_ip.v6.addr, manual_address->address, sizeof (station_ip.v6.addr));
|
|
|
|
|
+ status = efi_call_3 (pxe->set_station_ip, pxe, &station_ip, NULL);
|
|
|
|
|
+ status = pxe->set_station_ip(pxe, &station_ip, NULL);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ grub_printf ("Couldn't set station ip\n");
|
|
|
|
@ -3578,7 +3569,7 @@ index 0000000000..531949cba5
|
|
|
|
|
+ grub_memcpy (station_ip.v4.addr, manual_address->address, sizeof (station_ip.v4.addr));
|
|
|
|
|
+ grub_memcpy (subnet_mask.v4.addr, manual_address->subnet_mask, sizeof (subnet_mask.v4.addr));
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_3 (pxe->set_station_ip, pxe, &station_ip, &subnet_mask);
|
|
|
|
|
+ status = pxe->set_station_ip(pxe, &station_ip, &subnet_mask);
|
|
|
|
|
+
|
|
|
|
|
+ if (status != GRUB_EFI_SUCCESS)
|
|
|
|
|
+ grub_printf ("Couldn't set station ip\n");
|
|
|
|
@ -3731,7 +3722,7 @@ index 0000000000..531949cba5
|
|
|
|
|
+ server_ip.v4.addr[i] = grub_strtoul (p, &p, 10);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_10 (pxe->mtftp,
|
|
|
|
|
+ status = pxe->mtftp(
|
|
|
|
|
+ pxe,
|
|
|
|
|
+ GRUB_EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
|
|
|
|
|
+ NULL,
|
|
|
|
@ -3816,7 +3807,7 @@ index 0000000000..531949cba5
|
|
|
|
|
+ server_ip.v4.addr[i] = grub_strtoul (p, &p, 10);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_10 (pxe->mtftp,
|
|
|
|
|
+ status = pxe->mtftp(
|
|
|
|
|
+ pxe,
|
|
|
|
|
+ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE,
|
|
|
|
|
+ buf,
|
|
|
|
@ -3847,7 +3838,7 @@ index 0000000000..531949cba5
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ status = efi_call_10 (pxe->mtftp,
|
|
|
|
|
+ status = pxe->mtftp(
|
|
|
|
|
+ pxe,
|
|
|
|
|
+ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE,
|
|
|
|
|
+ buf2,
|
|
|
|
@ -3890,7 +3881,7 @@ index 0000000000..531949cba5
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
|
|
|
|
|
index 0ce5e675ed..55aed92722 100644
|
|
|
|
|
index fa6b6537142..fdec64d55ee 100644
|
|
|
|
|
--- a/grub-core/net/net.c
|
|
|
|
|
+++ b/grub-core/net/net.c
|
|
|
|
|
@@ -32,6 +32,9 @@
|
|
|
|
@ -3903,8 +3894,8 @@ index 0ce5e675ed..55aed92722 100644
|
|
|
|
|
|
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
|
|
|
|
|
@@ -2033,8 +2036,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
|
|
|
|
|
static grub_command_t cmd_lsroutes, cmd_lscards;
|
|
|
|
|
@@ -2092,8 +2095,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
|
|
|
|
|
static grub_command_t cmd_setvlan, cmd_lsroutes, cmd_lscards;
|
|
|
|
|
static grub_command_t cmd_lsaddr, cmd_slaac;
|
|
|
|
|
|
|
|
|
|
+#ifdef GRUB_MACHINE_EFI
|
|
|
|
@ -3953,7 +3944,7 @@ index 0ce5e675ed..55aed92722 100644
|
|
|
|
|
grub_register_variable_hook ("net_default_server", defserver_get_env,
|
|
|
|
|
defserver_set_env);
|
|
|
|
|
grub_env_export ("net_default_server");
|
|
|
|
|
@@ -2082,10 +2126,37 @@ GRUB_MOD_INIT(net)
|
|
|
|
|
@@ -2144,10 +2188,37 @@ GRUB_MOD_INIT(net)
|
|
|
|
|
grub_net_restore_hw,
|
|
|
|
|
GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK);
|
|
|
|
|
grub_net_poll_cards_idle = grub_net_poll_cards_idle_real;
|
|
|
|
@ -3991,16 +3982,16 @@ index 0ce5e675ed..55aed92722 100644
|
|
|
|
|
grub_register_variable_hook ("net_default_server", 0, 0);
|
|
|
|
|
grub_register_variable_hook ("pxe_default_server", 0, 0);
|
|
|
|
|
|
|
|
|
|
@@ -2104,4 +2175,7 @@ GRUB_MOD_FINI(net)
|
|
|
|
|
@@ -2166,4 +2237,7 @@ GRUB_MOD_FINI(net)
|
|
|
|
|
grub_net_fini_hw (0);
|
|
|
|
|
grub_loader_unregister_preboot_hook (fini_hnd);
|
|
|
|
|
grub_net_poll_cards_idle = grub_net_poll_cards_idle_real;
|
|
|
|
|
grub_net_poll_cards_idle = NULL;
|
|
|
|
|
+#ifdef GRUB_MACHINE_EFI
|
|
|
|
|
+ init_mode = INIT_MODE_NONE;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c
|
|
|
|
|
index a2461cda1c..77958dd9dd 100644
|
|
|
|
|
index 46f304c2b47..11c9db11775 100644
|
|
|
|
|
--- a/util/grub-mknetdir.c
|
|
|
|
|
+++ b/util/grub-mknetdir.c
|
|
|
|
|
@@ -32,13 +32,15 @@
|
|
|
|
@ -4055,7 +4046,7 @@ index a2461cda1c..77958dd9dd 100644
|
|
|
|
|
{
|
|
|
|
|
const char *mkimage_target;
|
|
|
|
|
const char *netmodule;
|
|
|
|
|
@@ -156,6 +161,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform)
|
|
|
|
|
@@ -157,6 +162,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform)
|
|
|
|
|
grub_install_push_module (targets[platform].netmodule);
|
|
|
|
|
|
|
|
|
|
output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext);
|
|
|
|
@ -4063,7 +4054,7 @@ index a2461cda1c..77958dd9dd 100644
|
|
|
|
|
grub_install_make_image_wrap (input_dir, prefix, output,
|
|
|
|
|
0, load_cfg,
|
|
|
|
|
targets[platform].mkimage_target, 0);
|
|
|
|
|
@@ -195,7 +201,16 @@ main (int argc, char *argv[])
|
|
|
|
|
@@ -196,7 +202,16 @@ main (int argc, char *argv[])
|
|
|
|
|
|
|
|
|
|
grub_install_mkdir_p (base);
|
|
|
|
|
|
|
|
|
@ -4082,10 +4073,10 @@ index a2461cda1c..77958dd9dd 100644
|
|
|
|
|
if (!grub_install_source_directory)
|
|
|
|
|
{
|
|
|
|
|
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
|
|
|
|
index 0b490195ad..f431f49973 100644
|
|
|
|
|
index 248d6a28ff9..805a9d7adf9 100644
|
|
|
|
|
--- a/include/grub/efi/api.h
|
|
|
|
|
+++ b/include/grub/efi/api.h
|
|
|
|
|
@@ -622,6 +622,23 @@ typedef union
|
|
|
|
|
@@ -668,6 +668,23 @@ typedef union
|
|
|
|
|
|
|
|
|
|
typedef grub_efi_uint64_t grub_efi_physical_address_t;
|
|
|
|
|
typedef grub_efi_uint64_t grub_efi_virtual_address_t;
|
|
|
|
@ -4107,9 +4098,9 @@ index 0b490195ad..f431f49973 100644
|
|
|
|
|
+ grub_efi_pxe_ipv6_address_t v6;
|
|
|
|
|
+} grub_efi_pxe_ip_address_t;
|
|
|
|
|
|
|
|
|
|
struct grub_efi_guid
|
|
|
|
|
{
|
|
|
|
|
@@ -889,6 +906,8 @@ struct grub_efi_ipv6_device_path
|
|
|
|
|
/* XXX although the spec does not specify the padding, this actually
|
|
|
|
|
must have the padding! */
|
|
|
|
|
@@ -917,6 +934,8 @@ struct grub_efi_ipv6_device_path
|
|
|
|
|
grub_efi_uint16_t remote_port;
|
|
|
|
|
grub_efi_uint16_t protocol;
|
|
|
|
|
grub_efi_uint8_t static_ip_address;
|
|
|
|
@ -4118,7 +4109,7 @@ index 0b490195ad..f431f49973 100644
|
|
|
|
|
} GRUB_PACKED;
|
|
|
|
|
typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t;
|
|
|
|
|
|
|
|
|
|
@@ -938,6 +957,15 @@ struct grub_efi_uri_device_path
|
|
|
|
|
@@ -975,6 +994,15 @@ struct grub_efi_uri_device_path
|
|
|
|
|
} GRUB_PACKED;
|
|
|
|
|
typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t;
|
|
|
|
|
|
|
|
|
@ -4134,7 +4125,7 @@ index 0b490195ad..f431f49973 100644
|
|
|
|
|
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
|
|
|
|
|
|
|
|
|
|
/* Media Device Path. */
|
|
|
|
|
@@ -1020,6 +1048,23 @@ struct grub_efi_bios_device_path
|
|
|
|
|
@@ -1057,6 +1085,23 @@ struct grub_efi_bios_device_path
|
|
|
|
|
} GRUB_PACKED;
|
|
|
|
|
typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t;
|
|
|
|
|
|
|
|
|
@ -4158,7 +4149,7 @@ index 0b490195ad..f431f49973 100644
|
|
|
|
|
struct grub_efi_open_protocol_information_entry
|
|
|
|
|
{
|
|
|
|
|
grub_efi_handle_t agent_handle;
|
|
|
|
|
@@ -1569,23 +1614,27 @@ typedef struct grub_efi_pxe_tftp_error
|
|
|
|
|
@@ -1617,23 +1662,27 @@ typedef struct grub_efi_pxe_tftp_error
|
|
|
|
|
grub_efi_char8_t error_string[127];
|
|
|
|
|
} grub_efi_pxe_tftp_error_t;
|
|
|
|
|
|
|
|
|
@ -4200,18 +4191,27 @@ index 0b490195ad..f431f49973 100644
|
|
|
|
|
|
|
|
|
|
#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8
|
|
|
|
|
typedef struct grub_efi_pxe_ip_filter
|
|
|
|
|
@@ -1652,17 +1701,31 @@ typedef struct grub_efi_pxe_mode
|
|
|
|
|
@@ -1700,18 +1749,31 @@ typedef struct grub_efi_pxe_mode
|
|
|
|
|
typedef struct grub_efi_pxe
|
|
|
|
|
{
|
|
|
|
|
grub_uint64_t rev;
|
|
|
|
|
- void (*start) (void);
|
|
|
|
|
- void *start;
|
|
|
|
|
- void *stop;
|
|
|
|
|
- void *dhcp;
|
|
|
|
|
- void *discover;
|
|
|
|
|
- void *mftp;
|
|
|
|
|
- void *udpwrite;
|
|
|
|
|
- void *udpread;
|
|
|
|
|
- void *setipfilter;
|
|
|
|
|
- void *arp;
|
|
|
|
|
- void *setparams;
|
|
|
|
|
- void *setstationip;
|
|
|
|
|
- void *setpackets;
|
|
|
|
|
+ grub_efi_status_t (*start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6);
|
|
|
|
|
void (*stop) (void);
|
|
|
|
|
- void (*dhcp) (void);
|
|
|
|
|
+ void (*stop) (void);
|
|
|
|
|
+ grub_efi_status_t (*dhcp) (struct grub_efi_pxe *this,
|
|
|
|
|
+ grub_efi_boolean_t sort_offers);
|
|
|
|
|
void (*discover) (void);
|
|
|
|
|
- void (*mftp) (void);
|
|
|
|
|
+ void (*discover) (void);
|
|
|
|
|
+ grub_efi_status_t (*mtftp) (struct grub_efi_pxe *this,
|
|
|
|
|
+ grub_efi_pxe_base_code_tftp_opcode_t operation,
|
|
|
|
|
+ void *buffer_ptr,
|
|
|
|
@ -4223,20 +4223,19 @@ index 0b490195ad..f431f49973 100644
|
|
|
|
|
+ grub_efi_char8_t *filename,
|
|
|
|
|
+ grub_efi_pxe_base_code_mtftp_info_t *info,
|
|
|
|
|
+ grub_efi_boolean_t dont_use_buffer);
|
|
|
|
|
void (*udpwrite) (void);
|
|
|
|
|
void (*udpread) (void);
|
|
|
|
|
void (*setipfilter) (void);
|
|
|
|
|
void (*arp) (void);
|
|
|
|
|
void (*setparams) (void);
|
|
|
|
|
- void (*setstationip) (void);
|
|
|
|
|
+ void (*udpwrite) (void);
|
|
|
|
|
+ void (*udpread) (void);
|
|
|
|
|
+ void (*setipfilter) (void);
|
|
|
|
|
+ void (*arp) (void);
|
|
|
|
|
+ void (*setparams) (void);
|
|
|
|
|
+ grub_efi_status_t (*set_station_ip) (struct grub_efi_pxe *this,
|
|
|
|
|
+ grub_efi_pxe_ip_address_t *new_station_ip,
|
|
|
|
|
+ grub_efi_pxe_ip_address_t *new_subnet_mask);
|
|
|
|
|
+ //void (*setstationip) (void);
|
|
|
|
|
void (*setpackets) (void);
|
|
|
|
|
+ void (*setpackets) (void);
|
|
|
|
|
struct grub_efi_pxe_mode *mode;
|
|
|
|
|
} grub_efi_pxe_t;
|
|
|
|
|
@@ -1924,6 +1987,44 @@ struct grub_efi_ip4_config2_protocol
|
|
|
|
|
|
|
|
|
|
@@ -2005,6 +2067,44 @@ struct grub_efi_ip4_config2_protocol
|
|
|
|
|
};
|
|
|
|
|
typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t;
|
|
|
|
|
|
|
|
|
@ -4281,7 +4280,7 @@ index 0b490195ad..f431f49973 100644
|
|
|
|
|
enum grub_efi_ip6_config_data_type {
|
|
|
|
|
GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
|
|
|
|
|
GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID,
|
|
|
|
|
@@ -1958,6 +2059,49 @@ struct grub_efi_ip6_config_protocol
|
|
|
|
|
@@ -2039,6 +2139,49 @@ struct grub_efi_ip6_config_protocol
|
|
|
|
|
};
|
|
|
|
|
typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t;
|
|
|
|
|
|
|
|
|
@ -4328,12 +4327,12 @@ index 0b490195ad..f431f49973 100644
|
|
|
|
|
+};
|
|
|
|
|
+typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t;
|
|
|
|
|
+
|
|
|
|
|
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|
|
|
|
|
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|
|
|
|
|
|| defined(__riscv)
|
|
|
|
|
struct initrd_media_device_path {
|
|
|
|
|
grub_efi_vendor_media_device_path_t vendor;
|
|
|
|
|
grub_efi_device_path_t end;
|
|
|
|
|
diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..fdb88eb810
|
|
|
|
|
index 00000000000..fdb88eb810e
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/include/grub/efi/dhcp.h
|
|
|
|
|
@@ -0,0 +1,343 @@
|
|
|
|
@ -4682,7 +4681,7 @@ index 0000000000..fdb88eb810
|
|
|
|
|
+#endif /* ! GRUB_EFI_DHCP_HEADER */
|
|
|
|
|
diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..c5e9a89f50
|
|
|
|
|
index 00000000000..c5e9a89f505
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/include/grub/efi/http.h
|
|
|
|
|
@@ -0,0 +1,215 @@
|
|
|
|
@ -4903,7 +4902,7 @@ index 0000000000..c5e9a89f50
|
|
|
|
|
+#endif /* !GRUB_EFI_HTTP_HEADER */
|
|
|
|
|
diff --git a/include/grub/net/efi.h b/include/grub/net/efi.h
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000..de90d223e8
|
|
|
|
|
index 00000000000..de90d223e8e
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/include/grub/net/efi.h
|
|
|
|
|
@@ -0,0 +1,144 @@
|