summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2006-06-10 17:05:18 +0000
committerBob Beck <beck@cvs.openbsd.org>2006-06-10 17:05:18 +0000
commit04a801d64eb55374ecdcd59b1dd374075a299d5a (patch)
tree45e52db072f33ab343d9520b7f08fa6722203833
parent76a53b6496cc9ff271f6b456ab3234b13e8a8dc6 (diff)
allow SO_SNDBUF and SO_RECVBUF setsockopts on existing sockets to succeed
for any value that is not an increase in size when we are under mbuf pressure, rather than only succeeding when setting the value to the 4k minimum. ok markus@, henning@
-rw-r--r--sys/kern/uipc_socket.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 64848625731..4c63f749fba 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.63 2006/03/04 22:40:15 brad Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.64 2006/06/10 17:05:17 beck Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -1016,8 +1016,6 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m0)
case SO_RCVLOWAT:
{
u_long cnt;
- extern u_long unpst_recvspace;
- extern u_long unpst_sendspace;
if (m == NULL || m->m_len < sizeof (int)) {
error = EINVAL;
@@ -1029,7 +1027,7 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m0)
switch (optname) {
case SO_SNDBUF:
- if (sbcheckreserve(cnt, unpst_sendspace) ||
+ if (sbcheckreserve(cnt, so->so_snd.sb_hiwat) ||
sbreserve(&so->so_snd, cnt) == 0) {
error = ENOBUFS;
goto bad;
@@ -1037,7 +1035,7 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m0)
break;
case SO_RCVBUF:
- if (sbcheckreserve(cnt, unpst_recvspace) ||
+ if (sbcheckreserve(cnt, so->so_rcv.sb_hiwat) ||
sbreserve(&so->so_rcv, cnt) == 0) {
error = ENOBUFS;
goto bad;