diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-11-05 12:49:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-11-05 12:49:05 +0000 |
commit | badd541a3da5b515a659860b2515a7ea3654e791 (patch) | |
tree | ec642686f37ba1e5595e015d57d70de218ce7818 /src/exit | |
parent | 62e660ff5b046d14a79b738ecb3cb1add4d99a89 (diff) | |
download | gnunet-badd541a3da5b515a659860b2515a7ea3654e791.tar.gz gnunet-badd541a3da5b515a659860b2515a7ea3654e791.zip |
-actually enable free regex specification, in binary for now
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 d0a4b35f3..f8f0764f7 100644 --- a/src/exit/exit.conf +++ b/src/exit/exit.conf | |||
@@ -16,6 +16,14 @@ IPV4ADDR = 169.254.86.1 | |||
16 | # Netmask for the IPv4 subnet on the TUN interface. | 16 | # Netmask for the IPv4 subnet on the TUN interface. |
17 | IPV4MASK = 255.255.255.0 | 17 | IPV4MASK = 255.255.255.0 |
18 | 18 | ||
19 | # Regular expression matching IPv4 addresses in binary (32 values of 0 or 1) | ||
20 | # format for which this system is willing to serve as an exit. | ||
21 | EXIT_RANGE_IPV4_REGEX = (0|1)* | ||
22 | |||
23 | # Regular expression matching IPv4 addresses in binary (128 values of 0 or 1) | ||
24 | # format for which this system is willing to serve as an exit. | ||
25 | EXIT_RANGE_IPV6_REGEX = (0|1)* | ||
26 | |||
19 | 27 | ||
20 | # Name of the (virtual) tunnel interface the exit daemon will manage | 28 | # Name of the (virtual) tunnel interface the exit daemon will manage |
21 | TUN_IFNAME = exit-gnunet | 29 | TUN_IFNAME = exit-gnunet |
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index e03a9b55c..aab25072a 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, | |||
3015 | char *ipv4mask; | 3015 | char *ipv4mask; |
3016 | char *binary; | 3016 | char *binary; |
3017 | char *regex; | 3017 | char *regex; |
3018 | char ipv4regex[GNUNET_REGEX_IPV4_REGEXLEN]; | ||
3019 | char ipv6regex[GNUNET_REGEX_IPV6_REGEXLEN]; | ||
3020 | 3018 | ||
3021 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-exit"); | 3019 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-exit"); |
3022 | if (GNUNET_YES != | 3020 | if (GNUNET_YES != |
@@ -3208,29 +3206,21 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
3208 | } | 3206 | } |
3209 | 3207 | ||
3210 | /* Mesh handle acquired, now announce regular expressions matching our exit */ | 3208 | /* Mesh handle acquired, now announce regular expressions matching our exit */ |
3211 | if (GNUNET_YES == ipv4_enabled && GNUNET_YES == ipv4_exit) | 3209 | if ( (GNUNET_YES == ipv4_enabled) && (GNUNET_YES == ipv4_exit) ) |
3212 | { | 3210 | { |
3213 | GNUNET_REGEX_ipv4toregex (&exit_ipv4addr, ipv4mask, ipv4regex); | 3211 | if (GNUNET_OK != |
3214 | GNUNET_asprintf (®ex, "%s%s%s", | 3212 | GNUNET_CONFIGURATION_get_value_string (cfg, "exit", "EXIT_RANGE_IPV4_REGEX", ®ex)) |
3215 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | 3213 | regex = GNUNET_strdup ("(0|1)*"); |
3216 | "4", | ||
3217 | ipv4regex); | ||
3218 | |||
3219 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing exit regex: %s\n", regex); | ||
3220 | GNUNET_MESH_announce_regex (mesh_handle, regex, REGEX_MAX_PATH_LEN_IPV4); | 3214 | GNUNET_MESH_announce_regex (mesh_handle, regex, REGEX_MAX_PATH_LEN_IPV4); |
3221 | GNUNET_free (regex); | 3215 | GNUNET_free (regex); |
3222 | } | 3216 | } |
3223 | 3217 | ||
3224 | if (GNUNET_YES == ipv6_enabled && GNUNET_YES == ipv6_exit) | 3218 | if (GNUNET_YES == ipv6_enabled && GNUNET_YES == ipv6_exit) |
3225 | { | 3219 | { |
3226 | GNUNET_REGEX_ipv6toregex (&exit_ipv6addr, ipv6prefix, ipv6regex); | 3220 | if (GNUNET_OK != |
3227 | GNUNET_asprintf (®ex, "%s%s%s", | 3221 | GNUNET_CONFIGURATION_get_value_string (cfg, "exit", "EXIT_RANGE_IPV6_REGEX", ®ex)) |
3228 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | 3222 | regex = GNUNET_strdup ("(0|1)*"); |
3229 | "6", | 3223 | GNUNET_MESH_announce_regex (mesh_handle, regex, REGEX_MAX_PATH_LEN_IPV6); |
3230 | ipv6regex); | ||
3231 | |||
3232 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing exit regex: %s\n", regex); | ||
3233 | GNUNET_MESH_announce_regex (mesh_handle, regex, REGEX_MAX_PATH_LEN_IPV4); | ||
3234 | GNUNET_free (regex); | 3224 | GNUNET_free (regex); |
3235 | } | 3225 | } |
3236 | 3226 | ||