aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-16 16:25:18 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-16 16:25:18 +0200
commit77cb689bc95d0dd37c88548ff0d3c2930fa7cf27 (patch)
treef8969161c8992c006c82798ad8d2267a4de08708 /src/cadet
parent59cd18790707fbe4600709f5337b3b67ce2a08f6 (diff)
downloadgnunet-77cb689bc95d0dd37c88548ff0d3c2930fa7cf27.tar.gz
gnunet-77cb689bc95d0dd37c88548ff0d3c2930fa7cf27.zip
add more KX stats to CADET
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/gnunet-service-cadet_tunnels.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c
index fb91a4a6a..6e8ce96b3 100644
--- a/src/cadet/gnunet-service-cadet_tunnels.c
+++ b/src/cadet/gnunet-service-cadet_tunnels.c
@@ -1356,6 +1356,10 @@ send_kx (struct CadetTunnel *t,
1356 CADET_TUNNEL_KEY_AX_SENT_AND_RECV); 1356 CADET_TUNNEL_KEY_AX_SENT_AND_RECV);
1357 GCC_transmit (cc, 1357 GCC_transmit (cc,
1358 env); 1358 env);
1359 GNUNET_STATISTICS_update (stats,
1360 "# KX transmitted",
1361 1,
1362 GNUNET_NO);
1359} 1363}
1360 1364
1361 1365
@@ -1429,9 +1433,12 @@ send_kx_auth (struct CadetTunnel *t,
1429 if (CADET_TUNNEL_KEY_OK != t->estate) 1433 if (CADET_TUNNEL_KEY_OK != t->estate)
1430 GCT_change_estate (t, 1434 GCT_change_estate (t,
1431 CADET_TUNNEL_KEY_AX_AUTH_SENT); 1435 CADET_TUNNEL_KEY_AX_AUTH_SENT);
1432
1433 GCC_transmit (cc, 1436 GCC_transmit (cc,
1434 env); 1437 env);
1438 GNUNET_STATISTICS_update (stats,
1439 "# KX_AUTH transmitted",
1440 1,
1441 GNUNET_NO);
1435} 1442}
1436 1443
1437 1444
@@ -1492,6 +1499,10 @@ update_ax_by_kx (struct CadetTunnelAxolotl *ax,
1492 ratchet_key, 1499 ratchet_key,
1493 sizeof (*ratchet_key))) 1500 sizeof (*ratchet_key)))
1494 { 1501 {
1502 GNUNET_STATISTICS_update (stats,
1503 "# Ratchet key already known",
1504 1,
1505 GNUNET_NO);
1495 LOG (GNUNET_ERROR_TYPE_DEBUG, 1506 LOG (GNUNET_ERROR_TYPE_DEBUG,
1496 "Ratchet key already known. Ignoring KX.\n"); 1507 "Ratchet key already known. Ignoring KX.\n");
1497 return GNUNET_NO; 1508 return GNUNET_NO;
@@ -1525,8 +1536,6 @@ update_ax_by_kx (struct CadetTunnelAxolotl *ax,
1525 GNUNET_CRYPTO_eddsa_ecdh (my_private_key, /* A */ 1536 GNUNET_CRYPTO_eddsa_ecdh (my_private_key, /* A */
1526 ephemeral_key, /* B0 */ 1537 ephemeral_key, /* B0 */
1527 &key_material[1]); 1538 &key_material[1]);
1528
1529
1530 } 1539 }
1531 1540
1532 /* ECDH A0 B0 */ 1541 /* ECDH A0 B0 */
@@ -1548,6 +1557,10 @@ update_ax_by_kx (struct CadetTunnelAxolotl *ax,
1548 { 1557 {
1549 LOG (GNUNET_ERROR_TYPE_DEBUG, 1558 LOG (GNUNET_ERROR_TYPE_DEBUG,
1550 "Root key of handshake already known. Ignoring KX.\n"); 1559 "Root key of handshake already known. Ignoring KX.\n");
1560 GNUNET_STATISTICS_update (stats,
1561 "# Root key already known",
1562 1,
1563 GNUNET_NO);
1551 return GNUNET_NO; 1564 return GNUNET_NO;
1552 } 1565 }
1553 1566
@@ -1680,6 +1693,10 @@ GCT_handle_kx (struct CadetTConnection *ct,
1680 struct CadetTunnelAxolotl *ax; 1693 struct CadetTunnelAxolotl *ax;
1681 int ret; 1694 int ret;
1682 1695
1696 GNUNET_STATISTICS_update (stats,
1697 "# KX received",
1698 1,
1699 GNUNET_NO);
1683 if (0 == 1700 if (0 ==
1684 memcmp (&t->ax.DHRr, 1701 memcmp (&t->ax.DHRr,
1685 &msg->ratchet_key, 1702 &msg->ratchet_key,
@@ -1687,6 +1704,10 @@ GCT_handle_kx (struct CadetTConnection *ct,
1687 { 1704 {
1688 LOG (GNUNET_ERROR_TYPE_DEBUG, 1705 LOG (GNUNET_ERROR_TYPE_DEBUG,
1689 "Got duplicate KX. Firing back KX_AUTH.\n"); 1706 "Got duplicate KX. Firing back KX_AUTH.\n");
1707 GNUNET_STATISTICS_update (stats,
1708 "# Duplicate KX received",
1709 1,
1710 GNUNET_NO);
1690 send_kx_auth (t, 1711 send_kx_auth (t,
1691 ct, 1712 ct,
1692 &t->ax, 1713 &t->ax,
@@ -1706,6 +1727,10 @@ GCT_handle_kx (struct CadetTConnection *ct,
1706 LOG (GNUNET_ERROR_TYPE_DEBUG, 1727 LOG (GNUNET_ERROR_TYPE_DEBUG,
1707 "Got duplicate unverified KX on %s. Fire back KX_AUTH again.\n", 1728 "Got duplicate unverified KX on %s. Fire back KX_AUTH again.\n",
1708 GCT_2s (t)); 1729 GCT_2s (t));
1730 GNUNET_STATISTICS_update (stats,
1731 "# Duplicate unverified KX received",
1732 1,
1733 GNUNET_NO);
1709 send_kx_auth (t, 1734 send_kx_auth (t,
1710 ct, 1735 ct,
1711 t->unverified_ax, 1736 t->unverified_ax,
@@ -1715,6 +1740,10 @@ GCT_handle_kx (struct CadetTConnection *ct,
1715 LOG (GNUNET_ERROR_TYPE_DEBUG, 1740 LOG (GNUNET_ERROR_TYPE_DEBUG,
1716 "Dropping old unverified KX state. Got a fresh KX for %s.\n", 1741 "Dropping old unverified KX state. Got a fresh KX for %s.\n",
1717 GCT_2s (t)); 1742 GCT_2s (t));
1743 GNUNET_STATISTICS_update (stats,
1744 "# Unverified KX dropped for fresh KX",
1745 1,
1746 GNUNET_NO);
1718 memset (t->unverified_ax, 1747 memset (t->unverified_ax,
1719 0, 1748 0,
1720 sizeof (struct CadetTunnelAxolotl)); 1749 sizeof (struct CadetTunnelAxolotl));
@@ -1726,6 +1755,10 @@ GCT_handle_kx (struct CadetTConnection *ct,
1726 LOG (GNUNET_ERROR_TYPE_DEBUG, 1755 LOG (GNUNET_ERROR_TYPE_DEBUG,
1727 "Creating fresh unverified KX for %s.\n", 1756 "Creating fresh unverified KX for %s.\n",
1728 GCT_2s (t)); 1757 GCT_2s (t));
1758 GNUNET_STATISTICS_update (stats,
1759 "# Fresh KX setup",
1760 1,
1761 GNUNET_NO);
1729 t->unverified_ax = GNUNET_new (struct CadetTunnelAxolotl); 1762 t->unverified_ax = GNUNET_new (struct CadetTunnelAxolotl);
1730 t->unverified_ax->DHRs = t->ax.DHRs; 1763 t->unverified_ax->DHRs = t->ax.DHRs;
1731 t->unverified_ax->kx_0 = t->ax.kx_0; 1764 t->unverified_ax->kx_0 = t->ax.kx_0;
@@ -1745,8 +1778,13 @@ GCT_handle_kx (struct CadetTConnection *ct,
1745 &msg->ratchet_key); 1778 &msg->ratchet_key);
1746 GNUNET_break (GNUNET_SYSERR != ret); 1779 GNUNET_break (GNUNET_SYSERR != ret);
1747 if (GNUNET_OK != ret) 1780 if (GNUNET_OK != ret)
1781 {
1782 GNUNET_STATISTICS_update (stats,
1783 "# Useless KX",
1784 1,
1785 GNUNET_NO);
1748 return; /* duplicate KX, nothing to do */ 1786 return; /* duplicate KX, nothing to do */
1749 1787 }
1750 /* move ahead in our state machine */ 1788 /* move ahead in our state machine */
1751 if (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate) 1789 if (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate)
1752 GCT_change_estate (t, 1790 GCT_change_estate (t,
@@ -1782,6 +1820,10 @@ GCT_handle_kx_auth (struct CadetTConnection *ct,
1782 struct GNUNET_HashCode kx_auth; 1820 struct GNUNET_HashCode kx_auth;
1783 int ret; 1821 int ret;
1784 1822
1823 GNUNET_STATISTICS_update (stats,
1824 "# KX_AUTH received",
1825 1,
1826 GNUNET_NO);
1785 if ( (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate) || 1827 if ( (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate) ||
1786 (CADET_TUNNEL_KEY_AX_RECV == t->estate) ) 1828 (CADET_TUNNEL_KEY_AX_RECV == t->estate) )
1787 { 1829 {