用于每个具体协议注册到netlink中的钩子,用户通过netlink协议通过该钩子和具体协议通讯。例如ip工具就是这么做的。
rtnetlink_links[PF_INET] = inet_rtnetlink_table;
static struct rtnetlink_link inet_rtnetlink_table[RTM_MAX-RTM_BASE+1] =
{
{ NULL, NULL, },
{ NULL, NULL, },
{ NULL, NULL, },
{ NULL, NULL, },
{ inet_rtm_newaddr, NULL, },
{ inet_rtm_deladdr, NULL, },
{ NULL, inet_dump_ifaddr, },
{ NULL, NULL, },
{ inet_rtm_newroute, NULL, },
{ inet_rtm_delroute, NULL, },
{ inet_rtm_getroute, inet_dump_fib, },
{ NULL, NULL, },
{ NULL, NULL, },
{ NULL, NULL, },
{ NULL, NULL, },
{ NULL, NULL, },
#ifdef CONFIG_IP_MULTIPLE_TABLES
{ inet_rtm_newrule, NULL, },
{ inet_rtm_delrule, NULL, },
{ NULL, inet_dump_rules, },
{ NULL, NULL, },
#else
{ NULL, NULL, },
{ NULL, NULL, },
{ NULL, NULL, },
{ NULL, NULL, },
#endif
}; |