aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/Makefile.am2
-rw-r--r--src/transport/plugin_transport_udp.c31
-rw-r--r--src/transport/plugin_transport_udp.h1
3 files changed, 19 insertions, 15 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 9fb451383..99ed900c5 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -347,7 +347,7 @@ libgnunet_plugin_transport_udp_la_LIBADD = \
347 $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \ 347 $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \
348 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 348 $(top_builddir)/src/statistics/libgnunetstatistics.la \
349 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ 349 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
350 $(top_builddir)/src/nat/libgnunetnat.la \ 350 $(top_builddir)/src/nat/libgnunetnatnew.la \
351 $(top_builddir)/src/util/libgnunetutil.la \ 351 $(top_builddir)/src/util/libgnunetutil.la \
352 $(LTLIBINTL) 352 $(LTLIBINTL)
353libgnunet_plugin_transport_udp_la_LDFLAGS = \ 353libgnunet_plugin_transport_udp_la_LDFLAGS = \
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 35ae92460..c9fb754c1 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2010-2015 GNUnet e.V. 3 Copyright (C) 2010-2017 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -30,7 +30,7 @@
30#include "gnunet_hello_lib.h" 30#include "gnunet_hello_lib.h"
31#include "gnunet_util_lib.h" 31#include "gnunet_util_lib.h"
32#include "gnunet_fragmentation_lib.h" 32#include "gnunet_fragmentation_lib.h"
33#include "gnunet_nat_lib.h" 33#include "gnunet_nat_service.h"
34#include "gnunet_protocols.h" 34#include "gnunet_protocols.h"
35#include "gnunet_resolver_service.h" 35#include "gnunet_resolver_service.h"
36#include "gnunet_signatures.h" 36#include "gnunet_signatures.h"
@@ -1287,12 +1287,14 @@ udp_plugin_check_address (void *cls,
1287 * @param cls closure, the `struct Plugin` 1287 * @param cls closure, the `struct Plugin`
1288 * @param add_remove #GNUNET_YES to mean the new public IP address, 1288 * @param add_remove #GNUNET_YES to mean the new public IP address,
1289 * #GNUNET_NO to mean the previous (now invalid) one 1289 * #GNUNET_NO to mean the previous (now invalid) one
1290 * @param ac address class the address belongs to
1290 * @param addr either the previous or the new public IP address 1291 * @param addr either the previous or the new public IP address
1291 * @param addrlen actual length of the @a addr 1292 * @param addrlen actual length of the @a addr
1292 */ 1293 */
1293static void 1294static void
1294udp_nat_port_map_callback (void *cls, 1295udp_nat_port_map_callback (void *cls,
1295 int add_remove, 1296 int add_remove,
1297 enum GNUNET_NAT_AddressClass ac,
1296 const struct sockaddr *addr, 1298 const struct sockaddr *addr,
1297 socklen_t addrlen) 1299 socklen_t addrlen)
1298{ 1300{
@@ -1359,6 +1361,7 @@ udp_nat_port_map_callback (void *cls,
1359 return; 1361 return;
1360 } 1362 }
1361 /* modify our published address list */ 1363 /* modify our published address list */
1364 /* TODO: use 'ac' here in the future... */
1362 address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, 1365 address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
1363 PLUGIN_NAME, 1366 PLUGIN_NAME,
1364 arg, 1367 arg,
@@ -3082,7 +3085,7 @@ udp_select_read (struct Plugin *plugin,
3082 sizeof(addr)); 3085 sizeof(addr));
3083 size = GNUNET_NETWORK_socket_recvfrom (rsock, 3086 size = GNUNET_NETWORK_socket_recvfrom (rsock,
3084 buf, 3087 buf,
3085 sizeof(buf), 3088 sizeof (buf),
3086 (struct sockaddr *) &addr, 3089 (struct sockaddr *) &addr,
3087 &fromlen); 3090 &fromlen);
3088 sa = (const struct sockaddr *) &addr; 3091 sa = (const struct sockaddr *) &addr;
@@ -3111,9 +3114,12 @@ udp_select_read (struct Plugin *plugin,
3111 } 3114 }
3112 3115
3113 /* Check if this is a STUN packet */ 3116 /* Check if this is a STUN packet */
3114 if (GNUNET_NAT_is_valid_stun_packet (plugin->nat, 3117 if (GNUNET_NO !=
3115 (uint8_t *)buf, 3118 GNUNET_NAT_stun_handle_packet (plugin->nat,
3116 size)) 3119 (const struct sockaddr *) &addr,
3120 fromlen,
3121 buf,
3122 size))
3117 return; /* was STUN, do not process further */ 3123 return; /* was STUN, do not process further */
3118 3124
3119 if (size < sizeof(struct GNUNET_MessageHeader)) 3125 if (size < sizeof(struct GNUNET_MessageHeader))
@@ -3572,13 +3578,13 @@ udp_plugin_select_v6 (void *cls)
3572 * @param bind_v4 IPv4 address to bind to (can be NULL, for 'any') 3578 * @param bind_v4 IPv4 address to bind to (can be NULL, for 'any')
3573 * @return number of sockets that were successfully bound 3579 * @return number of sockets that were successfully bound
3574 */ 3580 */
3575static int 3581static unsigned int
3576setup_sockets (struct Plugin *plugin, 3582setup_sockets (struct Plugin *plugin,
3577 const struct sockaddr_in6 *bind_v6, 3583 const struct sockaddr_in6 *bind_v6,
3578 const struct sockaddr_in *bind_v4) 3584 const struct sockaddr_in *bind_v4)
3579{ 3585{
3580 int tries; 3586 int tries;
3581 int sockets_created = 0; 3587 unsigned int sockets_created = 0;
3582 struct sockaddr_in6 server_addrv6; 3588 struct sockaddr_in6 server_addrv6;
3583 struct sockaddr_in server_addrv4; 3589 struct sockaddr_in server_addrv4;
3584 const struct sockaddr *server_addr; 3590 const struct sockaddr *server_addr;
@@ -3788,15 +3794,14 @@ setup_sockets (struct Plugin *plugin,
3788 schedule_select_v4 (plugin); 3794 schedule_select_v4 (plugin);
3789 schedule_select_v6 (plugin); 3795 schedule_select_v6 (plugin);
3790 plugin->nat = GNUNET_NAT_register (plugin->env->cfg, 3796 plugin->nat = GNUNET_NAT_register (plugin->env->cfg,
3791 GNUNET_NO, 3797 "transport-udp",
3792 plugin->port, 3798 IPPROTO_UDP,
3793 sockets_created, 3799 sockets_created,
3794 addrs, 3800 addrs,
3795 addrlens, 3801 addrlens,
3796 &udp_nat_port_map_callback, 3802 &udp_nat_port_map_callback,
3797 NULL, 3803 NULL,
3798 plugin, 3804 plugin);
3799 plugin->sockv4);
3800 return sockets_created; 3805 return sockets_created;
3801} 3806}
3802 3807
@@ -3825,7 +3830,7 @@ libgnunet_plugin_transport_udp_init (void *cls)
3825 struct GNUNET_TIME_Relative interval; 3830 struct GNUNET_TIME_Relative interval;
3826 struct sockaddr_in server_addrv4; 3831 struct sockaddr_in server_addrv4;
3827 struct sockaddr_in6 server_addrv6; 3832 struct sockaddr_in6 server_addrv6;
3828 int res; 3833 unsigned int res;
3829 int have_bind4; 3834 int have_bind4;
3830 int have_bind6; 3835 int have_bind6;
3831 3836
diff --git a/src/transport/plugin_transport_udp.h b/src/transport/plugin_transport_udp.h
index c6799ba74..152b16099 100644
--- a/src/transport/plugin_transport_udp.h
+++ b/src/transport/plugin_transport_udp.h
@@ -32,7 +32,6 @@
32#include "gnunet_hello_lib.h" 32#include "gnunet_hello_lib.h"
33#include "gnunet_util_lib.h" 33#include "gnunet_util_lib.h"
34#include "gnunet_fragmentation_lib.h" 34#include "gnunet_fragmentation_lib.h"
35#include "gnunet_nat_lib.h"
36#include "gnunet_protocols.h" 35#include "gnunet_protocols.h"
37#include "gnunet_resolver_service.h" 36#include "gnunet_resolver_service.h"
38#include "gnunet_signatures.h" 37#include "gnunet_signatures.h"