Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Dec 2021 09:24:37 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a7ba00a438a6 - main - sctp: minor improvements in sctp_get_frag_point MFC after:	3 days
Message-ID:  <202112280924.1BS9Obi7075043@gitrepo.freebsd.org>

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

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

commit a7ba00a438a64b34219f2990b3f7348126f7b4ab
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-12-28 09:23:31 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2021-12-28 09:23:31 +0000

    sctp: minor improvements in sctp_get_frag_point
    MFC after:      3 days
---
 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 e77517de2973..17a4df2243e2 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?202112280924.1BS9Obi7075043>