Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Feb 2022 23:58:33 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: fe06ce52323f - stable/13 - sctp: minor improvements in sctp_get_frag_point
Message-ID:  <202202222358.21MNwXih051965@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=fe06ce52323f4ff6ae032a1d4d2c342504b02648

commit fe06ce52323f4ff6ae032a1d4d2c342504b02648
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-12-28 09:23:31 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-02-22 23:57:06 +0000

    sctp: minor improvements in sctp_get_frag_point
    
    (cherry picked from commit a7ba00a438a64b34219f2990b3f7348126f7b4ab)
---
 sys/netinet/sctp_output.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index 8b4a891c23aa..27c384ca5b5a 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -6237,13 +6237,15 @@ sctp_get_frag_point(struct sctp_tcb *stcb)
 			overhead += sctp_get_auth_chunk_len(asoc->peer_hmac_id);
 		}
 	} else {
-		overhead += sizeof(struct sctp_idata_chunk);
+		overhead += sizeof(struct sctp_data_chunk);
 		if (sctp_auth_is_required_chunk(SCTP_DATA, asoc->peer_auth_chunks)) {
 			overhead += sctp_get_auth_chunk_len(asoc->peer_hmac_id);
 		}
 	}
+	KASSERT(overhead % 4 == 0,
+	    ("overhead (%u) not a multiple of 4", overhead));
 	/* Consider padding. */
-	if (asoc->smallest_mtu % 4) {
+	if (asoc->smallest_mtu % 4 > 0) {
 		overhead += (asoc->smallest_mtu % 4);
 	}
 	KASSERT(asoc->smallest_mtu > overhead,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202222358.21MNwXih051965>