also generate PONG if PING contains an empty address:
authorChristian Grothoff <christian@grothoff.org>
Sun, 23 Oct 2011 17:20:21 +0000 (17:20 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 23 Oct 2011 17:20:21 +0000 (17:20 +0000)
src/transport/gnunet-service-transport_neighbours.c
src/transport/gnunet-service-transport_validation.c

index bd86fcdbd10f51ed23b43f1934346edea64f71a7..802a2cf326ae1ffad36e2447e586112a62f44a0c 100644 (file)
@@ -973,8 +973,13 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity
                               gettext_noop
                               ("# messages discarded due to lack of neighbour record"),
                               1, GNUNET_NO);
-    *do_forward = GNUNET_NO;
-    return GNUNET_TIME_UNIT_ZERO;
+    GST_neighbours_try_connect (sender);
+    n = lookup_neighbour (sender);
+    if (NULL == n)
+    {
+      *do_forward = GNUNET_NO;
+      return GNUNET_TIME_UNIT_ZERO;
+    }
   }
   if (GNUNET_YES != n->is_connected)
   {
index 6b6b017684ca2fe97fdacc6ce92376cd56e5400d..fd9ded10e6f3323cb4dd82664254e700aee68a56 100644 (file)
@@ -604,25 +604,31 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
   alen = ntohs (hdr->size) - sizeof (struct TransportPingMessage);
   /* peer wants to confirm that this is one of our addresses, this is what is
    * used for address validation */
-
-  addrend = memchr (addr, '\0', alen);
-  if (NULL == addrend)
+  if (0 < alen)
   {
-    GNUNET_break_op (0);
-    return;
-  }
-  addrend++;
-  slen = strlen (addr) + 1;
-  alen -= slen;
-
-  if (GNUNET_YES !=
-      GST_hello_test_address (addr, addrend, alen, &sig_cache, &sig_cache_exp))
+    addrend = memchr (addr, '\0', alen);
+    if (NULL == addrend)
+      {
+       GNUNET_break_op (0);
+       return;
+      }
+    addrend++;
+    slen = strlen (addr) + 1;
+    alen -= slen;
+    
+    if (GNUNET_YES !=
+       GST_hello_test_address (addr, addrend, alen, &sig_cache, &sig_cache_exp))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                 _
+                 ("Not confirming PING with address `%s' since I cannot confirm having this address.\n"),
+                 GST_plugins_a2s (addr, addrend, alen));
+      return;
+    }
+  } 
+  else
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _
-                ("Not confirming PING with address `%s' since I cannot confirm having this address.\n"),
-                GST_plugins_a2s (addr, addrend, alen));
-    return;
+    slen = 0;
   }
 
   pong = GNUNET_malloc (sizeof (struct TransportPongMessage) + alen + slen);