[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 04/06: TNG: Fixed bug happening during check for pending valida
From: |
gnunet |
Subject: |
[gnunet] 04/06: TNG: Fixed bug happening during check for pending validation requests after nat reversal. |
Date: |
Fri, 27 Jan 2023 13:17:11 +0100 |
This is an automated email from the git hooks/post-receive script.
t3sserakt pushed a commit to branch master
in repository gnunet.
commit f5d40212ba3934b8138c6db29b0afe8b2fadd7d3
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Fri Jan 27 13:11:14 2023 +0100
TNG: Fixed bug happening during check for pending validation requests after
nat reversal.
---
src/transport/gnunet-service-tng.c | 53 ++++++++++++++++++++++++++++++++------
1 file changed, 45 insertions(+), 8 deletions(-)
diff --git a/src/transport/gnunet-service-tng.c
b/src/transport/gnunet-service-tng.c
index 5a28efb66..21aa46947 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -800,10 +800,7 @@ struct TransportDVBoxMessage
/**
* Size this msg had initially. This is needed to calculate the hmac at the
target.
* The header size can not be used for that, because the box size is getting
smaller at each hop.
- */
- /**
- * The length of the struct (in bytes, including the length field itself),
- * in big-endian format.
+ *
*/
uint16_t orig_size GNUNET_PACKED;
@@ -10383,9 +10380,10 @@ suggest_to_connect (const struct GNUNET_PeerIdentity
*pid, const char *address)
}
/* forward suggestion for queue creation to communicator */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Request #%u for `%s' communicator to create queue to `%s'\n",
+ "Request #%u for `%s' communicator to create queue to `%s' at
`%s'\n",
(unsigned int) idgen,
prefix,
+ GNUNET_i2s (pid),
address);
GNUNET_free (prefix);
alen = strlen (address) + 1;
@@ -10660,6 +10658,30 @@ start_dv_learn (void *cls)
}
+/**
+ * Get the IP address without the port number.
+ *
+ * @param address The string contains a communicator prefix, IP address and
port
+ * like this 'tcp-92.68.150.1:55452'.
+ * @return String with IP address only.
+ */
+static char *
+get_address_without_port (const char *address)
+{
+ const char *colon;
+ char *colon_rest;
+ size_t colon_rest_length;
+ char *address_without_port;
+
+ colon = strchr (address,':');
+ colon_rest = GNUNET_strndup (address, colon - address);
+ colon_rest_length = strlen (colon_rest);
+ address_without_port = GNUNET_strndup (&colon_rest[4], colon_rest_length -
4);
+ GNUNET_free (colon_rest);
+
+ return address_without_port;
+}
+
/**
* A new queue has been created, check if any address validation
* requests have been waiting for it.
@@ -10676,16 +10698,31 @@ check_validation_request_pending (void *cls,
{
struct Queue *q = cls;
struct ValidationState *vs = value;
+ char *address_without_port_vs;
+ char *address_without_port_q;
+ int success = GNUNET_YES;
+ address_without_port_vs = get_address_without_port (vs->address);
+ address_without_port_q = get_address_without_port (q->address);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Check validation request pending for `%s' at `%s'/`%s'
(vs)/(q)\n",
+ GNUNET_i2s (pid),
+ address_without_port_vs,
+ address_without_port_q);
(void) pid;
if ((GNUNET_YES == vs->awaiting_queue) &&
- (0 == strcmp (vs->address, q->address)))
+ (0 == strcmp (address_without_port_vs, address_without_port_q)))
{
+
vs->awaiting_queue = GNUNET_NO;
validation_transmit_on_queue (q, vs);
- return GNUNET_NO;
+ success = GNUNET_NO;
}
- return GNUNET_OK;
+
+ GNUNET_free (address_without_port_vs);
+ GNUNET_free (address_without_port_q);
+ return success;
}
--
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, 2023/01/27
- [gnunet] 04/06: TNG: Fixed bug happening during check for pending validation requests after nat reversal.,
gnunet <=
- [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