summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-06-21 21:13:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-06-23 13:34:07 +0200
commite90817a514083345e80b248955e5d3d130561621 (patch)
tree27232af58e138ca04fdbe43170f27cf54cc84634 /scripts
parentb2fb42fb63a838383873f9de1a4037d8403a5cec (diff)
downloadbarebox-e90817a514083345e80b248955e5d3d130561621.tar.gz
barebox-e90817a514083345e80b248955e5d3d130561621.tar.xz
ratp: remove bogus data checks in behavior C2
The SN validation was being completely ignored if the packet had no data (e.g. for RST, FIN or SYN or plain ACKs). This condition is now removed so that the SN check is done. The second check removed was actually never being used, as it was already being tested for not having data in the first one. These two fixes are a cleanup to follow the protocol correctly. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/remote/ratp.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/scripts/remote/ratp.py b/scripts/remote/ratp.py
index a41d2e8a3f..0dfc8420c7 100644
--- a/scripts/remote/ratp.py
+++ b/scripts/remote/ratp.py
@@ -339,9 +339,6 @@ class RatpConnection(object):
def _c2(self, r):
logging.info("C2")
- if r.length == 0 and r.c_so == 0:
- return True
-
if r.c_sn != self._r_sn:
return True
@@ -358,14 +355,11 @@ class RatpConnection(object):
self._state = RatpState.closed
return False
- # FIXME: only ack duplicate data packages?
- # This is not documented in RFC 916
- if r.length or r.c_so:
- logging.info("C2: duplicate data packet, dropping")
- s = RatpPacket(flags='A')
- s.c_sn = r.c_an
- s.c_an = (r.c_sn + 1) % 2
- self._write(s)
+ logging.info("C2: duplicate packet")
+ s = RatpPacket(flags='A')
+ s.c_sn = r.c_an
+ s.c_an = (r.c_sn + 1) % 2
+ self._write(s)
return False