summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/UefiPxeBcDxe
diff options
context:
space:
mode:
authorFu Siyuan <siyuan.fu@intel.com>2016-10-27 09:23:08 +0800
committerFu Siyuan <siyuan.fu@intel.com>2016-10-28 14:20:10 +0800
commit01b5ac880f00cf89833e6fc80666bccc9779dea7 (patch)
tree7809986a78952db2dfec814b5b94adca13d17f17 /MdeModulePkg/Universal/Network/UefiPxeBcDxe
parent3289dcba45e48af5c4fd329f57c49cc8e5830ed8 (diff)
downloadedk2-platforms-01b5ac880f00cf89833e6fc80666bccc9779dea7.tar.xz
MdeModulePkg: Update IP4 stack drivers for classless address unicast check.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal/Network/UefiPxeBcDxe')
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
index cf7b7b566e..4746256fa0 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -176,7 +176,9 @@ IcmpErrorListenHandlerDpc (
}
if (EFI_IP4 (RxData->Header->SourceAddress) != 0 &&
- !NetIp4IsUnicast (EFI_NTOHL (RxData->Header->SourceAddress), 0)) {
+ (NTOHL (Mode->SubnetMask.Addr[0]) != 0) &&
+ IP4_NET_EQUAL (NTOHL(Mode->StationIp.Addr[0]), EFI_NTOHL (RxData->Header->SourceAddress), NTOHL (Mode->SubnetMask.Addr[0])) &&
+ !NetIp4IsUnicast (EFI_NTOHL (RxData->Header->SourceAddress), NTOHL (Mode->SubnetMask.Addr[0]))) {
//
// The source address is not zero and it's not a unicast IP address, discard it.
//
@@ -1163,7 +1165,9 @@ EfiPxeBcMtftp (
if ((This == NULL) ||
(Filename == NULL) ||
(BufferSize == NULL) ||
- ((ServerIp == NULL) || !NetIp4IsUnicast (NTOHL (ServerIp->Addr[0]), 0)) ||
+ ((ServerIp == NULL) ||
+ (IP4_IS_UNSPECIFIED (NTOHL (ServerIp->Addr[0])) ||
+ IP4_IS_LOCAL_BROADCAST (NTOHL (ServerIp->Addr[0])))) ||
((BufferPtr == NULL) && DontUseBuffer) ||
((BlockSize != NULL) && (*BlockSize < 512))) {
@@ -1378,7 +1382,7 @@ EfiPxeBcUdpWrite (
return EFI_INVALID_PARAMETER;
}
- if ((GatewayIp != NULL) && !NetIp4IsUnicast (NTOHL (GatewayIp->Addr[0]), 0)) {
+ if ((GatewayIp != NULL) && (IP4_IS_UNSPECIFIED (NTOHL (GatewayIp->Addr[0])) || IP4_IS_LOCAL_BROADCAST (NTOHL (GatewayIp->Addr[0])))) {
//
// Gateway is provided but it's not a unicast IP address.
//
@@ -1964,9 +1968,11 @@ EfiPxeBcSetIpFilter (
DEBUG ((EFI_D_ERROR, "There is broadcast address in NewFilter.\n"));
return EFI_INVALID_PARAMETER;
}
- if (NetIp4IsUnicast (EFI_IP4 (NewFilter->IpList[Index].v4), 0) &&
- ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0)
- ) {
+ if ((EFI_NTOHL(Mode->StationIp) != 0) &&
+ (EFI_NTOHL(Mode->SubnetMask) != 0) &&
+ IP4_NET_EQUAL(EFI_NTOHL(Mode->StationIp), EFI_NTOHL(NewFilter->IpList[Index].v4), EFI_NTOHL(Mode->SubnetMask)) &&
+ NetIp4IsUnicast (EFI_IP4 (NewFilter->IpList[Index].v4), EFI_NTOHL(Mode->SubnetMask)) &&
+ ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0)) {
//
// If EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP is set and IP4 address is in IpList,
// promiscuous mode is needed.
@@ -2308,11 +2314,11 @@ EfiPxeBcSetStationIP (
return EFI_INVALID_PARAMETER;
}
- if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), 0)) {
+ if (NewSubnetMask != NULL && !IP4_IS_VALID_NETMASK (NTOHL (NewSubnetMask->Addr[0]))) {
return EFI_INVALID_PARAMETER;
}
-
- if (NewSubnetMask != NULL && !IP4_IS_VALID_NETMASK (NTOHL (NewSubnetMask->Addr[0]))) {
+
+ if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) {
return EFI_INVALID_PARAMETER;
}