Increase threshold for detecting two nodes with the same Name.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 8 May 2011 10:16:26 +0000 (12:16 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 8 May 2011 10:16:26 +0000 (12:16 +0200)
In commit 4a21aabada23d1d2c8a10f54dd7248171c4ec82f, code was added to detect
contradicting ADD_EDGE and DEL_EDGE messages being sent, which is an indication
of two nodes with the same Name connected to the same VPN.  However, these
contradictory messages can also happen when there is a network partitioning. In
the former case a loop happens which causes many contradictory message, while
in the latter case only a few of those messages will be sent. So, now we
increase the threshold to at least 10 of both ADD_EDGE and DEL_EDGE messages.

src/net.c

index 08e3cad..ee5789c 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -427,7 +427,7 @@ int main_loop(void) {
                                keyexpires = now + keylifetime;
                        }
 
                                keyexpires = now + keylifetime;
                        }
 
-                       if(contradicting_del_edge && contradicting_add_edge) {
+                       if(contradicting_del_edge > 10 && contradicting_add_edge > 10) {
                                logger(LOG_WARNING, "Possible node with same Name as us!");
 
                                if(rand() % 3 == 0) {
                                logger(LOG_WARNING, "Possible node with same Name as us!");
 
                                if(rand() % 3 == 0) {