/** @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
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
\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
}\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
@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
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
// 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
}\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
//\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