bring all interfaces down on restart
authorFelix Fietkau <nbd@openwrt.org>
Sun, 11 Sep 2011 09:15:39 +0000 (11:15 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 11 Sep 2011 09:15:39 +0000 (11:15 +0200)
interface.c
main.c

index 705bdd3..4b22807 100644 (file)
@@ -312,8 +312,13 @@ interface_set_up(struct interface *iface)
 int
 interface_set_down(struct interface *iface)
 {
-       iface->autostart = false;
-       __interface_set_down(iface, false);
+       if (!iface) {
+               list_for_each_entry(iface, &interfaces, list)
+                       __interface_set_down(iface, false);
+       } else {
+               iface->autostart = false;
+               __interface_set_down(iface, false);
+       }
 
        return 0;
 }
diff --git a/main.c b/main.c
index da5ae09..7d7bfcb 100644 (file)
--- a/main.c
+++ b/main.c
@@ -6,6 +6,7 @@
 #include "netifd.h"
 #include "ubus.h"
 #include "config.h"
+#include "interface.h"
 
 const char *main_path = ".";
 static char **global_argv;
@@ -21,6 +22,7 @@ static struct uloop_timeout restart_timer = {
 
 void netifd_restart(void)
 {
+       interface_set_down(NULL);
        uloop_timeout_set(&restart_timer, 1000);
 }