From 7cf68b5e35c002511cc7468967de6a75934cc998 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 18 Feb 2011 23:11:43 +0100 Subject: [PATCH] Prevent anything from updating our own UDP address. Because we don't want to keep track of that, and this will cause the node structure from being relinked into the node tree, which results in myself pointing to an invalid address. --- src/net_packet.c | 3 +++ src/node.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/net_packet.c b/src/net_packet.c index 13f13256..e732ef8b 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -581,6 +581,9 @@ static node_t *try_harder(const sockaddr_t *from, const vpn_packet_t *pkt) { for(node = edge_weight_tree->head; node; node = node->next) { e = node->data; + if(e->to == myself) + continue; + if(sockaddrcmp_noport(from, &e->address)) { if(last_hard_try == now) continue; diff --git a/src/node.c b/src/node.c index 7bcad892..b00d034b 100644 --- a/src/node.c +++ b/src/node.c @@ -141,6 +141,11 @@ node_t *lookup_node_udp(const sockaddr_t *sa) { } void update_node_udp(node_t *n, const sockaddr_t *sa) { + if(n == myself) { + logger(LOG_WARNING, "Trying to update UDP address of myself!\n"); + return; + } + avl_delete(node_udp_tree, n); if(n->hostname) -- 2.20.1