From 559e1b0322c474b3476c6734d693658f43cc790a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 10 Jan 2024 05:05:29 +0900 Subject: [PATCH] resolvectl: use JSON_ALLOW_EXTENSIONS Follow-up for f0e4244b2fda1b3de3da1c2792ed1cd21c72087b. (cherry picked from commit 0c61995d80d3ba211b50e28349cdc9b121104d41) --- src/resolve/resolvectl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c index afa537f160b..64b829e5e64 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c @@ -2715,7 +2715,7 @@ static int print_answer(JsonVariant *answer) { static void monitor_query_dump(JsonVariant *v) { _cleanup_(json_variant_unrefp) JsonVariant *question = NULL, *answer = NULL, *collected_questions = NULL; - int rcode = -1, error = 0, r; + int rcode = -1, error = 0; const char *state = NULL; assert(v); @@ -2730,9 +2730,8 @@ static void monitor_query_dump(JsonVariant *v) { {} }; - r = json_dispatch(v, dispatch_table, 0, NULL); - if (r < 0) - return (void) log_warning("Received malformed monitor message, ignoring."); + if (json_dispatch(v, dispatch_table, JSON_LOG|JSON_ALLOW_EXTENSIONS, NULL) < 0) + return; /* First show the current question */ print_question('Q', ansi_highlight_cyan(), question); @@ -2856,7 +2855,7 @@ static int dump_cache_item(JsonVariant *item) { _cleanup_(dns_resource_key_unrefp) DnsResourceKey *k = NULL; int r, c = 0; - r = json_dispatch(item, dispatch_table, JSON_LOG, &item_info); + r = json_dispatch(item, dispatch_table, JSON_LOG|JSON_ALLOW_EXTENSIONS, &item_info); if (r < 0) return r; @@ -2918,7 +2917,7 @@ static int dump_cache_scope(JsonVariant *scope) { {}, }; - r = json_dispatch(scope, dispatch_table, JSON_LOG, &scope_info); + r = json_dispatch(scope, dispatch_table, JSON_LOG|JSON_ALLOW_EXTENSIONS, &scope_info); if (r < 0) return r; @@ -3034,7 +3033,7 @@ static int dump_server_state(JsonVariant *server) { {}, }; - r = json_dispatch(server, dispatch_table, JSON_LOG|JSON_PERMISSIVE, &server_state); + r = json_dispatch(server, dispatch_table, JSON_LOG|JSON_ALLOW_EXTENSIONS, &server_state); if (r < 0) return r;