[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8826 - GNUnet/src/applications/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8826 - GNUnet/src/applications/testing |
Date: |
Sat, 15 Aug 2009 16:12:22 -0600 |
Author: nevans
Date: 2009-08-15 16:12:22 -0600 (Sat, 15 Aug 2009)
New Revision: 8826
Modified:
GNUnet/src/applications/testing/remote.c
GNUnet/src/applications/testing/remotetopologies.c
Log:
malicious config support
Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c 2009-08-11 22:24:07 UTC (rev
8825)
+++ GNUnet/src/applications/testing/remote.c 2009-08-15 22:12:22 UTC (rev
8826)
@@ -317,6 +317,10 @@
unsigned long long temp_port;
unsigned long long topology;
+ unsigned long long malicious_getters;
+ unsigned long long malicious_putters;
+ unsigned long long malicious_droppers;
+
unsigned long long extra_daemons;
unsigned int count;
unsigned int count_started;
@@ -333,6 +337,10 @@
char *ipk_dir;
double percentage;
+ double malicious_getter_num;
+ double malicious_putter_num;
+ double malicious_dropper_num;
+
length = 0;
ipk_dir = GNUNET_get_installation_path (GNUNET_IPK_DATADIR);
if (ipk_dir == NULL)
@@ -348,6 +356,24 @@
GNUNET_GC_get_configuration_value_number (newcfg, "MULTIPLE_SERVER_TESTING",
"TOPOLOGY", 0, -1, 0, &topology);
+ GNUNET_GC_get_configuration_value_number (newcfg, "MULTIPLE_SERVER_TESTING",
+ "MALICIOUS_GETTERS", 0,
number_of_daemons, 0, &malicious_getters);
+
+ if (malicious_getters > 0)
+ malicious_getter_num = number_of_daemons/malicious_getters;
+
+ GNUNET_GC_get_configuration_value_number (newcfg, "MULTIPLE_SERVER_TESTING",
+ "MALICIOUS_PUTTERS", 0,
number_of_daemons, 0, &malicious_putters);
+
+ if (malicious_putters > 0)
+ malicious_putter_num = number_of_daemons/malicious_putters;
+
+ GNUNET_GC_get_configuration_value_number (newcfg, "MULTIPLE_SERVER_TESTING",
+ "MALICIOUS_DROPPERS", 0,
number_of_daemons, 0, &malicious_droppers);
+
+ if (malicious_droppers > 0)
+ malicious_dropper_num = number_of_daemons/malicious_droppers;
+
type_of_topology = (unsigned int) topology;
GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
@@ -497,6 +523,55 @@
for (j = 0; j < daemons_per_machine; ++j)
{
+
+ /*
+ * Indicates that the first node should be set as a malicious getter
+ */
+ if ((malicious_getters > 0) && ( (((count_started + 1) %
(int)malicious_getter_num) == 0 )))
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT", "MALICIOUS_GETTER",
+ "YES");
+ }
+ else
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT", "MALICIOUS_GETTER",
+ "NO");
+ }
+
+ /*
+ * Indicates that the first node should be set as a malicious putter
+ */
+ if ((malicious_putters > 0) && ( (((count_started + 1) %
(int)malicious_putter_num) == 0 )))
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT", "MALICIOUS_PUTTER",
+ "YES");
+ }
+ else
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT", "MALICIOUS_PUTTER",
+ "NO");
+ }
+
+ /*
+ * Indicates that the first node should be set as a malicious dropper
+ */
+ if ((malicious_droppers > 0) && ( (((count_started + 1) %
(int)malicious_dropper_num) == 0 )))
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT", "MALICIOUS_DROPPER",
+ "YES");
+ }
+ else
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT", "MALICIOUS_DROPPER",
+ "NO");
+ }
+
length_temp =
snprintf (NULL, 0, "%s%s%d", remote_pid_path, "pid", j);
temp_pid_file = GNUNET_malloc (length_temp + 1);
@@ -643,6 +718,54 @@
break;
}
+ /*
+ * Indicates that the first node should be set as a malicious
getter
+ */
+ if ((malicious_getters > 0) && ( (((count_started + 1) %
(int)malicious_getter_num) == 0 )))
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT",
"MALICIOUS_GETTER",
+ "YES");
+ }
+ else
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT",
"MALICIOUS_GETTER",
+ "NO");
+ }
+
+ /*
+ * Indicates that the first node should be set as a malicious
putter
+ */
+ if ((malicious_putters > 0) && ( (((count_started + 1) %
(int)malicious_putter_num) == 0 )))
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT",
"MALICIOUS_PUTTER",
+ "YES");
+ }
+ else
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT",
"MALICIOUS_PUTTER",
+ "NO");
+ }
+
+ /*
+ * Indicates that the first node should be set as a malicious
dropper
+ */
+ if ((malicious_droppers > 0) && ( (((count_started + 1) %
(int)malicious_dropper_num) == 0 )))
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT",
"MALICIOUS_DROPPER",
+ "YES");
+ }
+ else
+ {
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "DHT",
"MALICIOUS_DROPPER",
+ "NO");
+ }
+
GNUNET_GC_set_configuration_value_number (basecfg, NULL,
"NETWORK", "PORT",
starting_port);
@@ -886,7 +1009,7 @@
#endif
ret =
GNUNET_REMOTE_connect_small_world (number_of_daemons, list_as_array,
- dotOutFile);
+ dotOutFile, percentage);
break;
case GNUNET_REMOTE_RING:
#if VERBOSE
Modified: GNUnet/src/applications/testing/remotetopologies.c
===================================================================
--- GNUnet/src/applications/testing/remotetopologies.c 2009-08-11 22:24:07 UTC
(rev 8825)
+++ GNUnet/src/applications/testing/remotetopologies.c 2009-08-15 22:12:22 UTC
(rev 8826)
@@ -387,7 +387,7 @@
int
GNUNET_REMOTE_connect_small_world (int number_of_daemons,
struct GNUNET_REMOTE_host_list
- **list_as_array, FILE * dotOutFile)
+ **list_as_array, FILE * dotOutFile, double
percentage)
{
unsigned int i, j, k;
unsigned int square;
@@ -485,10 +485,11 @@
natLog = log (number_of_daemons);
#if VERBOSE
- fprintf (stderr, _("natural log of %d is %d\n"), number_of_daemons, natLog);
+ fprintf (stderr, _("natural log of %d is %d, will run %d iterations\n"),
number_of_daemons, natLog, (int)(natLog * percentage));
+ fprintf (stderr, _("Total connections added thus far: %d!\n"),
smallWorldConnections);
#endif
smallWorldConnections = 0;
- for (i = 0; i < natLog; i++)
+ for (i = 0; i < (int)(natLog * percentage); i++)
{
for (j = 0; j < number_of_daemons; j++)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8826 - GNUnet/src/applications/testing,
gnunet <=