From 7a3095de09f614f3f3eeeaec7340f97215c30c6c Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Wed, 7 May 2014 17:02:32 +0930 Subject: [PATCH] Detect abbreviation collisions with multiple identities --- route_link.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/route_link.c b/route_link.c index 568c351c..9568d5d6 100644 --- a/route_link.c +++ b/route_link.c @@ -1302,6 +1302,14 @@ int link_receive(struct internal_mdp_header *header, struct overlay_buffer *payl ack_mask, drop_rate); + if (transmitter && transmitter!=my_subscriber && transmitter->reachable==REACHABLE_SELF){ + // Our neighbour is talking about a path *from* a secondary SID of ours? Impossible. + // Maybe we decoded an abbreviation incorrectly and this indicates a SID collision. + // TODO add a test for this case! + transmitter->send_full=1; + continue; + } + if (receiver == my_subscriber){ // track if our neighbour is using us as an immediate neighbour, if they are we need to ack / nack promptly neighbour->using_us = (transmitter==header->source?1:0); @@ -1310,6 +1318,16 @@ int link_receive(struct internal_mdp_header *header, struct overlay_buffer *payl // we can always send packets to ourself :) continue; } + + if (receiver->reachable == REACHABLE_SELF){ + if (transmitter && transmitter!=my_subscriber){ + // An alternative path to a secondary SID, that isn't via me? Impossible. + // Maybe we decoded an abbreviation incorrectly and this indicates a SID collision. + // TODO add a test for this case! + receiver->send_full=1; + continue; + } + } struct network_destination *destination=NULL;