From 7d38c48a8bc41aeeffa2b3dfe66b59e8e130f5b7 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sat, 10 Oct 2015 17:41:56 +0200
Subject: [PATCH] Initialize acknowledgment number on establishment of outgoing
TCP connection.
Ported change 2432a8ee7da3a7cdd6c05c54d28ada85105a0b37 (set expected reception sequence no to zero - to get initial connection to avoid having ack-number other than zero) from uIPv6 to uIPv4.
---
core/net/ipv4/uip.c | 11 ++++++++---
core/net/ipv6/uip6.c | 6 +++---
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/core/net/ipv4/uip.c b/core/net/ipv4/uip.c
index 1c3c24aaf..023da75fa 100644
--- a/core/net/ipv4/uip.c
+++ b/core/net/ipv4/uip.c
@@ -436,6 +436,11 @@ uip_connect(const uip_ipaddr_t *ripaddr, uint16_t rport)
conn->snd_nxt[2] = iss[2];
conn->snd_nxt[3] = iss[3];
+ conn->rcv_nxt[0] = 0;
+ conn->rcv_nxt[1] = 0;
+ conn->rcv_nxt[2] = 0;
+ conn->rcv_nxt[3] = 0;
+
conn->initialmss = conn->mss = UIP_TCP_MSS;
conn->len = 1; /* TCP length of the SYN is one. */
@@ -1367,10 +1372,10 @@ uip_process(uint8_t flag)
uip_connr->len = 1;
/* rcv_nxt should be the seqno from the incoming packet + 1. */
- uip_connr->rcv_nxt[3] = BUF->seqno[3];
- uip_connr->rcv_nxt[2] = BUF->seqno[2];
- uip_connr->rcv_nxt[1] = BUF->seqno[1];
uip_connr->rcv_nxt[0] = BUF->seqno[0];
+ uip_connr->rcv_nxt[1] = BUF->seqno[1];
+ uip_connr->rcv_nxt[2] = BUF->seqno[2];
+ uip_connr->rcv_nxt[3] = BUF->seqno[3];
uip_add_rcv_nxt(1);
/* Parse the TCP MSS option, if present. */
diff --git a/core/net/ipv6/uip6.c b/core/net/ipv6/uip6.c
index 73abd1115..2b11314d1 100644
--- a/core/net/ipv6/uip6.c
+++ b/core/net/ipv6/uip6.c
@@ -1747,10 +1747,10 @@ uip_process(uint8_t flag)
uip_connr->len = 1;
/* rcv_nxt should be the seqno from the incoming packet + 1. */
- uip_connr->rcv_nxt[3] = UIP_TCP_BUF->seqno[3];
- uip_connr->rcv_nxt[2] = UIP_TCP_BUF->seqno[2];
- uip_connr->rcv_nxt[1] = UIP_TCP_BUF->seqno[1];
uip_connr->rcv_nxt[0] = UIP_TCP_BUF->seqno[0];
+ uip_connr->rcv_nxt[1] = UIP_TCP_BUF->seqno[1];
+ uip_connr->rcv_nxt[2] = UIP_TCP_BUF->seqno[2];
+ uip_connr->rcv_nxt[3] = UIP_TCP_BUF->seqno[3];
uip_add_rcv_nxt(1);
/* Parse the TCP MSS option, if present. */