mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-18 02:19:39 +00:00
netlink: make the maximum allowed netlink socket buffer runtime tunable.
Dumping large routng tables (>1M paths with multipath) require the socket buffer which is larger than the currently defined limit. Allow the limit to be set in runtime, similar to kern.ipc.maxsockbuf. Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl> MFC after: 1 day
This commit is contained in:
parent
a4b92fefd2
commit
28a5d88f70
@ -280,6 +280,12 @@ Default receive buffer for the netlink socket.
|
||||
Note that the socket recvspace has to be least as long as the longest
|
||||
message that can be received from this socket.
|
||||
.El
|
||||
.Bl -tag -width indent
|
||||
.It Va net.netlink.nl_maxsockbuf
|
||||
Maximum receive buffer for the netlink socket that can be set via
|
||||
.Dv SO_RCVBUF
|
||||
socket option.
|
||||
.El
|
||||
.Sh DEBUGGING
|
||||
Netlink implements per-functional-unit debugging, with different severities
|
||||
controllable via the
|
||||
|
@ -77,6 +77,11 @@ SYSCTL_ULONG(_net_netlink, OID_AUTO, recvspace, CTLFLAG_RW, &nl_recvspace, 0,
|
||||
|
||||
extern u_long sb_max_adj;
|
||||
static u_long nl_maxsockbuf = 512 * 1024 * 1024; /* 512M, XXX: init based on physmem */
|
||||
static int sysctl_handle_nl_maxsockbuf(SYSCTL_HANDLER_ARGS);
|
||||
SYSCTL_OID(_net_netlink, OID_AUTO, nl_maxsockbuf,
|
||||
CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, &nl_maxsockbuf, 0,
|
||||
sysctl_handle_nl_maxsockbuf, "LU",
|
||||
"Maximum Netlink socket buffer size");
|
||||
|
||||
uint32_t
|
||||
nlp_get_pid(const struct nlpcb *nlp)
|
||||
@ -675,6 +680,22 @@ nl_ctloutput(struct socket *so, struct sockopt *sopt)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_handle_nl_maxsockbuf(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
int error = 0;
|
||||
u_long tmp_maxsockbuf = nl_maxsockbuf;
|
||||
|
||||
error = sysctl_handle_long(oidp, &tmp_maxsockbuf, arg2, req);
|
||||
if (error || !req->newptr)
|
||||
return (error);
|
||||
if (tmp_maxsockbuf < MSIZE + MCLBYTES)
|
||||
return (EINVAL);
|
||||
nl_maxsockbuf = tmp_maxsockbuf;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
nl_setsbopt(struct socket *so, struct sockopt *sopt)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user