summaryrefslogtreecommitdiffstats
path: root/net/can/bcm.c
diff options
context:
space:
mode:
authorMario Kicherer <dev@kicherer.org>2017-02-21 06:19:47 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2017-04-04 11:35:58 -0400
commit8e8cda6d737d356054c9eeef642aec0e8ae7e6bc (patch)
treebdc78138b5beca98f398c86ad65c526bbea2ebf8 /net/can/bcm.c
parentdabf54dd1c6369160f8d4c793a8613dfb4e7848a (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 'net/can/bcm.c')
-rw-r--r--net/can/bcm.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 95d13b233c65..1976629a8463 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -764,8 +764,8 @@ static void bcm_remove_op(struct bcm_op *op)
764static void bcm_rx_unreg(struct net_device *dev, struct bcm_op *op) 764static void bcm_rx_unreg(struct net_device *dev, struct bcm_op *op)
765{ 765{
766 if (op->rx_reg_dev == dev) { 766 if (op->rx_reg_dev == dev) {
767 can_rx_unregister(dev, op->can_id, REGMASK(op->can_id), 767 can_rx_unregister(&init_net, dev, op->can_id,
768 bcm_rx_handler, op); 768 REGMASK(op->can_id), bcm_rx_handler, op);
769 769
770 /* mark as removed subscription */ 770 /* mark as removed subscription */
771 op->rx_reg_dev = NULL; 771 op->rx_reg_dev = NULL;
@@ -808,7 +808,7 @@ static int bcm_delete_rx_op(struct list_head *ops, struct bcm_msg_head *mh,
808 } 808 }
809 } 809 }
810 } else 810 } else
811 can_rx_unregister(NULL, op->can_id, 811 can_rx_unregister(&init_net, NULL, op->can_id,
812 REGMASK(op->can_id), 812 REGMASK(op->can_id),
813 bcm_rx_handler, op); 813 bcm_rx_handler, op);
814 814
@@ -1222,7 +1222,8 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
1222 1222
1223 dev = dev_get_by_index(&init_net, ifindex); 1223 dev = dev_get_by_index(&init_net, ifindex);
1224 if (dev) { 1224 if (dev) {
1225 err = can_rx_register(dev, op->can_id, 1225 err = can_rx_register(&init_net, dev,
1226 op->can_id,
1226 REGMASK(op->can_id), 1227 REGMASK(op->can_id),
1227 bcm_rx_handler, op, 1228 bcm_rx_handler, op,
1228 "bcm", sk); 1229 "bcm", sk);
@@ -1232,7 +1233,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
1232 } 1233 }
1233 1234
1234 } else 1235 } else
1235 err = can_rx_register(NULL, op->can_id, 1236 err = can_rx_register(&init_net, NULL, op->can_id,
1236 REGMASK(op->can_id), 1237 REGMASK(op->can_id),
1237 bcm_rx_handler, op, "bcm", sk); 1238 bcm_rx_handler, op, "bcm", sk);
1238 if (err) { 1239 if (err) {
@@ -1528,7 +1529,7 @@ static int bcm_release(struct socket *sock)
1528 } 1529 }
1529 } 1530 }
1530 } else 1531 } else
1531 can_rx_unregister(NULL, op->can_id, 1532 can_rx_unregister(&init_net, NULL, op->can_id,
1532 REGMASK(op->can_id), 1533 REGMASK(op->can_id),
1533 bcm_rx_handler, op); 1534 bcm_rx_handler, op);
1534 1535