If the tun-if can't be initialized correctly, close the vpn-helper
authorPhilipp Tölke <toelke@in.tum.de>
Fri, 30 Jul 2010 23:35:25 +0000 (23:35 +0000)
committerPhilipp Tölke <toelke@in.tum.de>
Fri, 30 Jul 2010 23:35:25 +0000 (23:35 +0000)
src/vpn/gnunet-daemon-vpn.c
src/vpn/gnunet-helper-vpn.c

index 0f5b3b06ef64d4fbfb6695b4b8f522024bd1bc1e..24f141cfc675bc3bb4f7fa2b3f7d9ef5ab38369f 100644 (file)
@@ -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
index 4a75182f9a893821ebd17abaa789e4b6841bdbaa..83c0af4539cc49005a28c921f8f854edfd27131a 100644 (file)
@@ -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