Author: tuexen
Date: Wed Jul  1 21:54:39 2020
New Revision: 362873
URL: https://svnweb.freebsd.org/changeset/base/362873

Log:
  MFC r356357:
  
  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.

Modified:
  stable/12/share/man/man4/sctp.4
  stable/12/sys/netinet/sctp.h
  stable/12/sys/netinet/sctp_output.c
  stable/12/sys/netinet/sctp_sysctl.c
  stable/12/sys/netinet/sctp_sysctl.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/sctp.4
==============================================================================
--- stable/12/share/man/man4/sctp.4     Wed Jul  1 21:52:14 2020        
(r362872)
+++ stable/12/share/man/man4/sctp.4     Wed Jul  1 21:54:39 2020        
(r362873)
@@ -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

Modified: stable/12/sys/netinet/sctp.h
==============================================================================
--- stable/12/sys/netinet/sctp.h        Wed Jul  1 21:52:14 2020        
(r362872)
+++ stable/12/sys/netinet/sctp.h        Wed Jul  1 21:54:39 2020        
(r362873)
@@ -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

Modified: stable/12/sys/netinet/sctp_output.c
==============================================================================
--- stable/12/sys/netinet/sctp_output.c Wed Jul  1 21:52:14 2020        
(r362872)
+++ stable/12/sys/netinet/sctp_output.c Wed Jul  1 21:54:39 2020        
(r362873)
@@ -6885,8 +6885,8 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, 
                /* 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),

Modified: stable/12/sys/netinet/sctp_sysctl.c
==============================================================================
--- stable/12/sys/netinet/sctp_sysctl.c Wed Jul  1 21:52:14 2020        
(r362872)
+++ stable/12/sys/netinet/sctp_sysctl.c Wed Jul  1 21:54:39 2020        
(r362873)
@@ -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, SCTP
 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)

Modified: stable/12/sys/netinet/sctp_sysctl.h
==============================================================================
--- stable/12/sys/netinet/sctp_sysctl.h Wed Jul  1 21:52:14 2020        
(r362872)
+++ stable/12/sys/netinet/sctp_sysctl.h Wed Jul  1 21:54:39 2020        
(r362873)
@@ -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
@@ -537,6 +538,12 @@ struct sctp_sysctl {
 #define SCTPCTL_BLACKHOLE_MIN          0
 #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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to