Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102653498
D38472.id116898.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.id116898.diff
View Options
Index: sys/kern/uipc_sockbuf.c
===================================================================
--- sys/kern/uipc_sockbuf.c
+++ 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)
Index: sys/kern/uipc_socket.c
===================================================================
--- sys/kern/uipc_socket.c
+++ 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).
*
Index: sys/sys/sockopt.h
===================================================================
--- sys/sys/sockopt.h
+++ 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, 9:39 AM (21 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14656672
Default Alt Text
D38472.id116898.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