/** @file\r
This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.\r
\r
- Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
if (EFI_ERROR (Status)) {\r
goto ON_ERROR;\r
}\r
- \r
+\r
//\r
// Configure block size for TFTP as a default value to handle all link layers.\r
//\r
if (EFI_ERROR (Status)) {\r
goto ON_ERROR;\r
}\r
- \r
+\r
//\r
// Configure block size for TFTP as a default value to handle all link layers.\r
//\r
}\r
\r
//\r
- //DHCP4 service allows only one of its children to be configured in \r
- //the active state, If the DHCP4 D.O.R.A started by IP4 auto \r
- //configuration and has not been completed, the Dhcp4 state machine \r
- //will not be in the right state for the PXE to start a new round D.O.R.A. \r
+ //DHCP4 service allows only one of its children to be configured in\r
+ //the active state, If the DHCP4 D.O.R.A started by IP4 auto\r
+ //configuration and has not been completed, the Dhcp4 state machine\r
+ //will not be in the right state for the PXE to start a new round D.O.R.A.\r
//so we need to switch it's policy to static.\r
//\r
Status = PxeBcSetIp4Policy (Private);\r
if (NewCreatedInfo != NULL && NewCreatedInfo != &DefaultInfo) {\r
FreePool (NewCreatedInfo);\r
}\r
- \r
+\r
if (Mode->UsingIpv6) {\r
Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);\r
} else {\r
Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData);\r
}\r
- \r
+\r
//\r
// Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP\r
// receive filter list emptied and the filter set to EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP.\r
VOID *Config;\r
EFI_STATUS Status;\r
EFI_PXE_BASE_CODE_IP_FILTER IpFilter;\r
-\r
+ UINTN WindowSize;\r
\r
if ((This == NULL) ||\r
(Filename == NULL) ||\r
(BufferSize == NULL) ||\r
(ServerIp == NULL) ||\r
- ((BufferPtr == NULL) && DontUseBuffer) ||\r
((BlockSize != NULL) && (*BlockSize < PXE_MTFTP_DEFAULT_BLOCK_SIZE))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ if (Operation == EFI_PXE_BASE_CODE_TFTP_READ_FILE ||\r
+ Operation == EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY ||\r
+ Operation == EFI_PXE_BASE_CODE_MTFTP_READ_FILE ||\r
+ Operation == EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY) {\r
+ if (BufferPtr == NULL && !DontUseBuffer) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ }\r
+\r
Config = NULL;\r
Status = EFI_DEVICE_ERROR;\r
Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This);\r
Mode = Private->PxeBc.Mode;\r
\r
+ //\r
+ // Get PcdPxeTftpWindowSize.\r
+ //\r
+ WindowSize = (UINTN) PcdGet64 (PcdPxeTftpWindowSize);\r
+\r
if (Mode->UsingIpv6) {\r
if (!NetIp6IsValidUnicast (&ServerIp->v6)) {\r
return EFI_INVALID_PARAMETER;\r
Config,\r
Filename,\r
BlockSize,\r
+ (WindowSize > 1) ? &WindowSize : NULL,\r
BufferSize\r
);\r
\r
Config,\r
Filename,\r
BlockSize,\r
+ (WindowSize > 1) ? &WindowSize : NULL,\r
BufferPtr,\r
BufferSize,\r
DontUseBuffer\r
Config,\r
Filename,\r
BlockSize,\r
+ (WindowSize > 1) ? &WindowSize : NULL,\r
BufferPtr,\r
BufferSize,\r
DontUseBuffer\r
DoNotFragment = TRUE;\r
}\r
\r
- if (!Mode->UsingIpv6 && GatewayIp != NULL && Mode->SubnetMask.Addr[0] != 0 && \r
+ if (!Mode->UsingIpv6 && GatewayIp != NULL && Mode->SubnetMask.Addr[0] != 0 &&\r
!NetIp4IsUnicast (NTOHL (GatewayIp->Addr[0]), EFI_NTOHL(Mode->SubnetMask))) {\r
//\r
// Gateway is provided but it's not a unicast IPv4 address, while it will be ignored for IPv6.\r
//\r
Udp4Cfg = &Private->Udp4CfgData;\r
if ((AcceptPromiscuous != Udp4Cfg->AcceptPromiscuous) ||\r
- (AcceptBroadcast != Udp4Cfg->AcceptBroadcast) || MultiCastUpdate) {\r
+ (AcceptBroadcast != Udp4Cfg->AcceptBroadcast) || MultiCastUpdate) {\r
//\r
// Clear the UDP4 instance configuration, all joined groups will be left\r
// during the operation.\r
//\r
Private->Udp4Read->Configure (Private->Udp4Read, NULL);\r
- \r
+\r
//\r
// Configure the UDP instance with the new configuration.\r
//\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
- \r
+\r
//\r
// In not Promiscuous mode, need to join the new multicast group.\r
//\r
// during the operation.\r
//\r
Private->Udp6Read->Configure (Private->Udp6Read, NULL);\r
- \r
+\r
//\r
// Configure the UDP instance with the new configuration.\r
//\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
- \r
+\r
//\r
// In not Promiscuous mode, need to join the new multicast group.\r
//\r
\r
if (NewSendGUID != NULL) {\r
if (*NewSendGUID && EFI_ERROR (NetLibGetSystemGuid (&SystemGuid))) {\r
+ DEBUG ((EFI_D_WARN, "PXE: Failed to read system GUID from the smbios table!\n"));\r
return EFI_INVALID_PARAMETER;\r
}\r
Mode->SendGUID = *NewSendGUID;\r
EFI_STATUS Status;\r
PXEBC_PRIVATE_DATA *Private;\r
EFI_PXE_BASE_CODE_MODE *Mode;\r
- EFI_ARP_CONFIG_DATA ArpConfigData;\r
\r
if (This == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
if (!Mode->UsingIpv6 && NewStationIp != NULL) {\r
- if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) || \r
+ if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) ||\r
IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) ||\r
(NewSubnetMask != NULL && NewSubnetMask->Addr[0] != 0 && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0])))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
}\r
- \r
+\r
if (!Mode->Started) {\r
return EFI_NOT_STARTED;\r
}\r
if (EFI_ERROR (Status)) {\r
goto ON_EXIT;\r
}\r
- } else if (!Mode->UsingIpv6 && NewStationIp != NULL) {\r
- //\r
- // Configure the corresponding ARP with the IPv4 address.\r
- //\r
- ZeroMem (&ArpConfigData, sizeof (EFI_ARP_CONFIG_DATA));\r
-\r
- ArpConfigData.SwAddressType = 0x0800;\r
- ArpConfigData.SwAddressLength = (UINT8) sizeof (EFI_IPv4_ADDRESS);\r
- ArpConfigData.StationAddress = &NewStationIp->v4;\r
-\r
- Private->Arp->Configure (Private->Arp, NULL);\r
- Private->Arp->Configure (Private->Arp, &ArpConfigData);\r
-\r
- if (NewSubnetMask != NULL) {\r
- Mode->RouteTableEntries = 1;\r
- Mode->RouteTable[0].IpAddr.Addr[0] = NewStationIp->Addr[0] & NewSubnetMask->Addr[0];\r
- Mode->RouteTable[0].SubnetMask.Addr[0] = NewSubnetMask->Addr[0];\r
- Mode->RouteTable[0].GwAddr.Addr[0] = 0;\r
- }\r
-\r
- Private->IsAddressOk = TRUE;\r
}\r
\r
if (NewStationIp != NULL) {\r
}\r
\r
Status = PxeBcFlushStationIp (Private, NewStationIp, NewSubnetMask);\r
+ if (!EFI_ERROR (Status)) {\r
+ Private->IsAddressOk = TRUE;\r
+ }\r
+\r
ON_EXIT:\r
return Status;\r
}\r
EFI_STATUS Status;\r
EFI_STATUS MediaStatus;\r
\r
- if (FilePath == NULL || !IsDevicePathEnd (FilePath)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
- \r
- VirtualNic = PXEBC_VIRTUAL_NIC_FROM_LOADFILE (This);\r
- Private = VirtualNic->Private;\r
- PxeBc = &Private->PxeBc;\r
- UsingIpv6 = FALSE;\r
- Status = EFI_DEVICE_ERROR;\r
-\r
- if (This == NULL || BufferSize == NULL) {\r
+ if (This == NULL || BufferSize == NULL || FilePath == NULL || !IsDevicePathEnd (FilePath)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
return EFI_UNSUPPORTED;\r
}\r
\r
+ VirtualNic = PXEBC_VIRTUAL_NIC_FROM_LOADFILE (This);\r
+ Private = VirtualNic->Private;\r
+ PxeBc = &Private->PxeBc;\r
+ UsingIpv6 = FALSE;\r
+ Status = EFI_DEVICE_ERROR;\r
+\r
//\r
// Check media status before PXE start\r
//\r
} else {\r
//\r
// The DHCP4 can have only one configured child instance so we need to stop\r
- // reset the DHCP4 child before we return. Otherwise these programs which \r
+ // reset the DHCP4 child before we return. Otherwise these programs which\r
// also need to use DHCP4 will be impacted.\r
//\r
if (!PxeBc->Mode->UsingIpv6) {\r