From owner-svn-src-stable-12@freebsd.org Wed Dec 25 09:25:21 2019 Return-Path: Delivered-To: svn-src-stable-12@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 E6E9E1D77F7; Wed, 25 Dec 2019 09:25:21 +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 47jSNx5cFqz3DG3; Wed, 25 Dec 2019 09:25:21 +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 9CE0CE60A; Wed, 25 Dec 2019 09:25:21 +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 xBP9PLtp039428; Wed, 25 Dec 2019 09:25:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBP9PLD5039426; Wed, 25 Dec 2019 09:25:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912250925.xBP9PLD5039426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 25 Dec 2019 09:25:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r356069 - in stable/12/sys: netinet netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: netinet netinet6 X-SVN-Commit-Revision: 356069 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 09:25:22 -0000 Author: hselasky Date: Wed Dec 25 09:25:20 2019 New Revision: 356069 URL: https://svnweb.freebsd.org/changeset/base/356069 Log: MFC r355881: Leave multicast group before reaping and committing state for both IPv4 and IPv6. This fixes a regression issue after r349369. When trying to exit a multicast group before closing the socket, a multicast leave packet should be sent. Differential Revision: https://reviews.freebsd.org/D22848 PR: 242677 Reviewed by: bz (network) Tested by: Aleksandr Fedorov Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet/in_mcast.c stable/12/sys/netinet6/in6_mcast.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/in_mcast.c ============================================================================== --- stable/12/sys/netinet/in_mcast.c Wed Dec 25 05:51:47 2019 (r356068) +++ stable/12/sys/netinet/in_mcast.c Wed Dec 25 09:25:20 2019 (r356069) @@ -2401,6 +2401,12 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop if (is_final) { ip_mfilter_remove(&imo->imo_head, imf); imf_leave(imf); + + /* + * Give up the multicast address record to which + * the membership points. + */ + (void) in_leavegroup_locked(imf->imf_inm, imf); } else { if (imf->imf_st[0] == MCAST_EXCLUDE) { error = EADDRNOTAVAIL; @@ -2455,14 +2461,8 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop out_inp_locked: INP_WUNLOCK(inp); - if (is_final && imf) { - /* - * Give up the multicast address record to which - * the membership points. - */ - (void) in_leavegroup_locked(imf->imf_inm, imf); + if (is_final && imf) ip_mfilter_free(imf); - } IN_MULTI_UNLOCK(); return (error); Modified: stable/12/sys/netinet6/in6_mcast.c ============================================================================== --- stable/12/sys/netinet6/in6_mcast.c Wed Dec 25 05:51:47 2019 (r356068) +++ stable/12/sys/netinet6/in6_mcast.c Wed Dec 25 09:25:20 2019 (r356069) @@ -2326,6 +2326,12 @@ in6p_leave_group(struct inpcb *inp, struct sockopt *so if (is_final) { ip6_mfilter_remove(&imo->im6o_head, imf); im6f_leave(imf); + + /* + * Give up the multicast address record to which + * the membership points. + */ + (void)in6_leavegroup_locked(inm, imf); } else { if (imf->im6f_st[0] == MCAST_EXCLUDE) { error = EADDRNOTAVAIL; @@ -2382,14 +2388,8 @@ in6p_leave_group(struct inpcb *inp, struct sockopt *so out_in6p_locked: INP_WUNLOCK(inp); - if (is_final && imf) { - /* - * Give up the multicast address record to which - * the membership points. - */ - (void)in6_leavegroup_locked(inm, imf); + if (is_final && imf) ip6_mfilter_free(imf); - } IN6_MULTI_UNLOCK(); return (error);