Helper Routines
Here are a few routines used by some of the functions we will cover in this chapter:
-
fib_validate_source Validates the source IP address of a packet received on a given device, to detect spoofing attempts. Among other things, this function makes sure that unless asymmetric routing is enabled, the source IP address of the packet is reachable through the same interface the packet was received from (see the section "Reverse Path Filtering" in Chapter 31). It also returns the preferred source address
spec_dstto use for the reverse direction, as described in the upcoming section "Preferred Source Address Selection," and initializes the routing tag, as described in the section "Routing Table Based Classifier" in Chapter 31.-
inet_select_addr Given a device
dev, an IP addressdst, and a scopescope, returns the first primary address with scopescope, to use in sending a packet to the addressdstout of devicedev.This routine is needed because a device can be configured with multiple addresses, and each can have its own scope.
The reason for the
dstargument is that ifdevis configured with different IP addresses on different subnets,dstallows this function to return an IP address configured on the same subnet asdst.In the section "Scope" in Chapter 30, we saw that there are primary and secondary addresses;
inet_select_addrreturns only primary addresses.If no address configured on
devmeets the conditions specified byscopeanddst, the function tries the rest of the ...
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