// the gateway address must be a unicast on the connected network if not zero.\r
//\r
if ((Nexthop != IP4_ALLZERO_ADDRESS) &&\r
- (!IP4_NET_EQUAL (Nexthop, IpIf->Ip, IpIf->SubnetMask) ||\r
+ ((IpIf->SubnetMask != IP4_ALLONE_ADDRESS && !IP4_NET_EQUAL (Nexthop, IpIf->Ip, IpIf->SubnetMask)) ||\r
IP4_IS_BROADCAST (Ip4GetNetCast (Nexthop, IpIf)))) {\r
\r
Status = EFI_INVALID_PARAMETER;\r