From 47fbe3627640d60166e794dac3d0dcec1c7727a6 Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Tue, 20 Jun 2023 13:15:30 +0300 Subject: [PATCH] drouting: Fix 'inherit_reload' related errors on MI reloads Related to e871882cb6. Be silent about "MI param not found" errors, in case the function was _meant_ to be called without those parameters. --- mi/item.c | 12 ++++-------- modules/drouting/drouting.c | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/mi/item.c b/mi/item.c index d7384eb0be8..758a7bb7ca5 100644 --- a/mi/item.c +++ b/mi/item.c @@ -476,21 +476,17 @@ int get_mi_bool_like_param(const mi_params_t *params, char *name, { str tmp; - if (get_mi_string_param(params, name, &tmp.s, &tmp.len) < 0) { + if (try_get_mi_string_param(params, name, &tmp.s, &tmp.len) != 0) return default_value; - } - if (tmp.len != 1) { + if (tmp.len != 1) return default_value; - } - if (tmp.s[0] == '0' || tmp.s[0] == 'n' || tmp.s[0] == 'N') { + if (tmp.s[0] == '0' || tmp.s[0] == 'n' || tmp.s[0] == 'N') return 0; - } - if (tmp.s[0] == '1' || tmp.s[0] == 'y' || tmp.s[0] == 'Y') { + if (tmp.s[0] == '1' || tmp.s[0] == 'y' || tmp.s[0] == 'Y') return 1; - } return default_value; } diff --git a/modules/drouting/drouting.c b/modules/drouting/drouting.c index 0c08f72f88f..26bb1969f66 100644 --- a/modules/drouting/drouting.c +++ b/modules/drouting/drouting.c @@ -537,7 +537,7 @@ static const mi_export_t mi_cmds[] = { {dr_reload_cmd, {0}}, {dr_reload_cmd, {"inherit_state", 0}}, {dr_reload_cmd_1, {"partition_name", 0}}, - {dr_reload_cmd_1, {"partition_name", "inhert_state", 0}}, + {dr_reload_cmd_1, {"partition_name", "inherit_state", 0}}, {EMPTY_MI_RECIPE}} }, { "dr_gw_status", HLP2, MI_NAMED_PARAMS_ONLY, 0, {