We need this switch, as lxc_xmit works around the MEDIA to send
the data to another netns directly. It causes all netfilter and
tc rules to not apply to the traffic, which might not be
expected in some cases. Also, it cause that we can't do testing
over UDP/ETH MEDIA properly.

So add a systcl switch for lxc_xmit, so that users can use TIPC
between netns as before by setting it to 0. Note that it only
affects the new created nodes.

Signed-off-by: Xin Long <lucien....@gmail.com>
---
 net/tipc/node.c   | 4 +++-
 net/tipc/node.h   | 2 ++
 net/tipc/sysctl.c | 9 +++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/net/tipc/node.c b/net/tipc/node.c
index 6ef95ce565bd..c7ffb2cdefc3 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -49,6 +49,8 @@
 #define INVALID_NODE_SIG       0x10000
 #define NODE_CLEANUP_AFTER     300000
 
+int sysctl_tipc_lxc_xmit __read_mostly = 1;
+
 /* Flags used to take different actions according to flag type
  * TIPC_NOTIFY_NODE_DOWN: notify node is down
  * TIPC_NOTIFY_NODE_UP: notify node is up
@@ -446,7 +448,7 @@ static void tipc_node_assign_peer_net(struct tipc_node *n, 
u32 hash_mixes)
        struct net *tmp;
        u32 hash_chk;
 
-       if (n->peer_net)
+       if (!sysctl_tipc_lxc_xmit || n->peer_net)
                return;
 
        for_each_net_rcu(tmp) {
diff --git a/net/tipc/node.h b/net/tipc/node.h
index 154a5bbb0d29..db57335c9d6c 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -42,6 +42,8 @@
 #include "bearer.h"
 #include "msg.h"
 
+extern int sysctl_tipc_lxc_xmit __read_mostly;
+
 /* Optional capabilities supported by this code version
  */
 enum {
diff --git a/net/tipc/sysctl.c b/net/tipc/sysctl.c
index 9fb65c988f7f..ca27c1922e71 100644
--- a/net/tipc/sysctl.c
+++ b/net/tipc/sysctl.c
@@ -91,6 +91,15 @@ static struct ctl_table tipc_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_doulongvec_minmax,
        },
+       {
+               .procname       = "lxc_xmit",
+               .data           = &sysctl_tipc_lxc_xmit,
+               .maxlen         = sizeof(sysctl_tipc_lxc_xmit),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_ONE,
+       },
        {}
 };
 
-- 
2.31.1



_______________________________________________
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to