*/
#include "gnunet_protocols.h"
+/**
+ * Should we print (interesting|debug) messages that can happen during
+ * normal operation?
+ */
+#define DEBUG GNUNET_NO
+
/**
* Maximum size of a GNUnet message (GNUNET_SERVER_MAX_MESSAGE_SIZE)
*/
if (-1 == written)
{
- fprintf (stderr, "write-error to stdout: %s\n", strerror (errno));
+#if !DEBUG
+ if (errno != EPIPE)
+#endif
+ fprintf (stderr, "write-error to stdout: %s\n", strerror (errno));
shutdown (fd_tun, SHUT_RD);
shutdown (1, SHUT_WR);
read_open = 0;
}
else if (0 == bufin_size)
{
+#if DEBUG
fprintf (stderr, "EOF on stdin\n");
+#endif
shutdown (0, SHUT_RD);
shutdown (fd_tun, SHUT_WR);
write_open = 0;
};
+/**
+ * Return value from 'main'.
+ */
+static int global_ret;
+
/**
* Configuration we use.
*/
struct in_addr v4;
struct in6_addr v6;
+ if (GNUNET_YES !=
+ GNUNET_OS_check_helper_binary ("gnunet-helper-vpn"))
+ {
+ fprintf (stderr,
+ "`%s' is not SUID, refusing to run.\n",
+ "gnunet-helper-vpn");
+ global_ret = 1;
+ return;
+ }
cfg = cfg_;
stats = GNUNET_STATISTICS_create ("vpn", cfg);
if (GNUNET_OK !=
return (GNUNET_OK ==
GNUNET_SERVICE_run (argc, argv, "vpn",
GNUNET_SERVICE_OPTION_NONE,
- &run, NULL)) ? 0 : 1;
+ &run, NULL)) ? global_ret : 1;
}
/* end of gnunet-service-vpn.c */
#define VERBOSE GNUNET_NO
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 45)
+
struct PeerContext
{
struct GNUNET_CONFIGURATION_Handle *cfg;
GNUNET_YES,
GNUNET_TIME_UNIT_FOREVER_ABS,
&allocation_cb, NULL);
- ctrl_c_task_id = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+ ctrl_c_task_id = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
&ctrl_c_shutdown,
NULL);
}