- 论坛徽章:
- 1
|
最近在复习以前阅读的linux网络内核源码笔记,发现了一个以前忽略的问题,下面我列出我有疑问的代码
872 static void fib_del_ifaddr(struct in_ifaddr *ifa)
873 {
...
942 if (!(ok&LOCAL_OK)) {
943 fib_magic(RTM_DELROUTE, RTN_LOCAL, ifa->ifa_local, 32, prim);
944
945 /* Check, that this local address finally disappeared. */
946 if (inet_addr_type(ifa->ifa_local) != RTN_LOCAL) {
947 /* And the last, but not the least thing.
948 We must flush stray FIB entries.
949
950 First of all, we scan fib_info list searching
951 for stray nexthop entries, then ignite fib_flush.
952 */
953 if (fib_sync_down(ifa->ifa_local, NULL, 0))
954 fib_flush();
955 }
956 }
...
961 }
如上红色字体所示代码,通过inet_addr_type函数判断当前被删除的地址ifa对应的路由是否为RTN_LOCAL,如果不是则调用下面的fib_sync_down,我这里的问题是,什么样的地址具有这样的非RTN_LOCAL特征?作为对比,在fib_add_ifaddr函数中我们可以给linux添加一个ip,而该添加函数中我反复阅读了下,都找不到能在这里满足此红色字体语句的那样的ifa,这到底是怎么回事?以前阅读这段代码时没有想到这个细节,望各位能给予解答! |
|