summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-12-19 14:34:22 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-12-19 14:34:22 +0000
commita6a5670ac36add072a106e63a62177cdc18e2d36 (patch)
treeb7280d23978844fa8bec155ce9986a95cc9f2c4f /src/transport
parent341078a13b53786e3e7890f871b5f66965dd13d0 (diff)
added function to disable receiving broadcasts to prevent buildbots from connecting to the network
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/plugin_transport_udp.c8
-rw-r--r--src/transport/plugin_transport_udp.h5
-rw-r--r--src/transport/test_transport_defaults.conf5
-rw-r--r--src/transport/transport.conf.in1
4 files changed, 18 insertions, 1 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index a5ee6494a..d3a8d1017 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -2515,6 +2515,7 @@ udp_select_read (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *rsock)
switch (ntohs (msg->type))
{
case GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON:
+ if (GNUNET_YES == plugin->enable_broadcasting_receiving)
udp_broadcast_receive (plugin, buf, size,
(const struct sockaddr *) &addr, fromlen);
return;
@@ -3049,6 +3050,7 @@ libgnunet_plugin_transport_udp_init (void *cls)
unsigned long long udp_max_bps;
unsigned long long enable_v6;
unsigned long long enable_broadcasting;
+ unsigned long long enable_broadcasting_recv;
char * bind4_address;
char * bind6_address;
char * fancy_interval;
@@ -3147,6 +3149,11 @@ libgnunet_plugin_transport_udp_init (void *cls)
if (enable_broadcasting == GNUNET_SYSERR)
enable_broadcasting = GNUNET_NO;
+ enable_broadcasting_recv = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, "transport-udp",
+ "BROADCAST_RECEIVE");
+ if (enable_broadcasting_recv == GNUNET_SYSERR)
+ enable_broadcasting_recv = GNUNET_YES;
+
if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (env->cfg, "transport-udp",
"BROADCAST_INTERVAL", &fancy_interval))
{
@@ -3175,6 +3182,7 @@ libgnunet_plugin_transport_udp_init (void *cls)
p->enable_ipv6 = enable_v6;
p->enable_ipv4 = GNUNET_YES; /* default */
p->enable_broadcasting = enable_broadcasting;
+ p->enable_broadcasting_receiving = enable_broadcasting_recv;
p->env = env;
p->sessions = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
p->defrag_ctxs = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
diff --git a/src/transport/plugin_transport_udp.h b/src/transport/plugin_transport_udp.h
index 2873266b5..8f78ed4bc 100644
--- a/src/transport/plugin_transport_udp.h
+++ b/src/transport/plugin_transport_udp.h
@@ -254,6 +254,11 @@ struct Plugin
int enable_broadcasting;
/**
+ * Is receiving broadcasts enabled: GNUNET_YES or GNUNET_NO
+ */
+ int enable_broadcasting_receiving;
+
+ /**
* Port we broadcasting on.
*/
uint16_t broadcast_port;
diff --git a/src/transport/test_transport_defaults.conf b/src/transport/test_transport_defaults.conf
index 10c6d8ba3..314613226 100644
--- a/src/transport/test_transport_defaults.conf
+++ b/src/transport/test_transport_defaults.conf
@@ -8,7 +8,7 @@ TIMEOUT = 300 s
DEFAULTSERVICES =
[transport]
-# PREFIX = valgrind
+#PREFIX = valgrind -v --gen-suppressions=yes
[core]
AUTOSTART = NO
@@ -54,3 +54,6 @@ EXTERNAL_ADDRESS = 127.0.0.1
[TESTING]
WEAKRANDOM = YES
+
+[transport-udp]
+BROADCAST_RECEIVE = no \ No newline at end of file
diff --git a/src/transport/transport.conf.in b/src/transport/transport.conf.in
index 0464ba841..575f4dc20 100644
--- a/src/transport/transport.conf.in
+++ b/src/transport/transport.conf.in
@@ -56,6 +56,7 @@ MAX_CONNECTIONS = 128
# Use PORT = 0 to autodetect a port available
PORT = 2086
BROADCAST = YES
+BROADCAST_RECEIVE = YES
BROADCAST_INTERVAL = 30 s
MAX_BPS = 1000000
TESTING_IGNORE_KEYS = ACCEPT_FROM;