diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-11-05 12:49:05 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-11-05 12:49:05 +0000 |
commit | 1af9d3b32064fc8c81945f574e0b50ce6f956ab8 (patch) | |
tree | ec642686f37ba1e5595e015d57d70de218ce7818 /src/exit | |
parent | e2e510a7958d49622257fb32894d8bcf5f79e127 (diff) |
-actually enable free regex specification, in binary for now
git-svn-id: https://gnunet.org/svn/gnunet@24721 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/exit')
-rw-r--r-- | src/exit/exit.conf | 8 | ||||
-rw-r--r-- | src/exit/gnunet-daemon-exit.c | 26 |
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 (®ex, "%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", ®ex)) + 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 (®ex, "%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", ®ex)) + regex = GNUNET_strdup ("(0|1)*"); + GNUNET_MESH_announce_regex (mesh_handle, regex, REGEX_MAX_PATH_LEN_IPV6); GNUNET_free (regex); } |