gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r30253 - gnunet/src/mesh
Date: Thu, 17 Oct 2013 15:05:52 +0200

Author: bartpolot
Date: 2013-10-17 15:05:52 +0200 (Thu, 17 Oct 2013)
New Revision: 30253

Modified:
   gnunet/src/mesh/Makefile.am
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_connection.h
   gnunet/src/mesh/gnunet-service-mesh_peer.c
   gnunet/src/mesh/gnunet-service-mesh_tunnel.c
   gnunet/src/mesh/mesh_common.c
   gnunet/src/mesh/test_mesh.conf
Log:
- multiple fixes


Modified: gnunet/src/mesh/Makefile.am
===================================================================
--- gnunet/src/mesh/Makefile.am 2013-10-17 09:47:05 UTC (rev 30252)
+++ gnunet/src/mesh/Makefile.am 2013-10-17 13:05:52 UTC (rev 30253)
@@ -102,15 +102,15 @@
 endif
 
 gnunet_service_mesh_enc_SOURCES = \
- gnunet-service-mesh-enc.c \
  gnunet-service-mesh_tunnel.c \
+ gnunet-service-mesh_connection.c \
  gnunet-service-mesh_channel.c \
- gnunet-service-mesh_connection.c \
+ gnunet-service-mesh_local.c \
  gnunet-service-mesh_peer.c \
  gnunet-service-mesh_dht.c \
- gnunet-service-mesh_local.c \
  mesh_path.c \
- mesh_common.c
+ mesh_common.c \
+ gnunet-service-mesh-enc.c
 gnunet_service_mesh_enc_CFLAGS = $(AM_CFLAGS)
 gnunet_service_mesh_enc_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \

Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-17 09:47:05 UTC 
(rev 30252)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-17 13:05:52 UTC 
(rev 30253)
@@ -409,8 +409,7 @@
   /* Send ACK if needed, after accounting for sent ID in fc->queue_n */
   switch (type)
   {
-    case GNUNET_MESSAGE_TYPE_MESH_FWD:
-    case GNUNET_MESSAGE_TYPE_MESH_BCK:
+    case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
       fc->last_pid_sent++;
       LOG (GNUNET_ERROR_TYPE_DEBUG, "!   accounting pid %u\n", 
fc->last_pid_sent);
 //       send_ack (c, ch, fwd);
@@ -1309,23 +1308,23 @@
  *
  * @param peer Peer identity this notification is about.
  * @param message Encrypted message.
- * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
  *
  * @return GNUNET_OK to keep the connection open,
  *         GNUNET_SYSERR to close it (signal serious error)
  */
 static int
 handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer,
-                       const struct GNUNET_MESH_Encrypted *msg,
-                       int fwd)
+                       const struct GNUNET_MESH_Encrypted *msg)
 {
   struct MeshConnection *c;
   struct MeshPeer *neighbor;
   struct MeshFlowControl *fc;
+  GNUNET_PEER_Id peer_id;
   uint32_t pid;
   uint32_t ttl;
   uint16_t type;
   size_t size;
+  int fwd;
 
   /* Check size */
   size = ntohs (msg->header.size);
@@ -1350,15 +1349,27 @@
     return GNUNET_OK;
   }
 
-  fc = fwd ? &c->bck_fc : &c->fwd_fc;
-
   /* Check if origin is as expected */
-  neighbor = get_hop (c, !fwd);
-  if (GNUNET_PEER_search (peer) != GMP_get_short_id (neighbor))
+  neighbor = get_prev_hop (c);
+  peer_id = GNUNET_PEER_search (peer);
+  if (peer_id == GMP_get_short_id (neighbor))
   {
-    GNUNET_break_op (0);
-    return GNUNET_OK;
+    fwd = GNUNET_YES;
   }
+  else
+  {
+    neighbor = get_next_hop (c);
+    if (peer_id == GMP_get_short_id (neighbor))
+    {
+      fwd = GNUNET_NO;
+    }
+    else
+    {
+      GNUNET_break_op (0);
+      return GNUNET_OK;
+    }
+  }
+  fc = fwd ? &c->bck_fc : &c->fwd_fc;
 
   /* Check PID */
   pid = ntohl (msg->pid);
@@ -1421,7 +1432,7 @@
 
 
 /**
- * Core handler for mesh network traffic going orig->dest.
+ * Core handler for encrypted mesh network traffic (channel mgmt, data).
  *
  * @param cls Closure (unused).
  * @param message Message received.
@@ -1431,34 +1442,14 @@
  *         GNUNET_SYSERR to close it (signal serious error)
  */
 int
-GMC_handle_fwd (void *cls, const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_MessageHeader *message)
+GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer,
+                      const struct GNUNET_MessageHeader *message)
 {
   return handle_mesh_encrypted (peer,
-                                (struct GNUNET_MESH_Encrypted *)message,
-                                GNUNET_YES);
+                                (struct GNUNET_MESH_Encrypted *)message);
 }
 
-/**
- * Core handler for mesh network traffic going dest->orig.
- *
- * @param cls Closure (unused).
- * @param message Message received.
- * @param peer Peer who sent the message.
- *
- * @return GNUNET_OK to keep the connection open,
- *         GNUNET_SYSERR to close it (signal serious error)
- */
-int
-GMC_handle_bck (void *cls, const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_MessageHeader *message)
-{
-  return handle_mesh_encrypted (peer,
-                                (struct GNUNET_MESH_Encrypted *)message,
-                                GNUNET_NO);
-}
 
