From: Nathan S. Evans Date: Wed, 20 Jan 2010 13:18:58 +0000 (+0000) Subject: whiny christian fix X-Git-Tag: initial-import-from-subversion-38251~22922 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=924137ff73bab48b720d41cf73a1197df2d4b04d;p=oweals%2Fgnunet.git whiny christian fix --- 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 = \ $(GN_PLUGIN_LDFLAGS) check_PROGRAMS = \ - test_transport_api \ + test_transport_api_tcp \ + test_transport_api_udp \ test_plugin_transport \ test_plugin_transport_udp # TODO: add tests for tcp, udp, http, nat, etc. TESTS = $(check_PROGRAMS) -test_transport_api_SOURCES = \ +test_transport_api_tcp_SOURCES = \ test_transport_api.c -test_transport_api_LDADD = \ +test_transport_api_tcp_LDADD = \ $(top_builddir)/src/transport/libgnunettransport.la \ $(top_builddir)/src/util/libgnunetutil.la +test_transport_api_udp_SOURCES = \ + test_transport_api.c +test_transport_api_udp_LDADD = \ + $(top_builddir)/src/transport/libgnunettransport.la \ + $(top_builddir)/src/util/libgnunetutil.la test_plugin_transport_SOURCES = \ 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 /** * Message used to ask a peer to validate receipt (to check an address - * from a HELLO). Followed by the address used. Note that the - * recipients response does not affirm that he has this address, - * only that he got the challenge message. + * from a HELLO). */ struct UDPPingMessage { @@ -192,22 +190,16 @@ struct UDPPingMessage */ uint32_t challenge GNUNET_PACKED; - - }; /** - * Message used to validate a HELLO. The challenge is included in the - * confirmation to make matching of replies to requests possible. The - * signature signs the original challenge number, our public key, the - * sender's address (so that the sender can check that the address we - * saw is plausible for him and possibly detect a MiM attack) and a - * timestamp (to limit replay).

+ * Message used to validate a HELLO. The challenge number + * is sent along with whatever address the peer received + * the ping from. Used to validate our address (or at + * least give us a better idea where we look like we're + * coming from). * - * This message is followed by the address of the - * client that we are observing (which is part of what - * is being signed). */ struct UDPPongMessage { @@ -499,12 +491,10 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) buf = GNUNET_malloc (buflen); fromlen = sizeof (addr); - #if DEBUG_UDP GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "udp", _ ("src_addr_len is %u\n"), fromlen); #endif - memset (&addr, 0, fromlen); ret = GNUNET_NETWORK_socket_recvfrom (udp_sock, buf, buflen, @@ -521,7 +511,6 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_free (buf); return; } - msg = (struct UDPMessage *) buf; #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 () env.max_connections = max_connect_per_transport; } -static int retx; - /** * Runs the test. * 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; static int ok; +static int is_tcp; + +static int is_udp; + #if VERBOSE #define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) #else @@ -283,6 +287,16 @@ main (int argc, char *argv[]) { int ret; + if (strstr(argv[0], "test_transport_api_tcp") == 0) + { + is_tcp = GNUNET_YES; + } + else if (strstr(argv[0], "test_transport_api_udp") == 0) + { + is_udp = GNUNET_NO; + } + + GNUNET_log_setup ("test-transport-api", #if VERBOSE "DEBUG",