aboutsummaryrefslogtreecommitdiff
path: root/src/exit
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-07-22 07:16:58 +0000
committerChristian Grothoff <christian@grothoff.org>2013-07-22 07:16:58 +0000
commite284539fe4d076330ca7f09cc791bdfb4164c0ce (patch)
treece098f92974ac157f0a567e9288ef1cc704621e6 /src/exit
parentf3adc188b34d52c03d0abbe05edbee3b0c227483 (diff)
downloadgnunet-e284539fe4d076330ca7f09cc791bdfb4164c0ce.tar.gz
gnunet-e284539fe4d076330ca7f09cc791bdfb4164c0ce.zip
-move all code that deals with IP/policy to regex/string conversion to tun
Diffstat (limited to 'src/exit')
-rw-r--r--src/exit/gnunet-daemon-exit.c59
1 files changed, 37 insertions, 22 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index dcaa90be0..358e07434 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -3331,6 +3331,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3331 unsigned int app_idx; 3331 unsigned int app_idx;
3332 char *exit_ifname; 3332 char *exit_ifname;
3333 char *tun_ifname; 3333 char *tun_ifname;
3334 char *policy;
3334 char *ipv6addr; 3335 char *ipv6addr;
3335 char *ipv6prefix_s; 3336 char *ipv6prefix_s;
3336 char *ipv4addr; 3337 char *ipv4addr;
@@ -3565,40 +3566,54 @@ run (void *cls, char *const *args GNUNET_UNUSED,
3565 /* Mesh handle acquired, now announce regular expressions matching our exit */ 3566 /* Mesh handle acquired, now announce regular expressions matching our exit */
3566 if ( (GNUNET_YES == ipv4_enabled) && (GNUNET_YES == ipv4_exit) ) 3567 if ( (GNUNET_YES == ipv4_enabled) && (GNUNET_YES == ipv4_exit) )
3567 { 3568 {
3569 policy = NULL;
3568 if (GNUNET_OK != 3570 if (GNUNET_OK !=
3569 GNUNET_CONFIGURATION_get_value_string (cfg, 3571 GNUNET_CONFIGURATION_get_value_string (cfg,
3570 "exit", 3572 "exit",
3571 "EXIT_RANGE_IPV4_REGEX", 3573 "EXIT_RANGE_IPV4_REGEX",
3572 &regex)) 3574 &policy))
3573 regex = GNUNET_strdup ("(0|1)*"); 3575 regex = NULL;
3574 (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s", 3576 else
3575 GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, 3577 regex = GNUNET_TUN_ipv4policy2regex (policy);
3576 "4", regex); 3578 GNUNET_free_non_null (policy);
3577 regex4 = GNUNET_REGEX_announce (cfg, 3579 if (NULL != regex)
3578 prefixed_regex, 3580 {
3579 REGEX_REFRESH_FREQUENCY, 3581 (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s",
3580 REGEX_MAX_PATH_LEN_IPV4); 3582 GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX,
3581 GNUNET_free (regex); 3583 "4", regex);
3582 GNUNET_free (prefixed_regex); 3584 regex4 = GNUNET_REGEX_announce (cfg,
3585 prefixed_regex,
3586 REGEX_REFRESH_FREQUENCY,
3587 REGEX_MAX_PATH_LEN_IPV4);
3588 GNUNET_free (regex);
3589 GNUNET_free (prefixed_regex);
3590 }
3583 } 3591 }
3584 3592
3585 if (GNUNET_YES == ipv6_enabled && GNUNET_YES == ipv6_exit) 3593 if (GNUNET_YES == ipv6_enabled && GNUNET_YES == ipv6_exit)
3586 { 3594 {
3595 policy = NULL;
3587 if (GNUNET_OK != 3596 if (GNUNET_OK !=
3588 GNUNET_CONFIGURATION_get_value_string (cfg, 3597 GNUNET_CONFIGURATION_get_value_string (cfg,
3589 "exit", 3598 "exit",
3590 "EXIT_RANGE_IPV6_REGEX", 3599 "EXIT_RANGE_IPV6_REGEX",
3591 &regex)) 3600 &policy))
3592 regex = GNUNET_strdup ("(0|1)*"); 3601 regex = NULL;
3593 (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s", 3602 else
3594 GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, 3603 regex = GNUNET_TUN_ipv6policy2regex (policy);
3595 "6", regex); 3604 GNUNET_free_non_null (policy);
3596 regex6 = GNUNET_REGEX_announce (cfg, 3605 if (NULL != regex)
3597 prefixed_regex, 3606 {
3598 REGEX_REFRESH_FREQUENCY, 3607 (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s",
3599 REGEX_MAX_PATH_LEN_IPV6); 3608 GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX,
3600 GNUNET_free (regex); 3609 "6", regex);
3601 GNUNET_free (prefixed_regex); 3610 regex6 = GNUNET_REGEX_announce (cfg,
3611 prefixed_regex,
3612 REGEX_REFRESH_FREQUENCY,
3613 REGEX_MAX_PATH_LEN_IPV6);
3614 GNUNET_free (regex);
3615 GNUNET_free (prefixed_regex);
3616 }
3602 } 3617 }
3603 if ((ipv4_exit) || (ipv6_exit)) 3618 if ((ipv4_exit) || (ipv6_exit))
3604 helper_handle = GNUNET_HELPER_start (GNUNET_NO, 3619 helper_handle = GNUNET_HELPER_start (GNUNET_NO,