aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-06-26 10:07:07 +0000
committerBart Polot <bart@net.in.tum.de>2015-06-26 10:07:07 +0000
commite9a7ca0fc5b07c4f2cd48bf61540aa189b1ee781 (patch)
tree55eaf4312fb46940c63260ab0910a5face3a46c4
parent4c6c3ef78b6e5875b15d9b0258508ca4f0263835 (diff)
downloadgnunet-e9a7ca0fc5b07c4f2cd48bf61540aa189b1ee781.tar.gz
gnunet-e9a7ca0fc5b07c4f2cd48bf61540aa189b1ee781.zip
- don't log old mesh versions as errors
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index 6cda9f7ff..e540a6ce8 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -773,17 +773,35 @@ check_ephemeral (struct CadetTunnel *t,
773{ 773{
774 /* Check message size */ 774 /* Check message size */
775 if (ntohs (msg->header.size) != sizeof (struct GNUNET_CADET_KX_Ephemeral)) 775 if (ntohs (msg->header.size) != sizeof (struct GNUNET_CADET_KX_Ephemeral))
776 {
777 /* This is probably an old "MESH" version. */
778 LOG (GNUNET_ERROR_TYPE_INFO,
779 "Expected ephemeral of size %u, got %u\n",
780 sizeof (struct GNUNET_CADET_KX_Ephemeral),
781 ntohs (msg->header.size));
776 return GNUNET_SYSERR; 782 return GNUNET_SYSERR;
783 }
777 784
778 /* Check signature size */ 785 /* Check signature size */
779 if (ntohl (msg->purpose.size) != ephemeral_purpose_size ()) 786 if (ntohl (msg->purpose.size) != ephemeral_purpose_size ())
787 {
788 LOG (GNUNET_ERROR_TYPE_WARNING,
789 "Expected signature purpose of size %u, got %u\n",
790 ephemeral_purpose_size (),
791 ntohs (msg->purpose.size));
780 return GNUNET_SYSERR; 792 return GNUNET_SYSERR;
793 }
781 794
782 /* Check origin */ 795 /* Check origin */
783 if (0 != memcmp (&msg->origin_identity, 796 if (0 != memcmp (&msg->origin_identity,
784 GCP_get_id (t->peer), 797 GCP_get_id (t->peer),
785 sizeof (struct GNUNET_PeerIdentity))) 798 sizeof (struct GNUNET_PeerIdentity)))
799 {
800 LOG (GNUNET_ERROR_TYPE_WARNING,
801 "Unexpected origin, got %s\n",
802 GNUNET_i2s (&msg->origin_identity));
786 return GNUNET_SYSERR; 803 return GNUNET_SYSERR;
804 }
787 805
788 /* Check signature */ 806 /* Check signature */
789 if (GNUNET_OK != 807 if (GNUNET_OK !=
@@ -791,7 +809,10 @@ check_ephemeral (struct CadetTunnel *t,
791 &msg->purpose, 809 &msg->purpose,
792 &msg->signature, 810 &msg->signature,
793 &msg->origin_identity.public_key)) 811 &msg->origin_identity.public_key))
812 {
813 LOG (GNUNET_ERROR_TYPE_WARNING, "Signature invalid\n");
794 return GNUNET_SYSERR; 814 return GNUNET_SYSERR;
815 }
795 816
796 return GNUNET_OK; 817 return GNUNET_OK;
797} 818}
@@ -2711,11 +2732,9 @@ handle_ephemeral (struct CadetTunnel *t,
2711{ 2732{
2712 LOG (GNUNET_ERROR_TYPE_INFO, "<=== EPHM for %s\n", GCT_2s (t)); 2733 LOG (GNUNET_ERROR_TYPE_INFO, "<=== EPHM for %s\n", GCT_2s (t));
2713 2734
2735 /* Some old versions are still around, don't log as error. */
2714 if (GNUNET_OK != check_ephemeral (t, msg)) 2736 if (GNUNET_OK != check_ephemeral (t, msg))
2715 {
2716 GNUNET_break_op (0);
2717 return; 2737 return;
2718 }
2719 2738
2720 /* If we get a proper OTR-style ephemeral, fallback to old crypto. */ 2739 /* If we get a proper OTR-style ephemeral, fallback to old crypto. */
2721 if (NULL != t->ax) 2740 if (NULL != t->ax)