]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Ip6Dxe/Ip6Output.c
BaseTools: resolve initialization order errors in VfrFormPkg.h
[mirror_edk2.git] / NetworkPkg / Ip6Dxe / Ip6Output.c
index ecbaf2d94ca9014f5fe1cbb2c81972673c9f6721..8330e37935d01958dbe890e7dc8c1da0054fc9b8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The internal functions and routines to transmit the IP6 packet.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -23,7 +23,7 @@ UINT32 mIp6Id;
 \r
   @param[in]       IpSb             Points to an IP6 service binding instance.\r
   @param[out]      SourceList       The list entry head of all source addresses.\r
-                                    It is the caller's responsiblity to free the\r
+                                    It is the caller's responsibility to free the\r
                                     resources.\r
   @param[out]      SourceCount      The number of source addresses.\r
 \r
@@ -91,7 +91,7 @@ Ip6CandidateSource (
 }\r
 \r
 /**\r
-  Caculate how many bits are the same between two IPv6 addresses.\r
+  Calculate how many bits are the same between two IPv6 addresses.\r
 \r
   @param[in]       AddressA         Points to an IPv6 address.\r
   @param[in]       AddressB         Points to another IPv6 address.\r
@@ -364,7 +364,7 @@ Ip6SysPacketSent (
   @param[in]  LastHeader       The pointer of next header of last extension header.\r
   @param[in]  HeadLen          The length of the unfragmented part of the IP6 header.\r
 \r
-  @retval EFI_BAD_BUFFER_SIZE  There is no enought room in the head space of\r
+  @retval EFI_BAD_BUFFER_SIZE  There is no enough room in the head space of\r
                                Packet.\r
   @retval EFI_SUCCESS          The operation performed successfully.\r
 \r
@@ -388,6 +388,8 @@ Ip6PrependHead (
   EFI_STATUS                Status;\r
   UINT8                     NextHeader;\r
 \r
+  UpdatedExtHdrs = NULL;\r
+\r
   //\r
   // HeadLen is the length of the fixed part of the sequences of fragments, i.e.\r
   // the unfragment part.\r
@@ -689,13 +691,25 @@ Ip6Output (
     // For unicast packets, use a combination of the Destination Cache, the Prefix List\r
     // and the Default Router List to determine the IP address of the appropriate next hop.\r
     //\r
-    RouteCache = Ip6Route (IpSb, &Head->DestinationAddress, &Head->SourceAddress);\r
-    if (RouteCache == NULL) {\r
-      return EFI_NOT_FOUND;\r
-    }\r
 \r
-    IP6_COPY_ADDRESS (&NextHop, &RouteCache->NextHop);\r
-    Ip6FreeRouteCacheEntry (RouteCache);\r
+    NeighborCache = Ip6FindNeighborEntry (IpSb, &Head->DestinationAddress);\r
+    if (NeighborCache != NULL) {\r
+      //\r
+      // Hit Neighbor Cache.\r
+      //\r
+      IP6_COPY_ADDRESS (&NextHop, &Head->DestinationAddress);\r
+    } else {\r
+      //\r
+      // Not in Neighbor Cache, check Router cache\r
+      //\r
+      RouteCache = Ip6Route (IpSb, &Head->DestinationAddress, &Head->SourceAddress);\r
+      if (RouteCache == NULL) {\r
+        return EFI_NOT_FOUND;\r
+      }\r
+\r
+      IP6_COPY_ADDRESS (&NextHop, &RouteCache->NextHop);\r
+      Ip6FreeRouteCacheEntry (RouteCache);\r
+    }\r
   }\r
 \r
   //\r
@@ -712,7 +726,7 @@ Ip6Output (
       }\r
 \r
       //\r
-      // Send out multicast neighbor solicitation for address resolution immediatly.\r
+      // Send out multicast neighbor solicitation for address resolution immediately.\r
       //\r
       Ip6CreateSNMulticastAddr (&NeighborCache->Neighbor, &Destination);\r
       Status = Ip6SelectSourceAddress (IpSb, &NeighborCache->Neighbor, &Source);\r
@@ -795,7 +809,7 @@ Ip6Output (
   //\r
   // OK, selected the source and route, fragment the packet then send\r
   // them. Tag each fragment other than the first one as spawn from it.\r
-  // Each extension header is an integar multiple of 8 octets long, in\r
+  // Each extension header is an integer multiple of 8 octets long, in\r
   // order to retain 8-octet alignment for subsequent headers.\r
   //\r
   Mtu     = IpSb->MaxPacketSize + sizeof (EFI_IP6_HEADER);\r