[PATCH v2 05/16] ratp: completely ignore RST flagged packets in behavior G

Aleksander Morgado aleksander at aleksander.es
Wed Jun 21 12:13:12 PDT 2017


The reference says:

    This procedure represents the behavior of the CLOSED state of a
    connection. All incoming packets are discarded. If the packet
    had the RST flag set take no action. Otherwise it is necessary
    to build a RST packet.

So, skip building the RST packet if the incoming one had RST set.

This commit fixes an infinite loop of messages sent and received
between both ends during the connection close procedure, found when
testing barebox against a third party ratp implementation.

Signed-off-by: Aleksander Morgado <aleksander at aleksander.es>
---
 lib/ratp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/ratp.c b/lib/ratp.c
index 43b8b04dc..d3c252047 100644
--- a/lib/ratp.c
+++ b/lib/ratp.c
@@ -1033,6 +1033,9 @@ static int ratp_behaviour_g(struct ratp_internal *ri, void *pkt)
 
 	pr_debug("%s\n", __func__);
 
+	if (hdr->control & RATP_CONTROL_RST)
+		return 0;
+
 	control = RATP_CONTROL_RST;
 
 	if (hdr->control & RATP_CONTROL_ACK)
-- 
2.13.1




More information about the barebox mailing list