Increase max allowed backlog for listen sockets
from short to int. PR: 203922 Submitted by: White Knight <white_knight@2ch.net> MFC After: 4 weeks
This commit is contained in:
parent
92deafc3a3
commit
7325dfbb59
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=295136
@ -461,9 +461,9 @@ db_print_socket(struct socket *so, const char *socketname, int indent)
|
||||
|
||||
db_print_indent(indent);
|
||||
/* so_list skipped */
|
||||
db_printf("so_qlen: %d ", so->so_qlen);
|
||||
db_printf("so_incqlen: %d ", so->so_incqlen);
|
||||
db_printf("so_qlimit: %d ", so->so_qlimit);
|
||||
db_printf("so_qlen: %u ", so->so_qlen);
|
||||
db_printf("so_incqlen: %u ", so->so_incqlen);
|
||||
db_printf("so_qlimit: %u ", so->so_qlimit);
|
||||
db_printf("so_timeo: %d ", so->so_timeo);
|
||||
db_printf("so_error: %d\n", so->so_error);
|
||||
|
||||
|
@ -196,7 +196,7 @@ VNET_DEFINE(struct hhook_head *, socket_hhh[HHOOK_SOCKET_LAST + 1]);
|
||||
* NB: The orginal sysctl somaxconn is still available but hidden
|
||||
* to prevent confusion about the actual purpose of this number.
|
||||
*/
|
||||
static int somaxconn = SOMAXCONN;
|
||||
static u_int somaxconn = SOMAXCONN;
|
||||
|
||||
static int
|
||||
sysctl_somaxconn(SYSCTL_HANDLER_ARGS)
|
||||
@ -209,7 +209,13 @@ sysctl_somaxconn(SYSCTL_HANDLER_ARGS)
|
||||
if (error || !req->newptr )
|
||||
return (error);
|
||||
|
||||
if (val < 1 || val > USHRT_MAX)
|
||||
/*
|
||||
* The purpose of the UINT_MAX / 3 limit, is so that the formula
|
||||
* 3 * so_qlimit / 2
|
||||
* below, will not overflow.
|
||||
*/
|
||||
|
||||
if (val < 1 || val > UINT_MAX / 3)
|
||||
return (EINVAL);
|
||||
|
||||
somaxconn = val;
|
||||
|
@ -426,7 +426,11 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS)
|
||||
xinpcb.maxqlen = 0;
|
||||
} else {
|
||||
xinpcb.qlen = so->so_qlen;
|
||||
xinpcb.qlen_old = so->so_qlen > USHRT_MAX ?
|
||||
USHRT_MAX : (uint16_t) so->so_qlen;
|
||||
xinpcb.maxqlen = so->so_qlimit;
|
||||
xinpcb.maxqlen_old = so->so_qlimit > USHRT_MAX ?
|
||||
USHRT_MAX : (uint16_t) so->so_qlimit;
|
||||
}
|
||||
SCTP_INP_INCR_REF(inp);
|
||||
SCTP_INP_RUNLOCK(inp);
|
||||
|
@ -1170,13 +1170,15 @@ struct xsctp_inpcb {
|
||||
uint32_t total_nospaces;
|
||||
uint32_t fragmentation_point;
|
||||
uint16_t local_port;
|
||||
uint16_t qlen;
|
||||
uint16_t maxqlen;
|
||||
uint16_t qlen_old;
|
||||
uint16_t maxqlen_old;
|
||||
void *socket;
|
||||
uint32_t qlen;
|
||||
uint32_t maxqlen;
|
||||
#if defined(__LP64__)
|
||||
uint32_t extra_padding[29]; /* future */
|
||||
uint32_t extra_padding[27]; /* future */
|
||||
#else
|
||||
uint32_t extra_padding[30]; /* future */
|
||||
uint32_t extra_padding[28]; /* future */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -95,10 +95,10 @@ struct socket {
|
||||
TAILQ_HEAD(, socket) so_incomp; /* (e) queue of partial unaccepted connections */
|
||||
TAILQ_HEAD(, socket) so_comp; /* (e) queue of complete unaccepted connections */
|
||||
TAILQ_ENTRY(socket) so_list; /* (e) list of unaccepted connections */
|
||||
u_short so_qlen; /* (e) number of unaccepted connections */
|
||||
u_short so_incqlen; /* (e) number of unaccepted incomplete
|
||||
u_int so_qlen; /* (e) number of unaccepted connections */
|
||||
u_int so_incqlen; /* (e) number of unaccepted incomplete
|
||||
connections */
|
||||
u_short so_qlimit; /* (e) max number queued connections */
|
||||
u_int so_qlimit; /* (e) max number queued connections */
|
||||
short so_timeo; /* (g) connection timeout */
|
||||
u_short so_error; /* (f) error affecting connection */
|
||||
struct sigio *so_sigio; /* [sg] information for async I/O or
|
||||
@ -172,9 +172,9 @@ struct xsocket {
|
||||
caddr_t so_pcb; /* another convenient handle */
|
||||
int xso_protocol;
|
||||
int xso_family;
|
||||
u_short so_qlen;
|
||||
u_short so_incqlen;
|
||||
u_short so_qlimit;
|
||||
u_int so_qlen;
|
||||
u_int so_incqlen;
|
||||
u_int so_qlimit;
|
||||
short so_timeo;
|
||||
u_short so_error;
|
||||
pid_t so_pgid;
|
||||
|
@ -486,11 +486,11 @@ protopr(u_long off, const char *name, int af1, int proto)
|
||||
else
|
||||
xo_emit("{:protocol/%-3.3s%-2.2s/%s%s} ", name, vchar);
|
||||
if (Lflag) {
|
||||
char buf1[15];
|
||||
char buf1[33];
|
||||
|
||||
snprintf(buf1, 15, "%d/%d/%d", so->so_qlen,
|
||||
snprintf(buf1, sizeof buf1, "%u/%u/%u", so->so_qlen,
|
||||
so->so_incqlen, so->so_qlimit);
|
||||
xo_emit("{:listen-queue-sizes/%-14.14s} ", buf1);
|
||||
xo_emit("{:listen-queue-sizes/%-32.32s} ", buf1);
|
||||
} else if (Tflag) {
|
||||
if (istcp)
|
||||
xo_emit("{:sent-retransmit-packets/%6u} "
|
||||
|
@ -467,9 +467,10 @@ sctp_process_inpcb(struct xsctp_inpcb *xinpcb,
|
||||
tname = "????";
|
||||
|
||||
if (Lflag) {
|
||||
char buf1[9];
|
||||
char buf1[22];
|
||||
|
||||
snprintf(buf1, 9, "%hu/%hu", xinpcb->qlen, xinpcb->maxqlen);
|
||||
snprintf(buf1, sizeof buf1, "%u/%u",
|
||||
xinpcb->qlen, xinpcb->maxqlen);
|
||||
xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ",
|
||||
pname, tname);
|
||||
xo_emit("{d:queues/%-8.8s}{e:queue-len/%hu}"
|
||||
|
@ -271,7 +271,7 @@ unixdomainpr(struct xunpcb *xunp, struct xsocket *so)
|
||||
struct unpcb *unp;
|
||||
struct sockaddr_un *sa;
|
||||
static int first = 1;
|
||||
char buf1[15];
|
||||
char buf1[33];
|
||||
static const char *titles[2] = {
|
||||
"{T:/%-8.8s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%8.8s} "
|
||||
"{T:/%8.8s} {T:/%8.8s} {T:/%8.8s} {T:Addr}\n",
|
||||
@ -310,10 +310,10 @@ unixdomainpr(struct xunpcb *xunp, struct xsocket *so)
|
||||
return;
|
||||
|
||||
if (Lflag) {
|
||||
snprintf(buf1, 15, "%d/%d/%d", so->so_qlen,
|
||||
snprintf(buf1, sizeof buf1, "%u/%u/%u", so->so_qlen,
|
||||
so->so_incqlen, so->so_qlimit);
|
||||
xo_emit("unix {d:socket/%-14.14s}{e:queue-length/%d}"
|
||||
"{e:incomplete-queue-length/%d}{e:queue-limit/%d}",
|
||||
xo_emit("unix {d:socket/%-32.32s}{e:queue-length/%u}"
|
||||
"{e:incomplete-queue-length/%u}{e:queue-limit/%u}",
|
||||
buf1, so->so_qlen, so->so_incqlen, so->so_qlimit);
|
||||
} else {
|
||||
xo_emit(format[fmt],
|
||||
|
Loading…
Reference in New Issue
Block a user