December 2005
Intermediate to advanced
1066 pages
33h 38m
English
As mentioned in
the section "Special Routes" in Chapter 30, the kernel uses two routing tables by
default when there is no support for Policy Routing. A routing table lookup simply
consists of two table lookups (two calls to fn_hash_lookup), so the fib lookup function
defined in include/net/ip_fib.h is quite brief:
static inline int fib_lookup(const struct flowi *flp, struct fib_result *res)
{
if (ip_fib_local_table->tb_lookup(ip_fib_local_table, flp, res) &&
ip_fib_main_table->tb_lookup(ip_fib_main_table, flp, res))
return --ENETUNREACH;
return 0;
}The search key is flp. The function first checks
the ip_fib_local_table routing table, and if that
fails, it checks the ip_fib_main_table routing table.
If neither table manages to find a match, fib_loopkup
returns —ENETUNREACH (unreachable destination
network).
Read now
Unlock full access