X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_packet.c;h=c7efa8869e9d1d3ae544b007be368f9b13f60022;hb=5686ad80b545afa3de9ed2f4176a5346e289aaa8;hp=aef55342353cac99096822d10d41c728f34c503e;hpb=f99661a4ca5bacff47239ce7978b9c9948917c54;p=tinc diff --git a/src/net_packet.c b/src/net_packet.c index aef55342..c7efa886 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -1,7 +1,7 @@ /* net_packet.c -- Handles in- and outgoing VPN packets Copyright (C) 1998-2005 Ivo Timmermans, - 2000-2010 Guus Sliepen + 2000-2011 Guus Sliepen 2010 Timothy Redaelli 2010 Brandon Black @@ -575,20 +575,21 @@ static node_t *try_harder(const sockaddr_t *from, const vpn_packet_t *pkt) { avl_node_t *node; edge_t *e; node_t *n = NULL; + bool hard = false; static time_t last_hard_try = 0; 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; - last_hard_try = now; + hard = true; } - if(!n) - n = e->to; - if(!try_mac(e->to, pkt)) continue; @@ -596,6 +597,9 @@ static node_t *try_harder(const sockaddr_t *from, const vpn_packet_t *pkt) { break; } + if(hard) + last_hard_try = now; + return n; }