aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-09 08:22:33 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-09 21:17:18 +0100
commitb92cddf9eff5f5fd8b5c9f754a75a79ad24ed14e (patch)
tree54622c07e30eea0379e86233da75ee29055f85d3
parentfc158da4ce098ce9e178efa03cd4cddb1ef6e7b9 (diff)
downloadgnunet-b92cddf9eff5f5fd8b5c9f754a75a79ad24ed14e.tar.gz
gnunet-b92cddf9eff5f5fd8b5c9f754a75a79ad24ed14e.zip
out-of-order PIDs are not exactly protocol violations, hence do not report as such
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index fa2bb962b..c0ac32b06 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -2422,6 +2422,7 @@ check_message (const struct GNUNET_MessageHeader *message,
2422 "%s on unknown connection %s\n", 2422 "%s on unknown connection %s\n",
2423 GC_m2s (ntohs (message->type)), 2423 GC_m2s (ntohs (message->type)),
2424 GNUNET_h2s (GC_h2hc (cid))); 2424 GNUNET_h2s (GC_h2hc (cid)));
2425 GNUNET_break_op (0);
2425 send_broken_unknown (cid, 2426 send_broken_unknown (cid,
2426 &my_full_id, 2427 &my_full_id,
2427 NULL, 2428 NULL,
@@ -2460,10 +2461,13 @@ check_message (const struct GNUNET_MessageHeader *message,
2460 pid, fc->last_pid_recv + 1, fc->last_ack_sent); 2461 pid, fc->last_pid_recv + 1, fc->last_ack_sent);
2461 if (GC_is_pid_bigger (pid, fc->last_ack_sent)) 2462 if (GC_is_pid_bigger (pid, fc->last_ack_sent))
2462 { 2463 {
2463 GNUNET_break_op (0); 2464 GNUNET_STATISTICS_update (stats,
2464 GNUNET_STATISTICS_update (stats, "# unsolicited message", 1, GNUNET_NO); 2465 "# unsolicited message",
2465 LOG (GNUNET_ERROR_TYPE_WARNING, "Received PID %u, (prev %u), ACK %u\n", 2466 1,
2466 pid, fc->last_pid_recv, fc->last_ack_sent); 2467 GNUNET_NO);
2468 LOG (GNUNET_ERROR_TYPE_WARNING,
2469 "Received PID %u, (prev %u), ACK %u\n",
2470 pid, fc->last_pid_recv, fc->last_ack_sent);
2467 return GNUNET_SYSERR; 2471 return GNUNET_SYSERR;
2468 } 2472 }
2469 if (GC_is_pid_bigger (pid, fc->last_pid_recv)) 2473 if (GC_is_pid_bigger (pid, fc->last_pid_recv))
@@ -2477,10 +2481,16 @@ check_message (const struct GNUNET_MessageHeader *message,
2477 } 2481 }
2478 else 2482 else
2479 { 2483 {
2480 GNUNET_STATISTICS_update (stats, "# out of order PID", 1, GNUNET_NO); 2484 GNUNET_STATISTICS_update (stats,
2481 if (GNUNET_NO == is_ooo_ok (fc->last_pid_recv, pid, fc->recv_bitmap)) 2485 "# out of order PID",
2486 1,
2487 GNUNET_NO);
2488 if (GNUNET_NO == is_ooo_ok (fc->last_pid_recv,
2489 pid,
2490 fc->recv_bitmap))
2482 { 2491 {
2483 LOG (GNUNET_ERROR_TYPE_WARNING, "PID %u unexpected (%u+), dropping!\n", 2492 LOG (GNUNET_ERROR_TYPE_WARNING,
2493 "PID %u unexpected (%u+), dropping!\n",
2484 pid, fc->last_pid_recv - 31); 2494 pid, fc->last_pid_recv - 31);
2485 return GNUNET_SYSERR; 2495 return GNUNET_SYSERR;
2486 } 2496 }
@@ -2489,7 +2499,8 @@ check_message (const struct GNUNET_MessageHeader *message,
2489 } 2499 }
2490 2500
2491 /* Count as connection confirmation. */ 2501 /* Count as connection confirmation. */
2492 if (CADET_CONNECTION_SENT == c->state || CADET_CONNECTION_ACK == c->state) 2502 if ( (CADET_CONNECTION_SENT == c->state) ||
2503 (CADET_CONNECTION_ACK == c->state) )
2493 { 2504 {
2494 connection_change_state (c, CADET_CONNECTION_READY); 2505 connection_change_state (c, CADET_CONNECTION_READY);
2495 if (NULL != c->t) 2506 if (NULL != c->t)
@@ -2591,7 +2602,6 @@ GCC_handle_encrypted (struct CadetPeer *peer,
2591 /* If something went wrong, discard message. */ 2602 /* If something went wrong, discard message. */
2592 if (GNUNET_SYSERR == fwd) 2603 if (GNUNET_SYSERR == fwd)
2593 { 2604 {
2594 GNUNET_break_op (0);
2595 GCC_check_connections (); 2605 GCC_check_connections ();
2596 return; 2606 return;
2597 } 2607 }