Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ECONNREFUSED no longer works



tnn%NetBSD.org@localhost (Tobias Nygren) writes:

>$ nc -n -v 127.0.0.1 1234
># hangs forever in connect(2) instead of exiting w/ connection refused.

The logic in tcp_drop() got reversed:

@@ -1042,17 +1017,12 @@ tcp_newtcpcb(int family, void *aux)
 struct tcpcb *
 tcp_drop(struct tcpcb *tp, int errno)
 {
-       struct socket *so = NULL;
+       struct socket *so;
 
-       KASSERT(!(tp->t_inpcb && tp->t_in6pcb));
+       KASSERT(tp->t_inpcb != NULL);
 
-       if (tp->t_inpcb)
-               so = tp->t_inpcb->inp_socket;
-#ifdef INET6
-       if (tp->t_in6pcb)
-               so = tp->t_in6pcb->in6p_socket;
-#endif
-       if (!so)
+       so = tp->t_inpcb->inp_socket;
+       if (so != NULL)                                    <-------------
                return NULL;
 
        if (TCPS_HAVERCVDSYN(tp->t_state)) {




Home | Main Index | Thread Index | Old Index