TianoCore EDK2 master
|
#include "Ip4Impl.h"
Go to the source code of this file.
Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Ip4Route.c.
EFI_STATUS Ip4AddRoute | ( | IN OUT IP4_ROUTE_TABLE * | RtTable, |
IN IP4_ADDR | Dest, | ||
IN IP4_ADDR | Netmask, | ||
IN IP4_ADDR | Gateway | ||
) |
Add a route entry to the route table. All the IP4_ADDRs are in host byte order.
[in,out] | RtTable | Route table to add route to |
[in] | Dest | The destination of the network |
[in] | Netmask | The netmask of the destination |
[in] | Gateway | 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 is added successfully. |
Definition at line 291 of file Ip4Route.c.
EFI_STATUS Ip4BuildEfiRouteTable | ( | IN IP4_PROTOCOL * | IpInstance | ) |
Build a EFI_IP4_ROUTE_TABLE to be returned to the caller of GetModeData. The EFI_IP4_ROUTE_TABLE is clumsy to use in the internal operation of the IP4 driver.
[in] | IpInstance | The IP4 child that requests the route table. |
EFI_SUCCESS | The route table is successfully build |
EFI_OUT_OF_RESOURCES | Failed to allocate the memory for the route table. |
Definition at line 593 of file Ip4Route.c.
VOID Ip4CleanRouteCache | ( | IN IP4_ROUTE_CACHE * | RtCache | ) |
Clean up a route cache, that is free all the route cache entries enqueued in the cache.
[in] | RtCache | The route cache table to clean up |
Definition at line 150 of file Ip4Route.c.
IP4_ROUTE_CACHE_ENTRY * Ip4CreateRouteCacheEntry | ( | IN IP4_ADDR | Dst, |
IN IP4_ADDR | Src, | ||
IN IP4_ADDR | GateWay, | ||
IN UINTN | Tag | ||
) |
Allocate and initialize an IP4 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. |
Definition at line 80 of file Ip4Route.c.
IP4_ROUTE_ENTRY * Ip4CreateRouteEntry | ( | IN IP4_ADDR | Dest, |
IN IP4_ADDR | Netmask, | ||
IN IP4_ADDR | GateWay | ||
) |
Allocate a route entry then initialize it with the Dest/Netmask and Gateway.
[in] | Dest | The destination network |
[in] | Netmask | The destination network mask |
[in] | GateWay | The nexthop address |
Definition at line 23 of file Ip4Route.c.
IP4_ROUTE_TABLE * Ip4CreateRouteTable | ( | VOID | ) |
Create an empty route table, includes its internal route cache
Definition at line 177 of file Ip4Route.c.
EFI_STATUS Ip4DelRoute | ( | IN OUT IP4_ROUTE_TABLE * | RtTable, |
IN IP4_ADDR | Dest, | ||
IN IP4_ADDR | Netmask, | ||
IN IP4_ADDR | Gateway | ||
) |
Remove a route entry and all the route caches spawn from it.
RtTable | The route table to remove the route from |
Dest | The destination network |
Netmask | The netmask of the Dest |
Gateway | The next hop address |
EFI_SUCCESS | The route entry is successfully removed |
EFI_NOT_FOUND | There is no route entry in the table with that property. |
Definition at line 352 of file Ip4Route.c.
IP4_ROUTE_CACHE_ENTRY * Ip4FindRouteCache | ( | IN IP4_ROUTE_TABLE * | RtTable, |
IN IP4_ADDR | Dest, | ||
IN IP4_ADDR | Src | ||
) |
Find a route cache with the dst and src. This is used by ICMP redirect message process. All kinds of redirect is treated as host redirect according to RFC1122. So, only route cache entries are modified according to the ICMP redirect message.
[in] | RtTable | The route table to search the cache for |
[in] | Dest | The destination address |
[in] | Src | The source address |
Definition at line 397 of file Ip4Route.c.
IP4_ROUTE_ENTRY * Ip4FindRouteEntry | ( | IN IP4_ROUTE_TABLE * | RtTable, |
IN IP4_ADDR | Dst | ||
) |
Search the route table for a most specific match to the Dst. It searches from the longest route area (mask length == 32) 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 by the following requirements:
[in] | RtTable | The route table to search from |
[in] | Dst | The destination address to search |
Definition at line 438 of file Ip4Route.c.
VOID Ip4FreeRouteCacheEntry | ( | IN IP4_ROUTE_CACHE_ENTRY * | RtCacheEntry | ) |
Free the route cache entry. It is reference counted.
RtCacheEntry | The route cache entry to free. |
Definition at line 113 of file Ip4Route.c.
VOID Ip4FreeRouteEntry | ( | IN IP4_ROUTE_ENTRY * | RtEntry | ) |
Free the route table entry. It is reference counted.
RtEntry | The route entry to free. |
Definition at line 55 of file Ip4Route.c.
VOID Ip4FreeRouteTable | ( | IN IP4_ROUTE_TABLE * | RtTable | ) |
Free the route table and its associated route cache. Route table is reference counted.
[in] | RtTable | The route table to free. |
Definition at line 211 of file Ip4Route.c.
VOID Ip4InitRouteCache | ( | IN OUT IP4_ROUTE_CACHE * | RtCache | ) |
Initialize an empty route cache table.
[in,out] | RtCache | The route cache table to initialize. |
Definition at line 131 of file Ip4Route.c.
VOID Ip4PurgeRouteCache | ( | IN OUT IP4_ROUTE_CACHE * | RtCache, |
IN UINTN | Tag | ||
) |
Remove all the cache entries bearing the Tag. When a route cache entry is created, it is tagged with the address of route entry from which it is spawned. When a route entry is deleted, the cache entries spawned from it are also deleted.
RtCache | Route cache to remove the entries from |
Tag | The Tag of the entries to remove |
Definition at line 254 of file Ip4Route.c.
IP4_ROUTE_CACHE_ENTRY * Ip4Route | ( | IN IP4_ROUTE_TABLE * | RtTable, |
IN IP4_ADDR | Dest, | ||
IN IP4_ADDR | Src, | ||
IN IP4_ADDR | SubnetMask, | ||
IN BOOLEAN | AlwaysTryDestAddr | ||
) |
Search the route table to route the packet. Return/create a route cache if there is a route to the destination.
[in] | RtTable | The route table to search from |
[in] | Dest | The destination address to search for |
[in] | Src | The source address to search for |
[in] | SubnetMask | The subnet mask of the Src address, this field is used to check if the station is using /32 subnet. |
[in] | AlwaysTryDestAddr | Always try to use the dest address as next hop even though we can't find a matching route entry. This field is only valid when using /32 subnet. |
Definition at line 484 of file Ip4Route.c.