sctp: allow disabling of SCTP_ACCEPT_ZERO_CHECKSUM socket option

This commit is contained in:
Michael Tuexen 2023-03-15 22:55:23 +01:00 committed by Oscar Zhao
parent 88b7680550
commit 1d3fe4d43e

View File

@ -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;