From 4fb956e3bddd9f271197449e3b7029d23f602040 Mon Sep 17 00:00:00 2001 From: scipio Date: Fri, 26 Feb 2010 21:31:40 +0000 Subject: [PATCH] Fix compile crash. --- support/sdk/c/blip/libtcp/tcplib.c | 37 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/support/sdk/c/blip/libtcp/tcplib.c b/support/sdk/c/blip/libtcp/tcplib.c index 44577c05..7c498e20 100644 --- a/support/sdk/c/blip/libtcp/tcplib.c +++ b/support/sdk/c/blip/libtcp/tcplib.c @@ -179,29 +179,30 @@ static void tcplib_send_ack(struct tcplib_sock *sock, int fin_seqno, uint8_t fla static void tcplib_send_rst(struct ip6_hdr *iph, struct tcp_hdr *tcph) { struct split_ip_msg *msg = get_ipmsg(0); + struct tcp_hdr *tcp_rep; - if (msg != NULL) { - struct tcp_hdr *tcp_rep = (struct tcp_hdr *)(msg + 1); - - memcpy(&msg->hdr.ip6_dst, &iph->ip6_src, 16); - - tcp_rep->flags = TCP_FLAG_RST | TCP_FLAG_ACK; + if (msg == NULL) { + return; + } + + tcp_rep = (struct tcp_hdr *)(msg + 1); - tcp_rep->ackno = htonl(ntohl(tcph->seqno) + 1); - tcp_rep->seqno = tcph->ackno;; + tcp_rep->flags = TCP_FLAG_RST | TCP_FLAG_ACK; - tcp_rep->srcport = tcph->dstport; - tcp_rep->dstport = tcph->srcport; - tcp_rep->offset = sizeof(struct tcp_hdr) * 4; - tcp_rep->window = 0; - tcp_rep->chksum = 0; - tcp_rep->urgent = 0; + tcp_rep->ackno = htonl(ntohl(tcph->seqno) + 1); + tcp_rep->seqno = tcph->ackno;; - tcplib_send_out(msg, tcp_rep); + tcp_rep->srcport = tcph->dstport; + tcp_rep->dstport = tcph->srcport; + tcp_rep->offset = sizeof(struct tcp_hdr) * 4; + tcp_rep->window = 0; + tcp_rep->chksum = 0; + tcp_rep->urgent = 0; - ip_free(msg); - - } + memcpy(&msg->hdr.ip6_dst, &iph->ip6_src, 16); + + tcplib_send_out(msg, tcp_rep); + ip_free(msg); } /* send all the data in the tx buffer, starting at sseqno */ -- 2.39.2