aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--socket.c3
-rw-r--r--tcp_input.c6
2 files changed, 8 insertions, 1 deletions
diff --git a/socket.c b/socket.c
index ee87a77..f3b460d 100644
--- a/socket.c
+++ b/socket.c
@@ -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;