add wrappers to parse setup/teardown data
authorFelix Fietkau <nbd@openwrt.org>
Mon, 10 Oct 2011 00:02:29 +0000 (02:02 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 10 Oct 2011 00:02:29 +0000 (02:02 +0200)
dummy/netifd-proto.sh
dummy/proto/ppp.sh

index d15505cb1c36598e78aa76eeefee7d6cd8707da2..104edc7b6b55fad89c0f1504716daba288541244 100755 (executable)
@@ -26,6 +26,16 @@ add_default_handler() {
        esac
 }
 
+_proto_do_teardown() {
+       json_load "$data"
+       eval "$1_teardown \"$interface\" \"$ifname\""
+}
+
+_proto_do_setup() {
+       json_load "$data"
+       eval "$1_setup \"$interface\" \"$ifname\""
+}
+
 proto="$1"; shift
 cmd="$1"; shift
 interface="$1"; shift
@@ -56,8 +66,8 @@ case "$cmd" in
                        [[ "$proto" == "$1" ]] || return 0
 
                        case "$cmd" in
-                               setup) eval "$1_setup \"\$interface\" \"\$data\" \"\$ifname\"" ;;
-                               teardown) eval "$1_teardown \"\$interface\" \"\$data\" \"\$ifname\"" ;;
+                               setup) _proto_do_setup "$1";;
+                               teardown) _proto_do_teardown "$1" ;;
                                *) return 1 ;;
                        esac
                }
index cd57145c2bb124266bdff221ebeceb4f01de09ee..9a35fc9da292e00f32358bebf1116c292c56da12 100755 (executable)
@@ -32,7 +32,9 @@ pppoe_init() {
 }
 
 pppoe_setup() {
-       echo "pppoe_setup($1, $3): $2"
+       json_get_var username username
+       json_get_var password password
+       echo "pppoe_setup($1, $2), username=$username, password=$password"
 }
 
 pppoe_teardown() {