diff options
author | 2011-04-04 21:11:22 +0000 | |
---|---|---|
committer | 2011-04-04 21:11:22 +0000 | |
commit | 3145b9e6f7aa646bcff47022b09711e63532e662 (patch) | |
tree | e9cea5786fa0d0f6bc17ddf37f472f97230dbd1d /sys/netinet/tcp_usrreq.c | |
parent | Plug mbuf leaks in SO_PEERCRED by not double allocating mbufs into (diff) | |
download | wireguard-openbsd-3145b9e6f7aa646bcff47022b09711e63532e662.tar.xz wireguard-openbsd-3145b9e6f7aa646bcff47022b09711e63532e662.zip |
Correctly inherit and set the watermarks on socketbuffers.
This fixes the NFS problems reported on the mailing list
and ensures that accepted sockets have correct socketbuffer
setting. OK blambert@, henning@
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 11a2012ede0..f5b5096dd9d 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.105 2010/10/10 22:02:50 bluhm Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.106 2011/04/04 21:11:22 claudio Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -652,16 +652,10 @@ tcp_attach(so) struct inpcb *inp; int error; - if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { - /* if low on memory only allow smaller then default buffers */ - if (so->so_snd.sb_wat == 0 || - sbcheckreserve(so->so_snd.sb_wat, tcp_sendspace)) - so->so_snd.sb_wat = tcp_sendspace; - if (so->so_rcv.sb_wat == 0 || - sbcheckreserve(so->so_rcv.sb_wat, tcp_recvspace)) - so->so_rcv.sb_wat = tcp_recvspace; - - error = soreserve(so, so->so_snd.sb_wat, so->so_rcv.sb_wat); + if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0 || + sbcheckreserve(so->so_snd.sb_wat, tcp_sendspace) || + sbcheckreserve(so->so_rcv.sb_wat, tcp_recvspace)) { + error = soreserve(so, tcp_sendspace, tcp_recvspace); if (error) return (error); } |