/** @file\r
Interface routines for PxeBc.\r
\r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\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
}\r
\r
if (EFI_IP4 (RxData->Header->SourceAddress) != 0 &&\r
- !NetIp4IsUnicast (EFI_NTOHL (RxData->Header->SourceAddress), 0)) {\r
+ (NTOHL (Mode->SubnetMask.Addr[0]) != 0) &&\r
+ IP4_NET_EQUAL (NTOHL(Mode->StationIp.Addr[0]), EFI_NTOHL (RxData->Header->SourceAddress), NTOHL (Mode->SubnetMask.Addr[0])) &&\r
+ !NetIp4IsUnicast (EFI_NTOHL (RxData->Header->SourceAddress), NTOHL (Mode->SubnetMask.Addr[0]))) {\r
//\r
// The source address is not zero and it's not a unicast IP address, discard it.\r
//\r
if ((This == NULL) ||\r
(Filename == NULL) ||\r
(BufferSize == NULL) ||\r
- ((ServerIp == NULL) || !NetIp4IsUnicast (NTOHL (ServerIp->Addr[0]), 0)) ||\r
+ ((ServerIp == NULL) || \r
+ (IP4_IS_UNSPECIFIED (NTOHL (ServerIp->Addr[0])) || \r
+ IP4_IS_LOCAL_BROADCAST (NTOHL (ServerIp->Addr[0])))) ||\r
((BufferPtr == NULL) && DontUseBuffer) ||\r
((BlockSize != NULL) && (*BlockSize < 512))) {\r
\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if ((GatewayIp != NULL) && !NetIp4IsUnicast (NTOHL (GatewayIp->Addr[0]), 0)) {\r
+ if ((GatewayIp != NULL) && (IP4_IS_UNSPECIFIED (NTOHL (GatewayIp->Addr[0])) || IP4_IS_LOCAL_BROADCAST (NTOHL (GatewayIp->Addr[0])))) {\r
//\r
// Gateway is provided but it's not a unicast IP address.\r
//\r
&Private->StationIp.v4,\r
&Private->SubnetMask.v4,\r
&Private->GatewayIp.v4,\r
- &Private->CurrentUdpSrcPort\r
+ &Private->CurrentUdpSrcPort,\r
+ Private->Mode.TTL,\r
+ Private->Mode.ToS\r
);\r
if (EFI_ERROR (Status)) {\r
Private->CurrentUdpSrcPort = 0;\r
DEBUG ((EFI_D_ERROR, "There is broadcast address in NewFilter.\n"));\r
return EFI_INVALID_PARAMETER;\r
}\r
- if (NetIp4IsUnicast (EFI_IP4 (NewFilter->IpList[Index].v4), 0) &&\r
- ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0)\r
- ) {\r
+ 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)) &&\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
//\r
// If EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP is set and IP4 address is in IpList,\r
// promiscuous mode is needed.\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), 0)) {\r
+ if (NewSubnetMask != NULL && !IP4_IS_VALID_NETMASK (NTOHL (NewSubnetMask->Addr[0]))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
-\r
- if (NewSubnetMask != NULL && !IP4_IS_VALID_NETMASK (NTOHL (NewSubnetMask->Addr[0]))) {\r
+ \r
+ if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
//\r
if (Status == EFI_SUCCESS) {\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 the other programs which \r
+ // also need to use DHCP4 will be impacted.\r
// The functionality of PXE Base Code protocol will not be stopped,\r
// when downloading is successfully.\r
//\r
+ Private->Dhcp4->Stop (Private->Dhcp4);\r
+ Private->Dhcp4->Configure (Private->Dhcp4, NULL);\r
return EFI_SUCCESS;\r
\r
} else if (Status == EFI_BUFFER_TOO_SMALL) {\r