Make the message size limit used for SCTP_SENDALL configurable via

a sysctl variable instead of a compiled in constant.

This is based on a patch provided by nwhitehorn@.
This commit is contained in:
Michael Tuexen 2020-01-04 20:33:12 +00:00
parent cd0d51baaa
commit ae7cc6c9f8
5 changed files with 14 additions and 4 deletions

View File

@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd October 10, 2018
.Dd January 4, 2020
.Dt SCTP 4
.Os
.Sh NAME
@ -472,6 +472,8 @@ Enable SCTP blackholing.
See
.Xr blackhole 4
for more details.
.It Va sendall_limit
Maximum message size (in bytes) that can be transmitted with SCTP_SENDALL flags set.
.It Va buffer_splitting
Enable send/receive buffer splitting.
.It Va vtag_time_wait

View File

@ -491,7 +491,6 @@ struct sctp_error_auth_invalid_hmac {
* time */
#define SCTP_SAT_NETWORK_BURST_INCR 2 /* how many times to multiply maxburst
* in sat */
#define SCTP_MAX_SENDALL_LIMIT 1024
/* Data Chuck Specific Flags */
#define SCTP_DATA_FRAG_MASK 0x03

View File

@ -6885,8 +6885,8 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m,
/* There is another. */
return (EBUSY);
}
if (uio->uio_resid > SCTP_MAX_SENDALL_LIMIT) {
/* You must be less than the max! */
if (uio->uio_resid > SCTP_BASE_SYSCTL(sctp_sendall_limit)) {
/* You must not be larger than the limit! */
return (EMSGSIZE);
}
SCTP_MALLOC(ca, struct sctp_copy_all *, sizeof(struct sctp_copy_all),

View File

@ -119,6 +119,7 @@ sctp_init_sysctls()
SCTP_BASE_SYSCTL(sctp_steady_step) = SCTPCTL_RTTVAR_STEADYS_DEFAULT;
SCTP_BASE_SYSCTL(sctp_use_dccc_ecn) = SCTPCTL_RTTVAR_DCCCECN_DEFAULT;
SCTP_BASE_SYSCTL(sctp_blackhole) = SCTPCTL_BLACKHOLE_DEFAULT;
SCTP_BASE_SYSCTL(sctp_sendall_limit) = SCTPCTL_SENDALL_LIMIT_DEFAULT;
SCTP_BASE_SYSCTL(sctp_diag_info_code) = SCTPCTL_DIAG_INFO_CODE_DEFAULT;
#if defined(SCTP_LOCAL_TRACE_BUF)
memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
@ -943,6 +944,7 @@ SCTP_UINT_SYSCTL(rttvar_eqret, sctp_rttvar_eqret, SCTPCTL_RTTVAR_EQRET)
SCTP_UINT_SYSCTL(rttvar_steady_step, sctp_steady_step, SCTPCTL_RTTVAR_STEADYS)
SCTP_UINT_SYSCTL(use_dcccecn, sctp_use_dccc_ecn, SCTPCTL_RTTVAR_DCCCECN)
SCTP_UINT_SYSCTL(blackhole, sctp_blackhole, SCTPCTL_BLACKHOLE)
SCTP_UINT_SYSCTL(sendall_limit, sctp_sendall_limit, SCTPCTL_SENDALL_LIMIT)
SCTP_UINT_SYSCTL(diag_info_code, sctp_diag_info_code, SCTPCTL_DIAG_INFO_CODE)
#ifdef SCTP_DEBUG
SCTP_UINT_SYSCTL(debug, sctp_debug_on, SCTPCTL_DEBUG)

View File

@ -116,6 +116,7 @@ struct sctp_sysctl {
uint32_t sctp_buffer_splitting;
uint32_t sctp_initial_cwnd;
uint32_t sctp_blackhole;
uint32_t sctp_sendall_limit;
#if defined(SCTP_DEBUG)
uint32_t sctp_debug_on;
#endif
@ -538,6 +539,12 @@ struct sctp_sysctl {
#define SCTPCTL_BLACKHOLE_MAX 2
#define SCTPCTL_BLACKHOLE_DEFAULT SCTPCTL_BLACKHOLE_MIN
/* sendall_limit: Maximum message with SCTP_SENDALL */
#define SCTPCTL_SENDALL_LIMIT_DESC "Maximum size of a message send with SCTP_SENDALL"
#define SCTPCTL_SENDALL_LIMIT_MIN 0
#define SCTPCTL_SENDALL_LIMIT_MAX 0xFFFFFFFF
#define SCTPCTL_SENDALL_LIMIT_DEFAULT 1432
#define SCTPCTL_DIAG_INFO_CODE_DESC "Diagnostic information error cause code"
#define SCTPCTL_DIAG_INFO_CODE_MIN 0
#define SCTPCTL_DIAG_INFO_CODE_MAX 65535