From cbc2519681f5fceab5c6153110215090663eb3e9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 15 May 2019 21:40:40 +0100 Subject: [PATCH] polypath asymmetric routing: Handle data packet dupes If polypath has asymmetric routing, where path A upload is faster than path B, but path A download is completely broken, then we need to retain both paths A and B in our list of transport peers. Stepping back, we need to treat dupes of recent packets as evidence that the peer is at that address, even though we do not pass the packets to the netlink. We don't want to do this for arbitrarily old data packets. The heuristic we use here is rather crude: packets which are more than 32 (by default) out of order are treated as too old. This will be too short if path A is a high-bandwidth link and path B is quite slow, and it will be too long if the link is very idle. Hopefully this will not matter in practice. Signed-off-by: Ian Jackson --- site.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/site.c b/site.c index acbc2b6..5146501 100644 --- a/site.c +++ b/site.c @@ -1158,6 +1158,14 @@ static bool_t process_msg0(struct site *st, struct buffer_if *msg0, transform_apply_return problem; problem = decrypt_msg0(st,msg0,src); + if (problem==transform_apply_seqdupe) { + /* We recently received another copy of this packet, maybe due + * to polypath. That's not a problem; indeed, for the + * purposes of transport address management it is a success. + * But we don't want to process the packet. */ + transport_data_msgok(st,src); + return False; + } if (problem) return False; -- 2.30.2