On Tue, 5 Nov 2002, Giorgos Keramidas wrote:

> On 2002-11-04 18:38, Kelly Yancey <[EMAIL PROTECTED]> wrote:
> > Thanks for the info.  Are you sure that you only reverted the one delta?
>
> Yes.  I just recompiled the kernel from -rHEAD and started logging
> things while I connected to my dialup provider.  Apparently lo0 does
> have the 127.0.0.1 address *and* the LOOPBACK flag but somehow fails.
>
> When (near the end of the following log) I back only this change out,
> the problems go away :/
>

  Thanks for the great trace and your patience.  I believe I found the root of
the problem.  Could you please try the attached patch?  I'm afraid that
if I hadn't gotten thown off this morning be my lo0 lacking a
127.0.0.1 address I probably would have found it much, much sooner
(it's pretty obvious in hindsight).  At the very least, I also caught a
couple of pieces of code that are manipulating the socket buffer behind
sballoc() and sbfree()'s back so I've modified them to update the sb_cc
counter directly also.
  Let me know if this fixes things for you.  Thanks,

  Kelly

--
Kelly Yancey -- kbyanc@{posi.net,FreeBSD.org}
"Democracy is a device that insures we shall be governed no better than we
 deserve." -- George Bernard Shaw
Index: kern/uipc_socket.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.135
diff -u -p -r1.135 uipc_socket.c
--- kern/uipc_socket.c  2 Nov 2002 05:14:30 -0000       1.135
+++ kern/uipc_socket.c  5 Nov 2002 04:14:20 -0000
@@ -1794,7 +1794,7 @@ filt_soread(struct knote *kn, long hint)
                return (1);
        if (kn->kn_sfflags & NOTE_LOWAT)
                return (kn->kn_data >= kn->kn_sdata);
-       return (kn->kn_data >= so->so_rcv.sb_lowat);
+       return (so->so_rcv.sb_cc >= so->so_rcv.sb_lowat);
 }
 
 static void
Index: kern/uipc_socket2.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_socket2.c,v
retrieving revision 1.105
diff -u -p -r1.105 uipc_socket2.c
--- kern/uipc_socket2.c 2 Nov 2002 05:14:30 -0000       1.105
+++ kern/uipc_socket2.c 5 Nov 2002 04:19:05 -0000
@@ -705,6 +705,8 @@ sbcompress(sb, m, n)
                            (unsigned)m->m_len);
                        n->m_len += m->m_len;
                        sb->sb_cc += m->m_len;
+                       if (m->m_type != MT_DATA)
+                               sb->sb_ctl += m->m_len;
                        m = m_free(m);
                        continue;
                }
@@ -774,6 +776,8 @@ sbdrop(sb, len)
                        m->m_len -= len;
                        m->m_data += len;
                        sb->sb_cc -= len;
+                       if (m->m_type != MT_DATA)
+                               sb->sb_ctl -= len;
                        break;
                }
                len -= m->m_len;

Reply via email to