Data Structures Featured in This Part of the Book
The section "Main Data Structures" in Chapter 32 gave a brief overview of the main data structures, and Figure 34-1 in Chapter 34 can help you understand the relationships between them. This section provides a detailed description of each data structure type. Figure 36-5 shows the file that defines each data structure.

Figure 36-5. Distribution of data structures in kernel files
fib_table Structure
A fib_table structure is created for each routing
table instance. The structure consists mainly of a routing table identifier and a set of
function pointers used to manage the table:
-
unsigned char tb_id Routing table identifier. In include/linux/rtnetlink.h, you can find the
rt_class_tlist of predefined values, such asRT_TABLE_LOCAL.-
unsigned tb_stamp Not used.
-
int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res) The function called by the
fib_lookuproutine described in Chapter 35.-
int (*tb_insert)(struct fib_table *table, struct rtmsg *r,struct kern_rta *rta, struct nlmsghdr *n, struct netlink_skb_parms *req) -
int (*tb_delete)(struct fib_table *table, struct rtmsg *r, struct kern_rta *rta, struct nlmsghdr *n, struct netlink_skb_parms *req); tb_insertis called byinet_rtm_newrouteandip_rt_ioctlto process the ip route add/change/replace/prepend/append/test and route add user-space commands. Similarly, ...
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