From owner-svn-src-all@freebsd.org Tue Dec 3 08:47:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0C1C1CDC0F; Tue, 3 Dec 2019 08:47:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RwZr3mMJz45ZL; Tue, 3 Dec 2019 08:47:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 656A9D38E; Tue, 3 Dec 2019 08:47:00 +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 xB38l0Dl002923; Tue, 3 Dec 2019 08:47:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB38kxEH002918; Tue, 3 Dec 2019 08:47:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912030847.xB38kxEH002918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Dec 2019 08:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355322 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 355322 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.29 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: Tue, 03 Dec 2019 08:47:00 -0000 Author: hselasky Date: Tue Dec 3 08:46:59 2019 New Revision: 355322 URL: https://svnweb.freebsd.org/changeset/base/355322 Log: Use refcount from "in_joingroup_locked()" when joining multicast groups. Do not acquire additional references. This makes the IPv4 IGMP code in line with the IPv6 MLD code. Background: The IPv4 multicast code puts an extra reference on the in_multi struct when joining groups. This becomes visible when using daemons like igmpproxy from ports, that multicast entries do not disappear from the output of ifmcstat(8) when multicast streams are disconnected. This fixes a regression issue after r349762. While at it factor the ip_mfilter_insert() and ip6_mfilter_insert() calls to avoid repeated "is_new" check. Differential Revision: https://reviews.freebsd.org/D22595 Tested by: Guido van Rooij Reviewed by: rgrimes (network) MFC after: 1 week Sponsored by: Mellanox Technologies 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 Tue Dec 3 07:22:16 2019 (r355321) +++ head/sys/netinet/in_mcast.c Tue Dec 3 08:46:59 2019 (r355322) @@ -2211,7 +2211,11 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt __func__); goto out_inp_locked; } - inm_acquire(imf->imf_inm); + /* + * NOTE: Refcount from in_joingroup_locked() + * is protecting membership. + */ + ip_mfilter_insert(&imo->imo_head, imf); } else { CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); IN_MULTI_LIST_LOCK(); @@ -2235,8 +2239,6 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt goto out_inp_locked; } } - if (is_new) - ip_mfilter_insert(&imo->imo_head, imf); imf_commit(imf); imf = NULL; Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Tue Dec 3 07:22:16 2019 (r355321) +++ head/sys/netinet6/in6_mcast.c Tue Dec 3 08:46:59 2019 (r355322) @@ -2111,6 +2111,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sop * NOTE: Refcount from in6_joingroup_locked() * is protecting membership. */ + ip6_mfilter_insert(&imo->im6o_head, imf); } else { CTR1(KTR_MLD, "%s: merge inm state", __func__); IN6_MULTI_LIST_LOCK(); @@ -2135,9 +2136,6 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sop goto out_in6p_locked; } } - - if (is_new) - ip6_mfilter_insert(&imo->im6o_head, imf); im6f_commit(imf); imf = NULL;