]> git.meshlink.io Git - meshlink/blobdiff - src/net_packet.c
Drop messages from blacklisted nodes that I receive over a n-hops path
[meshlink] / src / net_packet.c
index e5dbd964577d7a0df2ef5c40ff6e190f3addae98..8367a9c5157d78c978d65ce9e1267daa1e6fc862 100644 (file)
@@ -276,10 +276,14 @@ static void receive_packet(meshlink_handle_t *mesh, node_t *n, vpn_packet_t *pac
        logger(DEBUG_TRAFFIC, LOG_DEBUG, "Received packet of %d bytes from %s (%s)",
                           packet->len, n->name, n->hostname);
 
+    if (n->status.blacklisted) {
+        logger(DEBUG_PROTOCOL, LOG_WARNING, "Dropping packet from blacklisted node %s", n->name);
+    } else {
        n->in_packets++;
        n->in_bytes += packet->len;
 
        route(mesh, n, packet);
+    }
 }
 
 static bool try_mac(meshlink_handle_t *mesh, node_t *n, const vpn_packet_t *inpkt) {
@@ -654,9 +658,10 @@ void handle_incoming_vpn_data(event_loop_t *loop, void *data, int flags) {
                        return;
        }
 
-    if (n->status.blacklisted)
-        return;
-
+    if (n->status.blacklisted) {
+                       logger(DEBUG_PROTOCOL, LOG_WARNING, "Dropping packet from blacklisted node %s", n->name);
+            return;
+    }
        n->sock = ls - mesh->listen_socket;
 
        receive_udppacket(mesh, n, &pkt);