From: Philipp Tölke Date: Fri, 30 Jul 2010 23:35:25 +0000 (+0000) Subject: If the tun-if can't be initialized correctly, close the vpn-helper X-Git-Tag: initial-import-from-subversion-38251~20787 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=096ec34ec77b2455cc4fd090ed093adfff413e36;p=oweals%2Fgnunet.git If the tun-if can't be initialized correctly, close the vpn-helper --- 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