diff options
author | t3sserakt <t3ss@posteo.de> | 2020-12-08 10:47:51 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2020-12-08 10:47:51 +0100 |
commit | 6e3ca264f69ea03520c5855161d1c8487c1e4e01 (patch) | |
tree | 5a2c0a6b1993986c9d9bf361e24dfae5f48a94a4 /src/transport | |
parent | 97782d1a85e43d55626b150c06b6479afd8d20d6 (diff) | |
download | gnunet-6e3ca264f69ea03520c5855161d1c8487c1e4e01.tar.gz gnunet-6e3ca264f69ea03520c5855161d1c8487c1e4e01.zip |
- added testing logic for backchannel and rekey tests. Fixed bugs for rekey logic.
Diffstat (limited to 'src/transport')
17 files changed, 437 insertions, 96 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index e0369059d..df5249275 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -807,42 +807,48 @@ test_communicator_basic_unix_SOURCES = \ | |||
807 | test_communicator_basic_unix_LDADD = \ | 807 | test_communicator_basic_unix_LDADD = \ |
808 | libgnunettransporttesting2.la \ | 808 | libgnunettransporttesting2.la \ |
809 | $(top_builddir)/src/testing/libgnunettesting.la \ | 809 | $(top_builddir)/src/testing/libgnunettesting.la \ |
810 | $(top_builddir)/src/util/libgnunetutil.la | 810 | $(top_builddir)/src/util/libgnunetutil.la \ |
811 | $(top_builddir)/src/statistics/libgnunetstatistics.la | ||
811 | 812 | ||
812 | test_communicator_basic_tcp_SOURCES = \ | 813 | test_communicator_basic_tcp_SOURCES = \ |
813 | test_communicator_basic.c | 814 | test_communicator_basic.c |
814 | test_communicator_basic_tcp_LDADD = \ | 815 | test_communicator_basic_tcp_LDADD = \ |
815 | libgnunettransporttesting2.la \ | 816 | libgnunettransporttesting2.la \ |
816 | $(top_builddir)/src/testing/libgnunettesting.la \ | 817 | $(top_builddir)/src/testing/libgnunettesting.la \ |
817 | $(top_builddir)/src/util/libgnunetutil.la | 818 | $(top_builddir)/src/util/libgnunetutil.la \ |
819 | $(top_builddir)/src/statistics/libgnunetstatistics.la | ||
818 | 820 | ||
819 | test_communicator_basic_udp_SOURCES = \ | 821 | test_communicator_basic_udp_SOURCES = \ |
820 | test_communicator_basic.c | 822 | test_communicator_basic.c |
821 | test_communicator_basic_udp_LDADD = \ | 823 | test_communicator_basic_udp_LDADD = \ |
822 | libgnunettransporttesting2.la \ | 824 | libgnunettransporttesting2.la \ |
823 | $(top_builddir)/src/testing/libgnunettesting.la \ | 825 | $(top_builddir)/src/testing/libgnunettesting.la \ |
824 | $(top_builddir)/src/util/libgnunetutil.la | 826 | $(top_builddir)/src/util/libgnunetutil.la \ |
827 | $(top_builddir)/src/statistics/libgnunetstatistics.la | ||
825 | 828 | ||
826 | test_communicator_rekey_tcp_SOURCES = \ | 829 | test_communicator_rekey_tcp_SOURCES = \ |
827 | test_communicator_basic.c | 830 | test_communicator_basic.c |
828 | test_communicator_rekey_tcp_LDADD = \ | 831 | test_communicator_rekey_tcp_LDADD = \ |
829 | libgnunettransporttesting2.la \ | 832 | libgnunettransporttesting2.la \ |
830 | $(top_builddir)/src/testing/libgnunettesting.la \ | 833 | $(top_builddir)/src/testing/libgnunettesting.la \ |
831 | $(top_builddir)/src/util/libgnunetutil.la | 834 | $(top_builddir)/src/util/libgnunetutil.la \ |
835 | $(top_builddir)/src/statistics/libgnunetstatistics.la | ||
832 | 836 | ||
833 | test_communicator_rekey_udp_SOURCES = \ | 837 | test_communicator_rekey_udp_SOURCES = \ |
834 | test_communicator_basic.c | 838 | test_communicator_basic.c |
835 | test_communicator_rekey_udp_LDADD = \ | 839 | test_communicator_rekey_udp_LDADD = \ |
836 | libgnunettransporttesting2.la \ | 840 | libgnunettransporttesting2.la \ |
837 | $(top_builddir)/src/testing/libgnunettesting.la \ | 841 | $(top_builddir)/src/testing/libgnunettesting.la \ |
838 | $(top_builddir)/src/util/libgnunetutil.la | 842 | $(top_builddir)/src/util/libgnunetutil.la \ |
843 | $(top_builddir)/src/statistics/libgnunetstatistics.la | ||
839 | 844 | ||
840 | test_communicator_backchannel_udp_SOURCES = \ | 845 | test_communicator_backchannel_udp_SOURCES = \ |
841 | test_communicator_basic.c | 846 | test_communicator_basic.c |
842 | test_communicator_backchannel_udp_LDADD = \ | 847 | test_communicator_backchannel_udp_LDADD = \ |
843 | libgnunettransporttesting2.la \ | 848 | libgnunettransporttesting2.la \ |
844 | $(top_builddir)/src/testing/libgnunettesting.la \ | 849 | $(top_builddir)/src/testing/libgnunettesting.la \ |
845 | $(top_builddir)/src/util/libgnunetutil.la | 850 | $(top_builddir)/src/util/libgnunetutil.la \ |
851 | $(top_builddir)/src/statistics/libgnunetstatistics.la | ||
846 | endif | 852 | endif |
847 | 853 | ||
848 | test_plugin_unix_SOURCES = \ | 854 | test_plugin_unix_SOURCES = \ |
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index 849adf4ab..4a91a70a5 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c | |||
@@ -137,10 +137,10 @@ | |||
137 | #define MAX_SECRETS 128000 | 137 | #define MAX_SECRETS 128000 |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * How often do we rekey based on number of bytes transmitted? | 140 | * Default value for how often we do rekey based on number of bytes transmitted? |
141 | * (additionally randomized). | 141 | * (additionally randomized). |
142 | */ | 142 | */ |
143 | #define REKEY_MAX_BYTES (1024LLU * 1024 * 1024 * 4LLU) | 143 | #define DEFAULT_REKEY_MAX_BYTES (1024LLU * 1024 * 1024 * 4LLU) |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * Address prefix used by the communicator. | 146 | * Address prefix used by the communicator. |
@@ -510,6 +510,11 @@ struct SharedSecret | |||
510 | struct SenderAddress | 510 | struct SenderAddress |
511 | { | 511 | { |
512 | /** | 512 | /** |
513 | * Shared secret we use with @e target for rekeying. | ||
514 | */ | ||
515 | struct SharedSecret *ss_rekey; | ||
516 | |||
517 | /** | ||
513 | * Flag indicating sender is initiated rekeying for this receiver. | 518 | * Flag indicating sender is initiated rekeying for this receiver. |
514 | */ | 519 | */ |
515 | int rekeying; | 520 | int rekeying; |
@@ -760,6 +765,10 @@ struct BroadcastInterface | |||
760 | static struct GNUNET_TIME_Relative rekey_interval; | 765 | static struct GNUNET_TIME_Relative rekey_interval; |
761 | 766 | ||
762 | /** | 767 | /** |
768 | * How often we do rekey based on number of bytes transmitted | ||
769 | */ | ||
770 | static unsigned long long rekey_max_bytes; | ||
771 | /** | ||
763 | * Shared secret we finished the last kce working queue for. | 772 | * Shared secret we finished the last kce working queue for. |
764 | */ | 773 | */ |
765 | struct SharedSecret *ss_finished; | 774 | struct SharedSecret *ss_finished; |
@@ -1056,14 +1065,14 @@ secret_destroy (struct SharedSecret *ss, int withoutKce) | |||
1056 | struct ReceiverAddress *receiver; | 1065 | struct ReceiverAddress *receiver; |
1057 | struct KeyCacheEntry *kce; | 1066 | struct KeyCacheEntry *kce; |
1058 | 1067 | ||
1059 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1060 | "secret destroy %u %u\n", | ||
1061 | withoutKce, | ||
1062 | ss->sequence_allowed); | ||
1063 | |||
1064 | if (withoutKce && (ss->sequence_allowed > 0)) | 1068 | if (withoutKce && (ss->sequence_allowed > 0)) |
1065 | return GNUNET_NO; | 1069 | return GNUNET_NO; |
1066 | 1070 | ||
1071 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1072 | "secret %s destroy %u %u\n", | ||
1073 | GNUNET_h2s (&ss->master), | ||
1074 | withoutKce, | ||
1075 | ss->sequence_allowed); | ||
1067 | if (NULL != (sender = ss->sender)) | 1076 | if (NULL != (sender = ss->sender)) |
1068 | { | 1077 | { |
1069 | GNUNET_CONTAINER_DLL_remove (sender->ss_head, sender->ss_tail, ss); | 1078 | GNUNET_CONTAINER_DLL_remove (sender->ss_head, sender->ss_tail, ss); |
@@ -1075,6 +1084,9 @@ secret_destroy (struct SharedSecret *ss, int withoutKce) | |||
1075 | receiver->num_secrets--; | 1084 | receiver->num_secrets--; |
1076 | // Uncomment this for alternativ 1 of backchannel functionality | 1085 | // Uncomment this for alternativ 1 of backchannel functionality |
1077 | receiver->acks_available -= (ss->sequence_allowed - ss->sequence_used); | 1086 | receiver->acks_available -= (ss->sequence_allowed - ss->sequence_used); |
1087 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1088 | "%u receiver->acks_available 3\n", | ||
1089 | receiver->acks_available); | ||
1078 | // Until here for alternativ 1 | 1090 | // Until here for alternativ 1 |
1079 | } | 1091 | } |
1080 | while (NULL != (kce = ss->kce_head)) | 1092 | while (NULL != (kce = ss->kce_head)) |
@@ -1194,15 +1206,15 @@ check_timeouts (void *cls) | |||
1194 | rt = GNUNET_TIME_UNIT_FOREVER_REL; | 1206 | rt = GNUNET_TIME_UNIT_FOREVER_REL; |
1195 | while (NULL != (receiver = GNUNET_CONTAINER_heap_peek (receivers_heap))) | 1207 | while (NULL != (receiver = GNUNET_CONTAINER_heap_peek (receivers_heap))) |
1196 | { | 1208 | { |
1197 | if (GNUNET_YES != receiver->receiver_destroy_called) | 1209 | /* if (GNUNET_YES != receiver->receiver_destroy_called) */ |
1198 | { | 1210 | /* { */ |
1199 | rt = GNUNET_TIME_absolute_get_remaining (receiver->timeout); | 1211 | rt = GNUNET_TIME_absolute_get_remaining (receiver->timeout); |
1200 | if (0 != rt.rel_value_us) | 1212 | if (0 != rt.rel_value_us) |
1201 | break; | 1213 | break; |
1202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1203 | "Receiver timed out\n"); | 1215 | "Receiver timed out\n"); |
1204 | receiver_destroy (receiver); | 1216 | receiver_destroy (receiver); |
1205 | } | 1217 | // } |
1206 | } | 1218 | } |
1207 | st = GNUNET_TIME_UNIT_FOREVER_REL; | 1219 | st = GNUNET_TIME_UNIT_FOREVER_REL; |
1208 | while (NULL != (sender = GNUNET_CONTAINER_heap_peek (senders_heap))) | 1220 | while (NULL != (sender = GNUNET_CONTAINER_heap_peek (senders_heap))) |
@@ -1433,7 +1445,8 @@ destroy_all_secrets (struct SharedSecret *ss, int withoutKce) | |||
1433 | int at_least_one_destroyed = GNUNET_NO; | 1445 | int at_least_one_destroyed = GNUNET_NO; |
1434 | 1446 | ||
1435 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1447 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1436 | "Starting destroy all.\n"); | 1448 | "Starting destroy all withoutKce: %u.\n", |
1449 | withoutKce); | ||
1437 | 1450 | ||
1438 | if (NULL != (sender = ss->sender)) | 1451 | if (NULL != (sender = ss->sender)) |
1439 | { | 1452 | { |
@@ -1462,6 +1475,8 @@ destroy_all_secrets (struct SharedSecret *ss, int withoutKce) | |||
1462 | 1475 | ||
1463 | if ((ss != ss_start) && ! at_least_one_destroyed) | 1476 | if ((ss != ss_start) && ! at_least_one_destroyed) |
1464 | { | 1477 | { |
1478 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1479 | "Really destroying all.\n"); | ||
1465 | destroy_all_secrets (ss_start, GNUNET_NO); | 1480 | destroy_all_secrets (ss_start, GNUNET_NO); |
1466 | } | 1481 | } |
1467 | 1482 | ||
@@ -1470,7 +1485,7 @@ destroy_all_secrets (struct SharedSecret *ss, int withoutKce) | |||
1470 | } | 1485 | } |
1471 | 1486 | ||
1472 | static void | 1487 | static void |
1473 | add_acks (struct SharedSecret *ss, int acks_to_add, int remove_from_receiver) | 1488 | add_acks (struct SharedSecret *ss, int acks_to_add) |
1474 | { | 1489 | { |
1475 | 1490 | ||
1476 | struct ReceiverAddress *receiver = ss->receiver; | 1491 | struct ReceiverAddress *receiver = ss->receiver; |
@@ -1489,6 +1504,9 @@ add_acks (struct SharedSecret *ss, int acks_to_add, int remove_from_receiver) | |||
1489 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1504 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1490 | "Tell transport we have %u more acks!\n", | 1505 | "Tell transport we have %u more acks!\n", |
1491 | acks_to_add); | 1506 | acks_to_add); |
1507 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1508 | "%u kce for rekeying.\n", | ||
1509 | receiver->number_rekeying_kce); | ||
1492 | GNUNET_TRANSPORT_communicator_mq_update (ch, | 1510 | GNUNET_TRANSPORT_communicator_mq_update (ch, |
1493 | receiver->d_qh, | 1511 | receiver->d_qh, |
1494 | acks_to_add, | 1512 | acks_to_add, |
@@ -1496,33 +1514,65 @@ add_acks (struct SharedSecret *ss, int acks_to_add, int remove_from_receiver) | |||
1496 | // Until here for alternativ 1 | 1514 | // Until here for alternativ 1 |
1497 | 1515 | ||
1498 | /* move ss to head to avoid discarding it anytime soon! */ | 1516 | /* move ss to head to avoid discarding it anytime soon! */ |
1499 | if (remove_from_receiver) | 1517 | |
1500 | GNUNET_CONTAINER_DLL_remove (receiver->ss_head, receiver->ss_tail, ss); | 1518 | GNUNET_CONTAINER_DLL_remove (receiver->ss_head, receiver->ss_tail, ss); |
1501 | GNUNET_CONTAINER_DLL_insert (receiver->ss_head, receiver->ss_tail, ss); | 1519 | GNUNET_CONTAINER_DLL_insert (receiver->ss_head, receiver->ss_tail, ss); |
1502 | destroy_all_secrets (ss, GNUNET_YES); | 1520 | destroy_all_secrets (ss, GNUNET_YES); |
1521 | } | ||
1503 | 1522 | ||
1523 | static uint32_t | ||
1524 | reset_rekey_kces (struct ReceiverAddress *receiver, | ||
1525 | uint32_t acks_to_add) | ||
1526 | { | ||
1527 | int needed_for_rekeying; | ||
1504 | 1528 | ||
1505 | // Uncomment this for alternativ 2 of backchannel functionality | 1529 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1506 | /*if (receiver->acks_available != ack->acks_available) | 1530 | "%u kce for rekeying and %u acks_to_add\n", |
1531 | receiver->number_rekeying_kce, | ||
1532 | acks_to_add); | ||
1533 | |||
1534 | needed_for_rekeying = (3 - receiver->number_rekeying_kce); | ||
1535 | if (acks_to_add <= needed_for_rekeying) | ||
1507 | { | 1536 | { |
1508 | receiver->acks_available = ack->acks_available; | 1537 | receiver->number_rekeying_kce += acks_to_add; |
1509 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1538 | acks_to_add = 0; |
1510 | "Tell transport we have different number of acks!\n"); | 1539 | } |
1511 | GNUNET_TRANSPORT_communicator_mq_update (ch, | 1540 | else |
1512 | receiver->d_qh, | 1541 | { |
1513 | receiver->acks_available, | 1542 | acks_to_add -= (3 - receiver->number_rekeying_kce); |
1514 | 1); | 1543 | receiver->number_rekeying_kce = 3; |
1515 | }*/ | 1544 | } |
1516 | // Until here for alternativ 2 | 1545 | |
1546 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1547 | "%u kce for rekeying and %u acks_to_add\n", | ||
1548 | receiver->number_rekeying_kce, | ||
1549 | acks_to_add); | ||
1550 | return acks_to_add; | ||
1517 | } | 1551 | } |
1518 | 1552 | ||
1519 | static void | 1553 | static void |
1520 | add_acks_rekey (struct ReceiverAddress *receiver) | 1554 | add_acks_rekey (struct ReceiverAddress *receiver) |
1521 | { | 1555 | { |
1522 | add_acks (receiver->ss_rekey, receiver->ss_rekey->sequence_allowed - 3, | 1556 | uint32_t acks_to_add = receiver->ss_rekey->sequence_allowed; |
1523 | GNUNET_NO); | 1557 | |
1558 | if (receiver->number_rekeying_kce < 3) | ||
1559 | acks_to_add = reset_rekey_kces (receiver, acks_to_add); | ||
1524 | receiver->acks_available = receiver->ss_rekey->sequence_allowed; | 1560 | receiver->acks_available = receiver->ss_rekey->sequence_allowed; |
1561 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1562 | "%u receiver->acks_available 4\n", | ||
1563 | receiver->acks_available); | ||
1564 | /* add_acks (receiver->ss_rekey, acks_to_add - 3); */ | ||
1565 | if (0 != acks_to_add) | ||
1566 | { | ||
1567 | add_acks (receiver->ss_rekey, acks_to_add); | ||
1568 | } | ||
1525 | receiver->ss_rekey = NULL; | 1569 | receiver->ss_rekey = NULL; |
1570 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1571 | "# rekeying successful\n"); | ||
1572 | GNUNET_STATISTICS_update (stats, | ||
1573 | "# rekeying successful", | ||
1574 | 1, | ||
1575 | GNUNET_NO); | ||
1526 | } | 1576 | } |
1527 | 1577 | ||
1528 | /** | 1578 | /** |
@@ -1540,15 +1590,17 @@ handle_ack (void *cls, const struct GNUNET_PeerIdentity *pid, void *value) | |||
1540 | { | 1590 | { |
1541 | const struct UDPAck *ack = cls; | 1591 | const struct UDPAck *ack = cls; |
1542 | struct ReceiverAddress *receiver = value; | 1592 | struct ReceiverAddress *receiver = value; |
1543 | int acks_to_add; | 1593 | uint32_t acks_to_add; |
1544 | uint32_t allowed; | 1594 | uint32_t allowed; |
1595 | // int needed_for_rekeying; | ||
1545 | 1596 | ||
1546 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1597 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1547 | "in handle ack\n"); | 1598 | "in handle ack with cmac %s\n", |
1599 | GNUNET_h2s (&ack->cmac)); | ||
1548 | 1600 | ||
1549 | if (NULL != receiver->ss_rekey) | 1601 | if (NULL != receiver->ss_rekey) |
1550 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1602 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1551 | "Received secret with cmac %s \n", | 1603 | "We have rekey secret with cmac %s \n", |
1552 | GNUNET_h2s (&receiver->ss_rekey->cmac)); | 1604 | GNUNET_h2s (&receiver->ss_rekey->cmac)); |
1553 | 1605 | ||
1554 | if ((NULL != receiver->ss_rekey) && (0 == memcmp (&ack->cmac, | 1606 | if ((NULL != receiver->ss_rekey) && (0 == memcmp (&ack->cmac, |
@@ -1598,16 +1650,37 @@ handle_ack (void *cls, const struct GNUNET_PeerIdentity *pid, void *value) | |||
1598 | // Uncomment this for alternativ 1 of backchannel functionality | 1650 | // Uncomment this for alternativ 1 of backchannel functionality |
1599 | acks_to_add = (allowed - ss->sequence_allowed); | 1651 | acks_to_add = (allowed - ss->sequence_allowed); |
1600 | if ((GNUNET_NO == receiver->rekeying) && | 1652 | if ((GNUNET_NO == receiver->rekeying) && |
1601 | (receiver->number_rekeying_kce < | 1653 | (receiver->number_rekeying_kce < 3) ) |
1602 | 3) ) | 1654 | acks_to_add = reset_rekey_kces (receiver, acks_to_add); |
1655 | /* if ((GNUNET_NO == receiver->rekeying) && */ | ||
1656 | /* (receiver->number_rekeying_kce < */ | ||
1657 | /* 3) ) */ | ||
1658 | /* { */ | ||
1659 | /* needed_for_rekeying = (3 - receiver->number_rekeying_kce); */ | ||
1660 | /* if (acks_to_add <= needed_for_rekeying) */ | ||
1661 | /* { */ | ||
1662 | /* receiver->number_rekeying_kce += acks_to_add; */ | ||
1663 | /* acks_to_add = 0; */ | ||
1664 | /* } */ | ||
1665 | /* else */ | ||
1666 | /* { */ | ||
1667 | /* acks_to_add -= (3 - receiver->number_rekeying_kce); */ | ||
1668 | /* receiver->number_rekeying_kce = 3; */ | ||
1669 | /* } */ | ||
1670 | /* } */ | ||
1671 | /* GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, */ | ||
1672 | /* "%u kce for rekeying\n", */ | ||
1673 | /* receiver->number_rekeying_kce); */ | ||
1674 | |||
1675 | if ((0 != acks_to_add) && (GNUNET_NO == receiver->rekeying)) | ||
1603 | { | 1676 | { |
1604 | acks_to_add -= (3 - receiver->number_rekeying_kce); | 1677 | receiver->acks_available += (allowed - ss->sequence_allowed); |
1605 | receiver->number_rekeying_kce = 3; | 1678 | ss->sequence_allowed = allowed; |
1679 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1680 | "%u receiver->acks_available 5\n", | ||
1681 | receiver->acks_available); | ||
1682 | add_acks (ss, acks_to_add); | ||
1606 | } | 1683 | } |
1607 | receiver->acks_available += (allowed - ss->sequence_allowed); | ||
1608 | ss->sequence_allowed = allowed; | ||
1609 | |||
1610 | add_acks (ss, acks_to_add, GNUNET_YES); | ||
1611 | } | 1684 | } |
1612 | return GNUNET_NO; | 1685 | return GNUNET_NO; |
1613 | } | 1686 | } |
@@ -1671,11 +1744,15 @@ kce_generate_cb (void *cls) | |||
1671 | 1744 | ||
1672 | 1745 | ||
1673 | 1746 | ||
1674 | if (ss->sender->acks_available < KCN_TARGET) | 1747 | if (((GNUNET_NO == ss->sender->rekeying) && (ss->sender->acks_available < |
1748 | KCN_TARGET) ) || | ||
1749 | ((ss->sender->ss_rekey == ss) && (GNUNET_YES == ss->sender->rekeying) && | ||
1750 | (ss->sender->acks_available < 128))) | ||
1675 | { | 1751 | { |
1676 | 1752 | ||
1677 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1753 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1678 | "Precomputing keys\n"); | 1754 | "Precomputing keys for master %s\n", |
1755 | GNUNET_h2s (&(ss->master))); | ||
1679 | 1756 | ||
1680 | for (int i = 0; i < GENERATE_AT_ONCE; i++) | 1757 | for (int i = 0; i < GENERATE_AT_ONCE; i++) |
1681 | kce_generate (ss, ++ss->sequence_allowed); | 1758 | kce_generate (ss, ++ss->sequence_allowed); |
@@ -1702,6 +1779,11 @@ kce_generate_rekey_cb (void *cls) | |||
1702 | 1779 | ||
1703 | if (NULL == kce_task) | 1780 | if (NULL == kce_task) |
1704 | { | 1781 | { |
1782 | |||
1783 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1784 | "Precomputing keys for rekey master %s\n", | ||
1785 | GNUNET_h2s (&(ss->master))); | ||
1786 | |||
1705 | for (int i = 0; i < GENERATE_AT_ONCE; i++) | 1787 | for (int i = 0; i < GENERATE_AT_ONCE; i++) |
1706 | kce_generate (ss, ++ss->sequence_allowed); | 1788 | kce_generate (ss, ++ss->sequence_allowed); |
1707 | 1789 | ||
@@ -1760,23 +1842,33 @@ consider_ss_ack (struct SharedSecret *ss, int initial) | |||
1760 | if (((NULL != kce_task) && kce_task_finished) || (GNUNET_NO == initial)) | 1842 | if (((NULL != kce_task) && kce_task_finished) || (GNUNET_NO == initial)) |
1761 | { | 1843 | { |
1762 | struct UDPAck ack; | 1844 | struct UDPAck ack; |
1845 | struct SharedSecret *ss_tell; | ||
1846 | |||
1847 | if (GNUNET_NO != initial) | ||
1848 | ss_tell = ss_finished; | ||
1849 | else | ||
1850 | ss_tell = ss; | ||
1763 | 1851 | ||
1764 | ack.header.type = htons (GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK); | 1852 | ack.header.type = htons (GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK); |
1765 | ack.header.size = htons (sizeof(ack)); | 1853 | ack.header.size = htons (sizeof(ack)); |
1766 | ack.sequence_max = htonl (ss_finished->sequence_allowed); | 1854 | ack.sequence_max = htonl (ss_tell->sequence_allowed); |
1767 | ack.acks_available = ss->sender->acks_available; | 1855 | ack.acks_available = ss->sender->acks_available; |
1768 | ack.cmac = ss_finished->cmac; | 1856 | ack.cmac = ss_tell->cmac; |
1769 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1857 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1770 | "Notifying transport of UDPAck %s with intial %u\n", | 1858 | "Notifying transport of UDPAck %s with intial %u and master %s\n", |
1771 | GNUNET_i2s_full (&ss_finished->sender->target), | 1859 | GNUNET_i2s_full (&ss_tell->sender->target), |
1772 | initial); | 1860 | initial, |
1861 | GNUNET_h2s (&(ss_tell->master))); | ||
1773 | GNUNET_TRANSPORT_communicator_notify (ch, | 1862 | GNUNET_TRANSPORT_communicator_notify (ch, |
1774 | &ss_finished->sender->target, | 1863 | &ss_tell->sender->target, |
1775 | COMMUNICATOR_ADDRESS_PREFIX, | 1864 | COMMUNICATOR_ADDRESS_PREFIX, |
1776 | &ack.header); | 1865 | &ack.header); |
1777 | destroy_all_secrets (ss, GNUNET_YES); | 1866 | if (GNUNET_NO != initial) |
1778 | kce_task = NULL; | 1867 | { |
1779 | kce_task_finished = GNUNET_NO; | 1868 | destroy_all_secrets (ss, GNUNET_YES); |
1869 | kce_task = NULL; | ||
1870 | kce_task_finished = GNUNET_NO; | ||
1871 | } | ||
1780 | } | 1872 | } |
1781 | else if ((NULL == kce_task) && ((KCN_THRESHOLD > ss->sender->acks_available)|| | 1873 | else if ((NULL == kce_task) && ((KCN_THRESHOLD > ss->sender->acks_available)|| |
1782 | (GNUNET_YES == ss->sender->rekeying) || | 1874 | (GNUNET_YES == ss->sender->rekeying) || |
@@ -1835,6 +1927,10 @@ decrypt_box (const struct UDPBox *box, | |||
1835 | "# bytes decrypted with BOX", | 1927 | "# bytes decrypted with BOX", |
1836 | sizeof(out_buf), | 1928 | sizeof(out_buf), |
1837 | GNUNET_NO); | 1929 | GNUNET_NO); |
1930 | GNUNET_STATISTICS_update (stats, | ||
1931 | "# messages decrypted with BOX", | ||
1932 | 1, | ||
1933 | GNUNET_NO); | ||
1838 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1934 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1839 | "decrypted UDPBox with kid %s\n", | 1935 | "decrypted UDPBox with kid %s\n", |
1840 | GNUNET_sh2s (&box->kid)); | 1936 | GNUNET_sh2s (&box->kid)); |
@@ -1842,16 +1938,17 @@ decrypt_box (const struct UDPBox *box, | |||
1842 | if ((GNUNET_NO == box->rekeying) && (GNUNET_YES == ss->sender->rekeying)) | 1938 | if ((GNUNET_NO == box->rekeying) && (GNUNET_YES == ss->sender->rekeying)) |
1843 | { | 1939 | { |
1844 | ss->sender->rekeying = GNUNET_NO; | 1940 | ss->sender->rekeying = GNUNET_NO; |
1941 | ss->sender->ss_rekey = NULL; | ||
1845 | // destroy_all_secrets (ss, GNUNET_NO); | 1942 | // destroy_all_secrets (ss, GNUNET_NO); |
1846 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1943 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1847 | "Receiver stopped rekeying.\n"); | 1944 | "Receiver stopped rekeying.\n"); |
1848 | } | 1945 | } |
1849 | else if (GNUNET_NO == box->rekeying) | 1946 | else if (GNUNET_NO == box->rekeying) |
1850 | consider_ss_ack (ss, GNUNET_YES); | 1947 | consider_ss_ack (ss, GNUNET_NO); |
1851 | else{ | 1948 | else{ |
1852 | ss->sender->rekeying = GNUNET_YES; | 1949 | ss->sender->rekeying = GNUNET_YES; |
1853 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1950 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1854 | "Receiver started rekeying.\n"); | 1951 | "Got Box: Receiver doing rekeying.\n"); |
1855 | } | 1952 | } |
1856 | } | 1953 | } |
1857 | 1954 | ||
@@ -1921,6 +2018,7 @@ decrypt_rekey (const struct UDPRekey *rekey, | |||
1921 | /* GNUNET_assert (ss_rekey->prev == NULL && sender->ss_head != ss_rekey); */ | 2018 | /* GNUNET_assert (ss_rekey->prev == NULL && sender->ss_head != ss_rekey); */ |
1922 | /* GNUNET_assert (ss_rekey->next == NULL && sender->ss_tail != ss_rekey); */ | 2019 | /* GNUNET_assert (ss_rekey->next == NULL && sender->ss_tail != ss_rekey); */ |
1923 | GNUNET_CONTAINER_DLL_insert (sender->ss_head, sender->ss_tail, ss_rekey); | 2020 | GNUNET_CONTAINER_DLL_insert (sender->ss_head, sender->ss_tail, ss_rekey); |
2021 | sender->ss_rekey = ss_rekey; | ||
1924 | sender->num_secrets++; | 2022 | sender->num_secrets++; |
1925 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2023 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1926 | "Received secret with cmac %s\n", | 2024 | "Received secret with cmac %s\n", |
@@ -2157,6 +2255,7 @@ sock_read (void *cls) | |||
2157 | box->rekeying); | 2255 | box->rekeying); |
2158 | else | 2256 | else |
2159 | do_decrypt = GNUNET_YES; | 2257 | do_decrypt = GNUNET_YES; |
2258 | |||
2160 | if ((GNUNET_YES == do_decrypt)&& (NULL != kce) && (GNUNET_YES == | 2259 | if ((GNUNET_YES == do_decrypt)&& (NULL != kce) && (GNUNET_YES == |
2161 | kce->ss->sender->rekeying)) | 2260 | kce->ss->sender->rekeying)) |
2162 | { | 2261 | { |
@@ -2165,6 +2264,10 @@ sock_read (void *cls) | |||
2165 | GNUNET_sh2s (&rekey->kid)); | 2264 | GNUNET_sh2s (&rekey->kid)); |
2166 | sender = setup_sender (&rekey->sender, (const struct sockaddr *) &sa, | 2265 | sender = setup_sender (&rekey->sender, (const struct sockaddr *) &sa, |
2167 | salen); | 2266 | salen); |
2267 | |||
2268 | if (NULL != sender->ss_rekey) | ||
2269 | return; | ||
2270 | |||
2168 | decrypt_rekey (rekey, (size_t) rcvd, kce, sender); | 2271 | decrypt_rekey (rekey, (size_t) rcvd, kce, sender); |
2169 | return; | 2272 | return; |
2170 | } | 2273 | } |
@@ -2290,6 +2393,7 @@ sock_read (void *cls) | |||
2290 | if ((GNUNET_NO == kx->rekeying) && (GNUNET_YES == ss->sender->rekeying)) | 2393 | if ((GNUNET_NO == kx->rekeying) && (GNUNET_YES == ss->sender->rekeying)) |
2291 | { | 2394 | { |
2292 | ss->sender->rekeying = GNUNET_NO; | 2395 | ss->sender->rekeying = GNUNET_NO; |
2396 | sender->ss_rekey = NULL; | ||
2293 | // destroy_all_secrets (ss, GNUNET_NO); | 2397 | // destroy_all_secrets (ss, GNUNET_NO); |
2294 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2398 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2295 | "Receiver stopped rekeying.\n"); | 2399 | "Receiver stopped rekeying.\n"); |
@@ -2299,7 +2403,7 @@ sock_read (void *cls) | |||
2299 | else{ | 2403 | else{ |
2300 | ss->sender->rekeying = GNUNET_YES; | 2404 | ss->sender->rekeying = GNUNET_YES; |
2301 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2405 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2302 | "Receiver started rekeying.\n"); | 2406 | "Got KX: Receiver doing rekeying.\n"); |
2303 | } | 2407 | } |
2304 | /*if (sender->num_secrets > MAX_SECRETS) | 2408 | /*if (sender->num_secrets > MAX_SECRETS) |
2305 | secret_destroy (sender->ss_tail);*/ | 2409 | secret_destroy (sender->ss_tail);*/ |
@@ -2584,12 +2688,12 @@ check_for_rekeying (struct ReceiverAddress *receiver, struct UDPBox *box) | |||
2584 | receiver->rekey_timeout.abs_value_us); | 2688 | receiver->rekey_timeout.abs_value_us); |
2585 | 2689 | ||
2586 | if ((0 == rt.rel_value_us)||(receiver->rekey_send_bytes > | 2690 | if ((0 == rt.rel_value_us)||(receiver->rekey_send_bytes > |
2587 | REKEY_MAX_BYTES) ) | 2691 | rekey_max_bytes) ) |
2588 | { | 2692 | { |
2589 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2693 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2590 | "Bytes send %lu greater than %llu max bytes\n.", | 2694 | "Bytes send %lu greater than %llu max bytes\n.", |
2591 | receiver->rekey_send_bytes, | 2695 | receiver->rekey_send_bytes, |
2592 | REKEY_MAX_BYTES); | 2696 | rekey_max_bytes); |
2593 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2697 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2594 | "Relative time is %lu and timeout is %lu\n.", | 2698 | "Relative time is %lu and timeout is %lu\n.", |
2595 | rt.rel_value_us, | 2699 | rt.rel_value_us, |
@@ -2631,9 +2735,14 @@ send_UDPRekey (struct ReceiverAddress *receiver, struct SharedSecret *ss) | |||
2631 | - (receiver->rekey_acks_available % 3)) / 3; | 2735 | - (receiver->rekey_acks_available % 3)) / 3; |
2632 | is_ss_rekey_sequence_allowed_zero = (0 == | 2736 | is_ss_rekey_sequence_allowed_zero = (0 == |
2633 | receiver->ss_rekey->sequence_allowed); | 2737 | receiver->ss_rekey->sequence_allowed); |
2634 | is_acks_available_below = (receiver->acks_available > not_below); | 2738 | is_acks_available_below = (receiver->acks_available >= not_below); |
2635 | send_rekey = (0 == (receiver->acks_available - not_below) % not_below) && | 2739 | send_rekey = (0 == (receiver->acks_available - not_below) % not_below) && |
2636 | is_acks_available_below && is_ss_rekey_sequence_allowed_zero; | 2740 | is_acks_available_below && is_ss_rekey_sequence_allowed_zero; |
2741 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2742 | "send_rekey: %u, %u, %u\n", | ||
2743 | send_rekey, | ||
2744 | receiver->rekey_acks_available, | ||
2745 | receiver->acks_available); | ||
2637 | } | 2746 | } |
2638 | else if (NULL == receiver->ss_rekey) | 2747 | else if (NULL == receiver->ss_rekey) |
2639 | { | 2748 | { |
@@ -2641,6 +2750,7 @@ send_UDPRekey (struct ReceiverAddress *receiver, struct SharedSecret *ss) | |||
2641 | GNUNET_CRYPTO_ecdhe_key_create (&epriv); | 2750 | GNUNET_CRYPTO_ecdhe_key_create (&epriv); |
2642 | receiver->ss_rekey = setup_shared_secret_enc (&epriv, receiver, | 2751 | receiver->ss_rekey = setup_shared_secret_enc (&epriv, receiver, |
2643 | GNUNET_NO); | 2752 | GNUNET_NO); |
2753 | receiver->ss_rekey->sequence_allowed = 0; | ||
2644 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2754 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2645 | "Setup secret with cmac %s\n", | 2755 | "Setup secret with cmac %s\n", |
2646 | GNUNET_h2s (&(receiver->ss_rekey->cmac))); | 2756 | GNUNET_h2s (&(receiver->ss_rekey->cmac))); |
@@ -2700,6 +2810,9 @@ send_UDPRekey (struct ReceiverAddress *receiver, struct SharedSecret *ss) | |||
2700 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2810 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2701 | "Sending rekey with cmac %s\n", | 2811 | "Sending rekey with cmac %s\n", |
2702 | GNUNET_h2s (&(receiver->ss_rekey->cmac))); | 2812 | GNUNET_h2s (&(receiver->ss_rekey->cmac))); |
2813 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2814 | "%u rekey kces left.\n", | ||
2815 | receiver->number_rekeying_kce); | ||
2703 | 2816 | ||
2704 | if (-1 == GNUNET_NETWORK_socket_sendto (udp_sock, | 2817 | if (-1 == GNUNET_NETWORK_socket_sendto (udp_sock, |
2705 | rekey_dgram, | 2818 | rekey_dgram, |
@@ -2708,6 +2821,10 @@ send_UDPRekey (struct ReceiverAddress *receiver, struct SharedSecret *ss) | |||
2708 | receiver->address_len)) | 2821 | receiver->address_len)) |
2709 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); | 2822 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); |
2710 | 2823 | ||
2824 | receiver->acks_available--; | ||
2825 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2826 | "%u receiver->acks_available 1\n", | ||
2827 | receiver->acks_available); | ||
2711 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2828 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2712 | "Sending UDPRekey to %s\n", GNUNET_a2s (receiver->address, | 2829 | "Sending UDPRekey to %s\n", GNUNET_a2s (receiver->address, |
2713 | receiver-> | 2830 | receiver-> |
@@ -2737,6 +2854,12 @@ mq_send_d (struct GNUNET_MQ_Handle *mq, | |||
2737 | if ((msize > receiver->d_mtu) || | 2854 | if ((msize > receiver->d_mtu) || |
2738 | (0 == receiver->acks_available)) | 2855 | (0 == receiver->acks_available)) |
2739 | { | 2856 | { |
2857 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2858 | "msize: %u, mtu: %lu, acks: %u\n", | ||
2859 | msize, | ||
2860 | receiver->d_mtu, | ||
2861 | receiver->acks_available); | ||
2862 | |||
2740 | GNUNET_break (0); | 2863 | GNUNET_break (0); |
2741 | if (GNUNET_YES != receiver->receiver_destroy_called) | 2864 | if (GNUNET_YES != receiver->receiver_destroy_called) |
2742 | receiver_destroy (receiver); | 2865 | receiver_destroy (receiver); |
@@ -2789,8 +2912,6 @@ mq_send_d (struct GNUNET_MQ_Handle *mq, | |||
2789 | else | 2912 | else |
2790 | box->rekeying = GNUNET_YES; | 2913 | box->rekeying = GNUNET_YES; |
2791 | 2914 | ||
2792 | check_for_rekeying (receiver, box); | ||
2793 | |||
2794 | if (-1 == GNUNET_NETWORK_socket_sendto (udp_sock, | 2915 | if (-1 == GNUNET_NETWORK_socket_sendto (udp_sock, |
2795 | dgram, | 2916 | dgram, |
2796 | sizeof(dgram), | 2917 | sizeof(dgram), |
@@ -2798,11 +2919,15 @@ mq_send_d (struct GNUNET_MQ_Handle *mq, | |||
2798 | receiver->address_len)) | 2919 | receiver->address_len)) |
2799 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); | 2920 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); |
2800 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2921 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2801 | "Sending UDPBox to %s\n", GNUNET_a2s (receiver->address, | 2922 | "Sending UDPBox %u acks left\n", |
2802 | receiver->address_len)); | 2923 | receiver->acks_available); |
2803 | GNUNET_MQ_impl_send_continue (mq); | 2924 | GNUNET_MQ_impl_send_continue (mq); |
2804 | receiver->acks_available--; | 2925 | receiver->acks_available--; |
2805 | if (0 == receiver->acks_available) | 2926 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2927 | "%u receiver->acks_available 2\n", | ||
2928 | receiver->acks_available); | ||
2929 | check_for_rekeying (receiver, box); | ||
2930 | if (0 == receiver->acks_available - receiver->number_rekeying_kce) | ||
2806 | { | 2931 | { |
2807 | /* We have no more ACKs */ | 2932 | /* We have no more ACKs */ |
2808 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2933 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2810,6 +2935,8 @@ mq_send_d (struct GNUNET_MQ_Handle *mq, | |||
2810 | if (GNUNET_YES == receiver->rekeying) | 2935 | if (GNUNET_YES == receiver->rekeying) |
2811 | { | 2936 | { |
2812 | receiver->rekeying = GNUNET_NO; | 2937 | receiver->rekeying = GNUNET_NO; |
2938 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2939 | "Sender stopped rekeying\n"); | ||
2813 | 2940 | ||
2814 | if ((NULL != receiver->ss_rekey) && (0 < | 2941 | if ((NULL != receiver->ss_rekey) && (0 < |
2815 | receiver->ss_rekey-> | 2942 | receiver->ss_rekey-> |
@@ -3120,6 +3247,8 @@ get_sender_delete_it (void *cls, | |||
3120 | static void | 3247 | static void |
3121 | do_shutdown (void *cls) | 3248 | do_shutdown (void *cls) |
3122 | { | 3249 | { |
3250 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3251 | "do_shutdown\n"); | ||
3123 | if (NULL != nat) | 3252 | if (NULL != nat) |
3124 | { | 3253 | { |
3125 | GNUNET_NAT_unregister (nat); | 3254 | GNUNET_NAT_unregister (nat); |
@@ -3151,6 +3280,11 @@ do_shutdown (void *cls) | |||
3151 | GNUNET_CONTAINER_multishortmap_destroy (key_cache); | 3280 | GNUNET_CONTAINER_multishortmap_destroy (key_cache); |
3152 | GNUNET_CONTAINER_heap_destroy (senders_heap); | 3281 | GNUNET_CONTAINER_heap_destroy (senders_heap); |
3153 | GNUNET_CONTAINER_heap_destroy (receivers_heap); | 3282 | GNUNET_CONTAINER_heap_destroy (receivers_heap); |
3283 | if (NULL != timeout_task) | ||
3284 | { | ||
3285 | GNUNET_SCHEDULER_cancel (timeout_task); | ||
3286 | timeout_task = NULL; | ||
3287 | } | ||
3154 | if (NULL != ch) | 3288 | if (NULL != ch) |
3155 | { | 3289 | { |
3156 | GNUNET_TRANSPORT_communicator_disconnect (ch); | 3290 | GNUNET_TRANSPORT_communicator_disconnect (ch); |
@@ -3176,6 +3310,8 @@ do_shutdown (void *cls) | |||
3176 | GNUNET_NT_scanner_done (is); | 3310 | GNUNET_NT_scanner_done (is); |
3177 | is = NULL; | 3311 | is = NULL; |
3178 | } | 3312 | } |
3313 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3314 | "do_shutdown finished\n"); | ||
3179 | } | 3315 | } |
3180 | 3316 | ||
3181 | 3317 | ||
@@ -3507,6 +3643,13 @@ run (void *cls, | |||
3507 | &rekey_interval)) | 3643 | &rekey_interval)) |
3508 | rekey_interval = DEFAULT_REKEY_TIME_INTERVAL; | 3644 | rekey_interval = DEFAULT_REKEY_TIME_INTERVAL; |
3509 | 3645 | ||
3646 | if (GNUNET_OK != | ||
3647 | GNUNET_CONFIGURATION_get_value_size (cfg, | ||
3648 | COMMUNICATOR_CONFIG_SECTION, | ||
3649 | "REKEY_MAX_BYTES", | ||
3650 | &rekey_max_bytes)) | ||
3651 | rekey_max_bytes = DEFAULT_REKEY_MAX_BYTES; | ||
3652 | |||
3510 | in = udp_address_to_sockaddr (bindto, &in_len); | 3653 | in = udp_address_to_sockaddr (bindto, &in_len); |
3511 | if (NULL == in) | 3654 | if (NULL == in) |
3512 | { | 3655 | { |
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c index df3c73b20..46eee2299 100644 --- a/src/transport/test_communicator_basic.c +++ b/src/transport/test_communicator_basic.c | |||
@@ -73,6 +73,10 @@ static struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *my_tc; | |||
73 | 73 | ||
74 | static char *test_name; | 74 | static char *test_name; |
75 | 75 | ||
76 | static struct GNUNET_STATISTICS_GetHandle *box_stats; | ||
77 | |||
78 | static struct GNUNET_STATISTICS_GetHandle *rekey_stats; | ||
79 | |||
76 | #define SHORT_MESSAGE_SIZE 128 | 80 | #define SHORT_MESSAGE_SIZE 128 |
77 | 81 | ||
78 | #define LONG_MESSAGE_SIZE 32000 /* FIXME */ | 82 | #define LONG_MESSAGE_SIZE 32000 /* FIXME */ |
@@ -90,7 +94,7 @@ static unsigned int iterations_left = TOTAL_ITERATIONS; | |||
90 | #define TIMEOUT_MULTIPLIER 1 | 94 | #define TIMEOUT_MULTIPLIER 1 |
91 | 95 | ||
92 | #define DELAY \ | 96 | #define DELAY \ |
93 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,50) | 97 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,200) |
94 | 98 | ||
95 | #define SHORT_BURST_WINDOW \ | 99 | #define SHORT_BURST_WINDOW \ |
96 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2) | 100 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2) |
@@ -514,6 +518,30 @@ update_avg_latency (const char*payload) | |||
514 | 518 | ||
515 | } | 519 | } |
516 | 520 | ||
521 | process_statistics_box_done (void *cls, int success) | ||
522 | { | ||
523 | if (NULL != box_stats) | ||
524 | box_stats = NULL; | ||
525 | if (NULL == rekey_stats) | ||
526 | { | ||
527 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
528 | "Finished\n"); | ||
529 | GNUNET_SCHEDULER_shutdown (); | ||
530 | } | ||
531 | } | ||
532 | |||
533 | process_statistics_rekey_done (void *cls, int success) | ||
534 | { | ||
535 | if (NULL != rekey_stats) | ||
536 | rekey_stats = NULL; | ||
537 | if (NULL == box_stats) | ||
538 | { | ||
539 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
540 | "Finished\n"); | ||
541 | GNUNET_SCHEDULER_shutdown (); | ||
542 | } | ||
543 | } | ||
544 | |||
517 | static int | 545 | static int |
518 | process_statistics (void *cls, | 546 | process_statistics (void *cls, |
519 | const char *subsystem, | 547 | const char *subsystem, |
@@ -521,6 +549,41 @@ process_statistics (void *cls, | |||
521 | uint64_t value, | 549 | uint64_t value, |
522 | int is_persistent) | 550 | int is_persistent) |
523 | { | 551 | { |
552 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
553 | "Statistic: Name %s and value %lu\n", | ||
554 | name, | ||
555 | value); | ||
556 | if ((0 == strcmp ("rekey", test_name)) && (0 == strcmp ( | ||
557 | "# rekeying successful", | ||
558 | name)) && (0 == value)) | ||
559 | { | ||
560 | ret = 2; | ||
561 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
562 | "No successful rekeying!\n"); | ||
563 | GNUNET_SCHEDULER_shutdown (); | ||
564 | } | ||
565 | if ((0 == strcmp ("backchannel", test_name)) && | ||
566 | (0 == strcmp ( | ||
567 | "# messages decrypted with BOX", | ||
568 | name)) | ||
569 | && (9000 > value)) | ||
570 | { | ||
571 | ret = 2; | ||
572 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
573 | "Not enough BOX messages!\n"); | ||
574 | GNUNET_SCHEDULER_shutdown (); | ||
575 | } | ||
576 | if ((0 == strcmp ("rekey", test_name)) && | ||
577 | (0 == strcmp ( | ||
578 | "# messages decrypted with BOX", | ||
579 | name)) | ||
580 | && (6000 > value)) | ||
581 | { | ||
582 | ret = 2; | ||
583 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
584 | "Not enough BOX messages!\n"); | ||
585 | GNUNET_SCHEDULER_shutdown (); | ||
586 | } | ||
524 | return GNUNET_OK; | 587 | return GNUNET_OK; |
525 | } | 588 | } |
526 | 589 | ||
@@ -660,18 +723,29 @@ incoming_message_cb (void *cls, | |||
660 | short_test (NULL); | 723 | short_test (NULL); |
661 | break; | 724 | break; |
662 | } | 725 | } |
663 | /* if (("rekey" == test_name) || ("backchannel" == test_name)) */ | 726 | if ((0 == strcmp ("rekey", test_name))||(0 == strcmp ("backchannel", |
664 | /* { */ | 727 | test_name)) ) |
665 | /* GNUNET_STATISTICS_get (stats[1], */ | 728 | { |
666 | /* "C-UDP", */ | 729 | if (NULL != box_stats) |
667 | /* "# bytes decrypted with Rekey", */ | 730 | GNUNET_STATISTICS_get_cancel (box_stats); |
668 | /* NULL, */ | 731 | box_stats = GNUNET_STATISTICS_get (stats[1], |
669 | /* &process_statistics, */ | 732 | "C-UDP", |
670 | /* NULL); */ | 733 | "# messages decrypted with BOX", |
671 | /* } */ | 734 | process_statistics_box_done, |
672 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 735 | &process_statistics, |
673 | "Finished\n"); | 736 | NULL); |
674 | GNUNET_SCHEDULER_shutdown (); | 737 | if (NULL != rekey_stats) |
738 | GNUNET_STATISTICS_get_cancel (rekey_stats); | ||
739 | rekey_stats = GNUNET_STATISTICS_get (stats[0], | ||
740 | "C-UDP", | ||
741 | "# rekeying successful", | ||
742 | process_statistics_rekey_done, | ||
743 | &process_statistics, | ||
744 | NULL); | ||
745 | } | ||
746 | /* LOG (GNUNET_ERROR_TYPE_DEBUG, */ | ||
747 | /* "Finished\n"); */ | ||
748 | /* GNUNET_SCHEDULER_shutdown (); */ | ||
675 | } | 749 | } |
676 | break; | 750 | break; |
677 | } | 751 | } |
@@ -682,6 +756,19 @@ incoming_message_cb (void *cls, | |||
682 | static void | 756 | static void |
683 | do_shutdown (void *cls) | 757 | do_shutdown (void *cls) |
684 | { | 758 | { |
759 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
760 | "shuting down test.\”"); | ||
761 | |||
762 | if (NULL != box_stats) | ||
763 | { | ||
764 | GNUNET_STATISTICS_get_cancel (box_stats); | ||
765 | box_stats = NULL; | ||
766 | } | ||
767 | if (NULL != rekey_stats) | ||
768 | { | ||
769 | GNUNET_STATISTICS_get_cancel (rekey_stats); | ||
770 | rekey_stats = NULL; | ||
771 | } | ||
685 | if (NULL != to_task) | 772 | if (NULL != to_task) |
686 | { | 773 | { |
687 | GNUNET_SCHEDULER_cancel (to_task); | 774 | GNUNET_SCHEDULER_cancel (to_task); |
@@ -690,6 +777,7 @@ do_shutdown (void *cls) | |||
690 | for (unsigned int i = 0; i < NUM_PEERS; i++) | 777 | for (unsigned int i = 0; i < NUM_PEERS; i++) |
691 | { | 778 | { |
692 | GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (tc_hs[i]); | 779 | GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (tc_hs[i]); |
780 | GNUNET_STATISTICS_destroy (stats[i], GNUNET_NO); | ||
693 | } | 781 | } |
694 | } | 782 | } |
695 | 783 | ||
@@ -697,7 +785,7 @@ do_shutdown (void *cls) | |||
697 | /** | 785 | /** |
698 | * @brief Main function called by the scheduler | 786 | * @brief Main function called by the scheduler |
699 | * | 787 | * |
700 | * @param cls Closure - Handle to configuration | 788 | * @param cls Closure - Handle to confiation |
701 | */ | 789 | */ |
702 | static void | 790 | static void |
703 | run (void *cls) | 791 | run (void *cls) |
@@ -707,6 +795,13 @@ run (void *cls) | |||
707 | // num_sent = 0; | 795 | // num_sent = 0; |
708 | for (unsigned int i = 0; i < NUM_PEERS; i++) | 796 | for (unsigned int i = 0; i < NUM_PEERS; i++) |
709 | { | 797 | { |
798 | if ((0 == strcmp ("rekey", test_name))||(0 == strcmp ("backchannel", | ||
799 | test_name)) ) | ||
800 | { | ||
801 | stats[i] = GNUNET_STATISTICS_create ("C-UDP", | ||
802 | cfg_peers[i]); | ||
803 | } | ||
804 | |||
710 | tc_hs[i] = GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( | 805 | tc_hs[i] = GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( |
711 | "transport", | 806 | "transport", |
712 | communicator_binary, | 807 | communicator_binary, |
@@ -719,12 +814,6 @@ run (void *cls) | |||
719 | &incoming_message_cb, | 814 | &incoming_message_cb, |
720 | &handle_backchannel_cb, | 815 | &handle_backchannel_cb, |
721 | cfg_peers_name[i]); /* cls */ | 816 | cfg_peers_name[i]); /* cls */ |
722 | |||
723 | /* if (("rekey" == test_name) || ("backchannel" == test_name)) */ | ||
724 | /* { */ | ||
725 | /* stats[i] = GNUNET_STATISTICS_create ("C-UDP", */ | ||
726 | /* cfg_peers[i]); */ | ||
727 | /* } */ | ||
728 | } | 817 | } |
729 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | 818 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
730 | NULL); | 819 | NULL); |
diff --git a/src/transport/test_communicator_tcp_basic_peer1.conf b/src/transport/test_communicator_tcp_basic_peer1.conf index c08737b7b..2411f485b 100644 --- a/src/transport/test_communicator_tcp_basic_peer1.conf +++ b/src/transport/test_communicator_tcp_basic_peer1.conf | |||
@@ -22,6 +22,10 @@ UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/nat.sock | |||
22 | [peerstore] | 22 | [peerstore] |
23 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock | 23 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock |
24 | 24 | ||
25 | [statistics] | ||
26 | PORT = 22461 | ||
27 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_1.sock | ||
28 | |||
25 | [communicator-unix] | 29 | [communicator-unix] |
26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_1.sock | 30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_1.sock |
27 | 31 | ||
diff --git a/src/transport/test_communicator_tcp_basic_peer2.conf b/src/transport/test_communicator_tcp_basic_peer2.conf index 45b7e7844..8005718bf 100644 --- a/src/transport/test_communicator_tcp_basic_peer2.conf +++ b/src/transport/test_communicator_tcp_basic_peer2.conf | |||
@@ -23,6 +23,10 @@ UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/nat.sock | |||
23 | [peerstore] | 23 | [peerstore] |
24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock | 24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock |
25 | 25 | ||
26 | [statistics] | ||
27 | PORT = 22462 | ||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_2.sock | ||
29 | |||
26 | [communicator-unix] | 30 | [communicator-unix] |
27 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_2.sock | 31 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_2.sock |
28 | 32 | ||
diff --git a/src/transport/test_communicator_tcp_rekey_peer1.conf b/src/transport/test_communicator_tcp_rekey_peer1.conf index 901f415ef..82fbf353a 100644 --- a/src/transport/test_communicator_tcp_rekey_peer1.conf +++ b/src/transport/test_communicator_tcp_rekey_peer1.conf | |||
@@ -23,6 +23,10 @@ ENABLE_IPSCAN = YES | |||
23 | [peerstore] | 23 | [peerstore] |
24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock | 24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock |
25 | 25 | ||
26 | [statistics] | ||
27 | PORT = 22461 | ||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_1.sock | ||
29 | |||
26 | [resolver] | 30 | [resolver] |
27 | PORT = 62089 | 31 | PORT = 62089 |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock | 32 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock |
diff --git a/src/transport/test_communicator_tcp_rekey_peer2.conf b/src/transport/test_communicator_tcp_rekey_peer2.conf index 643b037b2..1036039c4 100644 --- a/src/transport/test_communicator_tcp_rekey_peer2.conf +++ b/src/transport/test_communicator_tcp_rekey_peer2.conf | |||
@@ -23,6 +23,10 @@ UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/nat.sock | |||
23 | [peerstore] | 23 | [peerstore] |
24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock | 24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock |
25 | 25 | ||
26 | [statistics] | ||
27 | PORT = 22462 | ||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_2.sock | ||
29 | |||
26 | [resolver] | 30 | [resolver] |
27 | PORT = 62090 | 31 | PORT = 62090 |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock | 32 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock |
diff --git a/src/transport/test_communicator_udp_backchannel_peer1.conf b/src/transport/test_communicator_udp_backchannel_peer1.conf index b99a76d6c..59e6d68e3 100644 --- a/src/transport/test_communicator_udp_backchannel_peer1.conf +++ b/src/transport/test_communicator_udp_backchannel_peer1.conf | |||
@@ -23,6 +23,10 @@ ENABLE_IPSCAN = YES | |||
23 | [peerstore] | 23 | [peerstore] |
24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock | 24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock |
25 | 25 | ||
26 | [statistics] | ||
27 | PORT = 22461 | ||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_1.sock | ||
29 | |||
26 | [resolver] | 30 | [resolver] |
27 | PORT = 62089 | 31 | PORT = 62089 |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock | 32 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock |
@@ -35,6 +39,7 @@ BINDTO = 60002 | |||
35 | DISABLE_V6 = YES | 39 | DISABLE_V6 = YES |
36 | 40 | ||
37 | [communicator-udp] | 41 | [communicator-udp] |
42 | #PREFIX = valgrind --leak-check=full --track-origins=yes | ||
38 | BINDTO = 60002 | 43 | BINDTO = 60002 |
39 | DISABLE_V6 = YES | 44 | DISABLE_V6 = YES |
40 | MAX_QUEUE_LENGTH=5000 | 45 | MAX_QUEUE_LENGTH=5000 |
diff --git a/src/transport/test_communicator_udp_backchannel_peer2.conf b/src/transport/test_communicator_udp_backchannel_peer2.conf index 48bd54c8b..3abf7999b 100644 --- a/src/transport/test_communicator_udp_backchannel_peer2.conf +++ b/src/transport/test_communicator_udp_backchannel_peer2.conf | |||
@@ -23,6 +23,10 @@ UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/nat.sock | |||
23 | [peerstore] | 23 | [peerstore] |
24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock | 24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock |
25 | 25 | ||
26 | [statistics] | ||
27 | PORT = 22462 | ||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_2.sock | ||
29 | |||
26 | [resolver] | 30 | [resolver] |
27 | PORT = 62090 | 31 | PORT = 62090 |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock | 32 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock |
@@ -35,6 +39,7 @@ BINDTO = 60003 | |||
35 | DISABLE_V6 = YES | 39 | DISABLE_V6 = YES |
36 | 40 | ||
37 | [communicator-udp] | 41 | [communicator-udp] |
42 | #PREFIX = valgrind --leak-check=full --track-origins=yes | ||
38 | BINDTO = 60003 | 43 | BINDTO = 60003 |
39 | DISABLE_V6 = YES | 44 | DISABLE_V6 = YES |
40 | MAX_QUEUE_LENGTH=5000 | 45 | MAX_QUEUE_LENGTH=5000 |
diff --git a/src/transport/test_communicator_udp_basic_peer1.conf b/src/transport/test_communicator_udp_basic_peer1.conf index d53a55210..c6ff024ee 100644 --- a/src/transport/test_communicator_udp_basic_peer1.conf +++ b/src/transport/test_communicator_udp_basic_peer1.conf | |||
@@ -23,11 +23,16 @@ ENABLE_IPSCAN = YES | |||
23 | [peerstore] | 23 | [peerstore] |
24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock | 24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock |
25 | 25 | ||
26 | [statistics] | ||
27 | PORT = 22461 | ||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_1.sock | ||
29 | |||
26 | [resolver] | 30 | [resolver] |
27 | PORT = 62089 | 31 | PORT = 62089 |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock | 32 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock |
29 | 33 | ||
30 | [communicator-udp] | 34 | [communicator-udp] |
35 | #PREFIX = valgrind --leak-check=full --track-origins=yes | ||
31 | BINDTO = 60002 | 36 | BINDTO = 60002 |
32 | DISABLE_V6 = YES | 37 | DISABLE_V6 = YES |
33 | MAX_QUEUE_LENGTH=5000 | 38 | MAX_QUEUE_LENGTH=5000 |
diff --git a/src/transport/test_communicator_udp_basic_peer2.conf b/src/transport/test_communicator_udp_basic_peer2.conf index f05ebc5cb..b353b03e9 100644 --- a/src/transport/test_communicator_udp_basic_peer2.conf +++ b/src/transport/test_communicator_udp_basic_peer2.conf | |||
@@ -24,11 +24,16 @@ UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/nat.sock | |||
24 | [peerstore] | 24 | [peerstore] |
25 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock | 25 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock |
26 | 26 | ||
27 | [statistics] | ||
28 | PORT = 22462 | ||
29 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_2.sock | ||
30 | |||
27 | [resolver] | 31 | [resolver] |
28 | PORT = 62090 | 32 | PORT = 62090 |
29 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock | 33 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock |
30 | 34 | ||
31 | [communicator-udp] | 35 | [communicator-udp] |
36 | #PREFIX = valgrind --leak-check=full --track-origins=yes | ||
32 | BINDTO = 60003 | 37 | BINDTO = 60003 |
33 | DISABLE_V6 = YES | 38 | DISABLE_V6 = YES |
34 | MAX_QUEUE_LENGTH=5000 | 39 | MAX_QUEUE_LENGTH=5000 |
diff --git a/src/transport/test_communicator_udp_rekey_peer1.conf b/src/transport/test_communicator_udp_rekey_peer1.conf index 8fede6f8c..6bfeafe33 100644 --- a/src/transport/test_communicator_udp_rekey_peer1.conf +++ b/src/transport/test_communicator_udp_rekey_peer1.conf | |||
@@ -23,6 +23,10 @@ ENABLE_IPSCAN = YES | |||
23 | [peerstore] | 23 | [peerstore] |
24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock | 24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock |
25 | 25 | ||
26 | [statistics] | ||
27 | PORT = 22461 | ||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_1.sock | ||
29 | |||
26 | [resolver] | 30 | [resolver] |
27 | PORT = 62089 | 31 | PORT = 62089 |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock | 32 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock |
@@ -41,7 +45,7 @@ REKEY_INTERVAL = 100ms | |||
41 | BINDTO = 60002 | 45 | BINDTO = 60002 |
42 | DISABLE_V6 = YES | 46 | DISABLE_V6 = YES |
43 | MAX_QUEUE_LENGTH=5000 | 47 | MAX_QUEUE_LENGTH=5000 |
44 | REKEY_INTERVAL = 1s | 48 | REKEY_MAX_BYTES=9MiB |
45 | 49 | ||
46 | [communicator-test] | 50 | [communicator-test] |
47 | BACKCHANNEL_ENABLED = YES | 51 | BACKCHANNEL_ENABLED = YES |
diff --git a/src/transport/test_communicator_udp_rekey_peer2.conf b/src/transport/test_communicator_udp_rekey_peer2.conf index f545ba07a..474ca0c15 100644 --- a/src/transport/test_communicator_udp_rekey_peer2.conf +++ b/src/transport/test_communicator_udp_rekey_peer2.conf | |||
@@ -23,6 +23,10 @@ UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/nat.sock | |||
23 | [peerstore] | 23 | [peerstore] |
24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock | 24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock |
25 | 25 | ||
26 | [statistics] | ||
27 | PORT = 22462 | ||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_2.sock | ||
29 | |||
26 | [resolver] | 30 | [resolver] |
27 | PORT = 62090 | 31 | PORT = 62090 |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock | 32 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock |
@@ -41,7 +45,7 @@ REKEY_INTERVAL = 100ms | |||
41 | BINDTO = 60003 | 45 | BINDTO = 60003 |
42 | DISABLE_V6 = YES | 46 | DISABLE_V6 = YES |
43 | MAX_QUEUE_LENGTH=5000 | 47 | MAX_QUEUE_LENGTH=5000 |
44 | REKEY_INTERVAL = 1s | 48 | REKEY_MAX_BYTES=9MiB |
45 | 49 | ||
46 | [communicator-test] | 50 | [communicator-test] |
47 | BACKCHANNEL_ENABLED = YES | 51 | BACKCHANNEL_ENABLED = YES |
diff --git a/src/transport/test_communicator_unix_basic_peer1.conf b/src/transport/test_communicator_unix_basic_peer1.conf index 8e9700108..13ba2d16b 100644 --- a/src/transport/test_communicator_unix_basic_peer1.conf +++ b/src/transport/test_communicator_unix_basic_peer1.conf | |||
@@ -23,6 +23,10 @@ ENABLE_IPSCAN = YES | |||
23 | [peerstore] | 23 | [peerstore] |
24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock | 24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/peerstore.sock |
25 | 25 | ||
26 | [statistics] | ||
27 | PORT = 22461 | ||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_1.sock | ||
29 | |||
26 | [resolver] | 30 | [resolver] |
27 | PORT = 62089 | 31 | PORT = 62089 |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock | 32 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock |
diff --git a/src/transport/test_communicator_unix_basic_peer2.conf b/src/transport/test_communicator_unix_basic_peer2.conf index c12cc9111..727e844a7 100644 --- a/src/transport/test_communicator_unix_basic_peer2.conf +++ b/src/transport/test_communicator_unix_basic_peer2.conf | |||
@@ -23,6 +23,10 @@ UNIXPATH = $GNUNET_TMP/communicator-unix-2/nat.sock | |||
23 | [peerstore] | 23 | [peerstore] |
24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock | 24 | UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/peerstore.sock |
25 | 25 | ||
26 | [statistics] | ||
27 | PORT = 22462 | ||
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics_test_2.sock | ||
29 | |||
26 | [resolver] | 30 | [resolver] |
27 | PORT = 62090 | 31 | PORT = 62090 |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock | 32 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock |
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c index 076fbf331..70f68d3f8 100644 --- a/src/transport/transport-testing2.c +++ b/src/transport/transport-testing2.c | |||
@@ -827,9 +827,9 @@ communicator_start ( | |||
827 | 827 | ||
828 | 828 | ||
829 | /** | 829 | /** |
830 | * @brief Task run at shutdown to kill communicator and clean up | 830 | * @brief Task run at shutdown to kill NAT and clean up |
831 | * | 831 | * |
832 | * @param cls Closure - Process of communicator | 832 | * @param cls Closure - Process of NAT |
833 | */ | 833 | */ |
834 | static void | 834 | static void |
835 | shutdown_nat (void *cls) | 835 | shutdown_nat (void *cls) |
@@ -838,6 +838,17 @@ shutdown_nat (void *cls) | |||
838 | shutdown_process (proc); | 838 | shutdown_process (proc); |
839 | } | 839 | } |
840 | 840 | ||
841 | /** | ||
842 | * @brief Task run at shutdown to kill statistics service and clean up | ||
843 | * | ||
844 | * @param cls Closure - Process of statistics service | ||
845 | */ | ||
846 | static void | ||
847 | shutdown_statistics (void *cls) | ||
848 | { | ||
849 | struct GNUNET_OS_Process *proc = cls; | ||
850 | shutdown_process (proc); | ||
851 | } | ||
841 | 852 | ||
842 | /** | 853 | /** |
843 | * @brief Task run at shutdown to kill the resolver process | 854 | * @brief Task run at shutdown to kill the resolver process |
@@ -942,6 +953,38 @@ nat_start ( | |||
942 | GNUNET_free (binary); | 953 | GNUNET_free (binary); |
943 | } | 954 | } |
944 | 955 | ||
956 | /** | ||
957 | * @brief Start statistics | ||
958 | * | ||
959 | */ | ||
960 | static void | ||
961 | statistics_start ( | ||
962 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h) | ||
963 | { | ||
964 | char *binary; | ||
965 | |||
966 | LOG (GNUNET_ERROR_TYPE_DEBUG, "statistics_start\n"); | ||
967 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics"); | ||
968 | tc_h->statistics_proc = GNUNET_OS_start_process ( | ||
969 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR | ||
970 | | GNUNET_OS_USE_PIPE_CONTROL, | ||
971 | NULL, | ||
972 | NULL, | ||
973 | NULL, | ||
974 | binary, | ||
975 | "gnunet-service-statistics", | ||
976 | "-c", | ||
977 | tc_h->cfg_filename, | ||
978 | NULL); | ||
979 | if (NULL == tc_h->statistics_proc) | ||
980 | { | ||
981 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start statistics service!"); | ||
982 | return; | ||
983 | } | ||
984 | LOG (GNUNET_ERROR_TYPE_INFO, "started statistics service\n"); | ||
985 | GNUNET_free (binary); | ||
986 | } | ||
987 | |||
945 | 988 | ||
946 | /** | 989 | /** |
947 | * @brief Start communicator part of transport service and communicator | 990 | * @brief Start communicator part of transport service and communicator |
@@ -1009,6 +1052,8 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( | |||
1009 | resolver_start (tc_h); | 1052 | resolver_start (tc_h); |
1010 | /* Start peerstore service */ | 1053 | /* Start peerstore service */ |
1011 | peerstore_start (tc_h); | 1054 | peerstore_start (tc_h); |
1055 | /* Start statistics service */ | ||
1056 | statistics_start (tc_h); | ||
1012 | /* Schedule start communicator */ | 1057 | /* Schedule start communicator */ |
1013 | communicator_start (tc_h, | 1058 | communicator_start (tc_h, |
1014 | binary_name); | 1059 | binary_name); |
@@ -1025,6 +1070,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop ( | |||
1025 | shutdown_nat (tc_h->nat_proc); | 1070 | shutdown_nat (tc_h->nat_proc); |
1026 | shutdown_resolver (tc_h->resolver_proc); | 1071 | shutdown_resolver (tc_h->resolver_proc); |
1027 | shutdown_peerstore (tc_h->ps_proc); | 1072 | shutdown_peerstore (tc_h->ps_proc); |
1073 | shutdown_statistics (tc_h->statistics_proc); | ||
1028 | GNUNET_CONFIGURATION_destroy (tc_h->cfg); | 1074 | GNUNET_CONFIGURATION_destroy (tc_h->cfg); |
1029 | GNUNET_free (tc_h); | 1075 | GNUNET_free (tc_h); |
1030 | } | 1076 | } |
diff --git a/src/transport/transport-testing2.h b/src/transport/transport-testing2.h index 04f75fc88..a95c0dfa7 100644 --- a/src/transport/transport-testing2.h +++ b/src/transport/transport-testing2.h | |||
@@ -195,6 +195,11 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle | |||
195 | struct GNUNET_OS_Process *nat_proc; | 195 | struct GNUNET_OS_Process *nat_proc; |
196 | 196 | ||
197 | /** | 197 | /** |
198 | * statistics service process | ||
199 | */ | ||
200 | struct GNUNET_OS_Process *statistics_proc; | ||
201 | |||
202 | /** | ||
198 | * resolver service process | 203 | * resolver service process |
199 | */ | 204 | */ |
200 | struct GNUNET_OS_Process *resolver_proc; | 205 | struct GNUNET_OS_Process *resolver_proc; |