aboutsummaryrefslogtreecommitdiff
path: root/slirp/tcp_input.c
diff options
context:
space:
mode:
authorSteven Luo <steven+qemu@steven676.net>2016-04-06 22:04:55 -0700
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-04-07 13:02:05 +0200
commit6625d83a6eb3b51a622d72adce713cab75cbf2e7 (patch)
treecf4b63d2e2500003ead1ddd06ef318ce79661160 /slirp/tcp_input.c
parent27d92ebc5ed1bb0b518d0ebc4c609182ad20a799 (diff)
downloadqemu-6625d83a6eb3b51a622d72adce713cab75cbf2e7.zip
qemu-6625d83a6eb3b51a622d72adce713cab75cbf2e7.tar.gz
qemu-6625d83a6eb3b51a622d72adce713cab75cbf2e7.tar.bz2
slirp: handle deferred ECONNREFUSED on non-blocking TCP sockets
slirp currently only handles ECONNREFUSED in the case where connect() returns immediately with that error; since we use non-blocking sockets, most of the time we won't receive the error until we later try to read from the socket. Ensure that we deliver the appropriate RST to the guest in this case. Signed-off-by: Steven Luo <steven+qemu@steven676.net> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/tcp_input.c')
-rw-r--r--slirp/tcp_input.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index 1fcca30..5433e7f 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -725,6 +725,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;