git: cee09bda03c8 - main - sctp: allow disabling of SCTP_ACCEPT_ZERO_CHECKSUM socket option
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Mar 2023 21:57:34 UTC
The branch main has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=cee09bda03c8be540f1c02d933db714ee2bd6ec7
commit cee09bda03c8be540f1c02d933db714ee2bd6ec7
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2023-03-15 21:55:23 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2023-03-15 21:55:23 +0000
sctp: allow disabling of SCTP_ACCEPT_ZERO_CHECKSUM socket option
---
sys/netinet/sctp_usrreq.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index 57d5abdebd30..65edfb49a955 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -6840,18 +6840,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
SCTP_CHECK_AND_CAST(value, optval, uint32_t, optsize);
SCTP_INP_WLOCK(inp);
- if (*value == 0) {
- /*
- * Do not allow turning zero checksum
- * acceptance off again, since this could
- * result in inconsistent behaviour for
- * listeners.
- */
- if (inp->zero_checksum > 0) {
- error = EINVAL;
- }
- } else {
+ if (*value != 0) {
inp->zero_checksum = 1;
+ } else {
+ inp->zero_checksum = 0;
}
SCTP_INP_WUNLOCK(inp);
break;