From 80d1ac7320f597b4c981dfdeb19d8e88eb85ca69 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 26 Mar 2010 17:53:24 +0000 Subject: [PATCH] [pxe] Remove pxe_set_cached_filename() gPXE currently overwrites the filename stored in the cached DHCP packets when a call to PXENV_TFTP_READ_FILE or PXENV_RESTART_TFTP is made. This code has existed for many years as a workaround for RIS, which seemed to require that this be done. pxe_set_cached_filename() causes problems with the Bootix NBP, and a recent test demonstrates that RIS will complete successfully even with pxe_set_cached_filename() removed. There have been many changes to the DHCP and PXE logic since this code was first added, and it is quite plausible that it was masking a bug that no longer exists. Reported-by: Alex Zeffertt Debugged-by: Shao Miller Signed-off-by: Michael Brown --- src/arch/i386/include/pxe.h | 2 -- src/arch/i386/interface/pxe/pxe_preboot.c | 21 --------------------- src/arch/i386/interface/pxe/pxe_tftp.c | 14 -------------- 3 files changed, 37 deletions(-) diff --git a/src/arch/i386/include/pxe.h b/src/arch/i386/include/pxe.h index 041ee7ba..f4a34a6e 100644 --- a/src/arch/i386/include/pxe.h +++ b/src/arch/i386/include/pxe.h @@ -149,6 +149,4 @@ extern struct net_device *pxe_netdev; extern void pxe_set_netdev ( struct net_device *netdev ); -extern void pxe_set_cached_filename ( const unsigned char *filename ); - #endif /* PXE_H */ diff --git a/src/arch/i386/interface/pxe/pxe_preboot.c b/src/arch/i386/interface/pxe/pxe_preboot.c index 3939c7bf..22be2e02 100644 --- a/src/arch/i386/interface/pxe/pxe_preboot.c +++ b/src/arch/i386/interface/pxe/pxe_preboot.c @@ -102,24 +102,6 @@ static struct pxe_dhcp_packet_creator pxe_dhcp_packet_creators[] = { static union pxe_cached_info __bss16_array ( cached_info, [NUM_CACHED_INFOS] ); #define cached_info __use_data16 ( cached_info ) -/** - * Set PXE cached TFTP filename - * - * @v filename TFTP filename - * - * This is a bug-for-bug compatibility hack needed in order to work - * with Microsoft Remote Installation Services (RIS). The filename - * used in a call to PXENV_RESTART_TFTP or PXENV_TFTP_READ_FILE must - * be returned as the DHCP filename in subsequent calls to - * PXENV_GET_CACHED_INFO. - */ -void pxe_set_cached_filename ( const unsigned char *filename ) { - memcpy ( cached_info[CACHED_INFO_DHCPACK].dhcphdr.file, filename, - sizeof ( cached_info[CACHED_INFO_DHCPACK].dhcphdr.file ) ); - memcpy ( cached_info[CACHED_INFO_BINL].dhcphdr.file, filename, - sizeof ( cached_info[CACHED_INFO_BINL].dhcphdr.file ) ); -} - /** * UNLOAD BASE CODE STACK * @@ -236,9 +218,6 @@ PXENV_EXIT_t pxenv_restart_tftp ( struct s_PXENV_TFTP_READ_FILE DBG ( "PXENV_RESTART_TFTP " ); - /* Intel bug-for-bug hack */ - pxe_set_cached_filename ( restart_tftp->FileName ); - /* Words cannot describe the complete mismatch between the PXE * specification and any possible version of reality... */ diff --git a/src/arch/i386/interface/pxe/pxe_tftp.c b/src/arch/i386/interface/pxe/pxe_tftp.c index 0e3ca3c5..e0ec5f1d 100644 --- a/src/arch/i386/interface/pxe/pxe_tftp.c +++ b/src/arch/i386/interface/pxe/pxe_tftp.c @@ -171,9 +171,6 @@ static int pxe_tftp_open ( uint32_t ipaddress, unsigned int port, struct in_addr address; int rc; - /* Intel bug-for-bug hack */ - pxe_set_cached_filename ( filename ); - /* Reset PXE TFTP connection structure */ memset ( &pxe_tftp, 0, sizeof ( pxe_tftp ) ); xfer_init ( &pxe_tftp.xfer, &pxe_tftp_xfer_ops, NULL ); @@ -470,17 +467,6 @@ PXENV_EXIT_t pxenv_tftp_read ( struct s_PXENV_TFTP_READ *tftp_read ) { * value before calling this function in protected mode. You cannot * call this function with a 32-bit stack segment. (See the relevant * @ref pxe_x86_pmode16 "implementation note" for more details.) - * - * @note Microsoft's NTLDR assumes that the filename passed in via - * s_PXENV_TFTP_READ_FILE::FileName will be stored in the "file" field - * of the stored DHCPACK packet, whence it will be returned via any - * subsequent calls to pxenv_get_cached_info(). Though this is - * essentially a bug in the Intel PXE implementation (not, for once, - * in the specification!), it is a bug that Microsoft relies upon, and - * so we implement this bug-for-bug compatibility by overwriting the - * filename stored DHCPACK packet with the filename passed in - * s_PXENV_TFTP_READ_FILE::FileName. - * */ PXENV_EXIT_t pxenv_tftp_read_file ( struct s_PXENV_TFTP_READ_FILE *tftp_read_file ) {