From 096ec34ec77b2455cc4fd090ed093adfff413e36 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philipp=20T=C3=B6lke?= Date: Fri, 30 Jul 2010 23:35:25 +0000 Subject: [PATCH] If the tun-if can't be initialized correctly, close the vpn-helper --- src/vpn/gnunet-daemon-vpn.c | 1 + src/vpn/gnunet-helper-vpn.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index 0f5b3b06e..24f141cfc 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c @@ -78,6 +78,7 @@ static void start_helper_and_schedule(struct vpn_cls* mycls) { static void restart_helper(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) { + // FIXME: Ratelimit this! struct vpn_cls* mycls = (struct vpn_cls*) cls; // Kill the helper diff --git a/src/vpn/gnunet-helper-vpn.c b/src/vpn/gnunet-helper-vpn.c index 4a75182f9..83c0af453 100644 --- a/src/vpn/gnunet-helper-vpn.c +++ b/src/vpn/gnunet-helper-vpn.c @@ -122,6 +122,12 @@ int main(int argc, char** argv) { signal(SIGTERM, &term); int fd_tun = init_tun(dev); + + if (fd_tun < 0) { + fprintf(stderr, "Could not initialize tun-interface: %m\n"); + exit(1); + } + fprintf(stderr, "Initialized the interface %s as %d.\n", dev, fd_tun); // TODO: get this out of argv -- 2.25.1