diff options
-rw-r--r-- | socket.c | 3 | ||||
-rw-r--r-- | tcp_input.c | 6 |
2 files changed, 8 insertions, 1 deletions
@@ -188,7 +188,8 @@ int soread(struct socket *so) nn, errno, strerror(errno))); sofcantrcvmore(so); - if (err == ECONNRESET || err == ENOTCONN || err == EPIPE) { + if (err == ECONNRESET || err == ECONNREFUSED || err == ENOTCONN || + err == EPIPE) { tcp_drop(sototcpcb(so), err); } else { tcp_sockclosed(sototcpcb(so)); diff --git a/tcp_input.c b/tcp_input.c index 99a16ae..7ca8b2b 100644 --- a/tcp_input.c +++ b/tcp_input.c @@ -724,6 +724,12 @@ findso: so->so_ti = ti; tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT; tp->t_state = TCPS_SYN_RECEIVED; + /* + * Initialize receive sequence numbers now so that we can send a + * valid RST if the remote end rejects our connection. + */ + tp->irs = ti->ti_seq; + tcp_rcvseqinit(tp); tcp_template(tp); } return; |