diff options
| author | David S. Miller <davem@davemloft.net> | 2020-01-27 11:03:44 +0100 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2020-01-27 11:03:44 +0100 |
| commit | 09917a126d5babd9d0d9bee8ee2c5fc8517851e6 (patch) | |
| tree | 1b30b5e4c33fde74699a46fb49e7a289bbc2be67 /include | |
| parent | cd94ef06392ffd49e0a0e1c28bc5cd44f37f1f6b (diff) | |
| parent | d48834f9d4b4e7611cc84ac2c5018f1b420d59c2 (diff) | |
| download | cachepc-linux-09917a126d5babd9d0d9bee8ee2c5fc8517851e6.tar.gz cachepc-linux-09917a126d5babd9d0d9bee8ee2c5fc8517851e6.zip | |
Merge branch 'net-allow-per-net-notifier-to-follow-netdev-into-namespace'
Jiri Pirko says:
====================
net: allow per-net notifier to follow netdev into namespace
Currently we have per-net notifier, which allows to get only
notifications relevant to particular network namespace. That is enough
for drivers that have netdevs local in a particular namespace (cannot
move elsewhere).
However if netdev can change namespace, per-net notifier cannot be used.
Introduce dev_net variant that is basically per-net notifier with an
extension that re-registers the per-net notifier upon netdev namespace
change. Basically the per-net notifier follows the netdev into
namespace.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/netdevice.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 20445f94eb1c..4626188a754b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -939,6 +939,11 @@ struct netdev_name_node { int netdev_name_node_alt_create(struct net_device *dev, const char *name); int netdev_name_node_alt_destroy(struct net_device *dev, const char *name); +struct netdev_net_notifier { + struct list_head list; + struct notifier_block *nb; +}; + /* * This structure defines the management hooks for network devices. * The following hooks can be defined; unless noted otherwise, they are @@ -1793,6 +1798,10 @@ enum netdev_priv_flags { * * @wol_enabled: Wake-on-LAN is enabled * + * @net_notifier_list: List of per-net netdev notifier block + * that follow this device when it is moved + * to another network namespace. + * * FIXME: cleanup struct net_device such that network protocol info * moves out. */ @@ -2085,6 +2094,8 @@ struct net_device { struct lock_class_key addr_list_lock_key; bool proto_down; unsigned wol_enabled:1; + + struct list_head net_notifier_list; }; #define to_net_dev(d) container_of(d, struct net_device, dev) @@ -2529,6 +2540,12 @@ int unregister_netdevice_notifier(struct notifier_block *nb); int register_netdevice_notifier_net(struct net *net, struct notifier_block *nb); int unregister_netdevice_notifier_net(struct net *net, struct notifier_block *nb); +int register_netdevice_notifier_dev_net(struct net_device *dev, + struct notifier_block *nb, + struct netdev_net_notifier *nn); +int unregister_netdevice_notifier_dev_net(struct net_device *dev, + struct notifier_block *nb, + struct netdev_net_notifier *nn); struct netdev_notifier_info { struct net_device *dev; |
