aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-24 18:58:32 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-24 18:58:32 +0000
commit5b620798700aaee2cf916f020aeab724a7256e5f (patch)
tree07587167c49f3e6f24a5cd4203eac3526463c0b2 /src/vpn
parenta97329c6445c3b0b32f61cfd2030734e9998de66 (diff)
downloadgnunet-5b620798700aaee2cf916f020aeab724a7256e5f.tar.gz
gnunet-5b620798700aaee2cf916f020aeab724a7256e5f.zip
-fixes
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/test_gnunet_vpn.c21
-rw-r--r--src/vpn/test_gnunet_vpn.conf3
2 files changed, 11 insertions, 13 deletions
diff --git a/src/vpn/test_gnunet_vpn.c b/src/vpn/test_gnunet_vpn.c
index 91cb9c495..c5298b3fe 100644
--- a/src/vpn/test_gnunet_vpn.c
+++ b/src/vpn/test_gnunet_vpn.c
@@ -106,6 +106,7 @@ mhd_ahc (void *cls,
106 struct MHD_Response *response; 106 struct MHD_Response *response;
107 int ret; 107 int ret;
108 108
109 fprintf (stderr, "MHD got request for URL `%s'\n", url);
109 if (0 != strcmp ("GET", method)) 110 if (0 != strcmp ("GET", method))
110 return MHD_NO; /* unexpected method */ 111 return MHD_NO; /* unexpected method */
111 if (&ptr != *unused) 112 if (&ptr != *unused)
@@ -114,6 +115,7 @@ mhd_ahc (void *cls,
114 return MHD_YES; 115 return MHD_YES;
115 } 116 }
116 *unused = NULL; 117 *unused = NULL;
118 fprintf (stderr, "MHD sends respose for request to URL `%s'\n", url);
117 response = MHD_create_response_from_buffer (strlen (url), 119 response = MHD_create_response_from_buffer (strlen (url),
118 (void *) url, 120 (void *) url,
119 MHD_RESPMEM_MUST_COPY); 121 MHD_RESPMEM_MUST_COPY);
@@ -221,10 +223,10 @@ curl_main ()
221 delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, (unsigned int) timeout); 223 delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, (unsigned int) timeout);
222 GNUNET_NETWORK_fdset_copy_native (&nrs, 224 GNUNET_NETWORK_fdset_copy_native (&nrs,
223 &rs, 225 &rs,
224 max); 226 max + 1);
225 GNUNET_NETWORK_fdset_copy_native (&nws, 227 GNUNET_NETWORK_fdset_copy_native (&nws,
226 &ws, 228 &ws,
227 max); 229 max + 1);
228 curl_task_id = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 230 curl_task_id = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
229 GNUNET_SCHEDULER_NO_TASK, 231 GNUNET_SCHEDULER_NO_TASK,
230 delay, 232 delay,
@@ -338,10 +340,10 @@ mhd_main ()
338 delay = GNUNET_TIME_UNIT_FOREVER_REL; 340 delay = GNUNET_TIME_UNIT_FOREVER_REL;
339 GNUNET_NETWORK_fdset_copy_native (&nrs, 341 GNUNET_NETWORK_fdset_copy_native (&nrs,
340 &rs, 342 &rs,
341 max_fd); 343 max_fd + 1);
342 GNUNET_NETWORK_fdset_copy_native (&nws, 344 GNUNET_NETWORK_fdset_copy_native (&nws,
343 &ws, 345 &ws,
344 max_fd); 346 max_fd + 1);
345 mhd_task_id = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 347 mhd_task_id = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
346 GNUNET_SCHEDULER_NO_TASK, 348 GNUNET_SCHEDULER_NO_TASK,
347 delay, 349 delay,
@@ -356,25 +358,22 @@ static void
356run (void *cls, char *const *args, const char *cfgfile, 358run (void *cls, char *const *args, const char *cfgfile,
357 const struct GNUNET_CONFIGURATION_Handle *cfg) 359 const struct GNUNET_CONFIGURATION_Handle *cfg)
358{ 360{
359 struct sockaddr_in v4; 361 struct in_addr v4;
360 362
361 vpn = GNUNET_VPN_connect (cfg); 363 vpn = GNUNET_VPN_connect (cfg);
362 GNUNET_assert (NULL != vpn); 364 GNUNET_assert (NULL != vpn);
363 v4.sin_family = AF_INET;
364 v4.sin_port = htons (PORT);
365 GNUNET_assert (1 == inet_pton (AF_INET, "127.0.0.1", &v4.sin_addr));
366 mhd = MHD_start_daemon (MHD_USE_DEBUG, 365 mhd = MHD_start_daemon (MHD_USE_DEBUG,
367 PORT, 366 PORT,
368 NULL, NULL, 367 NULL, NULL,
369 &mhd_ahc, NULL, 368 &mhd_ahc, NULL,
370 MHD_OPTION_SOCK_ADDR, &v4,
371 MHD_OPTION_END); 369 MHD_OPTION_END);
372 GNUNET_assert (NULL != mhd); 370 GNUNET_assert (NULL != mhd);
373 mhd_main (); 371 mhd_main ();
372 GNUNET_assert (1 == inet_pton (AF_INET, "10.10.1.1", &v4));
374 rr = GNUNET_VPN_redirect_to_ip (vpn, 373 rr = GNUNET_VPN_redirect_to_ip (vpn,
375 AF_INET, 374 AF_INET,
376 AF_INET, 375 AF_INET,
377 &v4.sin_addr, 376 &v4,
378 GNUNET_YES, 377 GNUNET_YES,
379 GNUNET_TIME_UNIT_FOREVER_ABS, 378 GNUNET_TIME_UNIT_FOREVER_ABS,
380 &allocation_cb, NULL); 379 &allocation_cb, NULL);
diff --git a/src/vpn/test_gnunet_vpn.conf b/src/vpn/test_gnunet_vpn.conf
index 66f96c3a4..7537407ba 100644
--- a/src/vpn/test_gnunet_vpn.conf
+++ b/src/vpn/test_gnunet_vpn.conf
@@ -12,8 +12,7 @@ ALLOW_SHUTDOWN = YES
12EXIT_IPV4 = YES 12EXIT_IPV4 = YES
13EXIT_IPV6 = YES 13EXIT_IPV6 = YES
14 14
15# FIXME: with this, the test will fail if the 15# FIXME: can we use 'lo'?
16# interface does not exist; can we use 'lo'?
17EXIT_IFNAME = eth1 16EXIT_IFNAME = eth1
18 17
19[testing] 18[testing]