Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Nov 2017 14:43:35 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325806 - head/sys/ofed/drivers/infiniband/core
Message-ID:  <201711141443.vAEEhZTo085799@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue Nov 14 14:43:35 2017
New Revision: 325806
URL: https://svnweb.freebsd.org/changeset/base/325806

Log:
  Make sure a valid VNET is set before trying to access the V_ip6_v6only
  variable. Access the variable directly instead of going through the sysctl()
  interface in the kernel.
  
  Sponsored by:	Mellanox Technologies
  MFC after:	1 week

Modified:
  head/sys/ofed/drivers/infiniband/core/cma.c

Modified: head/sys/ofed/drivers/infiniband/core/cma.c
==============================================================================
--- head/sys/ofed/drivers/infiniband/core/cma.c	Tue Nov 14 14:39:37 2017	(r325805)
+++ head/sys/ofed/drivers/infiniband/core/cma.c	Tue Nov 14 14:43:35 2017	(r325806)
@@ -2752,10 +2752,6 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct socka
 {
 	struct rdma_id_private *id_priv;
 	int ret;
-#if defined(INET6)
-	int ipv6only;
-	size_t var_size = sizeof(int);
-#endif
 
 	if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6)
 		return -EAFNOSUPPORT;
@@ -2783,9 +2779,11 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct socka
 		if (addr->sa_family == AF_INET)
 			id_priv->afonly = 1;
 #if defined(INET6)
-		else if (addr->sa_family == AF_INET6)
-			id_priv->afonly = kernel_sysctlbyname(&thread0, "net.inet6.ip6.v6only",
-			                    &ipv6only, &var_size, NULL, 0, NULL, 0);
+		else if (addr->sa_family == AF_INET6) {
+			CURVNET_SET_QUIET(&init_net);
+			id_priv->afonly = V_ip6_v6only;
+			CURVNET_RESTORE();
+		}
 #endif
 	}
 	ret = cma_get_port(id_priv);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711141443.vAEEhZTo085799>