From: Felix Fietkau Date: Sun, 11 Sep 2011 10:35:21 +0000 (+0200) Subject: proto-shell: add a config option for setting PROTO_FLAG_NODEV X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=commitdiff_plain;h=7f081660bf24fed49a716022a6ea17bb1dcde73a proto-shell: add a config option for setting PROTO_FLAG_NODEV --- diff --git a/proto-shell.c b/proto-shell.c index d014b43..8612631 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -230,6 +230,10 @@ proto_shell_add_handler(const char *script, json_object *obj) proto->config_params = &handler->config; proto->attach = proto_shell_attach; + tmp = get_field(obj, "no-device", json_type_boolean); + if (tmp && json_object_get_boolean(tmp)) + handler->proto.flags |= PROTO_FLAG_NODEV; + config = get_field(obj, "config", json_type_array); if (config) handler->config_buf = proto_shell_parse_config(&handler->config, config); diff --git a/proto/netifd-proto.sh b/proto/netifd-proto.sh index b91863f..9aace59 100755 --- a/proto/netifd-proto.sh +++ b/proto/netifd-proto.sh @@ -33,14 +33,16 @@ data="$3" case "$cmd" in dump) add_protocol() { - immediate=0 + no_device=0 + available=0 add_default_handler "$1_init_config" json_init json_add_string "name" "$1" eval "$1_init" - json_add_boolean immediate "$immediate" + json_add_boolean no-device "$no_device" + json_add_boolean available "$available" json_add_array "config" eval "$1_init_config" json_close_array diff --git a/proto/ppp.sh b/proto/ppp.sh index 9a5816b..7eed579 100755 --- a/proto/ppp.sh +++ b/proto/ppp.sh @@ -17,7 +17,8 @@ ppp_teardown() { } ppp_init() { - return + no_device=1 + available=1 } add_protocol ppp