From 77f6ea83ae17d216619332f2e6327c98eb760bff Mon Sep 17 00:00:00 2001 From: Alan Date: Wed, 1 Apr 2015 22:00:09 +0100 Subject: [PATCH] uip: finish off the changes for connect() A connect that fails is now echoed back to the guest with a valid RST frame so that the client user sees "connection refused" not a long timeout and failure. --- net/uip/tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/uip/tcp.c b/net/uip/tcp.c index 964c929..5126f0a 100644 --- a/net/uip/tcp.c +++ b/net/uip/tcp.c @@ -161,8 +161,9 @@ static struct uip_tcp_socket *uip_tcp_socket_alloc(struct uip_tx_arg *arg, u32 s ret = connect(sk->fd, (struct sockaddr *)&sk->addr, sizeof(sk->addr)); if (ret) { - perror("connect"); - uip_tcp_payload_send(sk, UIP_TCP_FLAG_RST, 0); + sk->ack_server = ntohl(tcp->seq) + 1; + sk->seq_server = 0; + uip_tcp_payload_send(sk, UIP_TCP_FLAG_RST|UIP_TCP_FLAG_ACK, 0); free(sk); return NULL; }