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,
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
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
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.
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
+ char *addr_str;
(void) cls;
(void) args;
(void) cfgfile;
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);
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
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
/* *********************** 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)
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
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
{
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,