diff options
author | Philipp Tölke <toelke@in.tum.de> | 2011-01-30 20:53:33 +0000 |
---|---|---|
committer | Philipp Tölke <toelke@in.tum.de> | 2011-01-30 20:53:33 +0000 |
commit | 7781a7e6c4aa4ebfb2391dcaf7b58a12726a2a7f (patch) | |
tree | e312ba92b0b8691e19b0a529d8efed47a4e39c3b /src/vpn/gnunet-daemon-vpn-helper.c | |
parent | 13b3ecd3c2d5ce04939eb147968c06770176abee (diff) | |
download | gnunet-7781a7e6c4aa4ebfb2391dcaf7b58a12726a2a7f.tar.gz gnunet-7781a7e6c4aa4ebfb2391dcaf7b58a12726a2a7f.zip |
read ip-addresses from configuration
Diffstat (limited to 'src/vpn/gnunet-daemon-vpn-helper.c')
-rw-r--r-- | src/vpn/gnunet-daemon-vpn-helper.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c index 23df26297..d2815d4e5 100644 --- a/src/vpn/gnunet-daemon-vpn-helper.c +++ b/src/vpn/gnunet-daemon-vpn-helper.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <gnunet_server_lib.h> | 32 | #include <gnunet_server_lib.h> |
33 | #include <gnunet_container_lib.h> | 33 | #include <gnunet_container_lib.h> |
34 | #include <block_dns.h> | 34 | #include <block_dns.h> |
35 | #include <gnunet_configuration_lib.h> | ||
35 | 36 | ||
36 | #include "gnunet-daemon-vpn-dns.h" | 37 | #include "gnunet-daemon-vpn-dns.h" |
37 | #include "gnunet-daemon-vpn.h" | 38 | #include "gnunet-daemon-vpn.h" |
@@ -74,10 +75,44 @@ start_helper_and_schedule(void *cls, | |||
74 | 75 | ||
75 | if (helper_in == NULL || helper_out == NULL) return; | 76 | if (helper_in == NULL || helper_out == NULL) return; |
76 | 77 | ||
78 | char* ipv6addr; | ||
79 | char* ipv6prefix; | ||
80 | char* ipv4addr; | ||
81 | char* ipv4mask; | ||
82 | |||
83 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, "vpn", "IPV6ADDR", &ipv6addr)) | ||
84 | { | ||
85 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "No entry 'IPV6ADDR' in configuration!\n"); | ||
86 | exit(1); | ||
87 | } | ||
88 | |||
89 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, "vpn", "IPV6PREFIX", &ipv6prefix)) | ||
90 | { | ||
91 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "No entry 'IPV6PREFIX' in configuration!\n"); | ||
92 | exit(1); | ||
93 | } | ||
94 | |||
95 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, "vpn", "IPV4ADDR", &ipv4addr)) | ||
96 | { | ||
97 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "No entry 'IPV4ADDR' in configuration!\n"); | ||
98 | exit(1); | ||
99 | } | ||
100 | |||
101 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, "vpn", "IPV4MASK", &ipv4mask)) | ||
102 | { | ||
103 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "No entry 'IPV4MASK' in configuration!\n"); | ||
104 | exit(1); | ||
105 | } | ||
106 | |||
77 | helper_proc = | 107 | helper_proc = |
78 | GNUNET_OS_start_process (helper_in, helper_out, "gnunet-helper-vpn", | 108 | GNUNET_OS_start_process (helper_in, helper_out, "gnunet-helper-vpn", |
79 | "gnunet-helper-vpn", "1234::1", "16", "10.10.10.1", | 109 | "gnunet-helper-vpn", ipv6addr, ipv6prefix, |
80 | "255.255.255.0"); | 110 | ipv4addr, ipv4mask, NULL); |
111 | |||
112 | GNUNET_free(ipv6addr); | ||
113 | GNUNET_free(ipv6prefix); | ||
114 | GNUNET_free(ipv4addr); | ||
115 | GNUNET_free(ipv4mask); | ||
81 | 116 | ||
82 | fh_from_helper = GNUNET_DISK_pipe_handle (helper_out, GNUNET_DISK_PIPE_END_READ); | 117 | fh_from_helper = GNUNET_DISK_pipe_handle (helper_out, GNUNET_DISK_PIPE_END_READ); |
83 | fh_to_helper = GNUNET_DISK_pipe_handle (helper_in, GNUNET_DISK_PIPE_END_WRITE); | 118 | fh_to_helper = GNUNET_DISK_pipe_handle (helper_in, GNUNET_DISK_PIPE_END_WRITE); |