All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] RDMA/addr: Disable ipv6 features when ipv6.disable set in cmdline
@ 2021-03-26  2:44 Zhu Yanjun
  2021-03-31  3:04 ` Zhu Yanjun
  0 siblings, 1 reply; 2+ messages in thread
From: Zhu Yanjun @ 2021-03-26  2:44 UTC (permalink / raw)
  To: dledford, jgg, leon, linux-rdma; +Cc: Zhu Yanjun, Jason Gunthorpe

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 will fail.
So ipv6 features in addr should also be disabled.

Fixes: caf1e3ae9fa6 ("RDMA/core Introduce and use rdma_find_ndev_for_src_ip_rcu")
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com>
---
 drivers/infiniband/core/addr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 0abce004a959..6fa57b83c4b1 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -257,6 +257,9 @@ rdma_find_ndev_for_src_ip_rcu(struct net *net, const struct sockaddr *src_in)
 		break;
 #if IS_ENABLED(CONFIG_IPV6)
 	case AF_INET6:
+		if (!ipv6_mod_enabled())
+			return ERR_PTR(-EPFNOSUPPORT);
+
 		for_each_netdev_rcu(net, dev) {
 			if (ipv6_chk_addr(net,
 					  &((const struct sockaddr_in6 *)src_in)->sin6_addr,
@@ -424,6 +427,9 @@ static int addr6_resolve(struct sockaddr *src_sock,
 	struct flowi6 fl6;
 	struct dst_entry *dst;
 
+	if (!ipv6_mod_enabled())
+		return -EADDRNOTAVAIL;
+
 	memset(&fl6, 0, sizeof fl6);
 	fl6.daddr = dst_in->sin6_addr;
 	fl6.saddr = src_in->sin6_addr;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] RDMA/addr: Disable ipv6 features when ipv6.disable set in cmdline
  2021-03-26  2:44 [PATCH 1/1] RDMA/addr: Disable ipv6 features when ipv6.disable set in cmdline Zhu Yanjun
@ 2021-03-31  3:04 ` Zhu Yanjun
  0 siblings, 0 replies; 2+ messages in thread
From: Zhu Yanjun @ 2021-03-31  3:04 UTC (permalink / raw)
  To: Zhu Yanjun
  Cc: Doug Ledford, Jason Gunthorpe, Leon Romanovsky,
	RDMA mailing list, Jason Gunthorpe

On Thu, Mar 25, 2021 at 6:19 PM Zhu Yanjun <yanjun.zhu@intel.com> wrote:
>
> 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 will fail.
> So ipv6 features in addr should also be disabled.
>
> Fixes: caf1e3ae9fa6 ("RDMA/core Introduce and use rdma_find_ndev_for_src_ip_rcu")
> Suggested-by: Jason Gunthorpe <jgg@nvidia.com>

Hi, Jason

Gently ping

> Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com>
> ---
>  drivers/infiniband/core/addr.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
> index 0abce004a959..6fa57b83c4b1 100644
> --- a/drivers/infiniband/core/addr.c
> +++ b/drivers/infiniband/core/addr.c
> @@ -257,6 +257,9 @@ rdma_find_ndev_for_src_ip_rcu(struct net *net, const struct sockaddr *src_in)
>                 break;
>  #if IS_ENABLED(CONFIG_IPV6)
>         case AF_INET6:
> +               if (!ipv6_mod_enabled())
> +                       return ERR_PTR(-EPFNOSUPPORT);
> +
>                 for_each_netdev_rcu(net, dev) {
>                         if (ipv6_chk_addr(net,
>                                           &((const struct sockaddr_in6 *)src_in)->sin6_addr,
> @@ -424,6 +427,9 @@ static int addr6_resolve(struct sockaddr *src_sock,
>         struct flowi6 fl6;
>         struct dst_entry *dst;
>
> +       if (!ipv6_mod_enabled())
> +               return -EADDRNOTAVAIL;
> +
>         memset(&fl6, 0, sizeof fl6);
>         fl6.daddr = dst_in->sin6_addr;
>         fl6.saddr = src_in->sin6_addr;
> --
> 2.27.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-31  3:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26  2:44 [PATCH 1/1] RDMA/addr: Disable ipv6 features when ipv6.disable set in cmdline Zhu Yanjun
2021-03-31  3:04 ` Zhu Yanjun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.