proto-shell: add a config option for setting PROTO_FLAG_NODEV
authorFelix Fietkau <nbd@openwrt.org>
Sun, 11 Sep 2011 10:35:21 +0000 (12:35 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 11 Sep 2011 10:35:35 +0000 (12:35 +0200)
proto-shell.c
proto/netifd-proto.sh
proto/ppp.sh

index d014b430421a822877450e496decf9a076cfe720..86126317271e235df613870f7e4f44ad1437a45d 100644 (file)
@@ -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);
index b91863f7346fc4cd3548a2bd714d2184ef85e795..9aace594453997c3a6a9cdfed44908f99aa7b02c 100755 (executable)
@@ -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
index 9a5816b0b2839f2c75d4b82e0e3f03ca7e6c6c77..7eed5794c8b6c2002ed007881460c931051095f1 100755 (executable)
@@ -17,7 +17,8 @@ ppp_teardown() {
 }
 
 ppp_init() {
-       return
+       no_device=1
+       available=1
 }
 
 add_protocol ppp