]> git.proxmox.com Git - grub2.git/blob - debian/patches/efinet_uefi_ipv6_pxe_support.patch
Fix support for IPv6 PXE booting under UEFI (LP: #1229458).
[grub2.git] / debian / patches / efinet_uefi_ipv6_pxe_support.patch
1 From 335be97c8fbaba3b5a52da43ecacc742c34d3cd0 Mon Sep 17 00:00:00 2001
2 From: Michael Chang <mchang@suse.com>
3 Date: Thu, 27 Oct 2016 17:41:21 -0400
4 Subject: efinet: UEFI IPv6 PXE support
5
6 When grub2 image is booted from UEFI IPv6 PXE, the DHCPv6 Reply packet is
7 cached in firmware buffer which can be obtained by PXE Base Code protocol. The
8 network interface can be setup through the parameters in that obtained packet.
9
10 Signed-off-by: Michael Chang <mchang@suse.com>
11 Signed-off-by: Ken Lin <ken.lin@hpe.com>
12
13 Patch-Name: efinet_uefi_ipv6_pxe_support.patch
14 ---
15 grub-core/net/drivers/efi/efinet.c | 24 +++++++++++++----
16 include/grub/efi/api.h | 55 +++++++++++++++++++++++++++++++++++++-
17 2 files changed, 73 insertions(+), 6 deletions(-)
18
19 diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
20 index 5388f95..fc90415 100644
21 --- a/grub-core/net/drivers/efi/efinet.c
22 +++ b/grub-core/net/drivers/efi/efinet.c
23 @@ -378,11 +378,25 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
24 if (! pxe)
25 continue;
26 pxe_mode = pxe->mode;
27 - grub_net_configure_by_dhcp_ack (card->name, card, 0,
28 - (struct grub_net_bootp_packet *)
29 - &pxe_mode->dhcp_ack,
30 - sizeof (pxe_mode->dhcp_ack),
31 - 1, device, path);
32 +
33 + if (pxe_mode->using_ipv6)
34 + {
35 + grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
36 + (struct grub_net_dhcp6_packet *)
37 + &pxe_mode->dhcp_ack,
38 + sizeof (pxe_mode->dhcp_ack),
39 + 1, device, path);
40 + if (grub_errno)
41 + grub_print_error ();
42 + }
43 + else
44 + {
45 + grub_net_configure_by_dhcp_ack (card->name, card, 0,
46 + (struct grub_net_bootp_packet *)
47 + &pxe_mode->dhcp_ack,
48 + sizeof (pxe_mode->dhcp_ack),
49 + 1, device, path);
50 + }
51 return;
52 }
53 }
54 diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
55 index c7c9f0e..92f9b5a 100644
56 --- a/include/grub/efi/api.h
57 +++ b/include/grub/efi/api.h
58 @@ -1452,14 +1452,67 @@ typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output
59
60 typedef grub_uint8_t grub_efi_pxe_packet_t[1472];
61
62 +typedef struct {
63 + grub_uint8_t addr[4];
64 +} grub_efi_pxe_ipv4_address_t;
65 +
66 +typedef struct {
67 + grub_uint8_t addr[16];
68 +} grub_efi_pxe_ipv6_address_t;
69 +
70 +typedef struct {
71 + grub_uint8_t addr[32];
72 +} grub_efi_pxe_mac_address_t;
73 +
74 +typedef union {
75 + grub_uint32_t addr[4];
76 + grub_efi_pxe_ipv4_address_t v4;
77 + grub_efi_pxe_ipv6_address_t v6;
78 +} grub_efi_pxe_ip_address_t;
79 +
80 +#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8
81 +typedef struct {
82 + grub_uint8_t filters;
83 + grub_uint8_t ip_cnt;
84 + grub_uint16_t reserved;
85 + grub_efi_pxe_ip_address_t ip_list[GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT];
86 +} grub_efi_pxe_ip_filter_t;
87 +
88 +typedef struct {
89 + grub_efi_pxe_ip_address_t ip_addr;
90 + grub_efi_pxe_mac_address_t mac_addr;
91 +} grub_efi_pxe_arp_entry_t;
92 +
93 +typedef struct {
94 + grub_efi_pxe_ip_address_t ip_addr;
95 + grub_efi_pxe_ip_address_t subnet_mask;
96 + grub_efi_pxe_ip_address_t gw_addr;
97 +} grub_efi_pxe_route_entry_t;
98 +
99 +
100 +#define GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8
101 +#define GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8
102 +
103 typedef struct grub_efi_pxe_mode
104 {
105 - grub_uint8_t unused[52];
106 + grub_uint8_t started;
107 + grub_uint8_t ipv6_available;
108 + grub_uint8_t ipv6_supported;
109 + grub_uint8_t using_ipv6;
110 + grub_uint8_t unused[16];
111 + grub_efi_pxe_ip_address_t station_ip;
112 + grub_efi_pxe_ip_address_t subnet_mask;
113 grub_efi_pxe_packet_t dhcp_discover;
114 grub_efi_pxe_packet_t dhcp_ack;
115 grub_efi_pxe_packet_t proxy_offer;
116 grub_efi_pxe_packet_t pxe_discover;
117 grub_efi_pxe_packet_t pxe_reply;
118 + grub_efi_pxe_packet_t pxe_bis_reply;
119 + grub_efi_pxe_ip_filter_t ip_filter;
120 + grub_uint32_t arp_cache_entries;
121 + grub_efi_pxe_arp_entry_t arp_cache[GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES];
122 + grub_uint32_t route_table_entries;
123 + grub_efi_pxe_route_entry_t route_table[GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES];
124 } grub_efi_pxe_mode_t;
125
126 typedef struct grub_efi_pxe