Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102646724
D38472.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D38472.diff
View Options
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -693,7 +693,8 @@
if (*lowat > *hiwat)
*lowat = *hiwat;
} else {
- if (!sbreserve_locked(sb, cc, so, curthread))
+ u_long limit = sogetmaxbuf(so);
+ if (!sbreserve_locked_limit(sb, cc, so, limit, curthread))
error = ENOBUFS;
}
if (error == 0)
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -128,6 +128,7 @@
#include <sys/event.h>
#include <sys/eventhandler.h>
#include <sys/poll.h>
+#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/sbuf.h>
@@ -2975,6 +2976,15 @@
return (0);
}
+u_long
+sogetmaxbuf(struct socket *so)
+{
+ if (so->so_proto->pr_domain->dom_family != PF_NETLINK)
+ return (sb_max);
+ u_long nl_maxsockbuf = 512 * 1024 * 1024; /* 512M, XXX: init based on physmem */
+ return ((priv_check(curthread, PRIV_NET_ROUTE) == 0) ? nl_maxsockbuf : sb_max);
+}
+
/*
* Kernel version of setsockopt(2).
*
diff --git a/sys/sys/sockopt.h b/sys/sys/sockopt.h
--- a/sys/sys/sockopt.h
+++ b/sys/sys/sockopt.h
@@ -68,5 +68,6 @@
int accept_filt_setopt(struct socket *, struct sockopt *);
int so_setsockopt(struct socket *so, int level, int optname,
void *optval, size_t optlen);
+u_long sogetmaxbuf(struct socket *so);
#endif /* _SYS_SOCKOPT_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 7:24 AM (22 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14655156
Default Alt Text
D38472.diff (1 KB)
Attached To
Mode
D38472: netlink: allow to override sb_max for netlink sockets
Attached
Detach File
Event Timeline
Log In to Comment