From 5533b105943b4f6dd688c1758350cd83ebeab3b9 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Wed, 19 Jun 2013 17:49:39 +0000 Subject: [PATCH] - drop to_orig messages on 0 ttl --- src/mesh/gnunet-service-mesh-new.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c index 77406d9b0..ef04ea259 100644 --- a/src/mesh/gnunet-service-mesh-new.c +++ b/src/mesh/gnunet-service-mesh-new.c @@ -3485,6 +3485,7 @@ handle_mesh_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, struct MeshTunnel *t; size_t size; uint32_t pid; + uint32_t ttl; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got a ToOrigin packet from %s\n", GNUNET_i2s (peer)); @@ -3568,6 +3569,15 @@ handle_mesh_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_i2s (&msg->oid), ntohl(msg->tid)); return GNUNET_OK; } + ttl = ntohl (msg->ttl); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ttl: %u\n", ttl); + if (ttl == 0) + { + GNUNET_STATISTICS_update (stats, "# TTL drops", 1, GNUNET_NO); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, " TTL is 0, DROPPING!\n"); + tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK); + return GNUNET_OK; + } send_prebuilt_message (message, t->prev_hop, t); GNUNET_STATISTICS_update (stats, "# to origin forwarded", 1, GNUNET_NO); -- 2.25.1