Skip to content

Commit

Permalink
drouting: Fix 'inherit_reload' related errors on MI reloads
Browse files Browse the repository at this point in the history
Related to e871882.  Be silent about "MI param not found" errors, in
case the function was _meant_ to be called without those parameters.
  • Loading branch information
liviuchircu committed Jun 20, 2023
1 parent ce177c1 commit 47fbe36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions mi/item.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/drouting/drouting.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

1 comment on commit 47fbe36

@bogdan-iancu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 nice catch

Please sign in to comment.