diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-11-04 19:36:26 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-11-04 19:36:26 +0000 |
commit | cc590605fc580fc42b87abae43693215d20ac1d2 (patch) | |
tree | 7ea96f5f623b8d915c32e004909570133deb895b /sys/netinet | |
parent | 49df5705bb16d7d6102089e7b02feb99d7b1bb8e (diff) |
The change of the sb_mbmax calculation in sbreserve() broke setting
a fixed socket send buffer size for TCP. tcp_update_sndspace()
could overwrite the value as the algorithms were not in sync.
OK benno@ claudio@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 304935cd569..73828d10fed 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.169 2018/06/11 07:40:26 bluhm Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.170 2018/11/04 19:36:25 bluhm Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -1143,8 +1143,9 @@ tcp_update_sndspace(struct tcpcb *tp) if (sbspace(so, &so->so_snd) >= so->so_snd.sb_lowat) { if (nmax < so->so_snd.sb_cc + so->so_snd.sb_lowat) nmax = so->so_snd.sb_cc + so->so_snd.sb_lowat; - if (nmax * 2 < so->so_snd.sb_mbcnt + so->so_snd.sb_lowat) - nmax = (so->so_snd.sb_mbcnt+so->so_snd.sb_lowat+1) / 2; + /* keep in sync with sbreserve() calculation */ + if (nmax * 8 < so->so_snd.sb_mbcnt + so->so_snd.sb_lowat) + nmax = (so->so_snd.sb_mbcnt+so->so_snd.sb_lowat+7) / 8; } /* round to MSS boundary */ |