summaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp_broadcasting.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-01-15 12:25:45 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-01-15 12:25:45 +0000
commit0df3f4819fd93b7a3c5829f4324dccdb0908b4a4 (patch)
treeecab2dae166e5c575544bf05df5d9ebc1c391beb /src/transport/plugin_transport_udp_broadcasting.c
parentcba4427ea24d4ab07c4028e11bef99c3f820e6b9 (diff)
fix mantis bug 0003270: do not broadcast on loopback
Diffstat (limited to 'src/transport/plugin_transport_udp_broadcasting.c')
-rw-r--r--src/transport/plugin_transport_udp_broadcasting.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c
index 669ebdb01..7dfe86944 100644
--- a/src/transport/plugin_transport_udp_broadcasting.c
+++ b/src/transport/plugin_transport_udp_broadcasting.c
@@ -473,6 +473,7 @@ iface_proc (void *cls,
{
struct Plugin *plugin = cls;
struct BroadcastAddress *ba;
+ struct GNUNET_ATS_Information network;
if (NULL == addr)
return GNUNET_OK;
@@ -487,11 +488,19 @@ iface_proc (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "netmask %s for interface %s %p\n ",
GNUNET_a2s (netmask, addrlen), name, netmask);
+ network = plugin->env->get_address_type (plugin->env->cls, broadcast_addr, addrlen);
+ if (GNUNET_ATS_NET_LOOPBACK == ntohl(network.value))
+ {
+ /* Broadcasting on loopback does not make sense */
+ return GNUNET_YES;
+ }
+
ba = GNUNET_new (struct BroadcastAddress);
ba->plugin = plugin;
ba->addr = GNUNET_malloc (addrlen);
memcpy (ba->addr, broadcast_addr, addrlen);
ba->addrlen = addrlen;
+
if ( (GNUNET_YES == plugin->enable_ipv4) &&
(NULL != plugin->sockv4) &&
(addrlen == sizeof (struct sockaddr_in)) )