aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2024-02-05 11:52:19 +0100
committert3sserakt <t3ss@posteo.de>2024-02-05 13:21:00 +0100
commit67c90f846cd2df62f9eefc896ba95814e76bbf51 (patch)
treec25f101dfcb6718bbdf3926802bb88d2e131a717
parent3ff5ca2600bb75814bd00c616fcc8e6b5a5e04b1 (diff)
downloadgnunet-67c90f846cd2df62f9eefc896ba95814e76bbf51.tar.gz
gnunet-67c90f846cd2df62f9eefc896ba95814e76bbf51.zip
Core: Fixed bug to stop keepalive after handling ping.
-rw-r--r--src/service/core/gnunet-service-core_kx.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/service/core/gnunet-service-core_kx.c b/src/service/core/gnunet-service-core_kx.c
index 68efe98f0..a07d75188 100644
--- a/src/service/core/gnunet-service-core_kx.c
+++ b/src/service/core/gnunet-service-core_kx.c
@@ -855,6 +855,7 @@ handle_ephemeral_key (void *cls, const struct EphemeralKeyMessage *m)
855 struct GNUNET_TIME_Absolute end_t; 855 struct GNUNET_TIME_Absolute end_t;
856 struct GNUNET_TIME_Absolute now; 856 struct GNUNET_TIME_Absolute now;
857 enum GNUNET_CORE_KxState sender_status; 857 enum GNUNET_CORE_KxState sender_status;
858 enum GNUNET_GenericReturnValue do_verify = GNUNET_YES;
858 859
859 end_t = GNUNET_TIME_absolute_ntoh (m->expiration_time); 860 end_t = GNUNET_TIME_absolute_ntoh (m->expiration_time);
860 if (((GNUNET_CORE_KX_STATE_KEY_RECEIVED == kx->status) || 861 if (((GNUNET_CORE_KX_STATE_KEY_RECEIVED == kx->status) ||
@@ -878,14 +879,14 @@ handle_ephemeral_key (void *cls, const struct EphemeralKeyMessage *m)
878 { 879 {
879 GNUNET_STATISTICS_update (GSC_stats, 880 GNUNET_STATISTICS_update (GSC_stats,
880 gettext_noop ( 881 gettext_noop (
881 "# duplicate ephemeral keys ignored"), 882 "# duplicate ephemeral keys. Not verifying."),
882 1, 883 1,
883 GNUNET_NO); 884 GNUNET_NO);
884 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 885 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
885 "Ignoring duplicate EPHEMERAL_KEY from %s\n", 886 "Duplicate EPHEMERAL_KEY from %s, do not verify\n",
886 GNUNET_i2s (&m->origin_identity)); 887 GNUNET_i2s (&m->origin_identity));
887 GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer); 888 GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
888 return; 889 do_verify = GNUNET_NO;
889 } 890 }
890 if (0 != memcmp (&m->origin_identity, 891 if (0 != memcmp (&m->origin_identity,
891 kx->peer, 892 kx->peer,
@@ -899,7 +900,7 @@ handle_ephemeral_key (void *cls, const struct EphemeralKeyMessage *m)
899 GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer); 900 GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
900 return; 901 return;
901 } 902 }
902 if ((ntohl (m->purpose.size) != 903 if (do_verify && ((ntohl (m->purpose.size) !=
903 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) 904 sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
904 + sizeof(struct GNUNET_TIME_AbsoluteNBO) 905 + sizeof(struct GNUNET_TIME_AbsoluteNBO)
905 + sizeof(struct GNUNET_TIME_AbsoluteNBO) 906 + sizeof(struct GNUNET_TIME_AbsoluteNBO)
@@ -909,7 +910,7 @@ handle_ephemeral_key (void *cls, const struct EphemeralKeyMessage *m)
909 GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY, 910 GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY,
910 &m->purpose, 911 &m->purpose,
911 &m->signature, 912 &m->signature,
912 &m->origin_identity.public_key))) 913 &m->origin_identity.public_key))))
913 { 914 {
914 /* invalid signature */ 915 /* invalid signature */
915 GNUNET_break_op (0); 916 GNUNET_break_op (0);
@@ -1140,6 +1141,11 @@ handle_ping (void *cls, const struct PingMessage *m)
1140 1, 1141 1,
1141 GNUNET_NO); 1142 GNUNET_NO);
1142 GNUNET_MQ_send (kx->mq, env); 1143 GNUNET_MQ_send (kx->mq, env);
1144 if (NULL != kx->keep_alive_task)
1145 {
1146 GNUNET_SCHEDULER_cancel (kx->keep_alive_task);
1147 kx->keep_alive_task = GNUNET_SCHEDULER_add_delayed (MIN_PING_FREQUENCY, &send_keep_alive, kx);
1148 }
1143 GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer); 1149 GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
1144} 1150}
1145 1151