Don't try to send MTU probes to unreachable nodes.

If there is an outstanding MTU probe event for a node which is not reachable
anymore, a UDP packet would be sent to that node, which caused a key request to
be sent to that node, which triggered a NULL pointer dereference. Probes and
other UDP packets to unreachable nodes are now dropped.
This commit is contained in:
Guus Sliepen 2009-06-11 18:36:08 +02:00
parent 261d1eac1c
commit 36f8e4da8b
2 changed files with 15 additions and 0 deletions

View file

@ -70,6 +70,11 @@ void send_mtu_probe(node_t *n)
n->mtuprobes++;
n->mtuevent = NULL;
if(!n->status.reachable) {
ifdebug(TRAFFIC) logger(LOG_INFO, _("Trying to send MTU probe to unreachable node %s (%s)"), n->name, n->hostname);
return;
}
if(n->mtuprobes >= 10 && !n->minmtu) {
ifdebug(TRAFFIC) logger(LOG_INFO, _("No response to MTU probes from %s (%s)"), n->name, n->hostname);
return;
@ -328,6 +333,11 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt)
cp();
if(!n->status.reachable) {
ifdebug(TRAFFIC) logger(LOG_INFO, _("Trying to send UDP packet to unreachable node %s (%s)"), n->name, n->hostname);
return;
}
/* Make sure we have a valid key */
if(!n->status.validkey) {