Hi,
We've noticed that when taking network interface down the local route
for its address is preserved. The following console session
illustrates it:
# ip addr add 5.5.5.5 dev eth4
# ip route list table all | grep eth4
local 5.5.5.5 dev eth4 table 255 vrf 0 proto kernel scope host src 5.5.5.5
# ip link set eth4 down
local 5.5.5.5 dev eth4 table 255 vrf 0 proto kernel scope host src 5.5.5.5
There seems to be an asymmetry between NETDEV_UP and NETDEV_DOWN events
in fib_netdev_event at net/ipv4/fib_frontend.c. On NETDEV_UP we are adding
routes for interface addresses. However on NETDEV_DOWN we do not delete them.
The attached (for a fear of GMail tab munging :)) patch tries to change it.
What do you think?
Thanks,
Boris.
Signed-off-by: Boris Sukholitko ([EMAIL PROTECTED])
---
Index: linux-2.6.18/net/ipv4/fib_frontend.c
===================================================================
--- linux-2.6.18.orig/net/ipv4/fib_frontend.c 2006-11-01 18:15:31.000000000 +0200
+++ linux-2.6.18/net/ipv4/fib_frontend.c 2006-11-05 15:32:56.000000000 +0200
@@ -727,6 +727,8 @@
*/
for (ifa1 = in_dev->ifa_list; ifa1; ifa1 = ifa1->ifa_next) {
+ if (ifa == ifa1)
+ continue;
if (ifa->ifa_local == ifa1->ifa_local)
ok |= LOCAL_OK;
if (ifa->ifa_broadcast == ifa1->ifa_broadcast)
@@ -880,6 +882,9 @@
rt_cache_flush(-1);
break;
case NETDEV_DOWN:
+ for_ifa(in_dev) {
+ fib_del_ifaddr(ifa);
+ } endfor_ifa(in_dev);
fib_disable_ip(dev, 0);
break;
case NETDEV_CHANGEMTU: