From owner-svn-src-head@freebsd.org Tue Nov 14 14:43:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9DF1DC0CAC; Tue, 14 Nov 2017 14:43:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B687E1629; Tue, 14 Nov 2017 14:43:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAEEhZGB085800; Tue, 14 Nov 2017 14:43:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAEEhZTo085799; Tue, 14 Nov 2017 14:43:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711141443.vAEEhZTo085799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 14 Nov 2017 14:43:35 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 325806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 14:43:37 -0000 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);