MdeModulePkg/Ip4Dxe: Add Ip/Netmask pair check for Ip4Config2
v2: * Add the check in Ip4Config2SetDefaultIf to avoid the DHCP configuration case. Ip4config2 doesn't check the validity of Ip/Netmask pair, which leads to the invalid combination of Ip and Netmask setting. This patch is to resolve the issue. Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Cc: Subramanian Sriram <sriram-s@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Common definition for IP4.
|
||||
|
||||
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -201,4 +201,23 @@ Ip4NtohHead (
|
||||
IN IP4_HEAD *Head
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Validate that Ip/Netmask pair is OK to be used as station
|
||||
address. Only continuous netmasks are supported. and check
|
||||
that StationAddress is a unicast address on the newtwork.
|
||||
|
||||
@param[in] Ip The IP address to validate.
|
||||
@param[in] Netmask The netmaks of the IP.
|
||||
|
||||
@retval TRUE The Ip/Netmask pair is valid.
|
||||
@retval FALSE The Ip/Netmask pair is invalid.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
Ip4StationAddressValid (
|
||||
IN IP4_ADDR Ip,
|
||||
IN IP4_ADDR Netmask
|
||||
);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user