diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-10-13 15:41:14 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-10-13 15:41:14 +0200 |
commit | 48abf838f8fecb58a1abca51084f5cff41cf3d9a (patch) | |
tree | f4dcf74f48f6754eeee238a36792a1bfd8091d50 | |
parent | 2901ce199c8f23050613ed44bc58e341d9a83f77 (diff) | |
download | modfastd-48abf838f8fecb58a1abca51084f5cff41cf3d9a.tar modfastd-48abf838f8fecb58a1abca51084f5cff41cf3d9a.zip |
Store network namespace in fastd_struct
-rw-r--r-- | fastd.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -54,6 +54,7 @@ #include <linux/netdevice.h> #include <linux/rculist.h> #include <net/genetlink.h> +#include <net/net_namespace.h> #include <net/route.h> #include "fastd.h" @@ -71,6 +72,8 @@ struct fastd_struct { struct list_head list; struct net_device *dev; + + struct net *net; u32 owner; u16 mode; @@ -103,7 +106,7 @@ static int fastd_nl_event(struct notifier_block *nb, rcu_read_lock(); list_for_each_entry_rcu(entry, &fastd_list, list) { - if (entry->owner == n->portid) { + if (net_eq(entry->net, n->net) && entry->owner == n->portid) { entry->owner = 0; queue_work(fastd_workqueue, &entry->destroy_work); @@ -158,7 +161,11 @@ static const struct ethtool_ops fastd_ethtool_ops = { static void fastd_netdev_free(struct net_device *dev) { + struct fastd_struct *fastd = netdev_priv(dev); + + put_net(fastd->net); free_netdev(dev); + module_put(THIS_MODULE); } @@ -244,6 +251,7 @@ static int fastd_cmd_create(struct sk_buff *skb, struct genl_info *info) fastd = netdev_priv(dev); fastd->dev = dev; + fastd->net = get_net(net); fastd->owner = info->snd_portid; fastd->mode = mode; INIT_WORK(&fastd->destroy_work, fastd_destroy_work); |