Log an error message with the node's name when receiving bad SPTPS packets.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 7 Dec 2014 16:25:30 +0000 (17:25 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 7 Dec 2014 16:25:30 +0000 (17:25 +0100)
The SPTPS code doesn't know about nodes, so when it logs an error about
a bad packet, it doesn't log which node it came from. So add a log
message with the node's name and hostname in receive_udppacket().

src/net_packet.c

index eb6ecfa46e5ed5b0ad3eb3960f4c5d60d881b15c..c3e8c6246206ed5226eef5dd0de2d8ba3e68944d 100644 (file)
@@ -372,7 +372,11 @@ static bool receive_udppacket(node_t *n, vpn_packet_t *inpkt) {
                        }
                        return false;
                }
-               return sptps_receive_data(&n->sptps, (char *)&inpkt->seqno, inpkt->len);
+               if(!sptps_receive_data(&n->sptps, (char *)&inpkt->seqno, inpkt->len)) {
+                       logger(DEBUG_TRAFFIC, LOG_ERR, "Got bad packet from %s (%s)", n->name, n->hostname);
+                       return false;
+               }
+               return true;
        }
 
        if(!n->status.validkey) {