-
 /**
  * Core handler for mesh network traffic point-to-point acks.
  *
@@ -2118,8 +2109,7 @@
     struct GNUNET_MESH_ConnectionBroken  *bmsg;
     uint32_t ttl;
 
-    case GNUNET_MESSAGE_TYPE_MESH_FWD:
-    case GNUNET_MESSAGE_TYPE_MESH_BCK:
+    case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
       emsg = (struct GNUNET_MESH_Encrypted *) data;
       ttl = ntohl (emsg->ttl);
       if (0 == ttl)

Modified: gnunet/src/mesh/gnunet-service-mesh_connection.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.h    2013-10-17 09:47:05 UTC 
(rev 30252)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.h    2013-10-17 13:05:52 UTC 
(rev 30253)
@@ -136,7 +136,7 @@
                     const struct GNUNET_MessageHeader *message);
 
 /**
- * Core handler for mesh network traffic going orig->dest.
+ * Core handler for encrypted mesh network traffic (channel mgmt, data).
  *
  * @param cls Closure (unused).
  * @param message Message received.
@@ -146,25 +146,10 @@
  *         GNUNET_SYSERR to close it (signal serious error)
  */
 int
-GMC_handle_fwd (void *cls, const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_MessageHeader *message);
+GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer,
+                      const struct GNUNET_MessageHeader *message);
 
-
 /**
- * Core handler for mesh network traffic going dest->orig.
- *
- * @param cls Closure (unused).
- * @param message Message received.
- * @param peer Peer who sent the message.
- *
- * @return GNUNET_OK to keep the connection open,
- *         GNUNET_SYSERR to close it (signal serious error)
- */
-int
-GMC_handle_bck (void *cls, const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_MessageHeader *message);
-
-/**
  * Core handler for mesh network traffic point-to-point acks.
  *
  * @param cls closure

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-10-17 09:47:05 UTC (rev 
30252)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-10-17 13:05:52 UTC (rev 
30253)
@@ -332,8 +332,7 @@
     sizeof (struct GNUNET_MESH_ACK)},
   {&GMC_handle_poll, GNUNET_MESSAGE_TYPE_MESH_POLL,
     sizeof (struct GNUNET_MESH_Poll)},
-  {&GMC_handle_fwd, GNUNET_MESSAGE_TYPE_MESH_FWD, 0},
-  {&GMC_handle_bck, GNUNET_MESSAGE_TYPE_MESH_BCK, 0},
+  {&GMC_handle_encrypted, GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED, 0},
   {NULL, 0, 0}
 };
 
@@ -774,8 +773,7 @@
       case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY:
         LOG (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n");
         /* fall through */
-      case GNUNET_MESSAGE_TYPE_MESH_FWD:
-      case GNUNET_MESSAGE_TYPE_MESH_BCK:
+      case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
       case GNUNET_MESSAGE_TYPE_MESH_ACK:
       case GNUNET_MESSAGE_TYPE_MESH_POLL:
       case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
@@ -872,8 +870,7 @@
     case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY:
     case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
     case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
-    case GNUNET_MESSAGE_TYPE_MESH_FWD:
-    case GNUNET_MESSAGE_TYPE_MESH_BCK:
+    case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
     case GNUNET_MESSAGE_TYPE_MESH_ACK:
     case GNUNET_MESSAGE_TYPE_MESH_POLL:
       LOG (GNUNET_ERROR_TYPE_DEBUG,

Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-10-17 09:47:05 UTC 
(rev 30252)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-10-17 13:05:52 UTC 
(rev 30253)
@@ -1199,10 +1199,10 @@
   type = ntohs (message->type);
   switch (type)
   {
-    case GNUNET_MESSAGE_TYPE_MESH_FWD:
-    case GNUNET_MESSAGE_TYPE_MESH_BCK:
+    case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
     case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
     case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
+    case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
       msg->cid = *GMC_get_id (c);
       msg->ttl = htonl (default_ttl);
       break;

Modified: gnunet/src/mesh/mesh_common.c
===================================================================
--- gnunet/src/mesh/mesh_common.c       2013-10-17 09:47:05 UTC (rev 30252)
+++ gnunet/src/mesh/mesh_common.c       2013-10-17 13:05:52 UTC (rev 30253)
@@ -146,21 +146,16 @@
     case 274: return "GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY";
 
       /**
-       * Confirm the creation of a channel
+       * Confirm the creation of a channel.
        */
     case 275: return "GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK";
 
       /**
-       * Ask the mesh service to create a new tunnel
+       * Encrypted payload.
        */
-    case 280: return "GNUNET_MESSAGE_TYPE_MESH_FWD";
+    case 280: return "GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED";
 
       /**
-       * Ask the mesh service to destroy a tunnel
-       */
-    case 281: return "GNUNET_MESSAGE_TYPE_MESH_BCK";
-
-      /**
        * Local payload traffic
        */
     case 285: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA";

Modified: gnunet/src/mesh/test_mesh.conf
===================================================================
--- gnunet/src/mesh/test_mesh.conf      2013-10-17 09:47:05 UTC (rev 30252)
+++ gnunet/src/mesh/test_mesh.conf      2013-10-17 13:05:52 UTC (rev 30253)
@@ -79,3 +79,11 @@
 
 [consensus]
 AUTOSTART = NO
+
+[nat]
+# Allow running on systems with only loopback?
+RETURN_LOCAL_ADDRESSES = YES
+# Disable redundant addresses...
+DISABLEV6 = YES
+USE_LOCALADDR = YES
+




reply via email to

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