gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30617 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r30617 - gnunet/src/mesh
Date: Thu, 7 Nov 2013 20:07:11 +0100

Author: bartpolot
Date: 2013-11-07 20:07:11 +0100 (Thu, 07 Nov 2013)
New Revision: 30617

Modified:
   gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- debug


Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-11-07 18:33:03 UTC 
(rev 30616)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-11-07 19:07:11 UTC 
(rev 30617)
@@ -672,8 +672,9 @@
 static void
 send_ephemeral (struct MeshTunnel3 *t)
 {
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "%s()\n", __FUNCTION__);
+
   kx_msg.sender_status = htonl (t->state);
-
   send_kx (t, &kx_msg.header);
 }
 
@@ -687,12 +688,20 @@
 {
   struct GNUNET_MESH_KX_Ping msg;
 
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "%s()\n", __FUNCTION__);
   msg.header.size = htons (sizeof (msg));
   msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_KX_PING);
   msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
   msg.target = *GMP_get_id (t->peer);
   msg.nonce = t->kx_ctx->challenge;
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  sending %u\n", msg.nonce);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  towards %s\n", GNUNET_i2s (&msg.target));
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  using e %s\n", GNUNET_h2s (&t->e_key));
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  using iv %u\n", msg.iv);
   t_encrypt (t, &msg.target, &msg.target, ping_encryption_size(), msg.iv);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  e sending %u\n", msg.nonce);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  e towards %s\n", GNUNET_i2s (&msg.target));
 
   send_kx (t, &msg.header);
 }
@@ -709,6 +718,7 @@
 {
   struct GNUNET_MESH_KX_Pong msg;
 
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "%s()\n", __FUNCTION__);
   msg.header.size = htons (sizeof (msg));
   msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_KX_PONG);
   msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
@@ -1091,10 +1101,12 @@
     return;
   }
   derive_key_material (&km, &msg->ephemeral_key);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  km is %s\n", GNUNET_h2s (&km));
   derive_symmertic (&t->e_key, &my_full_id, GMP_get_id (t->peer), &km);
   derive_symmertic (&t->d_key, GMP_get_id (t->peer), &my_full_id, &km);
   if (MESH_TUNNEL3_KEY_SENT == t->state)
   {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  our key was sent, send ping\n");
     send_ping (t);
     t->state = MESH_TUNNEL3_PING_SENT;
   }
@@ -1114,13 +1126,23 @@
 {
   struct GNUNET_MESH_KX_Ping res;
 
+  if (ntohs (msg->header.size) != sizeof (res))
+  {
+    GNUNET_break_op (0);
+    return;
+  }
+
   LOG (GNUNET_ERROR_TYPE_DEBUG, "  ping message\n");
-  t_decrypt (t, &res.target, &msg->target, ping_encryption_size(), msg->iv);
-  if (0 != memcmp (&my_full_id, &msg->target, sizeof (my_full_id)))
+  t_decrypt (t, &res.target, &msg->target, ping_encryption_size (), msg->iv);
+  if (0 != memcmp (&my_full_id, &res.target, sizeof (my_full_id)))
   {
     GNUNET_break (0);
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "  at %s\n", GNUNET_i2s (&my_full_id));
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "  for %s\n", GNUNET_i2s (&msg->target));
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  e got %u\n", msg->nonce);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  e towards %s\n", GNUNET_i2s 
(&msg->target));
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  using d %s\n", GNUNET_h2s (&t->d_key));
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  using iv %u\n", msg->iv);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  got %u\n", res.nonce);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  towards %s\n", GNUNET_i2s (&res.target));
     return;
   }
 
@@ -2018,7 +2040,7 @@
 
 
 /**
- * Is the tunnel using this path already?
+ * Is the tunnel this path already?
  *
  * @param t Tunnel.
  * @param p Path.




reply via email to

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