Skip PXE prompt/menu/discover if PXE_DISCOVERY_CONTROL tag bit 3 set.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ye Ting  <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14332 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
sfu5 2013-05-09 05:28:27 +00:00
parent 4db921cee0
commit 30a95d4d39
4 changed files with 26 additions and 5 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Support for PxeBc dhcp functions. Support for PxeBc dhcp functions.
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR> Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -1536,6 +1536,16 @@ PxeBcSelectBootPrompt (
} }
VendorOpt = &Packet->PxeVendorOption; VendorOpt = &Packet->PxeVendorOption;
//
// According to the PXE specification 2.1, Table 2-1 PXE DHCP Options,
// we must not consider a boot prompt or boot menu if all of the following hold:
// - the PXE_DISCOVERY_CONTROL tag(6) is present inside the Vendor Options(43), and has bit 3 set
// - a boot file name has been presented in the initial DHCP or ProxyDHCP offer packet.
//
if (IS_DISABLE_PROMPT_MENU (VendorOpt->DiscoverCtrl) &&
Packet->Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL) {
return EFI_ABORTED;
}
if (!IS_VALID_BOOT_PROMPT (VendorOpt->BitMap)) { if (!IS_VALID_BOOT_PROMPT (VendorOpt->BitMap)) {
return EFI_SUCCESS; return EFI_SUCCESS;

View File

@ -1,7 +1,7 @@
/** @file /** @file
Dhcp and Discover routines for PxeBc. Dhcp and Discover routines for PxeBc.
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -160,7 +160,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define IS_DISABLE_BCAST_DISCOVER(x) (((x) & BIT (0)) == BIT (0)) #define IS_DISABLE_BCAST_DISCOVER(x) (((x) & BIT (0)) == BIT (0))
#define IS_DISABLE_MCAST_DISCOVER(x) (((x) & BIT (1)) == BIT (1)) #define IS_DISABLE_MCAST_DISCOVER(x) (((x) & BIT (1)) == BIT (1))
#define IS_ENABLE_USE_SERVER_LIST(x) (((x) & BIT (2)) == BIT (2)) #define IS_ENABLE_USE_SERVER_LIST(x) (((x) & BIT (2)) == BIT (2))
#define IS_ENABLE_BOOT_FILE_NAME(x) (((x) & BIT (3)) == BIT (3)) #define IS_DISABLE_PROMPT_MENU(x) (((x) & BIT (3)) == BIT (3))
#define SET_VENDOR_OPTION_BIT_MAP(x, y) (((x)[(y) / 32]) = (UINT32) ((x)[(y) / 32]) | BIT ((y) % 32)) #define SET_VENDOR_OPTION_BIT_MAP(x, y) (((x)[(y) / 32]) = (UINT32) ((x)[(y) / 32]) | BIT ((y) % 32))

View File

@ -98,6 +98,17 @@ PxeBcSelectBootPrompt (
ASSERT (!Mode->UsingIpv6); ASSERT (!Mode->UsingIpv6);
VendorOpt = &Cache->Dhcp4.VendorOpt; VendorOpt = &Cache->Dhcp4.VendorOpt;
//
// According to the PXE specification 2.1, Table 2-1 PXE DHCP Options,
// we must not consider a boot prompt or boot menu if all of the following hold:
// - the PXE_DISCOVERY_CONTROL tag(6) is present inside the Vendor Options(43), and has bit 3 set
// - a boot file name has been presented in the initial DHCP or ProxyDHCP offer packet.
//
if (IS_DISABLE_PROMPT_MENU (VendorOpt->DiscoverCtrl) &&
Cache->Dhcp4.OptList[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL) {
return EFI_ABORTED;
}
if (!IS_VALID_BOOT_PROMPT (VendorOpt->BitMap)) { if (!IS_VALID_BOOT_PROMPT (VendorOpt->BitMap)) {
return EFI_TIMEOUT; return EFI_TIMEOUT;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Functions declaration related with DHCPv4 for UefiPxeBc Driver. Functions declaration related with DHCPv4 for UefiPxeBc Driver.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -200,7 +200,7 @@ typedef enum {
#define IS_ENABLE_USE_SERVER_LIST(x) \ #define IS_ENABLE_USE_SERVER_LIST(x) \
(((x) & BIT (2)) == BIT (2)) (((x) & BIT (2)) == BIT (2))
#define IS_ENABLE_BOOT_FILE_NAME(x) \ #define IS_DISABLE_PROMPT_MENU(x) \
(((x) & BIT (3)) == BIT (3)) (((x) & BIT (3)) == BIT (3))