allow starting without an active interface
authorFelix Fietkau <nbd@openwrt.org>
Wed, 11 Jun 2014 14:40:38 +0000 (16:40 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 11 Jun 2014 14:40:38 +0000 (16:40 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
main.c

diff --git a/main.c b/main.c
index 8275c4861d576590aeb53a3c3a083f84de55b1da..11eb42d6b8914e0db45af06c3dafdffd2eb73ce3 100644 (file)
--- a/main.c
+++ b/main.c
@@ -38,8 +38,6 @@
 #include "announce.h"
 #include "interface.h"
 
-static char *iface_name = "eth0";
-
 static void
 signal_shutdown(int signal)
 {
@@ -51,6 +49,8 @@ main(int argc, char **argv)
 {
        int ch, ttl;
 
+       uloop_init();
+
        while ((ch = getopt(argc, argv, "t:i:d")) != -1) {
                switch (ch) {
                case 't':
@@ -64,21 +64,11 @@ main(int argc, char **argv)
                        debug++;
                        break;
                case 'i':
-                       iface_name = optarg;
+                       interface_add(optarg);
                        break;
                }
        }
 
-       if (!iface_name)
-               return -1;
-
-       uloop_init();
-
-       if (interface_add(iface_name)) {
-               fprintf(stderr, "Failed to add interface %s\n", iface_name);
-               return -1;
-       }
-
        signal(SIGPIPE, SIG_IGN);
        signal(SIGTERM, signal_shutdown);
        signal(SIGKILL, signal_shutdown);