bring all interfaces down on restart
[project/netifd.git] / interface.c
index 51e9e92..4b22807 100644 (file)
@@ -19,10 +19,6 @@ enum {
        IFACE_ATTR_MAX
 };
 
-static const union config_param_info iface_attr_info[IFACE_ATTR_MAX] = {
-       [IFACE_ATTR_IFNAME].type = BLOBMSG_TYPE_STRING,
-};
-
 static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = {
        [IFACE_ATTR_PROTO] = { .name = "proto", .type = BLOBMSG_TYPE_STRING },
        [IFACE_ATTR_IFNAME] = { .name = "ifname", .type = BLOBMSG_TYPE_STRING },
@@ -32,7 +28,6 @@ static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = {
 const struct config_param_list interface_attr_list = {
        .n_params = IFACE_ATTR_MAX,
        .params = iface_attrs,
-       .info = iface_attr_info,
 };
 
 static void
@@ -317,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;
 }