/** @file\r
This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.\r
\r
- Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2007 - 2016, 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
if (EFI_ERROR (Status)) {\r
goto ON_ERROR;\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
+ //so we need to switch it's policy to static.\r
+ //\r
+ Status = PxeBcSetIp4Policy (Private);\r
+ if (EFI_ERROR (Status)) {\r
+ goto ON_ERROR;\r
+ }\r
}\r
\r
//\r
(BufferSize == NULL) ||\r
(ServerIp == NULL) ||\r
((BufferPtr == NULL) && DontUseBuffer) ||\r
- ((BlockSize != NULL) && (*BlockSize < PXE_MTFTP_DEFAULT_BLOCK_SIZE)) ||\r
- (!NetIp4IsUnicast (NTOHL (ServerIp->Addr[0]), 0) && !NetIp6IsValidUnicast (&ServerIp->v6))) {\r
+ ((BlockSize != NULL) && (*BlockSize < PXE_MTFTP_DEFAULT_BLOCK_SIZE))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This);\r
Mode = Private->PxeBc.Mode;\r
\r
+ if (Mode->UsingIpv6) {\r
+ if (!NetIp6IsValidUnicast (&ServerIp->v6)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ } else {\r
+ if (IP4_IS_UNSPECIFIED (NTOHL (ServerIp->Addr[0])) || IP4_IS_LOCAL_BROADCAST (NTOHL (ServerIp->Addr[0]))) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ }\r
+\r
if (Mode->UsingIpv6) {\r
//\r
// Set configuration data for Mtftp6 instance.\r
DoNotFragment = TRUE;\r
}\r
\r
- if (!Mode->UsingIpv6 && GatewayIp != NULL && !NetIp4IsUnicast (NTOHL (GatewayIp->Addr[0]), 0)) {\r
+ if (!Mode->UsingIpv6 && GatewayIp != NULL && !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
&Private->SubnetMask.v4,\r
&Private->GatewayIp.v4,\r
&Private->CurSrcPort,\r
- DoNotFragment\r
+ DoNotFragment,\r
+ Private->Mode.TTL,\r
+ Private->Mode.ToS\r
);\r
}\r
\r
//\r
return EFI_INVALID_PARAMETER;\r
}\r
- if ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0 &&\r
- (NetIp4IsUnicast (EFI_IP4 (NewFilter->IpList[Index].v4), 0) ||\r
- NetIp6IsValidUnicast (&NewFilter->IpList[Index].v6))) {\r
- //\r
- // If EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP is set and IPv4/IPv6 address\r
- // is in IpList, promiscuous mode is needed.\r
- //\r
+ if (Mode->UsingIpv6) {\r
+ if ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0 &&\r
+ NetIp6IsValidUnicast (&NewFilter->IpList[Index].v6)) {\r
+ NeedPromiscuous = TRUE;\r
+ }\r
+ } else if ((EFI_NTOHL(Mode->StationIp) != 0) &&\r
+ (EFI_NTOHL(Mode->SubnetMask) != 0) &&\r
+ IP4_NET_EQUAL(EFI_NTOHL(Mode->StationIp), EFI_NTOHL(NewFilter->IpList[Index].v4), EFI_NTOHL(Mode->SubnetMask.v4)) &&\r
+ NetIp4IsUnicast (EFI_IP4 (NewFilter->IpList[Index].v4), EFI_NTOHL(Mode->SubnetMask)) &&\r
+ ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0)) {\r
NeedPromiscuous = TRUE;\r
}\r
}\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (NewStationIp != NULL &&\r
- (!NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), 0) &&\r
- !NetIp6IsValidUnicast (&NewStationIp->v6))) {\r
+ if (NewStationIp != NULL && !NetIp6IsValidUnicast (&NewStationIp->v6)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ if (!Mode->UsingIpv6 && NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
if (!Mode->Started) {\r
return EFI_NOT_STARTED;\r
}\r
EFI_STATUS Status;\r
BOOLEAN MediaPresent;\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
// 3. unsupported.\r
//\r
PxeBc->Stop (PxeBc);\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
+ // also need to use DHCP4 will be impacted.\r
+ //\r
+ if (!PxeBc->Mode->UsingIpv6) {\r
+ Private->Dhcp4->Stop (Private->Dhcp4);\r
+ Private->Dhcp4->Configure (Private->Dhcp4, NULL);\r
+ }\r
}\r
\r
return Status;\r