Input Routing
Ingress IP packets for which no route can be found in the cache by ip_route_input are checked against the routing tables by
ip_route_input_slow, which is defined in net/ipv4/route.c and whose logic is shown in Figures 35-5(a) and 35-5(b). In this section, we describe the
internals of this routine in detail.

Figure 35-5a. ip_route_input_slow function

Figure 35-5b. ip_route_input_slow function
The function starts with a few sanity checks on the source and destination addresses; for instance, the source IP address must not be a multicast address. I already listed most of those checks in the section "Verbose Monitoring" in Chapter 31. More sanity checks are done later in the function.
The routing table lookup is done with fib_lookup,
the routine introduced in the section "fib_lookup Function." If fib_lookup cannot
find a matching route, the packet is dropped; additionally, if the receiving interface is
configured with forwarding enabled, an ICMP_UNREACHABLE
message is sent back to the source. Note that the ICMP message is sent not by ip_route_input_slow but by its caller, who takes care of it
upon seeing a return value of RTN_UNREACHABLE.
In case of success, ip_route_input_slow
distinguishes the following three cases:
Packet addressed to a broadcast address
Packet addressed to a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access