]> git.proxmox.com Git - mirror_edk2.git/commitdiff
[Description]:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 26 May 2008 08:16:25 +0000 (08:16 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 26 May 2008 08:16:25 +0000 (08:16 +0000)
 Fixed one bug in PciBus. PciBus doesn't clear the bridges bus number for all the root bridges before scanning any of them.
[Description]:
 The static IP configuration no long works in the EDK 1.04 network package. The cause is that changing the type of EFI_IP4_IPCONFIG_DATA.RouteTable from a variable length array to a pointer is not clean. If the whole structure is read from variable, the pointer is invalid.
[Solution]
Fix the pointer before using it
[Impaction]:
 Ip4ConfigDxe module.
[Reference Info]:
 EDK tracker 1134 - Static IP configuration no long works.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5291 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c
MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c
MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h

index 0c5c6bce376e4a0a73f0f011bc1101d8c0b84cba..be006a8eb7b009ce940989f3dad7cefa5aaeb0aa 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, 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
@@ -180,6 +180,7 @@ EfiNicIp4ConfigGetInfo (
   } else {\r
     Status = EFI_SUCCESS;\r
     CopyMem (NicConfig, Config, Len);\r
+    Ip4ConfigFixRouteTablePointer (&NicConfig->Ip4Info);\r
   }\r
 \r
   *ConfigLen = Len;\r
@@ -272,6 +273,7 @@ EfiNicIp4ConfigSetInfo (
   //\r
   if (Reconfig && (Instance->ReconfigEvent != NULL)) {\r
     Status = gBS->SignalEvent (Instance->ReconfigEvent);\r
+    NetLibDispatchDpc ();\r
   }\r
 \r
   return Status;\r
@@ -442,6 +444,8 @@ ON_ERROR:
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
 \r
+  NetLibDispatchDpc ();\r
+\r
   return Status;\r
 }\r
 \r
@@ -555,6 +559,7 @@ EfiIp4ConfigGetData (
       Status = EFI_BUFFER_TOO_SMALL;\r
     } else {\r
       CopyMem (ConfigData, &NicConfig->Ip4Info, Len);\r
+      Ip4ConfigFixRouteTablePointer (ConfigData);\r
     }\r
 \r
     *ConfigDataSize = Len;\r
@@ -676,6 +681,9 @@ Ip4ConfigOnDhcp4Complete (
 ON_EXIT:\r
   gBS->SignalEvent (Instance->DoneEvent);\r
   Ip4ConfigCleanDhcp4 (Instance);\r
+\r
+  NetLibDispatchDpc ();\r
+\r
   return ;\r
 }\r
 \r
index dabd13c1dba383ed711d394cb781f409691d2d64..65c2f840aa644b3534f70d656233494dcd251f8f 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
@@ -249,6 +249,7 @@ Ip4ConfigFindNicVariable (
       }\r
 \r
       CopyMem (Config, Cur, Len);\r
+      Ip4ConfigFixRouteTablePointer (&Config->Ip4Info);\r
       return Config;\r
     }\r
 \r
@@ -381,3 +382,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
index 103072c61abd0fe19f3717b5ab39c6701d697f1e..953f6edf960963dc5cc8fe2058d413b61f571104 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
@@ -32,11 +32,11 @@ Abstract:
 //\r
 #define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \\r
   (sizeof (EFI_IP4_IPCONFIG_DATA) + \\r
-   sizeof (EFI_IP4_ROUTE_TABLE) * (MAX (1, (Ip4Config)->RouteTableSize) - 1))\r
+   sizeof (EFI_IP4_ROUTE_TABLE) * (Ip4Config)->RouteTableSize)\r
 \r
 #define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \\r
   (sizeof (NIC_IP4_CONFIG_INFO) + \\r
-   sizeof (EFI_IP4_ROUTE_TABLE) * (MAX (1, (NicConfig)->Ip4Info.RouteTableSize) - 1))\r
+   sizeof (EFI_IP4_ROUTE_TABLE) * (NicConfig)->Ip4Info.RouteTableSize)\r
 \r
 //\r
 // Compare whether two NIC address are equal includes their type and length.\r
@@ -72,4 +72,10 @@ Ip4ConfigModifyVariable (
   IN NIC_ADDR               *NicAddr,\r
   IN NIC_IP4_CONFIG_INFO    *Config       OPTIONAL\r
   );\r
+\r
+VOID\r
+Ip4ConfigFixRouteTablePointer (\r
+  IN EFI_IP4_IPCONFIG_DATA  *ConfigData\r
+  );\r
+\r
 #endif\r