aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-communicator-udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-communicator-udp.c')
-rw-r--r--src/transport/gnunet-communicator-udp.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c
index b6edff485..70848ff79 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -1273,7 +1273,7 @@ pass_plaintext_to_core (struct SenderAddress *sender,
1273 const struct GNUNET_MessageHeader *hdr = plaintext; 1273 const struct GNUNET_MessageHeader *hdr = plaintext;
1274 const char *pos = plaintext; 1274 const char *pos = plaintext;
1275 1275
1276 while (ntohs (hdr->size) < plaintext_len) 1276 while (ntohs (hdr->size) <= plaintext_len)
1277 { 1277 {
1278 GNUNET_STATISTICS_update (stats, 1278 GNUNET_STATISTICS_update (stats,
1279 "# bytes given to core", 1279 "# bytes given to core",
@@ -1722,6 +1722,12 @@ try_handle_plaintext (struct SenderAddress *sender,
1722 const struct UDPAck *ack = (const struct UDPAck *) buf; 1722 const struct UDPAck *ack = (const struct UDPAck *) buf;
1723 uint16_t type; 1723 uint16_t type;
1724 1724
1725 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1726 "try_handle_plaintext of size %u (%u %u) and type %u\n",
1727 buf_size,
1728 ntohs (hdr->size),
1729 sizeof(*hdr),
1730 ntohs (hdr->type));
1725 if (sizeof(*hdr) > buf_size) 1731 if (sizeof(*hdr) > buf_size)
1726 return; /* not even a header */ 1732 return; /* not even a header */
1727 if (ntohs (hdr->size) > buf_size) 1733 if (ntohs (hdr->size) > buf_size)
@@ -2202,7 +2208,8 @@ verify_confirmation (const struct GNUNET_CRYPTO_EcdhePublicKey *ephemeral,
2202{ 2208{
2203 struct UdpHandshakeSignature uhs; 2209 struct UdpHandshakeSignature uhs;
2204 2210
2205 uhs.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_HANDSHAKE); 2211 uhs.purpose.purpose = htonl (
2212 GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_HANDSHAKE);
2206 uhs.purpose.size = htonl (sizeof(uhs)); 2213 uhs.purpose.size = htonl (sizeof(uhs));
2207 uhs.sender = uc->sender; 2214 uhs.sender = uc->sender;
2208 uhs.receiver = my_identity; 2215 uhs.receiver = my_identity;
@@ -2350,7 +2357,8 @@ sock_read (void *cls)
2350 "received UDPBroadcast from %s\n", 2357 "received UDPBroadcast from %s\n",
2351 GNUNET_a2s ((const struct sockaddr *) addr_verify, salen)); 2358 GNUNET_a2s ((const struct sockaddr *) addr_verify, salen));
2352 ub = (const struct UDPBroadcast *) buf; 2359 ub = (const struct UDPBroadcast *) buf;
2353 uhs.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_BROADCAST); 2360 uhs.purpose.purpose = htonl (
2361 GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_BROADCAST);
2354 uhs.purpose.size = htonl (sizeof(uhs)); 2362 uhs.purpose.size = htonl (sizeof(uhs));
2355 uhs.sender = ub->sender; 2363 uhs.sender = ub->sender;
2356 sender = ub->sender; 2364 sender = ub->sender;
@@ -2366,10 +2374,11 @@ sock_read (void *cls)
2366 GNUNET_i2s (&sender)); 2374 GNUNET_i2s (&sender));
2367 GNUNET_CRYPTO_hash ((struct sockaddr *) addr_verify, salen, &uhs.h_address); 2375 GNUNET_CRYPTO_hash ((struct sockaddr *) addr_verify, salen, &uhs.h_address);
2368 if (GNUNET_OK == 2376 if (GNUNET_OK ==
2369 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_BROADCAST, 2377 GNUNET_CRYPTO_eddsa_verify (
2370 &uhs, 2378 GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_BROADCAST,
2371 &ub->sender_sig, 2379 &uhs,
2372 &ub->sender.public_key)) 2380 &ub->sender_sig,
2381 &ub->sender.public_key))
2373 { 2382 {
2374 char *addr_s; 2383 char *addr_s;
2375 enum GNUNET_NetworkType nt; 2384 enum GNUNET_NetworkType nt;
@@ -2699,7 +2708,8 @@ mq_send_kx (struct GNUNET_MQ_Handle *mq,
2699 uc.sender = my_identity; 2708 uc.sender = my_identity;
2700 uc.monotonic_time = 2709 uc.monotonic_time =
2701 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_monotonic (cfg)); 2710 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_monotonic (cfg));
2702 uhs.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_HANDSHAKE); 2711 uhs.purpose.purpose = htonl (
2712 GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_HANDSHAKE);
2703 uhs.purpose.size = htonl (sizeof(uhs)); 2713 uhs.purpose.size = htonl (sizeof(uhs));
2704 uhs.sender = my_identity; 2714 uhs.sender = my_identity;
2705 uhs.receiver = receiver->target; 2715 uhs.receiver = receiver->target;
@@ -3644,7 +3654,8 @@ iface_proc (void *cls,
3644 bi->salen = addrlen; 3654 bi->salen = addrlen;
3645 bi->found = GNUNET_YES; 3655 bi->found = GNUNET_YES;
3646 bi->bcm.sender = my_identity; 3656 bi->bcm.sender = my_identity;
3647 ubs.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_BROADCAST); 3657 ubs.purpose.purpose = htonl (
3658 GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_BROADCAST);
3648 ubs.purpose.size = htonl (sizeof(ubs)); 3659 ubs.purpose.size = htonl (sizeof(ubs));
3649 ubs.sender = my_identity; 3660 ubs.sender = my_identity;
3650 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3661 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,