diff mbox series

[1/1] RDMA/rxe: Disable ipv6 features when ipv6.disable set in cmdline

Message ID CAD=hENdtK8qvHEnowpUZ+sL-SoB7bu2nMEDrkFjgdbbhxBqaMg@mail.gmail.com (mailing list archive)
State Superseded
Headers show
Series [1/1] RDMA/rxe: Disable ipv6 features when ipv6.disable set in cmdline | expand

Commit Message

Zhu Yanjun March 6, 2021, 2:05 p.m. UTC
From: Zhu Yanjun <zyjzyj2000@gmail.com>

When ipv6.disable=1 is set in cmdline, ipv6 is actually disabled
in the stack. As such, the operations of ipv6 in RXE will fail.
So ipv6 features in RXE should also be disabled in RXE.

Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/sw/rxe/rxe_net.c | 9 +++++++++
 1 file changed, 9 insertions(+)

        memcpy(&fl6.saddr, saddr, sizeof(*saddr));
@@ -608,6 +613,10 @@ static int rxe_net_ipv4_init(void)
 static int rxe_net_ipv6_init(void)
 {
 #if IS_ENABLED(CONFIG_IPV6)
+       if (!ipv6_mod_enabled()) {
+               pr_info("IPv6 is disabled by ipv6.disable=1 in cmdline");
+               return 0;
+       }

        recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net,
                                                htons(ROCE_V2_UDP_DPORT), true);
--
2.25.1
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_net.c
b/drivers/infiniband/sw/rxe/rxe_net.c
index 0701bd1ffd1a..6ef092cb575e 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -72,6 +72,11 @@  static struct dst_entry *rxe_find_route6(struct
net_device *ndev,
        struct dst_entry *ndst;
        struct flowi6 fl6 = { { 0 } };

+       if (!ipv6_mod_enabled()) {
+               pr_info("IPv6 is disabled by ipv6.disable=1 in cmdline");
+               return NULL;
+       }
+
        memset(&fl6, 0, sizeof(fl6));
        fl6.flowi6_oif = ndev->ifindex;