]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix a bug in IP4 driver that the broadcast/multicast mac address is overrided by...
authorsfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 11 Mar 2013 07:44:10 +0000 (07:44 +0000)
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 11 Mar 2013 07:44:10 +0000 (07:44 +0000)
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Ouyang Qian <qian.ouyang@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14167 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c

index 7ff17b6637936e361e37eea86ddac35d19de5aba..370eaa6a9f7a315928e894d23ff18c7258c1ecd2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Transmit the IP4 packet.\r
   \r
-Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2013, 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
@@ -286,46 +286,40 @@ Ip4Output (
   if (EFI_ERROR(Status)) {\r
     return Status;\r
   }\r
+  \r
+  Dest = Head->Dst;\r
+  if (IP4_IS_BROADCAST (Ip4GetNetCast (Dest, IpIf)) || (Dest == IP4_ALLONE_ADDRESS)) {\r
+    //\r
+    // Set the gateway to local broadcast if the Dest is\r
+    // the broadcast address for the connected network or\r
+    // it is local broadcast.\r
+    //\r
+    GateWay = IP4_ALLONE_ADDRESS;\r
 \r
-  //\r
-  // Route the packet unless overrided, that is, GateWay isn't zero.\r
-  //\r
-  if (GateWay == IP4_ALLZERO_ADDRESS) {\r
-    Dest = Head->Dst;\r
-\r
-    if (IP4_IS_BROADCAST (Ip4GetNetCast (Dest, IpIf)) || (Dest == IP4_ALLONE_ADDRESS)) {\r
-      //\r
-      // Set the gateway to local broadcast if the Dest is\r
-      // the broadcast address for the connected network or\r
-      // it is local broadcast.\r
-      //\r
-      GateWay = IP4_ALLONE_ADDRESS;\r
-\r
-    } else if (IP4_IS_MULTICAST (Dest)) {\r
-      //\r
-      // Set the gateway to the destination if it is an multicast\r
-      // address. The IP4_INTERFACE won't consult ARP to send local\r
-      // broadcast and multicast.\r
-      //\r
-      GateWay = Head->Dst;\r
+  } else if (IP4_IS_MULTICAST (Dest)) {\r
+    //\r
+    // Set the gateway to the destination if it is an multicast\r
+    // address. The IP4_INTERFACE won't consult ARP to send local\r
+    // broadcast and multicast.\r
+    //\r
+    GateWay = Head->Dst;\r
 \r
+  } else if (GateWay == IP4_ALLZERO_ADDRESS) {\r
+    //\r
+    // Route the packet unless overrided, that is, GateWay isn't zero.\r
+    //\r
+    if (IpInstance == NULL) {\r
+      CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src);\r
     } else {\r
-      //\r
-      // Consult the route table to route the packet\r
-      //\r
-      if (IpInstance == NULL) {\r
-        CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src);\r
-      } else {\r
-        CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head->Src);\r
-      }\r
-\r
-      if (CacheEntry == NULL) {\r
-        return EFI_NOT_FOUND;\r
-      }\r
+      CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head->Src);\r
+    }\r
 \r
-      GateWay = CacheEntry->NextHop;\r
-      Ip4FreeRouteCacheEntry (CacheEntry);\r
+    if (CacheEntry == NULL) {\r
+      return EFI_NOT_FOUND;\r
     }\r
+\r
+    GateWay = CacheEntry->NextHop;\r
+    Ip4FreeRouteCacheEntry (CacheEntry);\r
   }\r
 \r
   //\r