/** @file\r
Interface routine for Mtftp4.\r
\r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
+Copyright (c) 2006 - 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
IP4_ADDR Gateway;\r
\r
CopyMem (&Ip, &Override->ServerIp, sizeof (IP4_ADDR));\r
- if (!NetIp4IsUnicast (NTOHL (Ip), 0)) {\r
+ if (IP4_IS_UNSPECIFIED (NTOHL (Ip)) || IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {\r
return FALSE;\r
}\r
\r
Netmask = NTOHL (Netmask);\r
Ip = NTOHL (Ip);\r
\r
- if (!NetIp4IsUnicast (Gateway, Netmask) || !IP4_NET_EQUAL (Gateway, Ip, Netmask)) {\r
+ if ((Netmask != 0 && !NetIp4IsUnicast (Gateway, Netmask)) || !IP4_NET_EQUAL (Gateway, Ip, Netmask)) {\r
return FALSE;\r
}\r
}\r
return FALSE;\r
}\r
\r
- while (!EFI_ERROR (gBS->CheckEvent (Service->TimerToGetMap))) {\r
+ while (EFI_ERROR (gBS->CheckEvent (Service->TimerToGetMap))) {\r
Udp->Poll (Udp);\r
\r
if (!EFI_ERROR (Udp->GetModeData (Udp, NULL, &Ip4Mode, NULL, NULL)) &&\r
UdpConfig.ReceiveTimeout = 0;\r
UdpConfig.TransmitTimeout = 0;\r
UdpConfig.UseDefaultAddress = Config->UseDefaultSetting;\r
- UdpConfig.StationAddress = Config->StationIp;\r
- UdpConfig.SubnetMask = Config->SubnetMask;\r
+ IP4_COPY_ADDRESS (&UdpConfig.StationAddress, &Config->StationIp);\r
+ IP4_COPY_ADDRESS (&UdpConfig.SubnetMask, &Config->SubnetMask);\r
UdpConfig.StationPort = 0;\r
UdpConfig.RemotePort = 0;\r
\r
Ip = HTONL (Instance->ServerIp);\r
- CopyMem (&UdpConfig.RemoteAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
+ IP4_COPY_ADDRESS (&UdpConfig.RemoteAddress, &Ip);\r
\r
Status = UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, &UdpConfig);\r
\r
Gateway = NTOHL (Gateway);\r
ServerIp = NTOHL (ServerIp);\r
\r
- if (!NetIp4IsUnicast (ServerIp, 0)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
if (!ConfigData->UseDefaultSetting &&\r
- ((!IP4_IS_VALID_NETMASK (Netmask) || !NetIp4IsUnicast (Ip, Netmask)))) {\r
+ ((!IP4_IS_VALID_NETMASK (Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Ip, Netmask))))) {\r
\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if ((Gateway != 0) &&\r
- (!IP4_NET_EQUAL (Gateway, Ip, Netmask) || !NetIp4IsUnicast (Gateway, Netmask))) {\r
+ if ((Gateway != 0) && \r
+ (!IP4_NET_EQUAL (Gateway, Ip, Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Gateway, Netmask)))) {\r
\r
return EFI_INVALID_PARAMETER;\r
}\r