From: sfu5 Date: Thu, 9 May 2013 05:28:27 +0000 (+0000) Subject: Skip PXE prompt/menu/discover if PXE_DISCOVERY_CONTROL tag bit 3 set. X-Git-Tag: edk2-stable201903~12563 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=30a95d4d39214084f435acbc1534cb111dda3095 Skip PXE prompt/menu/discover if PXE_DISCOVERY_CONTROL tag bit 3 set. Signed-off-by: Laszlo Ersek Reviewed-by: Ye Ting Reviewed-by: Fu Siyuan git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14332 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c index fa3594d36b..6bca31967c 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c @@ -1,7 +1,7 @@ /** @file Support for PxeBc dhcp functions. -Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials 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 @@ -1536,6 +1536,16 @@ PxeBcSelectBootPrompt ( } 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)) { return EFI_SUCCESS; diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h index 5e37228efa..9045251f59 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h @@ -1,7 +1,7 @@ /** @file Dhcp and Discover routines for PxeBc. -Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials 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 @@ -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_MCAST_DISCOVER(x) (((x) & BIT (1)) == BIT (1)) #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)) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c b/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c index 540adee311..5bbefcee9d 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c @@ -98,6 +98,17 @@ PxeBcSelectBootPrompt ( ASSERT (!Mode->UsingIpv6); 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)) { return EFI_TIMEOUT; } diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.h b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.h index 37747ac74f..ee519d9ee2 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.h +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.h @@ -1,7 +1,7 @@ /** @file Functions declaration related with DHCPv4 for UefiPxeBc Driver. - Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials 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) \ (((x) & BIT (2)) == BIT (2)) -#define IS_ENABLE_BOOT_FILE_NAME(x) \ +#define IS_DISABLE_PROMPT_MENU(x) \ (((x) & BIT (3)) == BIT (3))