1.总的入口函数点
net/ipv4/af_inet.c ip_init()
net/ipv4/route.c/ devinet_init() 初始化struct net *net 指针
net/ipv4/ip_output.c ip_rt_init() register_pernet_subsys(&fib_net_ops); 初始化ntt->rule_ops
net/ipv4/fib_frontend.c fib_net_init
net/ipv4/fib_frontend.c fib4_rules_init
ops = kmemdup(&fib4_rules_ops_template, sizeof(*ops), GFP_KERNEL); if (ops == NULL) return -ENOMEM; INIT_LIST_HEAD(&ops->rules_list); ops->fro_net = net; fib_rules_register(ops);
注意一个结构fib4_rules_ops_template会出事花struct net *net ipv4->rules_ops 里面包括路由的匹配相关函数,match, compare等函数
net/ipv4/fib_frontend.c fib_rules_register(ops) 初始化三个路由表local main default