From e03f80b26ce527d2fc262ca09bd16f55f3d3df20 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 21 Jun 2017 21:13:17 +0200 Subject: ratp: fix sending ACKs without data All ACKs without data must be built in the same way from the input message: The code was actually doing this instead: This change fixes how the retransmissions are ACK-ed by the peer, and would have affected the barebox<->bbremote interactions. Signed-off-by: Aleksander Morgado Signed-off-by: Sascha Hauer --- lib/ratp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ratp.c b/lib/ratp.c index 321721ab71..5c52d3b5f6 100644 --- a/lib/ratp.c +++ b/lib/ratp.c @@ -364,13 +364,12 @@ static bool ratp_sn_expected(struct ratp_internal *ri, struct ratp_header *hdr) static int ratp_send_ack(struct ratp_internal *ri, struct ratp_header *hdr) { - uint8_t control = RATP_CONTROL_ACK; + uint8_t control; int ret; - if (hdr->control & RATP_CONTROL_SN) - control |= RATP_CONTROL_AN; - else - control |= 0; + control = ratp_set_sn(ratp_an(hdr)) | + ratp_set_an(ratp_sn(hdr) + 1) | + RATP_CONTROL_ACK; ret = ratp_send_hdr(ri, control); if (ret) -- cgit v1.2.3