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
[[ "$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
}
}
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() {