We need this for earlier check for OOB, before reaching do_qmp_dispatch(). Meanwhile, a small touch-up to allow "id" field, after all we allow that for sure in the spec (in any form).
Signed-off-by: Peter Xu <pet...@redhat.com> --- include/qapi/qmp/dispatch.h | 1 + qapi/qmp-dispatch.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index b76798800c..cf2657b5c9 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -49,6 +49,7 @@ bool qmp_command_is_enabled(const QmpCommand *cmd); const char *qmp_command_name(const QmpCommand *cmd); bool qmp_has_success_response(const QmpCommand *cmd); QObject *qmp_build_error_object(Error *err); +QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp); typedef void (*qmp_cmd_callback_fn)(QmpCommand *cmd, void *opaque); diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index b41fa174fe..b16f2f1d3f 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -20,7 +20,7 @@ #include "qapi-types.h" #include "qapi/qmp/qerror.h" -static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp) +QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp) { const QDictEntry *ent; const char *arg_name; @@ -52,6 +52,8 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp) "QMP input member 'arguments' must be an object"); return NULL; } + } else if (!strcmp(arg_name, "id")) { + continue; } else { error_setg(errp, "QMP input member '%s' is unexpected", arg_name); -- 2.14.3