endif
gnunet_service_mesh_enc_SOURCES = \
- gnunet-service-mesh-enc.c \
gnunet-service-mesh_tunnel.c \
- gnunet-service-mesh_channel.c \
gnunet-service-mesh_connection.c \
+ gnunet-service-mesh_channel.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 \
/* 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);
*
* @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);
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);
/**
- * 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.
* GNUNET_SYSERR to close it (signal serious error)
*/
int
-GMC_handle_fwd (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
-{
- return handle_mesh_encrypted (peer,
- (struct GNUNET_MESH_Encrypted *)message,
- GNUNET_YES);
-}
-
-/**
- * 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)
+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_NO);
+ (struct GNUNET_MESH_Encrypted *)message);
}
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)
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.
* GNUNET_SYSERR to close it (signal serious error)
*/
int
-GMC_handle_fwd (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);
+GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message);
/**
* Core handler for mesh network traffic point-to-point acks.
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}
};
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:
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,
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;
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
- */
- case 280: return "GNUNET_MESSAGE_TYPE_MESH_FWD";
-
- /**
- * Ask the mesh service to destroy a tunnel
+ * Encrypted payload.
*/
- case 281: return "GNUNET_MESSAGE_TYPE_MESH_BCK";
+ case 280: return "GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED";
/**
* Local payload traffic
[consensus]
AUTOSTART = NO
+
+[nat]
+# Allow running on systems with only loopback?
+RETURN_LOCAL_ADDRESSES = YES
+# Disable redundant addresses...
+DISABLEV6 = YES
+USE_LOCALADDR = YES
+