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 705bdd34f737b0b223bab31aaccc90f5771b1a05..4b22807f4a4a1c0b6e568bfd00395292544b3b3f 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 da5ae092ad52a608046bc5eed53695fac5b7797f..7d7bfcb478caf7a7abc21578bb8facaba7bfab3b 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);
 }