[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: bind to config option (defa
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: bind to config option (default localhost) for GNS |
Date: |
Sat, 09 Mar 2019 16:10:55 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new f275f660e bind to config option (default localhost) for GNS
f275f660e is described below
commit f275f660e1d44af17cca122b9cba2845c5e37f2a
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Sat Mar 9 16:10:53 2019 +0100
bind to config option (default localhost) for GNS
---
ChangeLog | 1 +
src/gns/gns.conf.in | 4 ++++
src/gns/gnunet-dns2gns.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++
src/gns/gnunet-gns-proxy.c | 57 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 122 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index f1c0bfa7e..c33c6071b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
Sat Mar 9 15:58:45 2019 +0100
REST: Config option for address bind. Defaults to localhost.
+ GNS: dns2gns/gns-proxy config option for address bind. Defaults to localhost.
Sat Mar 9 01:58:22 CET 2019
gnunet-publish now by default does not expose the creation time,
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in
index 2e6a02b07..3252e4888 100644
--- a/src/gns/gns.conf.in
+++ b/src/gns/gns.conf.in
@@ -32,6 +32,8 @@ INTERCEPT_DNS = NO
BINARY = gnunet-gns-proxy
START_ON_DEMAND = NO
RUN_PER_USER = YES
+BIND_TO=127.0.0.1
+BIND_TO6=::1
# Where is the certificate for the GNS proxy stored?
PROXY_CACERT = $GNUNET_DATA_HOME/gns/gns_ca_cert.pem
@@ -42,6 +44,8 @@ PROXY_UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-gns-proxy.sock
BINARY = gnunet-dns2gns
START_ON_DEMAND = NO
RUN_PER_USER = YES
+BIND_TO=127.0.0.1
+BIND_TO6=::1
# -d: DNS resolver to use, -s: suffix to use, -f: fcfs suffix to use
OPTIONS = -d 8.8.8.8
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index 68d090579..a4d3ffedc 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -92,6 +92,17 @@ struct Request
uint16_t original_request_id;
};
+/**
+ * The address to bind to
+ */
+static in_addr_t address;
+
+/**
+ * The IPv6 address to bind to
+ */
+static struct in6_addr address6;
+
+
/**
* Handle to GNS resolver.
@@ -578,6 +589,7 @@ run (void *cls,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
+ char *addr_str;
(void) cls;
(void) args;
(void) cfgfile;
@@ -602,6 +614,52 @@ run (void *cls,
gns = NULL;
return;
}
+
+ /* Get address to bind to */
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (c, "dnns2gns",
+ "BIND_TO",
+ &addr_str))
+ {
+ //No address specified
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Don't know what to bind to...\n");
+ GNUNET_free (addr_str);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ if (1 != inet_pton (AF_INET, addr_str, &address))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unable to parse address %s\n",
+ addr_str);
+ GNUNET_free (addr_str);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ GNUNET_free (addr_str);
+ /* Get address to bind to */
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (c, "dns2gns",
+ "BIND_TO6",
+ &addr_str))
+ {
+ //No address specified
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Don't know what to bind6 to...\n");
+ GNUNET_free (addr_str);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ if (1 != inet_pton (AF_INET6, addr_str, &address6))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unable to parse IPv6 address %s\n",
+ addr_str);
+ GNUNET_free (addr_str);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ GNUNET_free (addr_str);
+
listen_socket4 = GNUNET_NETWORK_socket_create (PF_INET,
SOCK_DGRAM,
IPPROTO_UDP);
@@ -611,6 +669,7 @@ run (void *cls,
memset (&v4, 0, sizeof (v4));
v4.sin_family = AF_INET;
+ v4.sin_addr.s_addr = address;
#if HAVE_SOCKADDR_IN_SIN_LEN
v4.sin_len = sizeof (v4);
#endif
@@ -634,6 +693,7 @@ run (void *cls,
memset (&v6, 0, sizeof (v6));
v6.sin6_family = AF_INET6;
+ v6.sin6_addr = address6;
#if HAVE_SOCKADDR_IN_SIN_LEN
v6.sin6_len = sizeof (v6);
#endif
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index 65a7b6018..a6b053e56 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -661,6 +661,15 @@ struct Socks5Request
/* *********************** Globals **************************** */
+/**
+ * The address to bind to
+ */
+static in_addr_t address;
+
+/**
+ * The IPv6 address to bind to
+ */
+static struct in6_addr address6;
/**
* The port the proxy is running on (default 7777)
@@ -3516,6 +3525,7 @@ bind_v4 ()
memset (&sa4, 0, sizeof (sa4));
sa4.sin_family = AF_INET;
sa4.sin_port = htons (port);
+ sa4.sin_addr.s_addr = address;
#if HAVE_SOCKADDR_IN_SIN_LEN
sa4.sin_len = sizeof (sa4);
#endif
@@ -3553,6 +3563,7 @@ bind_v6 ()
memset (&sa6, 0, sizeof (sa6));
sa6.sin6_family = AF_INET6;
sa6.sin6_port = htons (port);
+ sa6.sin6_addr = address6;
#if HAVE_SOCKADDR_IN_SIN_LEN
sa6.sin6_len = sizeof (sa6);
#endif
@@ -3591,10 +3602,56 @@ run (void *cls,
{
char* cafile_cfg = NULL;
char* cafile;
+ char* addr_str;
struct MhdHttpList *hd;
cfg = c;
+ /* Get address to bind to */
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns-proxy",
+ "BIND_TO",
+ &addr_str))
+ {
+ //No address specified
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Don't know what to bind to...\n");
+ GNUNET_free (addr_str);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ if (1 != inet_pton (AF_INET, addr_str, &address))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unable to parse address %s\n",
+ addr_str);
+ GNUNET_free (addr_str);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ GNUNET_free (addr_str);
+ /* Get address to bind to */
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns-proxy",
+ "BIND_TO6",
+ &addr_str))
+ {
+ //No address specified
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Don't know what to bind6 to...\n");
+ GNUNET_free (addr_str);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ if (1 != inet_pton (AF_INET6, addr_str, &address6))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unable to parse IPv6 address %s\n",
+ addr_str);
+ GNUNET_free (addr_str);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ GNUNET_free (addr_str);
+
if (NULL == (curl_multi = curl_multi_init ()))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: bind to config option (default localhost) for GNS,
gnunet <=