[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 13/20: -fix port initialization in addr
From: |
gnunet |
Subject: |
[gnunet] 13/20: -fix port initialization in addr |
Date: |
Sat, 19 Feb 2022 16:20:53 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit 980eec8b79b63b445530cd42778a772e8a67b820
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jan 16 18:51:27 2022 +0100
-fix port initialization in addr
---
src/dht/gnunet-service-dht.c | 7 +++++-
src/dht/gnunet-service-dht_clients.c | 1 +
src/dhtu/dhtu.conf | 2 ++
src/dhtu/plugin_dhtu_ip.c | 47 +++++++++++++++++++++++++++++++++---
src/util/network.c | 3 ++-
5 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 6ae56d427..4b0a290b9 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -382,6 +382,7 @@ shutdown_task (void *cls)
GNUNET_BLOCK_context_destroy (GDS_block_context);
GDS_block_context = NULL;
}
+ GDS_CLIENTS_stop ();
if (NULL != GDS_stats)
{
GNUNET_STATISTICS_destroy (GDS_stats,
@@ -393,7 +394,11 @@ shutdown_task (void *cls)
GNUNET_HELLO_builder_free (GDS_my_hello);
GDS_my_hello = NULL;
}
- GDS_CLIENTS_stop ();
+ if (NULL != hello_task)
+ {
+ GNUNET_SCHEDULER_cancel (hello_task);
+ hello_task = NULL;
+ }
}
diff --git a/src/dht/gnunet-service-dht_clients.c
b/src/dht/gnunet-service-dht_clients.c
index 88db7b0ea..e5819b193 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -1090,6 +1090,7 @@ handle_dht_local_hello_get (void *cls,
GNUNET_free (url);
GNUNET_MQ_send (ch->mq,
env);
+ GNUNET_SERVICE_client_continue (ch->client);
}
diff --git a/src/dhtu/dhtu.conf b/src/dhtu/dhtu.conf
index 438cd0955..ea5ade752 100644
--- a/src/dhtu/dhtu.conf
+++ b/src/dhtu/dhtu.conf
@@ -3,3 +3,5 @@ ENABLED = YES
[dhtu-ip]
ENABLED = NO
+NSE = 4
+UDP_PORT = 6666
diff --git a/src/dhtu/plugin_dhtu_ip.c b/src/dhtu/plugin_dhtu_ip.c
index 998a7903b..123a372b6 100644
--- a/src/dhtu/plugin_dhtu_ip.c
+++ b/src/dhtu/plugin_dhtu_ip.c
@@ -225,6 +225,11 @@ struct Plugin
* How often have we scanned for IPs?
*/
unsigned int scan_generation;
+
+ /**
+ * Port as a 16-bit value.
+ */
+ uint16_t port16;
};
@@ -598,9 +603,37 @@ process_ifcs (void *cls,
return GNUNET_OK;
}
}
- (void) create_source (plugin,
- addr,
- addrlen);
+ switch (addr->sa_family)
+ {
+ case AF_INET:
+ {
+ struct sockaddr_in v4;
+
+ GNUNET_assert (sizeof(v4) == addrlen);
+ memcpy (&v4,
+ addr,
+ addrlen);
+ v4.sin_port = htons (plugin->port16);
+ (void) create_source (plugin,
+ (const struct sockaddr *) &v4,
+ sizeof (v4));
+ break;
+ }
+ case AF_INET6:
+ {
+ struct sockaddr_in6 v6;
+
+ GNUNET_assert (sizeof(v6) == addrlen);
+ memcpy (&v6,
+ addr,
+ addrlen);
+ v6.sin6_port = htons (plugin->port16);
+ (void) create_source (plugin,
+ (const struct sockaddr *) &v6,
+ sizeof (v6));
+ break;
+ }
+ }
return GNUNET_OK;
}
@@ -854,6 +887,7 @@ libgnunet_plugin_dhtu_ip_init (void *cls)
plugin = GNUNET_new (struct Plugin);
plugin->env = env;
plugin->port = port;
+ plugin->port16 = (uint16_t) nport;
if (GNUNET_OK !=
GNUNET_CRYPTO_get_peer_identity (env->cfg,
&plugin->my_id))
@@ -1009,8 +1043,13 @@ libgnunet_plugin_dhtu_ip_done (void *cls)
0.0,
0.0);
GNUNET_CONTAINER_multihashmap_destroy (plugin->dsts);
+ if (NULL != plugin->read_task)
+ {
+ GNUNET_SCHEDULER_cancel (plugin->read_task);
+ plugin->read_task = NULL;
+ }
GNUNET_SCHEDULER_cancel (plugin->scan_task);
- GNUNET_break (0 ==
+ GNUNET_break (GNUNET_OK ==
GNUNET_NETWORK_socket_close (plugin->sock));
GNUNET_free (plugin->port);
GNUNET_free (plugin);
diff --git a/src/util/network.c b/src/util/network.c
index 688c37665..2f77bc54e 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -350,7 +350,8 @@ initialize_network_handle (struct GNUNET_NETWORK_Handle *h,
if (h->fd >= FD_SETSIZE)
{
- GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (h));
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_NETWORK_socket_close (h));
errno = EMFILE;
return GNUNET_SYSERR;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] branch master updated (25ef40ef7 -> d68731944), gnunet, 2022/02/19
- [gnunet] 02/20: -also add serialization from/to block, gnunet, 2022/02/19
- [gnunet] 03/20: incomplete first hack of new hello-uri lib, gnunet, 2022/02/19
- [gnunet] 01/20: first steps towards usable dhtu, gnunet, 2022/02/19
- [gnunet] 04/20: -conclude hello-uri implementation and test, gnunet, 2022/02/19
- [gnunet] 09/20: -DHT now takes care of queue size limit, gnunet, 2022/02/19
- [gnunet] 07/20: -more work on DHTU integration, gnunet, 2022/02/19
- [gnunet] 08/20: rebase, gnunet, 2022/02/19
- [gnunet] 13/20: -fix port initialization in addr,
gnunet <=
- [gnunet] 11/20: -DHT: add gnunet-dht-hello for bootstrapping, gnunet, 2022/02/19
- [gnunet] 16/20: -got basics to work with dhtu and udp+ip underlay, gnunet, 2022/02/19
- [gnunet] 18/20: -fix merge issues, gnunet, 2022/02/19
- [gnunet] 20/20: -fix assertion, fix key initialization, gnunet, 2022/02/19
- [gnunet] 17/20: -try to make static analysis happy, gnunet, 2022/02/19
- [gnunet] 15/20: -adding logging, minor dthu bugfixes, gnunet, 2022/02/19
- [gnunet] 19/20: -fix htons/htonl bug introduced by message format change, gnunet, 2022/02/19
- [gnunet] 12/20: -fix crashes on new DHT load/shutdown, gnunet, 2022/02/19
- [gnunet] 10/20: -add hold/drop logic, gnunet, 2022/02/19
- [gnunet] 06/20: -implement TVG, gnunet, 2022/02/19