Data Structures | |
struct | IP6_ROUTE_ENTRY |
struct | IP6_ROUTE_CACHE_ENTRY |
struct | IP6_ROUTE_CACHE |
struct | _IP6_ROUTE_TABLE |
Defines | |
#define | IP6_DIRECT_ROUTE 0x00000001 |
#define | IP6_PACKET_TOO_BIG 0x00000010 |
#define | IP6_ROUTE_CACHE_HASH_SIZE 31 |
#define | IP6_ROUTE_CACHE_MAX 32 |
#define | IP6_ROUTE_CACHE_HASH(Ip1, Ip2) Ip6RouteCacheHash ((Ip1), (Ip2)) |
Typedefs | |
typedef struct _IP6_ROUTE_TABLE | IP6_ROUTE_TABLE |
Functions | |
UINT32 | Ip6RouteCacheHash (IN EFI_IPv6_ADDRESS *Ip1, IN EFI_IPv6_ADDRESS *Ip2) |
IP6_ROUTE_CACHE_ENTRY * | Ip6CreateRouteCacheEntry (IN EFI_IPv6_ADDRESS *Dst, IN EFI_IPv6_ADDRESS *Src, IN EFI_IPv6_ADDRESS *GateWay, IN UINTN Tag) |
VOID | Ip6FreeRouteCacheEntry (IN OUT IP6_ROUTE_CACHE_ENTRY *RtCacheEntry) |
IP6_ROUTE_CACHE_ENTRY * | Ip6FindRouteCache (IN IP6_ROUTE_TABLE *RtTable, IN EFI_IPv6_ADDRESS *Dest, IN EFI_IPv6_ADDRESS *Src) |
EFI_STATUS | Ip6BuildEfiRouteTable (IN IP6_ROUTE_TABLE *RouteTable, OUT UINT32 *EfiRouteCount, OUT EFI_IP6_ROUTE_TABLE **EfiRouteTable) |
IP6_ROUTE_TABLE * | Ip6CreateRouteTable (VOID) |
VOID | Ip6CleanRouteTable (IN OUT IP6_ROUTE_TABLE *RtTable) |
IP6_ROUTE_ENTRY * | Ip6CreateRouteEntry (IN EFI_IPv6_ADDRESS *Destination, IN UINT8 PrefixLength, IN EFI_IPv6_ADDRESS *GatewayAddress) |
IP6_ROUTE_ENTRY * | Ip6FindRouteEntry (IN IP6_ROUTE_TABLE *RtTable, IN EFI_IPv6_ADDRESS *Destination, IN EFI_IPv6_ADDRESS *NextHop) |
VOID | Ip6FreeRouteEntry (IN OUT IP6_ROUTE_ENTRY *RtEntry) |
EFI_STATUS | Ip6AddRoute (IN OUT IP6_ROUTE_TABLE *RtTable, IN EFI_IPv6_ADDRESS *Destination, IN UINT8 PrefixLength, IN EFI_IPv6_ADDRESS *GatewayAddress) |
EFI_STATUS | Ip6DelRoute (IN OUT IP6_ROUTE_TABLE *RtTable, IN EFI_IPv6_ADDRESS *Destination, IN UINT8 PrefixLength, IN EFI_IPv6_ADDRESS *GatewayAddress) |
IP6_ROUTE_CACHE_ENTRY * | Ip6Route (IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Dest, IN EFI_IPv6_ADDRESS *Src) |
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define IP6_DIRECT_ROUTE 0x00000001 |
Referenced by Ip6AddRoute(), Ip6CreatePrefixListEntry(), Ip6ProcessPacketTooBig(), Ip6ProcessRedirect(), and Ip6Route().
#define IP6_PACKET_TOO_BIG 0x00000010 |
Referenced by Ip6Output(), and Ip6ProcessPacketTooBig().
#define IP6_ROUTE_CACHE_HASH | ( | Ip1, | |||
Ip2 | ) | Ip6RouteCacheHash ((Ip1), (Ip2)) |
Referenced by Ip6FindRouteCache(), Ip6ProcessRedirect(), and Ip6Route().
#define IP6_ROUTE_CACHE_HASH_SIZE 31 |
Referenced by Ip6CleanRouteTable(), Ip6CreateRouteTable(), Ip6NdTimerTicking(), Ip6PurgeRouteCache(), and Ip6RouteCacheHash().
#define IP6_ROUTE_CACHE_MAX 32 |
Max NO. of cache entry per hash bucket
Referenced by Ip6NdTimerTicking().
typedef struct _IP6_ROUTE_TABLE IP6_ROUTE_TABLE |
EFI_STATUS Ip6AddRoute | ( | IN OUT IP6_ROUTE_TABLE * | RtTable, | |
IN EFI_IPv6_ADDRESS * | Destination, | |||
IN UINT8 | PrefixLength, | |||
IN EFI_IPv6_ADDRESS * | GatewayAddress | |||
) |
Add a route entry to the route table. It is the help function for EfiIp6Routes.
[in,out] | RtTable | Route table to add route to. |
[in] | Destination | The destination of the network. |
[in] | PrefixLength | The PrefixLength of the destination. |
[in] | GatewayAddress | The next hop address. |
EFI_ACCESS_DENIED | The same route already exists. | |
EFI_OUT_OF_RESOURCES | Failed to allocate memory for the entry. | |
EFI_SUCCESS | The route was added successfully. |
References IP6_ROUTE_ENTRY::Destination, IP6_ROUTE_ENTRY::Flag, IP6_DIRECT_ROUTE, Ip6CreateRouteEntry(), IP6_ROUTE_ENTRY::Link, and IP6_ROUTE_ENTRY::NextHop.
Referenced by EfiIp6Routes().
EFI_STATUS Ip6BuildEfiRouteTable | ( | IN IP6_ROUTE_TABLE * | RouteTable, | |
OUT UINT32 * | EfiRouteCount, | |||
OUT EFI_IP6_ROUTE_TABLE ** | EfiRouteTable | |||
) |
Build a array of EFI_IP6_ROUTE_TABLE to be returned to the caller. The number of EFI_IP6_ROUTE_TABLE is also returned.
[in] | RouteTable | The pointer of IP6_ROUTE_TABLE internal used. |
[out] | EfiRouteCount | The number of returned route entries. |
[out] | EfiRouteTable | The pointer to the array of EFI_IP6_ROUTE_TABLE. If NULL, only the route entry count is returned. |
EFI_SUCCESS | The EFI_IP6_ROUTE_TABLE successfully built. | |
EFI_OUT_OF_RESOURCES | Failed to allocate the memory for the route table. |
[in] | RouteTable | The pointer of IP6_ROUTE_TABLE internal used. |
[out] | EfiRouteCount | The number of returned route entries. |
[out] | EfiRouteTable | The pointer to the array of EFI_IP6_ROUTE_TABLE. If NULL, only the route entry count is returned. |
EFI_SUCCESS | The EFI_IP6_ROUTE_TABLE successfully built. | |
EFI_OUT_OF_RESOURCES | Failed to allocate the memory for the route table. |
References IP6_ROUTE_ENTRY::Destination, Ip6CopyAddressByPrefix(), IP6_ROUTE_ENTRY::NextHop, and IP6_ROUTE_ENTRY::PrefixLength.
Referenced by EfiIp6GetModeData(), and Ip6ConfigGetIfInfo().
VOID Ip6CleanRouteTable | ( | IN OUT IP6_ROUTE_TABLE * | RtTable | ) |
Free the route table and its associated route cache. Route table is reference counted.
[in,out] | RtTable | The route table to free. |
References IP6_ROUTE_CACHE_HASH_SIZE, Ip6FreeRouteCacheEntry(), and Ip6FreeRouteEntry().
Referenced by Ip6CleanService().
IP6_ROUTE_CACHE_ENTRY* Ip6CreateRouteCacheEntry | ( | IN EFI_IPv6_ADDRESS * | Dst, | |
IN EFI_IPv6_ADDRESS * | Src, | |||
IN EFI_IPv6_ADDRESS * | GateWay, | |||
IN UINTN | Tag | |||
) |
Allocate and initialize an IP6 route cache entry.
[in] | Dst | The destination address. |
[in] | Src | The source address. |
[in] | GateWay | The next hop address. |
[in] | Tag | The tag from the caller. This marks all the cache entries spawned from one route table entry. |
[in] | Dst | The destination address. |
[in] | Src | The source address. |
[in] | GateWay | The next hop address. |
[in] | Tag | The tag from the caller. This marks all the cache entries spawned from one route table entry. |
References IP6_ROUTE_CACHE_ENTRY::Destination, IP6_ROUTE_CACHE_ENTRY::NextHop, IP6_ROUTE_CACHE_ENTRY::RefCnt, IP6_ROUTE_CACHE_ENTRY::Source, and IP6_ROUTE_CACHE_ENTRY::Tag.
Referenced by Ip6ProcessRedirect(), and Ip6Route().
IP6_ROUTE_ENTRY* Ip6CreateRouteEntry | ( | IN EFI_IPv6_ADDRESS * | Destination, | |
IN UINT8 | PrefixLength, | |||
IN EFI_IPv6_ADDRESS * | GatewayAddress | |||
) |
Allocate a route entry then initialize it with the Destination/PrefixLength and Gateway.
[in] | Destination | The IPv6 destination address. This is an optional parameter that may be NULL. |
[in] | PrefixLength | The destination network's prefix length. |
[in] | GatewayAddress | The next hop address. This is optional parameter that may be NULL. |
[in] | Destination | The IPv6 destination address. This is an optional parameter that may be NULL. |
[in] | PrefixLength | The destination network's prefix length. |
[in] | GatewayAddress | The next hop address. This is an optional parameter that may be NULL. |
References IP6_ROUTE_ENTRY::Destination, IP6_ROUTE_ENTRY::Flag, IP6_ROUTE_ENTRY::NextHop, IP6_ROUTE_ENTRY::PrefixLength, and IP6_ROUTE_ENTRY::RefCnt.
Referenced by Ip6AddRoute(), Ip6CreateDefaultRouter(), Ip6CreatePrefixListEntry(), Ip6ProcessPacketTooBig(), and Ip6ProcessRedirect().
IP6_ROUTE_TABLE* Ip6CreateRouteTable | ( | VOID | ) |
Create an empty route table, includes its internal route cache.
References _IP6_ROUTE_TABLE::Cache, IP6_ROUTE_CACHE::CacheBucket, IP6_ROUTE_CACHE::CacheNum, IP6_ROUTE_CACHE_HASH_SIZE, _IP6_ROUTE_TABLE::RefCnt, _IP6_ROUTE_TABLE::RouteArea, and _IP6_ROUTE_TABLE::TotalNum.
Referenced by Ip6CreateService().
EFI_STATUS Ip6DelRoute | ( | IN OUT IP6_ROUTE_TABLE * | RtTable, | |
IN EFI_IPv6_ADDRESS * | Destination, | |||
IN UINT8 | PrefixLength, | |||
IN EFI_IPv6_ADDRESS * | GatewayAddress | |||
) |
Remove a route entry and all the route caches spawn from it. It is the help function for EfiIp6Routes.
[in,out] | RtTable | The route table to remove the route from. |
[in] | Destination | The destination network. |
[in] | PrefixLength | The PrefixLength of the Destination. |
[in] | GatewayAddress | The next hop address. |
EFI_SUCCESS | Successfully removed the route entry. | |
EFI_NOT_FOUND | There is no route entry in the table with that properity. |
[in,out] | RtTable | The route table to remove the route from. |
[in] | Destination | The destination network. |
[in] | PrefixLength | The PrefixLength of the Destination. |
[in] | GatewayAddress | The next hop address. |
EFI_SUCCESS | The route entry was successfully removed. | |
EFI_NOT_FOUND | There is no route entry in the table with that property. |
References IP6_ROUTE_ENTRY::Destination, Ip6FreeRouteEntry(), Ip6PurgeRouteCache(), and IP6_ROUTE_ENTRY::NextHop.
Referenced by EfiIp6Routes(), Ip6DestroyDefaultRouter(), and Ip6DestroyPrefixListEntry().
IP6_ROUTE_CACHE_ENTRY* Ip6FindRouteCache | ( | IN IP6_ROUTE_TABLE * | RtTable, | |
IN EFI_IPv6_ADDRESS * | Dest, | |||
IN EFI_IPv6_ADDRESS * | Src | |||
) |
Find a route cache with the destination and source address. This is used by the ICMPv6 redirect messasge process.
[in] | RtTable | The route table to search the cache for. |
[in] | Dest | The destination address. |
[in] | Src | The source address. |
[in] | RtTable | The route table to search the cache for. |
[in] | Dest | The destination address. |
[in] | Src | The source address. |
References IP6_ROUTE_CACHE_ENTRY::Destination, IP6_ROUTE_CACHE_HASH, and IP6_ROUTE_CACHE_ENTRY::Source.
Referenced by Ip6ProcessRedirect(), and Ip6Route().
IP6_ROUTE_ENTRY* Ip6FindRouteEntry | ( | IN IP6_ROUTE_TABLE * | RtTable, | |
IN EFI_IPv6_ADDRESS * | Destination, | |||
IN EFI_IPv6_ADDRESS * | NextHop | |||
) |
Search the route table for a most specific match to the Dst. It searches from the longest route area (prefix length == 128) to the shortest route area (default routes). In each route area, it will first search the instance's route table, then the default route table. This is required per the following requirements: 1. IP search the route table for a most specific match. 2. The local route entries have precedence over the default route entry.
[in] | RtTable | The route table to search from. |
[in] | Destination | The destionation address to search. If NULL, search the route table by NextHop. |
[in] | NextHop | The next hop address. If NULL, search the route table by Destination. |
[in] | RtTable | The route table to search from. |
[in] | Destination | The destionation address to search. If NULL, search the route table by NextHop. |
[in] | NextHop | The next hop address. If NULL, search the route table by Destination. |
most specific route to the Dst.
References IP6_ROUTE_ENTRY::Destination, IP6_ROUTE_ENTRY::NextHop, and IP6_ROUTE_ENTRY::PrefixLength.
Referenced by Ip6Output(), Ip6ProcessPacketTooBig(), Ip6ProcessRedirect(), and Ip6Route().
VOID Ip6FreeRouteCacheEntry | ( | IN OUT IP6_ROUTE_CACHE_ENTRY * | RtCacheEntry | ) |
Free the route cache entry. It is reference counted.
[in,out] | RtCacheEntry | The route cache entry to free. |
Referenced by Ip6CleanRouteTable(), Ip6NdTimerTicking(), Ip6Output(), and Ip6PurgeRouteCache().
VOID Ip6FreeRouteEntry | ( | IN OUT IP6_ROUTE_ENTRY * | RtEntry | ) |
Free the route table entry. It is reference counted.
[in,out] | RtEntry | The route entry to free. |
Referenced by Ip6CleanRouteTable(), Ip6DelRoute(), Ip6Output(), Ip6ProcessPacketTooBig(), and Ip6Route().
IP6_ROUTE_CACHE_ENTRY* Ip6Route | ( | IN IP6_SERVICE * | IpSb, | |
IN EFI_IPv6_ADDRESS * | Dest, | |||
IN EFI_IPv6_ADDRESS * | Src | |||
) |
Search the route table to route the packet. Return/create a route cache if there is a route to the destination.
[in] | IpSb | The IP6 service data. |
[in] | Dest | The destination address to search for. |
[in] | Src | The source address to search for. |
[in] | IpSb | The IP6 service data. |
[in] | Dest | The destination address to search for. |
[in] | Src | The source address to search for. |
References _IP6_ROUTE_TABLE::Cache, IP6_ROUTE_CACHE::CacheBucket, IP6_ROUTE_CACHE::CacheNum, IP6_ROUTE_ENTRY::Flag, IP6_DIRECT_ROUTE, IP6_ROUTE_CACHE_HASH, Ip6CreateRouteCacheEntry(), Ip6FindRouteCache(), Ip6FindRouteEntry(), Ip6FreeRouteEntry(), IP6_ROUTE_CACHE_ENTRY::Link, and IP6_ROUTE_ENTRY::NextHop.
Referenced by Ip6Output().
UINT32 Ip6RouteCacheHash | ( | IN EFI_IPv6_ADDRESS * | Ip1, | |
IN EFI_IPv6_ADDRESS * | Ip2 | |||
) |
This is the worker function for IP6_ROUTE_CACHE_HASH(). It calculates the value as the index of the route cache bucket according to the prefix of two IPv6 addresses.
[in] | Ip1 | The IPv6 address. |
[in] | Ip2 | The IPv6 address. |
References IP6_ROUTE_CACHE_HASH_SIZE.