gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r18090 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r18090 - gnunet/src/transport
Date: Thu, 10 Nov 2011 10:50:37 +0100

Author: wachs
Date: 2011-11-10 10:50:37 +0100 (Thu, 10 Nov 2011)
New Revision: 18090

Modified:
   gnunet/src/transport/gnunet-service-transport_validation.c
Log:
handle PONG only if expected


Modified: gnunet/src/transport/gnunet-service-transport_validation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_validation.c  2011-11-10 
09:29:23 UTC (rev 18089)
+++ gnunet/src/transport/gnunet-service-transport_validation.c  2011-11-10 
09:50:37 UTC (rev 18090)
@@ -245,6 +245,10 @@
    */
   int in_use;
 
+  /**
+   * Are we expecting a PONG message for this validation entry?
+   */
+  int expecting_pong;
 };
 
 
@@ -488,6 +492,7 @@
                               gettext_noop
                               ("# PING without HELLO messages sent"), 1,
                               GNUNET_NO);
+    ve->expecting_pong = GNUNET_YES;
   }
 }
 
@@ -591,6 +596,7 @@
                                                   &timeout_hello_validation, 
ve);
   GNUNET_CONTAINER_multihashmap_put (validation_map, 
&address->peer.hashPubKey, ve,
                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+  ve->expecting_pong = GNUNET_NO;
   return ve;
 }
 
@@ -995,7 +1001,7 @@
   address.address_length = addrlen;
   address.transport_name = tname;
   ve = find_validation_entry (NULL, &address);
-  if (NULL == ve)
+  if ((NULL == ve) || (ve->expecting_pong == GNUNET_NO))
   {
     GNUNET_STATISTICS_update (GST_stats,
                               gettext_noop
@@ -1010,6 +1016,16 @@
     return;
   }
 
+  if (GNUNET_OK !=
+      GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN,
+                                &pong->purpose, &pong->signature,
+                                &ve->public_key))
+  {
+    GNUNET_break_op (0);
+    return;
+  }
+
+  ve->expecting_pong = GNUNET_NO;
   if (GNUNET_TIME_absolute_get_remaining
       (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value == 0)
   {
@@ -1019,14 +1035,6 @@
                               GNUNET_NO);
     return;
   }
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN,
-                                &pong->purpose, &pong->signature,
-                                &ve->public_key))
-  {
-    GNUNET_break_op (0);
-    return;
-  }
 #if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Address validated for peer `%s' with plugin `%s': `%s'\n",




reply via email to

[Prev in Thread] Current Thread [Next in Thread]