/** @file\r
\r
Copyright (c) 2005 - 2017, 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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
IN IP4_ADDR Netmask\r
)\r
{\r
- IP4_ADDR NetBrdcastMask;\r
- INTN Len;\r
- INTN Type;\r
-\r
//\r
// Only support the station address with 0.0.0.0/0 to enable DHCP client.\r
//\r
//\r
// Only support the continuous net masks\r
//\r
- if ((Len = NetGetMaskLength (Netmask)) == (IP4_MASK_MAX + 1)) {\r
+ if (NetGetMaskLength (Netmask) == (IP4_MASK_MAX + 1)) {\r
return FALSE;\r
}\r
\r
//\r
// Station address can't be class D or class E address\r
//\r
- if ((Type = NetGetIpClass (Ip)) > IP4_ADDR_CLASSC) {\r
- return FALSE;\r
- }\r
-\r
- //\r
- // Station address can't be subnet broadcast/net broadcast address\r
- //\r
- if ((Ip == (Ip & Netmask)) || (Ip == (Ip | ~Netmask))) {\r
- return FALSE;\r
- }\r
-\r
- NetBrdcastMask = gIp4AllMasks[MIN (Len, Type << 3)];\r
-\r
- if (Ip == (Ip | ~NetBrdcastMask)) {\r
+ if (NetGetIpClass (Ip) > IP4_ADDR_CLASSC) {\r
return FALSE;\r
}\r
\r
- return TRUE;\r
-}
\ No newline at end of file
+ return NetIp4IsUnicast (Ip, Netmask);\r
+}\r