From owner-svn-src-all@freebsd.org Mon May 21 08:34:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEE56EE8382; Mon, 21 May 2018 08:34:11 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60D2773C16; Mon, 21 May 2018 08:34:11 +0000 (UTC) (envelope-from mmacy@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41DF2228FC; Mon, 21 May 2018 08:34:11 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4L8YBqL022950; Mon, 21 May 2018 08:34:11 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4L8YAcD022948; Mon, 21 May 2018 08:34:10 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805210834.w4L8YAcD022948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Mon, 21 May 2018 08:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333968 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 333968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 08:34:12 -0000 Author: mmacy Date: Mon May 21 08:34:10 2018 New Revision: 333968 URL: https://svnweb.freebsd.org/changeset/base/333968 Log: in(6)_mcast: Expand out vnet set / restore macro so that they work in a conditional block Reported by: zec at fer.hr Modified: head/sys/netinet/in_mcast.c head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Mon May 21 07:12:06 2018 (r333967) +++ head/sys/netinet/in_mcast.c Mon May 21 08:34:10 2018 (r333968) @@ -653,6 +653,7 @@ inm_release(struct in_multi *inm) { struct ifmultiaddr *ifma; struct ifnet *ifp; + struct vnet *saved_vnet; CTR2(KTR_IGMPV3, "%s: refcount is %d", __func__, inm->inm_refcount); MPASS(inm->inm_refcount == 0); @@ -663,14 +664,16 @@ inm_release(struct in_multi *inm) /* XXX this access is not covered by IF_ADDR_LOCK */ CTR2(KTR_IGMPV3, "%s: purging ifma %p", __func__, ifma); - if (ifp) - CURVNET_SET(ifp->if_vnet); + if (ifp) { + saved_vnet = curvnet; + curvnet = ifp->if_vnet; + } inm_purge(inm); free(inm, M_IPMADDR); if_delmulti_ifma_flags(ifma, 1); if (ifp) { - CURVNET_RESTORE(); + curvnet = saved_vnet; if_rele(ifp); } } @@ -1666,6 +1669,7 @@ inp_gcmoptions(epoch_context_t ctx) struct in_mfilter *imf; struct in_multi *inm; struct ifnet *ifp; + struct vnet *saved_vnet; size_t idx, nmships; imo = __containerof(ctx, struct ip_moptions, imo_epoch_ctx); @@ -1677,11 +1681,13 @@ inp_gcmoptions(epoch_context_t ctx) imf_leave(imf); inm = imo->imo_membership[idx]; ifp = inm->inm_ifp; - if (ifp) - CURVNET_SET(ifp->if_vnet); + if (ifp) { + saved_vnet = curvnet; + curvnet = ifp->if_vnet; + } (void)in_leavegroup(inm, imf); if (ifp) - CURVNET_RESTORE(); + curvnet = saved_vnet; if (imf) imf_purge(imf); } Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Mon May 21 07:12:06 2018 (r333967) +++ head/sys/netinet6/in6_mcast.c Mon May 21 08:34:10 2018 (r333968) @@ -524,6 +524,7 @@ in6m_release(struct in6_multi *inm) { struct ifmultiaddr *ifma; struct ifnet *ifp; + struct vnet *saved_vnet; CTR2(KTR_MLD, "%s: refcount is %d", __func__, inm->in6m_refcount); @@ -539,14 +540,16 @@ in6m_release(struct in6_multi *inm) KASSERT(ifma->ifma_protospec == NULL, ("%s: ifma_protospec != NULL", __func__)); - if (ifp) - CURVNET_SET(ifp->if_vnet); + if (ifp) { + saved_vnet = curvnet; + curvnet = ifp->if_vnet; + } in6m_purge(inm); free(inm, M_IP6MADDR); if_delmulti_ifma_flags(ifma, 1); if (ifp) { - CURVNET_RESTORE(); + curvnet = saved_vnet; if_rele(ifp); } } @@ -1628,6 +1631,7 @@ inp_gcmoptions(epoch_context_t ctx) struct in6_mfilter *imf; struct in6_multi *inm; struct ifnet *ifp; + struct vnet *saved_vnet; size_t idx, nmships; imo = __containerof(ctx, struct ip6_moptions, imo6_epoch_ctx); @@ -1639,11 +1643,13 @@ inp_gcmoptions(epoch_context_t ctx) im6f_leave(imf); inm = imo->im6o_membership[idx]; ifp = inm->in6m_ifp; - if (ifp) - CURVNET_SET(ifp->if_vnet); + if (ifp) { + saved_vnet = curvnet; + curvnet = ifp->if_vnet; + } (void)in6_leavegroup(inm, imf); if (ifp) - CURVNET_RESTORE(); + curvnet = saved_vnet; if (imf) im6f_purge(imf); }