gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated (5ffc8cb3d -> 0abf3edae)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (5ffc8cb3d -> 0abf3edae)
Date: Sat, 09 Mar 2019 16:00:32 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a change to branch master
in repository gnunet.

    from 5ffc8cb3d fix.
     new fed55fd46 bind to config option (default localhost)
     new 0abf3edae update changelog

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog                     | 21 ++++++++-------
 src/rest/gnunet-rest-server.c | 59 +++++++++++++++++++++++++++++++++++++++++++
 src/rest/rest.conf            |  2 ++
 3 files changed, 73 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0bf4dffdf..f1c0bfa7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,20 +1,23 @@
-Sat Mar  9 01:58:22 CET 2019
-       gnunet-publish now by default does not expose the creation time,
-       option -d no longer exists, to enable the old behavior use -E. -CG
+Sat Mar 9 15:58:45 2019 +0100
+  REST: 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,
+  option -d no longer exists, to enable the old behavior use -E. -CG
 
 Sat Mar 2 14:23:10 2019 +0100
-       utils: gnunet-qr.py now installed under pkgshare instead of bin
+  utils: gnunet-qr.py now installed under pkgshare instead of bin
 
 Thu Feb 28 19:07:59 CET 2019
   CADET: Fix in order, unrealiable message ordering
 
 Thu 28 Feb 2019 10:54:58 AM CET
-       Releasing GNUnet 0.11.0. -CG
+  Releasing GNUnet 0.11.0. -CG
 
 Wed Jun  6 08:28:27 CEST 2018
-       Releasing GNUnet 0.11.0pre66. Let's try to keep a better
-       ChangeLog again henceforth. -CG
+  Releasing GNUnet 0.11.0pre66. Let's try to keep a better
+  ChangeLog again henceforth. -CG
 
 Sat Jan  7 16:41:34 CET 2017
-       Converting NAT library to new NAT service (and
-       splitting of nat-auto service for auto-configuration). -CG
+  Converting NAT library to new NAT service (and
+  splitting of nat-auto service for auto-configuration). -CG
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c
index 77f3d898d..f9e954912 100644
--- a/src/rest/gnunet-rest-server.c
+++ b/src/rest/gnunet-rest-server.c
@@ -63,6 +63,16 @@
  */
 static struct GNUNET_SCHEDULER_Task *httpd_task;
 
+/**
+ * The address to bind to
+ */
+static in_addr_t address;
+
+/**
+ * The IPv6 address to bind to
+ */
+static struct in6_addr address6;
+
 /**
  * The port the service is running on (default 7776)
  */
@@ -695,6 +705,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
@@ -731,6 +742,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
@@ -806,9 +818,56 @@ run (void *cls,
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
+  char* addr_str;
   cfg = c;
   plugin_map = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
 
+  /* Get address to bind to */
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "rest",
+                                                          "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, "rest",
+                                                          "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);
+
+
   /* Get CORS data from cfg */
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "rest",
                                                           "REST_ALLOW_ORIGIN",
diff --git a/src/rest/rest.conf b/src/rest/rest.conf
index 138751696..bef8cf473 100644
--- a/src/rest/rest.conf
+++ b/src/rest/rest.conf
@@ -1,6 +1,8 @@
 [rest]
 UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-rest.sock
 BINARY=gnunet-rest-server
+BIND_TO=127.0.0.1
+BIND_TO6=::1
 REST_PORT=7776
 REST_ALLOW_HEADERS=Authorization,Accept,Content-Type
 REST_ALLOW_ORIGIN=*

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]