aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/exit/exit.conf8
-rw-r--r--src/exit/gnunet-daemon-exit.c26
2 files changed, 16 insertions, 18 deletions
diff --git a/src/exit/exit.conf b/src/exit/exit.conf
index d0a4b35f39..f8f0764f75 100644
--- a/src/exit/exit.conf
+++ b/src/exit/exit.conf
@@ -16,6 +16,14 @@ IPV4ADDR = 169.254.86.1
# Netmask for the IPv4 subnet on the TUN interface.
IPV4MASK = 255.255.255.0
+# Regular expression matching IPv4 addresses in binary (32 values of 0 or 1)
+# format for which this system is willing to serve as an exit.
+EXIT_RANGE_IPV4_REGEX = (0|1)*
+
+# Regular expression matching IPv4 addresses in binary (128 values of 0 or 1)
+# format for which this system is willing to serve as an exit.
+EXIT_RANGE_IPV6_REGEX = (0|1)*
+
# Name of the (virtual) tunnel interface the exit daemon will manage
TUN_IFNAME = exit-gnunet
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index e03a9b55cd..aab25072ab 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -3015,8 +3015,6 @@ run (void *cls, char *const *args GNUNET_UNUSED,
char *ipv4mask;
char *binary;
char *regex;
- char ipv4regex[GNUNET_REGEX_IPV4_REGEXLEN];
- char ipv6regex[GNUNET_REGEX_IPV6_REGEXLEN];
binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-exit");
if (GNUNET_YES !=
@@ -3208,29 +3206,21 @@ run (void *cls, char *const *args GNUNET_UNUSED,
}
/* Mesh handle acquired, now announce regular expressions matching our exit */
- if (GNUNET_YES == ipv4_enabled && GNUNET_YES == ipv4_exit)
+ if ( (GNUNET_YES == ipv4_enabled) && (GNUNET_YES == ipv4_exit) )
{
- GNUNET_REGEX_ipv4toregex (&exit_ipv4addr, ipv4mask, ipv4regex);
- GNUNET_asprintf (&regex, "%s%s%s",
- GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX,
- "4",
- ipv4regex);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing exit regex: %s\n", regex);
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg, "exit", "EXIT_RANGE_IPV4_REGEX", &regex))
+ regex = GNUNET_strdup ("(0|1)*");
GNUNET_MESH_announce_regex (mesh_handle, regex, REGEX_MAX_PATH_LEN_IPV4);
GNUNET_free (regex);
}
if (GNUNET_YES == ipv6_enabled && GNUNET_YES == ipv6_exit)
{
- GNUNET_REGEX_ipv6toregex (&exit_ipv6addr, ipv6prefix, ipv6regex);
- GNUNET_asprintf (&regex, "%s%s%s",
- GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX,
- "6",
- ipv6regex);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing exit regex: %s\n", regex);
- GNUNET_MESH_announce_regex (mesh_handle, regex, REGEX_MAX_PATH_LEN_IPV4);
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg, "exit", "EXIT_RANGE_IPV6_REGEX", &regex))
+ regex = GNUNET_strdup ("(0|1)*");
+ GNUNET_MESH_announce_regex (mesh_handle, regex, REGEX_MAX_PATH_LEN_IPV6);
GNUNET_free (regex);
}