Prevent anything from updating our own UDP address.
authorGuus Sliepen <guus@tinc-vpn.org>
Fri, 18 Feb 2011 22:11:43 +0000 (23:11 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Fri, 18 Feb 2011 22:11:43 +0000 (23:11 +0100)
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
src/node.c

index 13f132565016bbe908a66bbb01ce34939b9dacec..e732ef8b6a38b8b413a25b4d868a38e9b07223d1 100644 (file)
@@ -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;
index 7bcad892753ddaec91beca2793fdff48780dcc31..b00d034be3376d66077e6b43e279cbbcdb698cf8 100644 (file)
@@ -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)