aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-05-02 13:25:32 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-05-02 13:25:32 +0000
commit002641dca1067843c94349c3bd7cf4ee0afcae37 (patch)
tree391d3467d355224abdc1d5dbde57fabac3a2feae /src/transport/plugin_transport_udp.c
parent4ba7a736fee18101f5a3d232353a206b3a298b66 (diff)
downloadgnunet-002641dca1067843c94349c3bd7cf4ee0afcae37.tar.gz
gnunet-002641dca1067843c94349c3bd7cf4ee0afcae37.zip
- fix
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index b1da80431..9e28f00d4 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -380,11 +380,30 @@ udp_string_to_address (void *cls, const char *addr, uint16_t addrlen,
380 void **buf, size_t *added) 380 void **buf, size_t *added)
381{ 381{
382 struct sockaddr_storage socket_address; 382 struct sockaddr_storage socket_address;
383 int ret = GNUNET_STRINGS_to_address_ip (addr, addrlen, 383
384 if ((NULL == addr) || (addrlen == 0))
385 {
386 GNUNET_break (0);
387 return GNUNET_SYSERR;
388 }
389
390 if ('\0' != addr[addrlen - 1])
391 {
392 return GNUNET_SYSERR;
393 }
394
395 if (strlen (addr) != addrlen - 1)
396 {
397 return GNUNET_SYSERR;
398 }
399
400 int ret = GNUNET_STRINGS_to_address_ip (addr, strlen (addr),
384 &socket_address); 401 &socket_address);
385 402
386 if (ret != GNUNET_OK) 403 if (ret != GNUNET_OK)
404 {
387 return GNUNET_SYSERR; 405 return GNUNET_SYSERR;
406 }
388 407
389 if (socket_address.ss_family == AF_INET) 408 if (socket_address.ss_family == AF_INET)
390 { 409 {
@@ -395,6 +414,7 @@ udp_string_to_address (void *cls, const char *addr, uint16_t addrlen,
395 u4->u4_port = in4->sin_port; 414 u4->u4_port = in4->sin_port;
396 *buf = u4; 415 *buf = u4;
397 *added = sizeof (struct IPv4UdpAddress); 416 *added = sizeof (struct IPv4UdpAddress);
417 return GNUNET_OK;
398 } 418 }
399 else if (socket_address.ss_family == AF_INET6) 419 else if (socket_address.ss_family == AF_INET6)
400 { 420 {
@@ -405,6 +425,7 @@ udp_string_to_address (void *cls, const char *addr, uint16_t addrlen,
405 u6->u6_port = in6->sin6_port; 425 u6->u6_port = in6->sin6_port;
406 *buf = u6; 426 *buf = u6;
407 *added = sizeof (struct IPv6UdpAddress); 427 *added = sizeof (struct IPv6UdpAddress);
428 return GNUNET_OK;
408 } 429 }
409 return GNUNET_SYSERR; 430 return GNUNET_SYSERR;
410} 431}