UNIXPATH = /tmp/gnunet-service-ats.sock
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
+
+# Enable MLP mode (default: NO)
MLP = NO
-WAN_QUOTA_IN = 65536
-WAN_QUOTA_OUT = 65536
+# Network specific inbound/outbound quotas
+# LOOPBACK
+LOOPBACK_QUOTA_IN = unlimited
+LOOPBACK_QUOTA_OUT = unlimited
+# LAN
+LAN_QUOTA_IN = unlimited
+LAN_QUOTA_OUT = unlimited
+# WAN
+WAN_QUOTA_IN = 64 KiB
+WAN_QUOTA_OUT = 64 KiB
+# WLAN
+WLAN_QUOTA_IN = 1 MiB
+WLAN_QUOTA_OUT = 1 MiB
# ATS options
+
DUMP_MLP = NO
DUMP_SOLUTION = NO
DUMP_OVERWRITE = NO
GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_STATISTICS_Handle *stats)
{
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
- "WAN_QUOTA_IN",
- &wan_quota_in));
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
- "WAN_QUOTA_OUT",
- &wan_quota_out));
-
- switch (GNUNET_CONFIGURATION_get_value_yesno (cfg, "ats", "MLP"))
+ int mode;
+
+ char *quota_wan_in_str;
+ char *quota_wan_out_str;
+
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "ats", "WAN_QUOTA_IN", "a_wan_in_str))
+ {
+ if (0 == strcmp(quota_wan_in_str, "unlimited") ||
+ (GNUNET_SYSERR == GNUNET_STRINGS_fancy_size_to_bytes (quota_wan_in_str, &wan_quota_in)))
+ wan_quota_in = (UINT32_MAX) /10;
+
+ GNUNET_free (quota_wan_in_str);
+ quota_wan_in_str = NULL;
+ }
+ else
+ {
+ wan_quota_in = (UINT32_MAX) /10;
+ }
+
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "ats", "WAN_QUOTA_OUT", "a_wan_out_str))
{
- /* MLP = YES */
- case GNUNET_YES:
+ if (0 == strcmp(quota_wan_out_str, "unlimited") ||
+ (GNUNET_SYSERR == GNUNET_STRINGS_fancy_size_to_bytes (quota_wan_out_str, &wan_quota_out)))
+ wan_quota_out = (UINT32_MAX) /10;
+
+ GNUNET_free (quota_wan_out_str);
+ quota_wan_out_str = NULL;
+ }
+ else
+ {
+ wan_quota_out = (UINT32_MAX) /10;
+ }
+
+
+ mode = GNUNET_CONFIGURATION_get_value_yesno (cfg, "ats", "MLP");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MLP mode %u", mode);
+ switch (mode)
+ {
+ /* MLP = YES */
+ case GNUNET_YES:
#if HAVE_LIBGLPK
- ats_mode = MLP;
- /* Init the MLP solver with default values */
- mlp = GAS_mlp_init (cfg, stats, MLP_MAX_EXEC_DURATION, MLP_MAX_ITERATIONS);
- break;
+ ats_mode = MLP;
+ /* Init the MLP solver with default values */
+ mlp = GAS_mlp_init (cfg, stats, MLP_MAX_EXEC_DURATION, MLP_MAX_ITERATIONS);
+ if (NULL == mlp)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MLP mode was configured, but libglpk is not installed, switching to simple mode\n");
+ GNUNET_STATISTICS_update (GSA_stats, "MLP mode enabled", 0, GNUNET_NO);
+ break;
+ }
+ else
+ {
+ GNUNET_STATISTICS_update (GSA_stats, "MLP enabled", 1, GNUNET_NO);
+ break;
+ }
#else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MLP mode was configured, but libglpk is not installed, switching to simple mode");
- ats_mode = SIMPLE;
- break;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MLP mode was configured, but libglpk is not installed, switching to simple mode");
+ GNUNET_STATISTICS_update (GSA_stats, "MLP enabled", 0, GNUNET_NO);
+ ats_mode = SIMPLE;
+ break;
#endif
- /* MLP = NO */
- case GNUNET_NO:
- ats_mode = SIMPLE;
- break;
- /* No configuration value */
- case GNUNET_SYSERR:
- ats_mode = SIMPLE;
- break;
- default:
- break;
+ /* MLP = NO */
+ case GNUNET_NO:
+ GNUNET_STATISTICS_update (GSA_stats, "MLP enabled", 0, GNUNET_NO);
+ ats_mode = SIMPLE;
+ break;
+ /* No configuration value */
+ case GNUNET_SYSERR:
+ GNUNET_STATISTICS_update (GSA_stats, "MLP enabled", 0, GNUNET_NO);
+ ats_mode = SIMPLE;
+ break;
+ default:
+ break;
}
-
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS started with %s mode\n", (SIMPLE == ats_mode) ? "SIMPLE" : "MLP");
addresses = GNUNET_CONTAINER_multihashmap_create (128);
}
unsigned int n_min;
struct GNUNET_TIME_Relative i_exec;
int c;
+ char * quota_out_str;
+ char * quota_in_str;
/* Init GLPK environment */
GNUNET_assert (glp_init_env() == 0);
mlp->prob = glp_create_prob();
GNUNET_assert (mlp->prob != NULL);
- mlp->BIG_M = (double) (UINT32_MAX) /10;
+ mlp->BIG_M = (double) BIG_M_VALUE;
/* Get diversity coefficient from configuration */
if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
if ((entry_in == NULL) || (entry_out == NULL))
continue;
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_size (cfg, "ats", entry_out, "a_out))
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "ats", entry_out, "a_out_str))
+ {
+ if (0 == strcmp(quota_out_str, BIG_M_STRING) ||
+ (GNUNET_SYSERR == GNUNET_STRINGS_fancy_size_to_bytes (quota_out_str, "a_out)))
+ quota_out = mlp->BIG_M;
+
+ GNUNET_free (quota_out_str);
+ quota_out_str = NULL;
+ }
+ else if (GNUNET_ATS_NET_UNSPECIFIED == quotas[c])
+ {
+ quota_out = 0;
+ }
+ else
{
quota_out = mlp->BIG_M;
}
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_size (cfg, "ats", entry_in, "a_in))
+
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "ats", entry_in, "a_in_str))
+ {
+ if (0 == strcmp(quota_in_str, BIG_M_STRING) ||
+ (GNUNET_SYSERR == GNUNET_STRINGS_fancy_size_to_bytes (quota_in_str, "a_in)))
+ quota_in = mlp->BIG_M;
+
+ GNUNET_free (quota_in_str);
+ quota_in_str = NULL;
+ }
+ else if (GNUNET_ATS_NET_UNSPECIFIED == quotas[c])
+ {
+ quota_in = 0;
+ }
+ else
{
quota_in = mlp->BIG_M;
}
+
/* Check if defined quota could make problem unsolvable */
- if ((n_min * b_min) > quota_out)
+ if (((n_min * b_min) > quota_out) && (GNUNET_ATS_NET_UNSPECIFIED != quotas[c]))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Inconsistent quota configuration value `%s': " \
"outbound quota (%u Bps) too small for combination of minimum connections and minimum bandwidth per peer (%u * %u Bps = %u)\n", entry_out, quota_out, n_min, b_min, n_min * b_min);
- unsigned int default_min = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__);
- if ((quota_out / n_min) > default_min)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Reducing minimum bandwidth per peer to %u Bps\n",
- (quota_out / n_min));
- b_min = (quota_out / n_min);
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Reducing minimum bandwidth per peer to %u Bps and minimum connections to %u \n",
- default_min, (quota_out / default_min));
- b_min = default_min;
- n_min = (quota_out / default_min);
- }
+
+ GAS_mlp_done(mlp);
+ mlp = NULL;
+ return NULL;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found `%s' quota %llu and `%s' quota %llu\n",
entry_out, quota_out, entry_in, quota_in);
+ GNUNET_STATISTICS_update ((struct GNUNET_STATISTICS_Handle *) stats, entry_out, quota_out, GNUNET_NO);
+ GNUNET_STATISTICS_update ((struct GNUNET_STATISTICS_Handle *) stats, entry_in, quota_in, GNUNET_NO);
mlp->quota_out[c] = quota_out;
mlp->quota_in[c] = quota_in;
}
#define DEBUG_MLP GNUNET_EXTRA_LOGGING
+#define BIG_M_VALUE (UINT32_MAX) /10
+#define BIG_M_STRING "unlimited"
+
#define MLP_AVERAGING_QUEUE_LENGTH 3
#define MLP_MAX_EXEC_DURATION GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3)
[ats]
#DEBUG = YES
-#PREFIX = valgrind --leak-check=full
-#WAN_QUOTA_OUT = 4294967295
-#WAN_QUOTA_IN = 4294967295
+PREFIX = valgrind --leak-check=full
AUTOSTART = YES
PORT = 12002
HOSTNAME = localhost
ACCEPT_FROM6 = ::1;
UNIXPATH = /tmp/test-ats-scheduling-ats.sock
UNIX_MATCH_UID = YES
-UNIX_MATCH_GID = YES
\ No newline at end of file
+UNIX_MATCH_GID = YES
+
+# Enable MLP mode (default: NO)
+MLP = YES
+# Network specific inbound/outbound quotas
+# LOOPBACK
+LOOPBACK_QUOTA_IN = unlimited
+LOOPBACK_QUOTA_OUT = unlimited
+# LAN
+LAN_QUOTA_IN = unlimited
+LAN_QUOTA_OUT = unlimited
+# WAN
+WAN_QUOTA_IN = 64 KiB
+WAN_QUOTA_OUT = 64 KiB
+# WLAN
+WLAN_QUOTA_IN = 1 MiB
+WLAN_QUOTA_OUT = 1 MiB
+
+# ATS extended options
+DUMP_MLP = NO
+DUMP_SOLUTION = NO
+DUMP_OVERWRITE = NO
+DUMP_MIN_PEERS = 0
+DUMP_MIN_ADDRS = 0
+DUMP_OVERWRITE = NO
+ATS_MIN_INTERVAL = 15000
+ATS_EXEC_INTERVAL = 30000