ipv4: Flush per-ns routing cache more sanely.

Flush the routing cache only of entries that match the
network namespace in which the purge event occurred.

Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
This commit is contained in:
David S. Miller
2010-12-19 21:11:20 -08:00
parent 782615aea8
commit 6561a3b12d
3 changed files with 30 additions and 42 deletions

View File

@@ -987,7 +987,11 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
rt_cache_flush(dev_net(dev), 0);
break;
case NETDEV_UNREGISTER_BATCH:
rt_cache_flush_batch();
/* The batch unregister is only called on the first
* device in the list of devices being unregistered.
* Therefore we should not pass dev_net(dev) in here.
*/
rt_cache_flush_batch(NULL);
break;
}
return NOTIFY_DONE;