fold the _init callback into _init_config
authorFelix Fietkau <nbd@openwrt.org>
Thu, 27 Oct 2011 09:01:32 +0000 (11:01 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 27 Oct 2011 09:01:32 +0000 (11:01 +0200)
dummy/netifd-proto.sh
dummy/proto/ppp.sh

index 11337c239e0c421337879e92961534f46b68d6f8..e7f0d9ece73fb8a454622ffabc446e07eb0e4793 100755 (executable)
@@ -229,12 +229,11 @@ init_proto() {
 
                                json_init
                                json_add_string "name" "$1"
-                               eval "$1_init"
-                               json_add_boolean no-device "$no_device"
-                               json_add_boolean available "$available"
                                json_add_array "config"
                                eval "$1_init_config"
                                json_close_array
+                               json_add_boolean no-device "$no_device"
+                               json_add_boolean available "$available"
                                json_dump
                        }
                ;;
index 6f5dfcc3292e1b3fe1dd6d3c63f200ee0f4e645e..fc918a538be3986e8ecd71702819ae0841efe768 100755 (executable)
@@ -3,12 +3,18 @@
 . ../netifd-proto.sh
 init_proto "$@"
 
-ppp_init_config() {
+ppp_generic_init_config() {
        proto_config_add_string "username"
        proto_config_add_string "password"
        proto_config_add_int "keepalive"
 }
 
+ppp_init_config() {
+       no_device=1
+       available=1
+       ppp_generic_init_config
+}
+
 ppp_setup() {
        echo "ppp_setup($1): $2"
 }
@@ -17,19 +23,10 @@ ppp_teardown() {
        return
 }
 
-ppp_init() {
-       no_device=1
-       available=1
-}
-
 add_protocol ppp
 
 pppoe_init_config() {
-       ppp_init_config
-}
-
-pppoe_init() {
-       return
+       ppp_generic_init_config
 }
 
 pppoe_setup() {