Output Routing
Packets generated locally are routed with ip_route_output_slow if _
_ip_route_output_key, the routine we introduced in the section "Initialization of Function Pointers for Egress
Traffic," encounters a cache miss. The structure of ip_route_output_slow somewhat resembles ip_route_input_slow. A high-level overview of the function is shown in Figures 35-8(a) and 35-8(b).

Figure 35-8a. ip_route_output_slow function

Figure 35-8b. p_route_output_slow function
In the next few sections, we will examine in detail what ip_route_output_slow needs to do to deliver a packet locally or transmit it
out. Both local delivery and forwarding have to perform the following tasks, though they
may do so in different ways:
Select the egress device to use from the route that matches.
Select the source IP address to use, based on the scope of the route being searched.
Create and initialize a new cache table entry and insert it into the cache.
Figure 35-8 is split into three parts by dotted lines. The top part, a, fills in the fields of the search key that are not already initialized when it is passed to the function. The central part, b, makes a routing table lookup and, if needed, selects the next hop in a multipath route or the default gateway. The bottom part, c, creates the new cache table entry. ...
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