diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2023-09-25 14:24:41 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-09-25 14:24:41 +0200 |
commit | 99042c82dad38aa20ece204c62040f009704cf48 (patch) | |
tree | b0e0376c4d9ffed7a71bac5d72a3bd60094a92fd /src/transport/gnunet-communicator-udp.c | |
parent | 6e33d4434f0384e0d2c5f873b770714c1c9e7585 (diff) | |
download | gnunet-99042c82dad38aa20ece204c62040f009704cf48.tar.gz gnunet-99042c82dad38aa20ece204c62040f009704cf48.zip |
BUILD: Fix warnings/unused variables
Diffstat (limited to 'src/transport/gnunet-communicator-udp.c')
-rw-r--r-- | src/transport/gnunet-communicator-udp.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index f5cf7ab0f..a58423c95 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c | |||
@@ -1372,14 +1372,14 @@ setup_receiver_mq (struct ReceiverAddress *receiver); | |||
1372 | * Ideally those, not ACKed. | 1372 | * Ideally those, not ACKed. |
1373 | * | 1373 | * |
1374 | * @param ss_list_tail the oldest secret in the list of interest. | 1374 | * @param ss_list_tail the oldest secret in the list of interest. |
1375 | * @return GNUNET_YES if any secret was deleted. | 1375 | * @return number of deleted secrets. |
1376 | */ | 1376 | */ |
1377 | static enum GNUNET_GenericReturnValue | 1377 | unsigned int |
1378 | purge_secrets (struct SharedSecret *ss_list_tail) | 1378 | purge_secrets (struct SharedSecret *ss_list_tail) |
1379 | { | 1379 | { |
1380 | struct SharedSecret *pos; | 1380 | struct SharedSecret *pos; |
1381 | struct SharedSecret *ss_to_purge; | 1381 | struct SharedSecret *ss_to_purge; |
1382 | int deleted = 0; | 1382 | unsigned int deleted = 0; |
1383 | 1383 | ||
1384 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1384 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1385 | "Purging secrets.\n"); | 1385 | "Purging secrets.\n"); |
@@ -1398,6 +1398,7 @@ purge_secrets (struct SharedSecret *ss_list_tail) | |||
1398 | } | 1398 | } |
1399 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1399 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1400 | "Finished purging all, deleted %u.\n", deleted); | 1400 | "Finished purging all, deleted %u.\n", deleted); |
1401 | return deleted; | ||
1401 | } | 1402 | } |
1402 | 1403 | ||
1403 | 1404 | ||
@@ -1550,7 +1551,6 @@ static void | |||
1550 | kce_generate_cb (void *cls) | 1551 | kce_generate_cb (void *cls) |
1551 | { | 1552 | { |
1552 | struct SharedSecret *ss = cls; | 1553 | struct SharedSecret *ss = cls; |
1553 | static uint64_t kce_last_available = 0; | ||
1554 | ss->sender->kce_task = NULL; | 1554 | ss->sender->kce_task = NULL; |
1555 | 1555 | ||
1556 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1556 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1598,7 +1598,6 @@ try_handle_plaintext (struct SenderAddress *sender, | |||
1598 | size_t buf_size) | 1598 | size_t buf_size) |
1599 | { | 1599 | { |
1600 | const struct GNUNET_MessageHeader *hdr; | 1600 | const struct GNUNET_MessageHeader *hdr; |
1601 | const struct GNUNET_CRYPTO_EcdhePublicKey *ephemeral_pubkey; | ||
1602 | const struct UDPAck *ack; | 1601 | const struct UDPAck *ack; |
1603 | const struct UDPRekey *rekey; | 1602 | const struct UDPRekey *rekey; |
1604 | struct SharedSecret *ss_rekey; | 1603 | struct SharedSecret *ss_rekey; |
@@ -1657,7 +1656,7 @@ try_handle_plaintext (struct SenderAddress *sender, | |||
1657 | pass_plaintext_to_core (sender, buf_pos, bytes_remaining); | 1656 | pass_plaintext_to_core (sender, buf_pos, bytes_remaining); |
1658 | if (sender->num_secrets > MAX_SECRETS) | 1657 | if (sender->num_secrets > MAX_SECRETS) |
1659 | { | 1658 | { |
1660 | if (GNUNET_NO == purge_secrets (sender->ss_tail)) | 1659 | if (0 == purge_secrets (sender->ss_tail)) |
1661 | { | 1660 | { |
1662 | // No secret purged. Delete oldest. | 1661 | // No secret purged. Delete oldest. |
1663 | secret_destroy (sender->ss_tail); | 1662 | secret_destroy (sender->ss_tail); |
@@ -1702,7 +1701,6 @@ decrypt_box (const struct UDPBox *box, | |||
1702 | { | 1701 | { |
1703 | struct SharedSecret *ss = kce->ss; | 1702 | struct SharedSecret *ss = kce->ss; |
1704 | char out_buf[box_len - sizeof(*box)]; | 1703 | char out_buf[box_len - sizeof(*box)]; |
1705 | uint16_t rekeying; | ||
1706 | 1704 | ||
1707 | GNUNET_assert (NULL != ss->sender); | 1705 | GNUNET_assert (NULL != ss->sender); |
1708 | if (GNUNET_OK != try_decrypt (ss, | 1706 | if (GNUNET_OK != try_decrypt (ss, |
@@ -2120,7 +2118,7 @@ sock_read (void *cls) | |||
2120 | try_handle_plaintext (sender, &uc[1], sizeof(pbuf) - sizeof(*uc)); | 2118 | try_handle_plaintext (sender, &uc[1], sizeof(pbuf) - sizeof(*uc)); |
2121 | if (sender->num_secrets > MAX_SECRETS) | 2119 | if (sender->num_secrets > MAX_SECRETS) |
2122 | { | 2120 | { |
2123 | if (GNUNET_NO == purge_secrets (sender->ss_tail)) | 2121 | if (0 == purge_secrets (sender->ss_tail)) |
2124 | { | 2122 | { |
2125 | // No secret purged. Delete oldest. | 2123 | // No secret purged. Delete oldest. |
2126 | secret_destroy (sender->ss_tail); | 2124 | secret_destroy (sender->ss_tail); |
@@ -2321,7 +2319,7 @@ send_msg_with_kx (const struct GNUNET_MessageHeader *msg, struct | |||
2321 | 2319 | ||
2322 | if (receiver->num_secrets > MAX_SECRETS) | 2320 | if (receiver->num_secrets > MAX_SECRETS) |
2323 | { | 2321 | { |
2324 | if (GNUNET_NO == purge_secrets (receiver->ss_tail)) | 2322 | if (0 == purge_secrets (receiver->ss_tail)) |
2325 | { | 2323 | { |
2326 | // No secret purged. Delete oldest. | 2324 | // No secret purged. Delete oldest. |
2327 | secret_destroy (receiver->ss_tail); | 2325 | secret_destroy (receiver->ss_tail); |
@@ -2401,9 +2399,6 @@ static void | |||
2401 | create_rekey (struct ReceiverAddress *receiver, struct SharedSecret *ss, struct | 2399 | create_rekey (struct ReceiverAddress *receiver, struct SharedSecret *ss, struct |
2402 | UDPRekey *rekey) | 2400 | UDPRekey *rekey) |
2403 | { | 2401 | { |
2404 | uint8_t is_ss_rekey_sequence_allowed_zero = GNUNET_NO; | ||
2405 | uint8_t is_acks_available_below = GNUNET_NO; | ||
2406 | uint8_t send_rekey = GNUNET_NO; | ||
2407 | struct SharedSecret *ss_rekey; | 2402 | struct SharedSecret *ss_rekey; |
2408 | 2403 | ||
2409 | ss->rekey_initiated = GNUNET_YES; | 2404 | ss->rekey_initiated = GNUNET_YES; |
@@ -2462,7 +2457,7 @@ mq_send_d (struct GNUNET_MQ_Handle *mq, | |||
2462 | 2457 | ||
2463 | if (receiver->num_secrets > MAX_SECRETS) | 2458 | if (receiver->num_secrets > MAX_SECRETS) |
2464 | { | 2459 | { |
2465 | if (GNUNET_NO == purge_secrets (receiver->ss_tail)) | 2460 | if (0 == purge_secrets (receiver->ss_tail)) |
2466 | { | 2461 | { |
2467 | // No secret purged. Delete oldest. | 2462 | // No secret purged. Delete oldest. |
2468 | secret_destroy (receiver->ss_tail); | 2463 | secret_destroy (receiver->ss_tail); |
@@ -2490,8 +2485,8 @@ mq_send_d (struct GNUNET_MQ_Handle *mq, | |||
2490 | if (ss->rekey_initiated == GNUNET_NO) | 2485 | if (ss->rekey_initiated == GNUNET_NO) |
2491 | { | 2486 | { |
2492 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 2487 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2493 | "Injecting rekey for ss with byte sent %u\n", | 2488 | "Injecting rekey for ss with byte sent %lu\n", |
2494 | ss->bytes_sent); | 2489 | (unsigned long) ss->bytes_sent); |
2495 | create_rekey (receiver, ss, &rekey); | 2490 | create_rekey (receiver, ss, &rekey); |
2496 | inject_rekey = GNUNET_YES; | 2491 | inject_rekey = GNUNET_YES; |
2497 | payload_len += sizeof (rekey); | 2492 | payload_len += sizeof (rekey); |
@@ -2539,9 +2534,10 @@ mq_send_d (struct GNUNET_MQ_Handle *mq, | |||
2539 | receiver->address_len)) | 2534 | receiver->address_len)) |
2540 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); | 2535 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); |
2541 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2542 | "Sending UDPBox with payload size %u, %u acks left, %u bytes sent\n", | 2537 | "Sending UDPBox with payload size %u, %u acks left, %lu bytes sent\n", |
2543 | msize, | 2538 | msize, |
2544 | receiver->acks_available); | 2539 | receiver->acks_available, |
2540 | (unsigned long) ss->bytes_sent); | ||
2545 | ss->bytes_sent += sizeof (dgram); | 2541 | ss->bytes_sent += sizeof (dgram); |
2546 | receiver->acks_available--; | 2542 | receiver->acks_available--; |
2547 | GNUNET_MQ_impl_send_continue (mq); | 2543 | GNUNET_MQ_impl_send_continue (mq); |