}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n");
do_shutdown ();
- return;
+ return;
}
- GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max));
+ GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max));
if ( (CURLM_OK != curl_multi_timeout (multi, &timeout)) ||
(-1 == timeout) )
delay = GNUNET_TIME_UNIT_SECONDS;
&nrs,
&nws,
&curl_task,
- NULL);
+ NULL);
}
static void
start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- GNUNET_asprintf (&url,
+ GNUNET_asprintf (&url,
"http://%s/hello_world",
TEST_DOMAIN);
curl = curl_easy_init ();
* will match 'result_af' from the request
* @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
* that the VPN allocated for the redirection;
- * traffic to this IP will now be redirected to the
+ * traffic to this IP will now be redirected to the
* specified target peer; NULL on error
*/
static void
if ((emsg != NULL) && (GNUNET_YES != success))
{
- fprintf (stderr,
+ fprintf (stderr,
"NS failed to create record %s\n", emsg);
GNUNET_SCHEDULER_shutdown ();
return;
- }
+ }
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), &start_curl, NULL);
}
/**
* Function to keep the HTTP server running.
*/
-static void
+static void
mhd_main (void);
}
-static void
+static void
mhd_main ()
{
struct GNUNET_NETWORK_FDSet nrs;
&nrs,
&nws,
&mhd_task,
- NULL);
+ NULL);
}
struct GNUNET_NAMESTORE_RecordData rd;
char *rd_string;
char *zone_keyfile;
-
+
GNUNET_TESTING_peer_get_identity (peer, &id);
GNUNET_CRYPTO_hash_to_enc ((struct GNUNET_HashCode*)&id, &peername);
MHD_OPTION_END);
GNUNET_assert (NULL != mhd);
mhd_main ();
-
+
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
"ZONEKEY",
&zone_keyfile))
if (fd == target_fd)
return;
if (-1 == dup2 (fd, target_fd))
- {
+ {
(void) close (fd);
abort ();
}
/**
* Run the given command and wait for it to complete.
- *
+ *
* @param file name of the binary to run
* @param cmd command line arguments (as given to 'execv')
* @return 0 on success, 1 on any error
*/
static int
-fork_and_exec (const char *file,
+fork_and_exec (const char *file,
char *const cmd[])
{
int status;
pid = fork ();
if (-1 == pid)
{
- fprintf (stderr,
- "fork failed: %s\n",
+ fprintf (stderr,
+ "fork failed: %s\n",
strerror (errno));
return 1;
}
/* we are the child process */
/* close stdin/stdout to not cause interference
with the helper's main protocol! */
- (void) close (0);
+ (void) close (0);
open_dev_null (0, O_RDONLY);
- (void) close (1);
+ (void) close (1);
open_dev_null (1, O_WRONLY);
(void) execv (file, cmd);
/* can only get here on error */
- fprintf (stderr,
- "exec `%s' failed: %s\n",
+ fprintf (stderr,
+ "exec `%s' failed: %s\n",
file,
strerror (errno));
_exit (1);
}
/* keep running waitpid as long as the only error we get is 'EINTR' */
while ( (-1 == (ret = waitpid (pid, &status, 0))) &&
- (errno == EINTR) );
+ (errno == EINTR) );
if (-1 == ret)
{
- fprintf (stderr,
- "waitpid failed: %s\n",
+ fprintf (stderr,
+ "waitpid failed: %s\n",
strerror (errno));
return 1;
}
{
"iptables", "-t", "mangle", "-L", "-v", NULL
};
-
+
if (0 == access ("/sbin/iptables", X_OK))
sbin_iptables = "/sbin/iptables";
else if (0 == access ("/usr/sbin/iptables", X_OK))
sbin_iptables = "/usr/sbin/iptables";
else
{
- fprintf (stderr,
+ fprintf (stderr,
"Executable iptables not found in approved directories: %s, skipping\n",
strerror (errno));
return 0;
}
-
+
if (0 != fork_and_exec (sbin_iptables, iptables_args))
{
fprintf (stderr,
GNUNET_OS_check_helper_binary (bin_exit, GNUNET_YES, "-d gnunet-vpn - - - 169.1.3.3.7 255.255.255.0")) || //no nat, ipv4 only
(GNUNET_YES !=
GNUNET_OS_check_helper_binary (bin_dns, GNUNET_YES, NULL))) ) // TODO: once we have a windows-testcase, add test parameters here
- {
+ {
fprintf (stderr,
"WARNING: gnunet-helper-{exit,vpn,dns} binaries in $PATH are not SUID, refusing to run test (as it would have to fail).\n");
fprintf (stderr,
"Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n");
- GNUNET_free (bin_vpn);
+ GNUNET_free (bin_vpn);
GNUNET_free (bin_exit);
GNUNET_free (bin_dns);
return 0;
}
- GNUNET_free (bin_vpn);
+ GNUNET_free (bin_vpn);
GNUNET_free (bin_exit);
GNUNET_free (bin_dns);
-
+
dest_ip = "169.254.86.1";
dest_af = AF_INET;
src_af = AF_INET;
use_v6 = GNUNET_YES;
else
use_v6 = GNUNET_NO;
-
+
if ( (GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) ||
(GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)) )
{
- fprintf (stderr,
+ fprintf (stderr,
"Required address families not supported by this system, skipping test.\n");
return 0;
}