bring all interfaces down on restart
[project/netifd.git] / main.c
diff --git a/main.c b/main.c
index d1f976d..7d7bfcb 100644 (file)
--- a/main.c
+++ b/main.c
@@ -6,7 +6,9 @@
 #include "netifd.h"
 #include "ubus.h"
 #include "config.h"
+#include "interface.h"
 
+const char *main_path = ".";
 static char **global_argv;
 
 static void netifd_do_restart(struct uloop_timeout *timeout)
@@ -20,6 +22,7 @@ static struct uloop_timeout restart_timer = {
 
 void netifd_restart(void)
 {
+       interface_set_down(NULL);
        uloop_timeout_set(&restart_timer, 1000);
 }
 
@@ -28,7 +31,8 @@ static int usage(const char *progname)
        fprintf(stderr, "Usage: %s [options]\n"
                "Options:\n"
                " -s <path>:            Path to the ubus socket\n"
-               "\n", progname);
+               " -p <path>:            Path to netifd addons (default: %s)\n"
+               "\n", progname, main_path);
 
        return 1;
 }
@@ -45,6 +49,9 @@ int main(int argc, char **argv)
                case 's':
                        socket = optarg;
                        break;
+               case 'p':
+                       main_path = optarg;
+                       break;
                default:
                        return usage(argv[0]);
                }