|
@@ -199,6 +199,11 @@ static struct list_head ptype_all __read_mostly; /* Taps */
|
|
|
DEFINE_RWLOCK(dev_base_lock);
|
|
|
EXPORT_SYMBOL(dev_base_lock);
|
|
|
|
|
|
+static inline void dev_base_seq_inc(struct net *net)
|
|
|
+{
|
|
|
+ while (++net->dev_base_seq == 0);
|
|
|
+}
|
|
|
+
|
|
|
static inline struct hlist_head *dev_name_hash(struct net *net, const char *name)
|
|
|
{
|
|
|
unsigned hash = full_name_hash(name, strnlen(name, IFNAMSIZ));
|
|
@@ -237,6 +242,9 @@ static int list_netdevice(struct net_device *dev)
|
|
|
hlist_add_head_rcu(&dev->index_hlist,
|
|
|
dev_index_hash(net, dev->ifindex));
|
|
|
write_unlock_bh(&dev_base_lock);
|
|
|
+
|
|
|
+ dev_base_seq_inc(net);
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -253,6 +261,8 @@ static void unlist_netdevice(struct net_device *dev)
|
|
|
hlist_del_rcu(&dev->name_hlist);
|
|
|
hlist_del_rcu(&dev->index_hlist);
|
|
|
write_unlock_bh(&dev_base_lock);
|
|
|
+
|
|
|
+ dev_base_seq_inc(dev_net(dev));
|
|
|
}
|
|
|
|
|
|
/*
|