Policy Routing and Routing Table Based Classifier
We saw in the section "Routing Table Based Classifier" in Chapter 31 that the Traffic Control subsystem, which implements the network QoS layer, can classify packets based on a tag computed by the routing subsystem. In the same section, we saw how realms are configured, and the logic used to derive the routing tag from those configurations. In this section, we will see how the realm configuration is stored in the routing table and how the routing tag is computed by the routing code. Because Traffic Control is outside the scope of this book, we will not cover how it uses the routing tag.
Storing the Realms
The kernel stores the policy and route realms in the fib_rule->r_tclassid and fib_nh->nh_tclassid fields, respectively.
-
fib_rule->r_tclassid Both the source and destination realms are 8-bit values (ranging from 0 to 255) but they are each assigned 16 bits within
r_tclassid. When the source realm is configured, it goes into the higher 16 bits, and when destination realm is configured, it goes into the lower 16 bits. See Figure 35-14.
Figure 35-14. r_tclassid field structure
-
fib_nh->nh_tclassid Normally, only the destination realm is used to compute the routing tag; the matching route is selected based on the destination address. However, as we saw in the section "Computing the routing tag" in Chapter 31, sometimes the kernel needs to ...
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