summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/Ip6Dxe/Ip6Common.c
diff options
context:
space:
mode:
authorZhang Lubo <lubo.zhang@intel.com>2016-04-08 09:44:09 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2016-04-11 08:24:47 +0800
commitc720da286687aed978d9a20bcdd6d303bade9ddc (patch)
treed7c947c59f48d487f47ee96883ebd3fa632a41e3 /NetworkPkg/Ip6Dxe/Ip6Common.c
parent70dc0b809c5ea4641a730a7750338048bae63be5 (diff)
downloadedk2-c720da286687aed978d9a20bcdd6d303bade9ddc.tar.gz
edk2-c720da286687aed978d9a20bcdd6d303bade9ddc.tar.bz2
edk2-c720da286687aed978d9a20bcdd6d303bade9ddc.zip
NetworkPkg: Add new macros and refine codes
v2: *refine some codes Add 2 macros in NetLib.h #define IP4_MASK_MAX 32 #define IP6_PREFIX_MAX 128 we will use these two macros to check the max mask/prefix length, instead of #define IP4_MASK_NUM 33 #define IP6_PREFIX_NUM 129 which means a valid number This will make the code readability and maintainability. Cc: Subramanian Sriram <sriram-s@hpe.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@@hpe.com>
Diffstat (limited to 'NetworkPkg/Ip6Dxe/Ip6Common.c')
-rw-r--r--NetworkPkg/Ip6Dxe/Ip6Common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/NetworkPkg/Ip6Dxe/Ip6Common.c b/NetworkPkg/Ip6Dxe/Ip6Common.c
index 4f71d052bf..7007301f81 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Common.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Common.c
@@ -1,7 +1,7 @@
/** @file
The implementation of common functions shared by IP6 driver.
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2016, 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
@@ -428,7 +428,7 @@ Ip6RemoveAddr (
IP6_ADDRESS_INFO *AddrInfo;
EFI_IPv6_ADDRESS SnMCastAddr;
- if (IsListEmpty (AddressList) || *AddressCount < 1 || PrefixLength > IP6_PREFIX_NUM) {
+ if (IsListEmpty (AddressList) || *AddressCount < 1 || PrefixLength > IP6_PREFIX_MAX) {
return EFI_INVALID_PARAMETER;
}
@@ -606,7 +606,7 @@ Ip6CopyAddressByPrefix (
UINT8 Mask;
ASSERT (Dest != NULL && Src != NULL);
- ASSERT (PrefixLength < IP6_PREFIX_NUM);
+ ASSERT (PrefixLength <= IP6_PREFIX_MAX);
Byte = (UINT8) (PrefixLength / 8);
Bit = (UINT8) (PrefixLength % 8);