aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp_broadcasting.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-05-08 12:35:29 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-05-08 12:35:29 +0000
commit087280973a36b24206dabd2d866a19967d66d211 (patch)
tree4df337cbfdbf99aab68e543a2205c75a7a10cfe3 /src/transport/plugin_transport_udp_broadcasting.c
parentf1a81cdef353dc670744447c77298d39797b4005 (diff)
downloadgnunet-087280973a36b24206dabd2d866a19967d66d211.tar.gz
gnunet-087280973a36b24206dabd2d866a19967d66d211.zip
- fix crashes
Diffstat (limited to 'src/transport/plugin_transport_udp_broadcasting.c')
-rw-r--r--src/transport/plugin_transport_udp_broadcasting.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c
index 623cde2bd..2935d8da3 100644
--- a/src/transport/plugin_transport_udp_broadcasting.c
+++ b/src/transport/plugin_transport_udp_broadcasting.c
@@ -175,7 +175,7 @@ udp_broadcast_receive (struct Plugin *plugin, const char * buf, ssize_t size, st
175{ 175{
176 struct GNUNET_ATS_Information ats; 176 struct GNUNET_ATS_Information ats;
177 177
178 if (addrlen == sizeof (struct sockaddr_in)) 178 if ((GNUNET_YES == plugin->broadcast_ipv4) && (addrlen == sizeof (struct sockaddr_in)))
179 { 179 {
180 LOG (GNUNET_ERROR_TYPE_DEBUG, 180 LOG (GNUNET_ERROR_TYPE_DEBUG,
181 "Received IPv4 HELLO beacon broadcast with %i bytes from address %s\n", 181 "Received IPv4 HELLO beacon broadcast with %i bytes from address %s\n",
@@ -189,12 +189,14 @@ udp_broadcast_receive (struct Plugin *plugin, const char * buf, ssize_t size, st
189 mc->addr.u4_port = av4->sin_port; 189 mc->addr.u4_port = av4->sin_port;
190 ats = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) addr, addrlen); 190 ats = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) addr, addrlen);
191 mc->ats_address_network_type = ats.value; 191 mc->ats_address_network_type = ats.value;
192
193 GNUNET_assert (NULL != plugin->broadcast_ipv4_mst);
192 if (GNUNET_OK != 194 if (GNUNET_OK !=
193 GNUNET_SERVER_mst_receive (plugin->broadcast_ipv4_mst, mc, buf, size, 195 GNUNET_SERVER_mst_receive (plugin->broadcast_ipv4_mst, mc, buf, size,
194 GNUNET_NO, GNUNET_NO)) 196 GNUNET_NO, GNUNET_NO))
195 GNUNET_free (mc); 197 GNUNET_free (mc);
196 } 198 }
197 else if (addrlen == sizeof (struct sockaddr_in6)) 199 else if ((GNUNET_YES == plugin->broadcast_ipv4) && (addrlen == sizeof (struct sockaddr_in6)))
198 { 200 {
199 LOG (GNUNET_ERROR_TYPE_DEBUG, 201 LOG (GNUNET_ERROR_TYPE_DEBUG,
200 "Received IPv6 HELLO beacon broadcast with %i bytes from address %s\n", 202 "Received IPv6 HELLO beacon broadcast with %i bytes from address %s\n",
@@ -208,7 +210,7 @@ udp_broadcast_receive (struct Plugin *plugin, const char * buf, ssize_t size, st
208 mc->addr.u6_port = av6->sin6_port; 210 mc->addr.u6_port = av6->sin6_port;
209 ats = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) addr, addrlen); 211 ats = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) addr, addrlen);
210 mc->ats_address_network_type = ats.value; 212 mc->ats_address_network_type = ats.value;
211 213 GNUNET_assert (NULL != plugin->broadcast_ipv4_mst);
212 if (GNUNET_OK != 214 if (GNUNET_OK !=
213 GNUNET_SERVER_mst_receive (plugin->broadcast_ipv6_mst, mc, buf, size, 215 GNUNET_SERVER_mst_receive (plugin->broadcast_ipv6_mst, mc, buf, size,
214 GNUNET_NO, GNUNET_NO)) 216 GNUNET_NO, GNUNET_NO))