]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c
Remove the unnecessary include, such as PiDxe.h, PiPei.h, Base.h and Uefi.h in header...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4ConfigDxe / NicIp4Variable.c
index dabd13c1dba383ed711d394cb781f409691d2d64..f97c34f4842ffd9ad1817a7973f531f107b9283b 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -20,6 +20,7 @@ Abstract:
 \r
 **/\r
 \r
+#include <Uefi.h>\r
 \r
 #include <Library/NetLib.h>\r
 #include <Library/DebugLib.h>\r
@@ -91,7 +92,7 @@ Ip4ConfigIsValid (
 \r
 \r
 /**\r
-  Read the ip4 configure variable from the EFI variable\r
+  Read the ip4 configure variable from the EFI variable.\r
 \r
   None\r
 \r
@@ -186,7 +187,7 @@ ON_ERROR:
 **/\r
 EFI_STATUS\r
 Ip4ConfigWriteVariable (\r
-  IN IP4_CONFIG_VARIABLE    * Config        OPTIONAL\r
+  IN IP4_CONFIG_VARIABLE    *Config        OPTIONAL\r
   )\r
 {\r
   EFI_STATUS                Status;\r
@@ -249,6 +250,7 @@ Ip4ConfigFindNicVariable (
       }\r
 \r
       CopyMem (Config, Cur, Len);\r
+      Ip4ConfigFixRouteTablePointer (&Config->Ip4Info);\r
       return Config;\r
     }\r
 \r
@@ -381,3 +383,20 @@ Ip4ConfigModifyVariable (
   NewVar->CheckSum = (UINT16) (~NetblockChecksum ((UINT8 *) NewVar, TotalLen));\r
   return NewVar;\r
 }\r
+\r
+VOID\r
+Ip4ConfigFixRouteTablePointer (\r
+  IN EFI_IP4_IPCONFIG_DATA  *ConfigData\r
+  )\r
+{\r
+  //\r
+  // The memory used for route table entries must immediately follow \r
+  // the ConfigData and be not packed.\r
+  //\r
+  if (ConfigData->RouteTableSize > 0) {\r
+    ConfigData->RouteTable = (EFI_IP4_ROUTE_TABLE *) (ConfigData + 1);\r
+  } else {\r
+    ConfigData->RouteTable = NULL;\r
+  }\r
+}\r
+\r