aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJianfeng Tan <henry.tjf@antfin.com>2019-06-14 20:04:30 +0800
committerDaniel Pono Takamori <dtakamori@contractor.linuxfoundation.org>2019-06-27 11:59:24 -0700
commitdeb5f4995a1e2b99edc435fb1b1e48de4667c40f (patch)
tree251c33b9bb4577511f7887f472beb548a16f4277
parent85b0a328d71300572a3c2e8b5b722c00ed0ac6e8 (diff)
l4p/tcp: few fixes for sending RST packet logic
- for RST on RTO use SND.NXT instead of SND.UNA - for RST on invalid SEQSEG.ACK in SYN-SENT state: - use SEG.ACK - don't terminate the connection Change-Id: I9943f6fdfb89493af4b0437c5a81af34c450c630 Signed-off-by: Jielong Zhou <jielong.zjl@antfin.com> Signed-off-by: Jianfeng Tan <henry.tjf@antfin.com> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
-rw-r--r--lib/libtle_l4p/tcp_rxtx.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/libtle_l4p/tcp_rxtx.c b/lib/libtle_l4p/tcp_rxtx.c
index c0a0dd1..e785b9a 100644
--- a/lib/libtle_l4p/tcp_rxtx.c
+++ b/lib/libtle_l4p/tcp_rxtx.c
@@ -1554,9 +1554,15 @@ rx_synack(struct tle_tcp_stream *s, uint32_t ts, uint32_t state,
if (state != TCP_ST_SYN_SENT)
return -EINVAL;
- /* invalid SEG.SEQ */
+ /*
+ * RFC 793 3.9: in the SYN-SENT state
+ * If SEG.ACK =< ISS, or SEG.ACK > SND.NXT, send a reset
+ * <SEQ=SEG.ACK><CTL=RST>
+ * and discard the segment.
+ * The connection remains in the same state.
+ */
if (si->ack != (uint32_t)s->tcb.snd.nxt) {
- rsp->flags = TCP_FLAG_RST;
+ send_rst(s, si->ack);
return 0;
}
@@ -1711,10 +1717,7 @@ rx_stream(struct tle_tcp_stream *s, uint32_t ts,
i = 0;
/* we have a response packet to send. */
- if (rsp.flags == TCP_FLAG_RST) {
- send_rst(s, si[i].ack);
- stream_term(s);
- } else if (rsp.flags != 0) {
+ if (rsp.flags != 0) {
send_ack(s, ts, rsp.flags);
/* start the timer for FIN packet */
@@ -2590,7 +2593,7 @@ rto_stream(struct tle_tcp_stream *s, uint32_t tms)
timer_restart(s);
} else {
- send_rst(s, s->tcb.snd.una);
+ send_rst(s, s->tcb.snd.nxt);
stream_term(s);
}
}