--- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1492,7 +1492,7 @@ static void ipv4_dst_destroy(struct dst_entry *dst) void rt_flush_dev(struct net_device *dev) { - struct net *net = dev_net(dev); + bool changed = false; struct rtable *rt; int cpu; @@ -1503,12 +1503,15 @@ void rt_flush_dev(struct net_device *dev) list_for_each_entry(rt, &ul->head, rt_uncached) { if (rt->dst.dev != dev) continue; - rt->dst.dev = net->loopback_dev; + rt->dst.dev = init_net.loopback_dev; dev_hold(rt->dst.dev); dev_put(dev); + changed = true; } spin_unlock_bh(&ul->lock); } + if (changed) + printk("rt_flush_dev(%u)\n", netdev_refcnt_read(init_net.loopback_dev)); } static bool rt_cache_valid(const struct rtable *rt)