From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Ys61o-0006mv-4n for mharc-grub-devel@gnu.org; Tue, 12 May 2015 04:59:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ys61l-0006l8-Fk for grub-devel@gnu.org; Tue, 12 May 2015 04:59:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ys61k-000799-6u for grub-devel@gnu.org; Tue, 12 May 2015 04:59:01 -0400 Received: from mail-ob0-x22f.google.com ([2607:f8b0:4003:c01::22f]:35218) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ys61k-000795-2e for grub-devel@gnu.org; Tue, 12 May 2015 04:59:00 -0400 Received: by obcus9 with SMTP id us9so435129obc.2 for ; Tue, 12 May 2015 01:58:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=PIYIOd1FT88K3OFUM6hnFcVWXMos+Nj88f7fXhvtClo=; b=N2cMVrlhTURHHOgKv5QrJUWqo9CdzrKsElUrRFPT2DE0HpICc4wH+wc1GCEfBFIS1v 8XvtojG2kM3za9yEvEY+sgOwJ25BanLFjx4Z9OZppN+p/VqRvx4SN2T3wt3sWWoDonA+ 8pNSpT9XdFJG+Hyec79JvETz/7+8u1N6ekatht3xW1Dq3x0Q+tMtCnqp+9hmwWgY3Z5z T6n/lFcq59nREe8iiq5uFQBmJCtrPRF/E3fCLUGyAPj4HIP+YOjIpPG0ybhg29hDU89s JFR+ZC8HhFXPv+50ow0dCpCLgUeewMnj9sElP/76U0YAvhpjMssgp5JhwYzI9OQKYuYb g2Sw== X-Received: by 10.60.101.137 with SMTP id fg9mr11186786oeb.83.1431421139606; Tue, 12 May 2015 01:58:59 -0700 (PDT) Received: from localhost.localdomain (nat.nue.novell.com. [195.135.221.2]) by mx.google.com with ESMTPSA id z133sm10632273oif.14.2015.05.12.01.58.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 May 2015 01:58:58 -0700 (PDT) Sender: =?UTF-8?B?5by15paH6I+v?= From: Michael Chang To: grub-devel@gnu.org Subject: [PATCH 2/3] UEFI IPv6 PXE support Date: Tue, 12 May 2015 16:49:49 +0800 Message-Id: <1431420590-7245-3-git-send-email-mchang@suse.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1431420590-7245-1-git-send-email-mchang@suse.com> References: <1431420590-7245-1-git-send-email-mchang@suse.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::22f X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2015 08:59:02 -0000 When system is booted from UEFI IPv6 PXE, the network interface can be configured directly by cached DHCPv6 packet in firmware without doing it all over again by contacting DHCP server. --- grub-core/net/drivers/efi/efinet.c | 24 ++++++++++++--- include/grub/efi/api.h | 55 +++++++++++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 6 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c index c44d531..4b70171 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -349,11 +349,25 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, if (! pxe) continue; pxe_mode = pxe->mode; - grub_net_configure_by_dhcp_ack (card->name, card, 0, - (struct grub_net_bootp_packet *) - &pxe_mode->dhcp_ack, - sizeof (pxe_mode->dhcp_ack), - 1, device, path); + + if (pxe_mode->using_ipv6) + { + grub_net_configure_by_dhcpv6_reply (card->name, card, 0, + (struct grub_net_dhcpv6_packet *) + &pxe_mode->dhcp_ack, + sizeof (pxe_mode->dhcp_ack), + 1, device, path); + if (grub_errno) + grub_print_error (); + } + else + { + grub_net_configure_by_dhcp_ack (card->name, card, 0, + (struct grub_net_bootp_packet *) + &pxe_mode->dhcp_ack, + sizeof (pxe_mode->dhcp_ack), + 1, device, path); + } return; } } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index e5dd543..e6684cd 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -1340,14 +1340,67 @@ typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output typedef grub_uint8_t grub_efi_pxe_packet_t[1472]; +typedef struct { + grub_uint8_t addr[4]; +} grub_efi_pxe_ipv4_address_t; + +typedef struct { + grub_uint8_t addr[16]; +} grub_efi_pxe_ipv6_address_t; + +typedef struct { + grub_uint8_t addr[32]; +} grub_efi_pxe_mac_address_t; + +typedef union { + grub_uint32_t addr[4]; + grub_efi_pxe_ipv4_address_t v4; + grub_efi_pxe_ipv6_address_t v6; +} grub_efi_pxe_ip_address_t; + +#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8 +typedef struct { + grub_uint8_t filters; + grub_uint8_t ip_cnt; + grub_uint16_t reserved; + grub_efi_pxe_ip_address_t ip_list[GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT]; +} grub_efi_pxe_ip_filter_t; + +typedef struct { + grub_efi_pxe_ip_address_t ip_addr; + grub_efi_pxe_mac_address_t mac_addr; +} grub_efi_pxe_arp_entry_t; + +typedef struct { + grub_efi_pxe_ip_address_t ip_addr; + grub_efi_pxe_ip_address_t subnet_mask; + grub_efi_pxe_ip_address_t gw_addr; +} grub_efi_pxe_route_entry_t; + + +#define GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8 +#define GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8 + typedef struct grub_efi_pxe_mode { - grub_uint8_t unused[52]; + grub_uint8_t started; + grub_uint8_t ipv6_available; + grub_uint8_t ipv6_supported; + grub_uint8_t using_ipv6; + grub_uint8_t unused[16]; + grub_efi_pxe_ip_address_t station_ip; + grub_efi_pxe_ip_address_t subnet_mask; grub_efi_pxe_packet_t dhcp_discover; grub_efi_pxe_packet_t dhcp_ack; grub_efi_pxe_packet_t proxy_offer; grub_efi_pxe_packet_t pxe_discover; grub_efi_pxe_packet_t pxe_reply; + grub_efi_pxe_packet_t pxe_bis_reply; + grub_efi_pxe_ip_filter_t ip_filter; + grub_uint32_t arp_cache_entries; + grub_efi_pxe_arp_entry_t arp_cache[GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES]; + grub_uint32_t route_table_entries; + grub_efi_pxe_route_entry_t route_table[GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES]; } grub_efi_pxe_mode_t; typedef struct grub_efi_pxe -- 1.7.3.4