| Additional Information |
Attaching to process 14924
Reading symbols from d:\progs\gnunet\bin\gnunet-service-transport.exe...done.
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 14924.0x3980]
0x75c7280d in KERNELBASE!DeleteAce () from C:\Windows\syswow64\KernelBase.dll
(gdb) bt
#0 0x75c7280d in KERNELBASE!DeleteAce () from C:\Windows\syswow64\KernelBase.dll
#1 0x61c065a4 in GNUNET_abort () at common_logging.c:271
#2 0x6c383b9d in _fu128__skip_log () at plugin_transport_tcp.c:904
#3 0x00411b2d in _fu680__skip_log () at gnunet-service-transport_validation.c:489
#4 0x00404977 in _fu140__skip_log () at gnunet-service-transport_blacklist.c:775
#5 0x00411f09 in revalidate_address (cls=0x1dff440, tc=0x28fc90) at gnunet-service-transport_validation.c:568
#6 0x61c37675 in run_ready (rs=0x2c7f0, ws=0x2d808) at scheduler.c:682
#7 0x61c37de6 in GNUNET_SCHEDULER_run (task=0x61c426f6 <service_task>, task_cls=0x28fe28) at scheduler.c:870
#8 0x61c433da in GNUNET_SERVICE_run (argc=3, argv=0x1ddbea8, serviceName=0x4162d7 "transport", opt=GNUNET_SERVICE_OPTION_NONE, task=0x40244a <run>, task_cls=0x0) at service.c:1716
#9 0x004027c7 in main (argc=3, argv=0x1ddbea8) at gnunet-service-transport.c:629
(gdb) up 2
#2 0x6c383b9d in _fu128__skip_log () at plugin_transport_tcp.c:904
904 GNUNET_assert (session->client != NULL);
(gdb) p/x *session
$1 = {header = {pong_signature = {sig = {0x0 <repeats 256 times>}}, pong_sig_expires = {abs_value = 0x0}}, next = 0x0, plugin = 0x1dec928, client = 0x0, pending_messages_head = 0x1de5788, pending_messages_tail = 0x1de5788,
transmit_handle = 0x0, target = {hashPubKey = {bits = {0x1c8bb058, 0xc7301a70, 0x8803e219, 0x6fc5ba36, 0x29b085e, 0x8c84eea8, 0x61c4838f, 0xa6977171, 0xb2891ccc, 0x84e34bab, 0x8d06ed05, 0x4ae1a785, 0x47ef32bf,
0xbf6b1748, 0xda5ba853, 0x11aa9a2a}}}, receive_delay_task = 0x0, addr = 0x0, addrlen = 0x0, last_activity = {abs_value = 0x135c92f3ec3}, expecting_welcome = 0x1, inbound = 0x0, is_nat = 0x1,
ats_address_network_type = 0x3000000}
(gdb) l
899 struct Plugin * plugin = cls;
900 struct PendingMessage *pm;
901
902 GNUNET_assert (plugin != NULL);
903 GNUNET_assert (session != NULL);
904 GNUNET_assert (session->client != NULL);
905
906 GNUNET_SERVER_client_set_timeout (session->client,
907 GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
908 GNUNET_STATISTICS_update (plugin->env->stats,
(gdb) up
#3 0x00411b2d in _fu680__skip_log () at gnunet-service-transport_validation.c:489
489 ret = papi->send (papi->cls, session,
|
|---|
| Attached Files |
0001-Try-to-not-to-create-dead-end-NAT-sessions.patch (4,609 bytes)
From b0a0aeac28295e7de9b427d621803ad6a3a2d76f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Wed, 29 Feb 2012 18:39:09 +0400
Subject: [PATCH] Try to not to create dead-end NAT sessions
---
src/include/gnunet_nat_lib.h | 4 +++-
src/nat/nat.c | 13 ++++++++-----
src/transport/plugin_transport_tcp.c | 19 ++++++++++++++++---
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h
index 6c1db80..a46b453 100644
--- a/src/include/gnunet_nat_lib.h
+++ b/src/include/gnunet_nat_lib.h
@@ -117,8 +117,10 @@ GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h, const void *addr,
*
* @param h handle (used for configuration)
* @param sa the address of the peer (IPv4-only)
+ * @return GNUNET_SYSERR on error, GNUNET_NO if nat client is disabled,
+ * GNUNET_OK otherwise
*/
-void
+int
GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h,
const struct sockaddr_in *sa);
diff --git a/src/nat/nat.c b/src/nat/nat.c
index 5117f5d..3e5c4c1 100644
--- a/src/nat/nat.c
+++ b/src/nat/nat.c
@@ -1310,8 +1310,10 @@ GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h)
*
* @param h NAT handle for us (largely used for configuration)
* @param sa the address of the peer (IPv4-only)
+ * @return GNUNET_SYSERR on error, GNUNET_NO if nat client is disabled,
+ * GNUNET_OK otherwise
*/
-void
+int
GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h,
const struct sockaddr_in *sa)
{
@@ -1320,20 +1322,20 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h,
struct GNUNET_OS_Process *proc;
if (GNUNET_YES != h->enable_nat_client)
- return; /* not permitted / possible */
+ return GNUNET_NO; /* not permitted / possible */
if (h->internal_address == NULL)
{
LOG (GNUNET_ERROR_TYPE_WARNING, "nat",
_
("Internal IP address not known, cannot use ICMP NAT traversal method\n"));
- return;
+ return GNUNET_SYSERR;
}
GNUNET_assert (sa->sin_family == AF_INET);
if (NULL == inet_ntop (AF_INET, &sa->sin_addr, inet4, INET_ADDRSTRLEN))
{
GNUNET_log_from_strerror (GNUNET_ERROR_TYPE_WARNING, "nat", "inet_ntop");
- return;
+ return GNUNET_SYSERR;
}
GNUNET_snprintf (port_as_string, sizeof (port_as_string), "%d", h->adv_port);
#if DEBUG_NAT
@@ -1347,11 +1349,12 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h,
"gnunet-helper-nat-client", h->internal_address,
inet4, port_as_string, NULL);
if (NULL == proc)
- return;
+ return GNUNET_SYSERR;
/* we know that the gnunet-helper-nat-client will terminate virtually
* instantly */
GNUNET_OS_process_wait (proc);
GNUNET_OS_process_close (proc);
+ return GNUNET_OK;
}
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 2b2d728..1477137 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -1129,8 +1129,21 @@ tcp_plugin_get_session (void *cls,
"Created NAT WAIT connection to `%4s' at `%s'\n",
GNUNET_i2s (&session->target), GNUNET_a2s (sb, sbs));
#endif
- GNUNET_NAT_run_client (plugin->nat, &a4);
- return session;
+ if (GNUNET_OK == GNUNET_NAT_run_client (plugin->nat, &a4))
+ return session;
+ else
+ {
+ /* This is necessary for disconnect_session() to work */
+ GNUNET_CONTAINER_multihashmap_put(plugin->sessionmap, &address->peer.hashPubKey, session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+ session->addr = GNUNET_malloc (addrlen);
+ memcpy (session->addr, address->address, addrlen);
+ session->addrlen = addrlen;
+
+ GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (
+ plugin->nat_wait_conns, &address->peer.hashPubKey, session));
+ disconnect_session (session);
+ session = NULL;
+ }
}
/* create new outbound session */
@@ -1141,7 +1154,7 @@ tcp_plugin_get_session (void *cls,
#if DEBUG_TCP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
"Failed to create connection to `%4s' at `%s'\n",
- GNUNET_i2s (&session->target), GNUNET_a2s (sb, sbs));
+ GNUNET_i2s (&address->peer), GNUNET_a2s (sb, sbs));
#endif
return NULL;
}
--
1.7.4
|
|---|