On Tue, Jul 05, 2016 at 07:22:27AM -0600, Bob Beck wrote:
> Makes sense to me. Others?
>
>
> On Tue, Jul 5, 2016 at 4:08 AM, Simon Mages <[email protected]>
> wrote:
> > At the moment the buffersize will be set to the default even if the
> > current value
> > is smaller.
> >
> > The following diff fixes this problem.
> >
> > Index: netinet/tcp_usrreq.c
> > ===================================================================
> > RCS file: /cvs/src/sys/netinet/tcp_usrreq.c,v
> > retrieving revision 1.131
> > diff -u -p -u -p -r1.131 tcp_usrreq.c
> > --- netinet/tcp_usrreq.c 18 Jun 2016 10:36:13 -0000 1.131
> > +++ netinet/tcp_usrreq.c 5 Jul 2016 09:26:24 -0000
> > @@ -979,10 +979,11 @@ tcp_update_sndspace(struct tcpcb *tp)
> > struct socket *so = tp->t_inpcb->inp_socket;
> > u_long nmax;
> >
> > - if (sbchecklowmem())
> > + if (sbchecklowmem()) {
> > /* low on memory try to get rid of some */
> > - nmax = tcp_sendspace;
> > - else if (so->so_snd.sb_wat != tcp_sendspace)
> > + if (so->so_snd.sb_hiwat < nmax)
> > + nmax = tcp_sendspace;
> > + } else if (so->so_snd.sb_wat != tcp_sendspace)
> > /* user requested buffer size, auto-scaling disabled */
> > nmax = so->so_snd.sb_wat;
> > else
Here, nmax can be used uninitialized now.
It needs be initialized to something maybe sb_hiwat?
> > @@ -1017,10 +1018,11 @@ tcp_update_rcvspace(struct tcpcb *tp)
> > struct socket *so = tp->t_inpcb->inp_socket;
> > u_long nmax = so->so_rcv.sb_hiwat;
> >
> > - if (sbchecklowmem())
> > + if (sbchecklowmem()) {
> > /* low on memory try to get rid of some */
> > - nmax = tcp_recvspace;
> > - else if (so->so_rcv.sb_wat != tcp_recvspace)
> > + if (tcp_recvspace < nmax)
> > + nmax = tcp_recvspace;
> > + } else if (so->so_rcv.sb_wat != tcp_recvspace)
> > /* user requested buffer size, auto-scaling disabled */
> > nmax = so->so_rcv.sb_wat;
> > else {
> >
Here there is no issue.
--
:wq Claudio