From b11629b8f1822e8fadc1f6a25138c4586e61a38a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 26 Oct 2015 15:59:32 +0000 Subject: [PATCH] never pass addresses for ourselves to ATS --- src/transport/gnunet-service-transport_ats.c | 36 ++++++++++++++++++++ src/transport/transport_api.c | 3 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c index d6bc836d3..faf97c8fe 100644 --- a/src/transport/gnunet-service-transport_ats.c +++ b/src/transport/gnunet-service-transport_ats.c @@ -332,6 +332,11 @@ GST_ats_block_address (const struct GNUNET_HELLO_Address *address, { struct AddressInfo *ai; + if (0 == + memcmp (&GST_my_identity, + &address->peer, + sizeof (struct GNUNET_PeerIdentity))) + return; /* our own, ignore! */ ai = find_ai (address, session); if (NULL == ai) @@ -399,6 +404,11 @@ GST_ats_block_reset (const struct GNUNET_HELLO_Address *address, { struct AddressInfo *ai; + if (0 == + memcmp (&GST_my_identity, + &address->peer, + sizeof (struct GNUNET_PeerIdentity))) + return; /* our own, ignore! */ ai = find_ai (address, session); if (NULL == ai) { @@ -429,6 +439,12 @@ GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_AddressRecord *ar; struct AddressInfo *ai; + if (0 == + memcmp (&GST_my_identity, + &address->peer, + sizeof (struct GNUNET_PeerIdentity))) + return; /* our own, ignore! */ + /* Sanity checks for a valid inbound address */ if (NULL == address->transport_name) { @@ -487,6 +503,11 @@ GST_ats_add_address (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_AddressRecord *ar; struct AddressInfo *ai; + if (0 == + memcmp (&GST_my_identity, + &address->peer, + sizeof (struct GNUNET_PeerIdentity))) + return; /* our own, ignore! */ /* validadte address */ if (NULL == address->transport_name) { @@ -537,6 +558,11 @@ GST_ats_new_session (const struct GNUNET_HELLO_Address *address, { struct AddressInfo *ai; + if (0 == + memcmp (&GST_my_identity, + &address->peer, + sizeof (struct GNUNET_PeerIdentity))) + return; /* our own, ignore! */ ai = find_ai (address, NULL); if (NULL == ai) { @@ -615,6 +641,11 @@ GST_ats_del_session (const struct GNUNET_HELLO_Address *address, { struct AddressInfo *ai; + if (0 == + memcmp (&GST_my_identity, + &address->peer, + sizeof (struct GNUNET_PeerIdentity))) + return; /* our own, ignore! */ if (NULL == session) { GNUNET_break (0); @@ -828,6 +859,11 @@ GST_ats_expire_address (const struct GNUNET_HELLO_Address *address) { struct AddressInfo *ai; + if (0 == + memcmp (&GST_my_identity, + &address->peer, + sizeof (struct GNUNET_PeerIdentity))) + return; /* our own, ignore! */ LOG (GNUNET_ERROR_TYPE_DEBUG, "Address %s of peer %s expired\n", GST_plugins_a2s (address), diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index e84ef9898..55caf407a 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c @@ -990,7 +990,8 @@ transport_notify_ready (void *cls, if (th->notify_size + sizeof (struct OutboundMessage) > size) break; /* does not fit */ if (GNUNET_BANDWIDTH_tracker_get_delay - (&n->out_tracker, th->notify_size).rel_value_us > 0) + (&n->out_tracker, + th->notify_size).rel_value_us > 0) break; /* too early */ GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap)); n->hn = NULL; -- 2.25.1