aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-01-20 13:18:58 +0000
committerNathan S. Evans <evans@in.tum.de>2010-01-20 13:18:58 +0000
commit924137ff73bab48b720d41cf73a1197df2d4b04d (patch)
tree231c3940cf419514e8952135a9b49241cd83bf7d /src
parent37ce662c67ea4b4c4ec37e2d820bd2b06505f7b5 (diff)
downloadgnunet-924137ff73bab48b720d41cf73a1197df2d4b04d.tar.gz
gnunet-924137ff73bab48b720d41cf73a1197df2d4b04d.zip
whiny christian fix
Diffstat (limited to 'src')
-rw-r--r--src/transport/Makefile.am12
-rw-r--r--src/transport/plugin_transport_udp.c23
-rw-r--r--src/transport/test_plugin_transport_udp.c2
-rw-r--r--src/transport/test_transport_api.c14
4 files changed, 29 insertions, 22 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 7d1f89a6e..8d5ea59dd 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -78,19 +78,25 @@ libgnunet_plugin_transport_udp_la_LDFLAGS = \
78 $(GN_PLUGIN_LDFLAGS) 78 $(GN_PLUGIN_LDFLAGS)
79 79
80check_PROGRAMS = \ 80check_PROGRAMS = \
81 test_transport_api \ 81 test_transport_api_tcp \
82 test_transport_api_udp \
82 test_plugin_transport \ 83 test_plugin_transport \
83 test_plugin_transport_udp 84 test_plugin_transport_udp
84# TODO: add tests for tcp, udp, http, nat, etc. 85# TODO: add tests for tcp, udp, http, nat, etc.
85 86
86TESTS = $(check_PROGRAMS) 87TESTS = $(check_PROGRAMS)
87 88
88test_transport_api_SOURCES = \ 89test_transport_api_tcp_SOURCES = \
89 test_transport_api.c 90 test_transport_api.c
90test_transport_api_LDADD = \ 91test_transport_api_tcp_LDADD = \
91 $(top_builddir)/src/transport/libgnunettransport.la \ 92 $(top_builddir)/src/transport/libgnunettransport.la \
92 $(top_builddir)/src/util/libgnunetutil.la 93 $(top_builddir)/src/util/libgnunetutil.la
93 94
95test_transport_api_udp_SOURCES = \
96 test_transport_api.c
97test_transport_api_udp_LDADD = \
98 $(top_builddir)/src/transport/libgnunettransport.la \
99 $(top_builddir)/src/util/libgnunetutil.la
94 100
95test_plugin_transport_SOURCES = \ 101test_plugin_transport_SOURCES = \
96 test_plugin_transport.c 102 test_plugin_transport.c
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index d3c2bac85..d88f1d209 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -175,9 +175,7 @@ struct Plugin
175 175
176/** 176/**
177 * Message used to ask a peer to validate receipt (to check an address 177 * Message used to ask a peer to validate receipt (to check an address
178 * from a HELLO). Followed by the address used. Note that the 178 * from a HELLO).
179 * recipients response does not affirm that he has this address,
180 * only that he got the challenge message.
181 */ 179 */
182struct UDPPingMessage 180struct UDPPingMessage
183{ 181{
@@ -192,22 +190,16 @@ struct UDPPingMessage
192 */ 190 */
193 uint32_t challenge GNUNET_PACKED; 191 uint32_t challenge GNUNET_PACKED;
194 192
195
196
197}; 193};
198 194
199 195
200/** 196/**
201 * Message used to validate a HELLO. The challenge is included in the 197 * Message used to validate a HELLO. The challenge number
202 * confirmation to make matching of replies to requests possible. The 198 * is sent along with whatever address the peer received
203 * signature signs the original challenge number, our public key, the 199 * the ping from. Used to validate our address (or at
204 * sender's address (so that the sender can check that the address we 200 * least give us a better idea where we look like we're
205 * saw is plausible for him and possibly detect a MiM attack) and a 201 * coming from).
206 * timestamp (to limit replay).<p>
207 * 202 *
208 * This message is followed by the address of the
209 * client that we are observing (which is part of what
210 * is being signed).
211 */ 203 */
212struct UDPPongMessage 204struct UDPPongMessage
213{ 205{
@@ -499,12 +491,10 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
499 491
500 buf = GNUNET_malloc (buflen); 492 buf = GNUNET_malloc (buflen);
501 fromlen = sizeof (addr); 493 fromlen = sizeof (addr);
502
503#if DEBUG_UDP 494#if DEBUG_UDP
504 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "udp", _ 495 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "udp", _
505 ("src_addr_len is %u\n"), fromlen); 496 ("src_addr_len is %u\n"), fromlen);
506#endif 497#endif
507
508 memset (&addr, 0, fromlen); 498 memset (&addr, 0, fromlen);
509 ret = 499 ret =
510 GNUNET_NETWORK_socket_recvfrom (udp_sock, buf, buflen, 500 GNUNET_NETWORK_socket_recvfrom (udp_sock, buf, buflen,
@@ -521,7 +511,6 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
521 GNUNET_free (buf); 511 GNUNET_free (buf);
522 return; 512 return;
523 } 513 }
524
525 msg = (struct UDPMessage *) buf; 514 msg = (struct UDPMessage *) buf;
526 515
527#if DEBUG_UDP 516#if DEBUG_UDP
diff --git a/src/transport/test_plugin_transport_udp.c b/src/transport/test_plugin_transport_udp.c
index c8122e2e2..bb75126bb 100644
--- a/src/transport/test_plugin_transport_udp.c
+++ b/src/transport/test_plugin_transport_udp.c
@@ -244,8 +244,6 @@ setup_plugin_environment ()
244 env.max_connections = max_connect_per_transport; 244 env.max_connections = max_connect_per_transport;
245} 245}
246 246
247static int retx;
248
249/** 247/**
250 * Runs the test. 248 * Runs the test.
251 * 249 *
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index a5afc5fe4..817077f58 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -62,6 +62,10 @@ static struct GNUNET_SCHEDULER_Handle *sched;
62 62
63static int ok; 63static int ok;
64 64
65static int is_tcp;
66
67static int is_udp;
68
65#if VERBOSE 69#if VERBOSE
66#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) 70#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
67#else 71#else
@@ -283,6 +287,16 @@ main (int argc, char *argv[])
283{ 287{
284 int ret; 288 int ret;
285 289
290 if (strstr(argv[0], "test_transport_api_tcp") == 0)
291 {
292 is_tcp = GNUNET_YES;
293 }
294 else if (strstr(argv[0], "test_transport_api_udp") == 0)
295 {
296 is_udp = GNUNET_NO;
297 }
298
299
286 GNUNET_log_setup ("test-transport-api", 300 GNUNET_log_setup ("test-transport-api",
287#if VERBOSE 301#if VERBOSE
288 "DEBUG", 302 "DEBUG",