[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 01/06: TNG: - Added topology file for tcp icmp nat hole punchin
From: |
gnunet |
Subject: |
[gnunet] 01/06: TNG: - Added topology file for tcp icmp nat hole punching test case. - Added code to configure connection attempts to natted peers. |
Date: |
Fri, 27 Jan 2023 13:17:08 +0100 |
This is an automated email from the git hooks/post-receive script.
t3sserakt pushed a commit to branch master
in repository gnunet.
commit 6de2cb8f7a78d9bf1132100f51c19a6a1cb223c5
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Fri Jan 27 12:59:05 2023 +0100
TNG: - Added topology file for tcp icmp nat hole punching test case.
- Added code to configure connection attempts to natted peers.
---
src/testing/testing.c | 22 +++++++++---------
.../test_transport_nat_icmp_tcp_topo.conf | 7 ++++++
src/transport/transport_api_cmd_connecting_peers.c | 27 +++++++++++++++++++++-
3 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/src/testing/testing.c b/src/testing/testing.c
index a1161925b..2a9b0309f 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -63,6 +63,10 @@
#define PREFIX_UDP "udp"
+#define PREFIX_TCP_NATTED "tcp_natted"
+
+#define PREFIX_UDP_NATTED "udp_natted"
+
/**
* Lowest port used for GNUnet testing. Should be high enough to not
* conflict with other applications running on the hosts but be low
@@ -1914,7 +1918,7 @@ get_value (const char *key, const char *line)
* Every line in the topology configuration starts with a string indicating
which
* kind of information will be configured with this line. Configuration values
following
* this string are seperated by special sequences of characters. A value might
be
- * a key value pair. A special key is the 'connect' which can appear more than
once.
+ * a key value pair. A special key is the 'connect' key which can appear more
than once.
* The value is the information about a connection via some protocol to some
other node.
* This function returns the struct GNUNET_TESTING_NodeConnection which holds
the information
* of the connect value.
@@ -2419,7 +2423,8 @@ GNUNET_TESTING_get_address (struct
GNUNET_TESTING_NodeConnection *connection,
unsigned int node_n;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "node_n: %u\n",
+ "get address prefix: %s node_n: %u\n",
+ prefix,
connection->node_n);
node = connection->node;
@@ -2443,15 +2448,10 @@ GNUNET_TESTING_get_address (struct
GNUNET_TESTING_NodeConnection *connection,
return NULL;
}
- if (0 == strcmp (PREFIX_TCP, prefix))
- {
-
- GNUNET_asprintf (&addr,
- template,
- prefix,
- node_n);
- }
- else if (0 == strcmp (PREFIX_UDP, prefix))
+ if (0 == strcmp (PREFIX_TCP, prefix) ||
+ 0 == strcmp (PREFIX_UDP, prefix) ||
+ 0 == strcmp (PREFIX_UDP_NATTED, prefix) ||
+ 0 == strcmp (PREFIX_TCP_NATTED, prefix))
{
GNUNET_asprintf (&addr,
template,
diff --git a/src/transport/test_transport_nat_icmp_tcp_topo.conf
b/src/transport/test_transport_nat_icmp_tcp_topo.conf
new file mode 100644
index 000000000..37738c80f
--- /dev/null
+++ b/src/transport/test_transport_nat_icmp_tcp_topo.conf
@@ -0,0 +1,7 @@
+M:1
+N:1
+X:1
+T:libgnunet_test_transport_plugin_cmd_nat_upnp
+K:1|{connect:{P:1:1:tcp_natted}}
+R:1|{tcp_port:0}|{udp_port:0}
+P:1:1
\ No newline at end of file
diff --git a/src/transport/transport_api_cmd_connecting_peers.c
b/src/transport/transport_api_cmd_connecting_peers.c
index d399e9d0a..7feecbcc7 100644
--- a/src/transport/transport_api_cmd_connecting_peers.c
+++ b/src/transport/transport_api_cmd_connecting_peers.c
@@ -97,6 +97,13 @@ connect_peers_run (void *cls,
pos_prefix->address_prefix);
if (NULL != addr)
{
+ char *natted_p = strstr (pos_prefix->address_prefix, "_");
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "0 validating peer number %s %s %s\n",
+ natted_p,
+ pos_prefix->address_prefix,
+ addr);
if (0 == GNUNET_memcmp (pos_prefix->address_prefix, "udp"))
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"validating memcmp\n");
@@ -108,10 +115,28 @@ connect_peers_run (void *cls,
GNUNET_asprintf (&addr_and_port,
"%s:2086",
addr);
- else
+ else if (NULL == natted_p)
GNUNET_asprintf (&addr_and_port,
"%s:60002",
addr);
+ else if (NULL != natted_p)
+ {
+ char *prefix;
+ char *rest;
+ char *rest2;
+ char *address;
+
+ prefix = strtok(addr, "_");
+ rest = strtok(NULL, "_");
+ rest2 = strtok(rest, "-");
+ address = strtok(NULL, "-");
+
+ GNUNET_asprintf (&addr_and_port,
+ "%s-%s:0",
+ prefix,
+ address);
+
+ }
peer = GNUNET_TESTING_get_peer (num, tl_system);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"validating peer number %u with identity %s and address %s
%u %s\n",
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] branch master updated (56b93c5ca -> 2652a92f5), gnunet, 2023/01/27
- [gnunet] 02/06: TNG: Added code in the netjail scripts to enable router nodes to forward icmp requests and response., gnunet, 2023/01/27
- [gnunet] 03/06: TNG: Added nat reversal code to tcp communicator. Prepared udp communicator., gnunet, 2023/01/27
- [gnunet] 01/06: TNG: - Added topology file for tcp icmp nat hole punching test case. - Added code to configure connection attempts to natted peers.,
gnunet <=
- [gnunet] 04/06: TNG: Fixed bug happening during check for pending validation requests after nat reversal., gnunet, 2023/01/27
- [gnunet] 05/06: TNG: Added tcp icmp nat hole punching test case script, and fixed bugs occuring during shutdown., gnunet, 2023/01/27
- [gnunet] 06/06: Merge branch 'master' of ssh://git.gnunet.org/gnunet, gnunet, 2023/01/27