#define DUMP_KEYS_TO_STDERR GNUNET_NO
#endif
+#define MIN_TUNNEL_BUFFER 8
+#define MAX_TUNNEL_BUFFER 64
#define MAX_SKIPPED_KEYS 64
#define MAX_KEY_GAP 256
#define AX_HEADER_SIZE (sizeof (uint32_t) * 2\
* @param t Tunnel on which the message came.
* @param msg The ephemeral key message.
*
- * @return GNUNET_OK if message is fine, GNUNET_SYSERR otherwise.
+ * @return #GNUNET_OK if message is fine, #GNUNET_SYSERR otherwise.
*/
int
check_ephemeral (struct CadetTunnel *t,
}
-
/**
* The peer's ephemeral key has changed: update the symmetrical keys.
*
* @param msg Key eXchange Pong message.
*/
static void
-handle_pong (struct CadetTunnel *t, const struct GNUNET_CADET_KX_Pong *msg)
+handle_pong (struct CadetTunnel *t,
+ const struct GNUNET_CADET_KX_Pong *msg)
{
uint32_t challenge;
return;
}
- if (GNUNET_YES == ntohl (msg->force_reply))
+ if (GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY ==
+ (GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY & ntohl (msg->flags)))
GCT_send_ax_kx (t, GNUNET_NO);
if (CADET_TUNNEL_KEY_OK == t->estate)
GNUNET_CONTAINER_multipeermap_remove (tunnels,
GCP_get_id (t->peer), t));
+ while (NULL != t->tq_head)
+ unqueue_data (t->tq_head);
+
for (iter_c = t->connection_head; NULL != iter_c; iter_c = next_c)
{
next_c = iter_c->next;
{
/* Probably getting buffer for a channel create/handshake. */
LOG (GNUNET_ERROR_TYPE_DEBUG, " no channels, allow max\n");
- return 64;
+ return MIN_TUNNEL_BUFFER;
}
buffer = 0;
if (ch_buf > buffer)
buffer = ch_buf;
}
+ if (MIN_TUNNEL_BUFFER > buffer)
+ return MIN_TUNNEL_BUFFER;
+
+ if (MAX_TUNNEL_BUFFER < buffer)
+ {
+ GNUNET_break (0);
+ return MAX_TUNNEL_BUFFER;
+ }
return buffer;
}
{
if (NULL != q->cq)
{
+ GNUNET_assert (NULL == q->tqd);
GCC_cancel (q->cq);
/* tun_message_sent() will be called and free q */
}
GCT_send_ax_kx (struct CadetTunnel *t, int force_reply)
{
struct GNUNET_CADET_AX_KX msg;
+ enum GNUNET_CADET_AX_KX_Flags flags;
LOG (GNUNET_ERROR_TYPE_INFO, "===> AX_KX for %s\n", GCT_2s (t));
if (NULL != t->ephm_h)
msg.header.size = htons (sizeof (msg));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_AX_KX);
- msg.force_reply = htonl (force_reply);
+ flags = GNUNET_CADET_AX_KX_FLAG_NONE;
+ if (force_reply)
+ flags |= GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY;
+ msg.flags = htonl (flags);
GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->kx_0, &msg.ephemeral_key);
GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->DHRs, &msg.ratchet_key);
GNUNET_CRYPTO_ecdhe_key_get_public (ax->DHRs, &pub);
LOG2 (level, "TTT DHRs\t %s\n",
- GNUNET_h2s ((struct GNUNET_HashCode *) &pub));
+ GNUNET_i2s ((struct GNUNET_PeerIdentity *) &pub));
LOG2 (level, "TTT DHRr\t %s\n",
GNUNET_h2s ((struct GNUNET_HashCode *) &ax->DHRr));