diff options
author | Mario Kicherer <dev@kicherer.org> | 2017-02-21 12:19:47 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2017-04-04 17:35:58 +0200 |
commit | 8e8cda6d737d356054c9eeef642aec0e8ae7e6bc (patch) | |
tree | bdc78138b5beca98f398c86ad65c526bbea2ebf8 /include/net | |
parent | dabf54dd1c6369160f8d4c793a8613dfb4e7848a (diff) |
can: initial support for network namespaces
This patch adds initial support for network namespaces. The changes only
enable support in the CAN raw, proc and af_can code. GW and BCM still
have their checks that ensure that they are used only from the main
namespace.
The patch boils down to moving the global structures, i.e. the global
filter list and their /proc stats, into a per-namespace structure and passing
around the corresponding "struct net" in a lot of different places.
Changes since v1:
- rebased on current HEAD (2bfe01e)
- fixed overlong line
Signed-off-by: Mario Kicherer <dev@kicherer.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/net_namespace.h | 4 | ||||
-rw-r--r-- | include/net/netns/can.h | 31 |
2 files changed, 35 insertions, 0 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index af8fe8a909dc..fe80bb48ab1f 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -27,6 +27,7 @@ #include <net/netns/nftables.h> #include <net/netns/xfrm.h> #include <net/netns/mpls.h> +#include <net/netns/can.h> #include <linux/ns_common.h> #include <linux/idr.h> #include <linux/skbuff.h> @@ -141,6 +142,9 @@ struct net { #if IS_ENABLED(CONFIG_MPLS) struct netns_mpls mpls; #endif +#if IS_ENABLED(CONFIG_CAN) + struct netns_can can; +#endif struct sock *diag_nlsk; atomic_t fnhe_genid; }; diff --git a/include/net/netns/can.h b/include/net/netns/can.h new file mode 100644 index 000000000000..e8beba772f1a --- /dev/null +++ b/include/net/netns/can.h @@ -0,0 +1,31 @@ +/* + * can in net namespaces + */ + +#ifndef __NETNS_CAN_H__ +#define __NETNS_CAN_H__ + +#include <linux/spinlock.h> + +struct dev_rcv_lists; + +struct netns_can { +#if IS_ENABLED(CONFIG_PROC_FS) + struct proc_dir_entry *proc_dir; + struct proc_dir_entry *pde_version; + struct proc_dir_entry *pde_stats; + struct proc_dir_entry *pde_reset_stats; + struct proc_dir_entry *pde_rcvlist_all; + struct proc_dir_entry *pde_rcvlist_fil; + struct proc_dir_entry *pde_rcvlist_inv; + struct proc_dir_entry *pde_rcvlist_sff; + struct proc_dir_entry *pde_rcvlist_eff; + struct proc_dir_entry *pde_rcvlist_err; +#endif + + /* receive filters subscribed for 'all' CAN devices */ + struct dev_rcv_lists *can_rx_alldev_list; + spinlock_t can_rcvlists_lock; +}; + +#endif /* __NETNS_CAN_H__ */ |