diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtocol.c index 6d117b2892..0e7ed34b4e 100644 --- a/NetworkPkg/DnsDxe/DnsProtocol.c +++ b/NetworkPkg/DnsDxe/DnsProtocol.c @@ -1,7 +1,7 @@ /** @file Implementation of EFI_DNS4_PROTOCOL and EFI_DNS6_PROTOCOL interfaces. -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -246,7 +246,7 @@ Dns4Configure ( Netmask = NTOHL (Netmask); if (!DnsConfigData->UseDefaultSetting && - ((!IP4_IS_VALID_NETMASK (Netmask) || !NetIp4IsUnicast (Ip, Netmask)))) { + ((!IP4_IS_VALID_NETMASK (Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Ip, Netmask))))) { Status = EFI_INVALID_PARAMETER; goto ON_EXIT; } diff --git a/NetworkPkg/TcpDxe/TcpMain.c b/NetworkPkg/TcpDxe/TcpMain.c index 03942ee32e..fc3713e533 100644 --- a/NetworkPkg/TcpDxe/TcpMain.c +++ b/NetworkPkg/TcpDxe/TcpMain.c @@ -2,7 +2,7 @@ Implementation of EFI_TCP4_PROTOCOL and EFI_TCP6_PROTOCOL. (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -159,7 +159,8 @@ Tcp4Configure ( CopyMem (&Ip, &TcpConfigData->AccessPoint.StationAddress, sizeof (IP4_ADDR)); CopyMem (&SubnetMask, &TcpConfigData->AccessPoint.SubnetMask, sizeof (IP4_ADDR)); - if (!IP4_IS_VALID_NETMASK (NTOHL (SubnetMask)) || !NetIp4IsUnicast (NTOHL (Ip), NTOHL (SubnetMask))) { + if (!IP4_IS_VALID_NETMASK (NTOHL (SubnetMask)) || + (SubnetMask != 0 && !NetIp4IsUnicast (NTOHL (Ip), NTOHL (SubnetMask)))) { return EFI_INVALID_PARAMETER; } } diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c index 36477e9f80..ab9e494b56 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c @@ -1085,7 +1085,8 @@ EfiPxeBcUdpWrite ( DoNotFragment = TRUE; } - if (!Mode->UsingIpv6 && GatewayIp != NULL && !NetIp4IsUnicast (NTOHL (GatewayIp->Addr[0]), EFI_NTOHL(Mode->SubnetMask))) { + if (!Mode->UsingIpv6 && GatewayIp != NULL && Mode->SubnetMask.Addr[0] != 0 && + !NetIp4IsUnicast (NTOHL (GatewayIp->Addr[0]), EFI_NTOHL(Mode->SubnetMask))) { // // Gateway is provided but it's not a unicast IPv4 address, while it will be ignored for IPv6. // @@ -2016,7 +2017,7 @@ EfiPxeBcSetStationIP ( if (!Mode->UsingIpv6 && NewStationIp != NULL) { if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) || IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) || - (NewSubnetMask != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0])))) { + (NewSubnetMask != NULL && NewSubnetMask->Addr[0] != 0 && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0])))) { return EFI_INVALID_PARAMETER; } }