From owner-svn-src-all@freebsd.org Mon Nov 30 09:07:22 2020 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 B7770474603; Mon, 30 Nov 2020 09:07:22 +0000 (UTC) (envelope-from tuexen@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4Ckzrp4bK6z4mHH; Mon, 30 Nov 2020 09:07:22 +0000 (UTC) (envelope-from tuexen@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 8C09420DA3; Mon, 30 Nov 2020 09:07:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU97Mpn083789; Mon, 30 Nov 2020 09:07:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU97M3O083788; Mon, 30 Nov 2020 09:07:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011300907.0AU97M3O083788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 30 Nov 2020 09:07:22 +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: r368170 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 368170 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.34 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, 30 Nov 2020 09:07:22 -0000 Author: tuexen Date: Mon Nov 30 09:07:21 2020 New Revision: 368170 URL: https://svnweb.freebsd.org/changeset/base/368170 Log: MFC r366425: Cleanup, no functional change intended. Modified: stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Mon Nov 30 08:31:41 2020 (r368169) +++ stable/12/sys/netinet/sctp_indata.c Mon Nov 30 09:07:21 2020 (r368170) @@ -289,17 +289,15 @@ sctp_build_ctl_nchunk(struct sctp_inpcb *inp, struct s static void sctp_mark_non_revokable(struct sctp_association *asoc, uint32_t tsn) { - uint32_t gap, i, cumackp1; - int fnd = 0; - int in_r = 0, in_nr = 0; + uint32_t gap, i; + int in_r, in_nr; if (SCTP_BASE_SYSCTL(sctp_do_drain) == 0) { return; } - cumackp1 = asoc->cumulative_tsn + 1; - if (SCTP_TSN_GT(cumackp1, tsn)) { + if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) { /* - * this tsn is behind the cum ack and thus we don't need to + * This tsn is behind the cum ack and thus we don't need to * worry about it being moved from one to the other. */ return; @@ -307,33 +305,27 @@ sctp_mark_non_revokable(struct sctp_association *asoc, SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn); in_r = SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap); in_nr = SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, gap); - if ((in_r == 0) && (in_nr == 0)) { -#ifdef INVARIANTS - panic("Things are really messed up now"); -#else - SCTP_PRINTF("gap:%x tsn:%x\n", gap, tsn); - sctp_print_mapping_array(asoc); -#endif - } - if (in_nr == 0) + KASSERT(in_r || in_nr, ("%s: Things are really messed up now", __FUNCTION__)); + if (!in_nr) { SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap); - if (in_r) - SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); - if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { - asoc->highest_tsn_inside_nr_map = tsn; + if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { + asoc->highest_tsn_inside_nr_map = tsn; + } } - if (tsn == asoc->highest_tsn_inside_map) { - /* We must back down to see what the new highest is */ - for (i = tsn - 1; SCTP_TSN_GE(i, asoc->mapping_array_base_tsn); i--) { - SCTP_CALC_TSN_TO_GAP(gap, i, asoc->mapping_array_base_tsn); - if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) { - asoc->highest_tsn_inside_map = i; - fnd = 1; - break; + if (in_r) { + SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); + if (tsn == asoc->highest_tsn_inside_map) { + /* We must back down to see what the new highest is. */ + for (i = tsn - 1; SCTP_TSN_GE(i, asoc->mapping_array_base_tsn); i--) { + SCTP_CALC_TSN_TO_GAP(gap, i, asoc->mapping_array_base_tsn); + if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) { + asoc->highest_tsn_inside_map = i; + break; + } } - } - if (!fnd) { - asoc->highest_tsn_inside_map = asoc->mapping_array_base_tsn - 1; + if (!SCTP_TSN_GE(i, asoc->mapping_array_base_tsn)) { + asoc->highest_tsn_inside_map = asoc->mapping_array_base_tsn - 1; + } } } }