]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.c
MdeModulePkg: Add new macros and refine codes
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Route.c
index ea0023ddcb2d823d3f8cf50a5ef2720955c1dccd..d240d5343aea366a3f0acab82ef73f09724114e6 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 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
@@ -204,7 +204,7 @@ Ip4CreateRouteTable (
   RtTable->RefCnt   = 1;\r
   RtTable->TotalNum = 0;\r
 \r
-  for (Index = 0; Index < IP4_MASK_NUM; Index++) {\r
+  for (Index = 0; Index <= IP4_MASK_MAX; Index++) {\r
     InitializeListHead (&(RtTable->RouteArea[Index]));\r
   }\r
 \r
@@ -241,7 +241,7 @@ Ip4FreeRouteTable (
   //\r
   // Free all the route table entry and its route cache.\r
   //\r
-  for (Index = 0; Index < IP4_MASK_NUM; Index++) {\r
+  for (Index = 0; Index <= IP4_MASK_MAX; Index++) {\r
     NET_LIST_FOR_EACH_SAFE (Entry, Next, &(RtTable->RouteArea[Index])) {\r
       RtEntry = NET_LIST_USER_STRUCT (Entry, IP4_ROUTE_ENTRY, Link);\r
 \r
@@ -469,7 +469,7 @@ Ip4FindRouteEntry (
 \r
   RtEntry = NULL;\r
 \r
-  for (Index = IP4_MASK_NUM - 1; Index >= 0; Index--) {\r
+  for (Index = IP4_MASK_MAX; Index >= 0; Index--) {\r
     for (Table = RtTable; Table != NULL; Table = Table->Next) {\r
       NET_LIST_FOR_EACH (Entry, &Table->RouteArea[Index]) {\r
         RtEntry = NET_LIST_USER_STRUCT (Entry, IP4_ROUTE_ENTRY, Link);\r
@@ -641,7 +641,7 @@ Ip4BuildEfiRouteTable (
   //\r
   Count = 0;\r
 \r
-  for (Index = IP4_MASK_NUM - 1; Index >= 0; Index--) {\r
+  for (Index = IP4_MASK_MAX; Index >= 0; Index--) {\r
     for (RtTable = IpInstance->RouteTable; RtTable != NULL; RtTable = RtTable->Next) {\r
       NET_LIST_FOR_EACH (Entry, &(RtTable->RouteArea[Index])) {\r
         RtEntry = NET_LIST_USER_STRUCT (Entry, IP4_ROUTE_ENTRY, Link);\r