summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--interface.c4
-rw-r--r--proto-shell.c5
-rw-r--r--proto.h1
3 files changed, 9 insertions, 1 deletions
diff --git a/interface.c b/interface.c
index a8f7b8f..787d7d9 100644
--- a/interface.c
+++ b/interface.c
@@ -184,6 +184,8 @@ interface_claim_device(struct interface *iface)
if (dev)
device_add_user(&iface->main_dev, dev);
}
+ if (iface->proto_handler->flags & PROTO_FLAG_INIT_AVAILABLE)
+ interface_set_available(iface, true);
}
@@ -517,8 +519,8 @@ interface_update(struct vlist_tree *tree, struct vlist_node *node_new,
set_config_state(if_old, IFC_REMOVE);
} else if (node_new) {
D(INTERFACE, "Create interface '%s'\n", if_new->name);
- interface_claim_device(if_new);
proto_init_interface(if_new, if_new->config);
+ interface_claim_device(if_new);
netifd_ubus_add_interface(if_new);
}
}
diff --git a/proto-shell.c b/proto-shell.c
index b40b456..51a6dac 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -25,6 +25,7 @@ struct proto_shell_handler {
struct proto_handler proto;
struct config_param_list config;
char *config_buf;
+ bool init_available;
char script_name[];
};
@@ -615,6 +616,10 @@ proto_shell_add_handler(const char *script, json_object *obj)
if (tmp && json_object_get_boolean(tmp))
handler->proto.flags |= PROTO_FLAG_NODEV;
+ tmp = get_field(obj, "available", json_type_boolean);
+ if (tmp && json_object_get_boolean(tmp))
+ handler->proto.flags |= PROTO_FLAG_INIT_AVAILABLE;
+
config = get_field(obj, "config", json_type_array);
if (config)
handler->config_buf = proto_shell_parse_config(&handler->config, config);
diff --git a/proto.h b/proto.h
index 57426bd..c401d6f 100644
--- a/proto.h
+++ b/proto.h
@@ -19,6 +19,7 @@ enum interface_proto_cmd {
enum {
PROTO_FLAG_IMMEDIATE = (1 << 0),
PROTO_FLAG_NODEV = (1 << 1),
+ PROTO_FLAG_INIT_AVAILABLE = (1 << 2),
};
struct interface_proto_state {