mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 16:54:30 +00:00
lib: fix route map generic error output
Two fixes here: * Don't attempt to use `vty` pointer in vty; * When `vty` is unavailable output to log; Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
a513824c34
commit
a162869ef0
@ -308,15 +308,21 @@ int generic_match_add(struct vty *vty, struct route_map_index *index,
|
|||||||
ret = route_map_add_match(index, command, arg, type);
|
ret = route_map_add_match(index, command, arg, type);
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case RMAP_RULE_MISSING:
|
case RMAP_RULE_MISSING:
|
||||||
vty_out(vty, "%% [%s] Can't find rule.\n", frr_protonameinst);
|
if (vty)
|
||||||
|
vty_out(vty, "%% [%s] Can't find rule.\n",
|
||||||
|
frr_protonameinst);
|
||||||
|
else
|
||||||
|
zlog_warn("Can't find rule: %s", command);
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
break;
|
|
||||||
case RMAP_COMPILE_ERROR:
|
case RMAP_COMPILE_ERROR:
|
||||||
vty_out(vty,
|
if (vty)
|
||||||
"%% [%s] Argument form is unsupported or malformed.\n",
|
vty_out(vty,
|
||||||
frr_protonameinst);
|
"%% [%s] Argument form is unsupported or malformed.\n",
|
||||||
|
frr_protonameinst);
|
||||||
|
else
|
||||||
|
zlog_warn("Argument form is unsupported or malformed: "
|
||||||
|
"%s %s", command, arg);
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
break;
|
|
||||||
case RMAP_COMPILE_SUCCESS:
|
case RMAP_COMPILE_SUCCESS:
|
||||||
/*
|
/*
|
||||||
* Nothing to do here move along
|
* Nothing to do here move along
|
||||||
@ -353,13 +359,21 @@ int generic_match_delete(struct vty *vty, struct route_map_index *index,
|
|||||||
ret = route_map_delete_match(index, command, dep_name, type);
|
ret = route_map_delete_match(index, command, dep_name, type);
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case RMAP_RULE_MISSING:
|
case RMAP_RULE_MISSING:
|
||||||
vty_out(vty, "%% [%s] Can't find rule.\n", frr_protonameinst);
|
if (vty)
|
||||||
|
vty_out(vty, "%% [%s] Can't find rule.\n",
|
||||||
|
frr_protonameinst);
|
||||||
|
else
|
||||||
|
zlog_warn("Can't find rule: %s", command);
|
||||||
retval = CMD_WARNING_CONFIG_FAILED;
|
retval = CMD_WARNING_CONFIG_FAILED;
|
||||||
break;
|
break;
|
||||||
case RMAP_COMPILE_ERROR:
|
case RMAP_COMPILE_ERROR:
|
||||||
vty_out(vty,
|
if (vty)
|
||||||
"%% [%s] Argument form is unsupported or malformed.\n",
|
vty_out(vty,
|
||||||
frr_protonameinst);
|
"%% [%s] Argument form is unsupported or malformed.\n",
|
||||||
|
frr_protonameinst);
|
||||||
|
else
|
||||||
|
zlog_warn("Argument form is unsupported or malformed: "
|
||||||
|
"%s %s", command, arg);
|
||||||
retval = CMD_WARNING_CONFIG_FAILED;
|
retval = CMD_WARNING_CONFIG_FAILED;
|
||||||
break;
|
break;
|
||||||
case RMAP_COMPILE_SUCCESS:
|
case RMAP_COMPILE_SUCCESS:
|
||||||
@ -383,15 +397,20 @@ int generic_set_add(struct vty *vty, struct route_map_index *index,
|
|||||||
ret = route_map_add_set(index, command, arg);
|
ret = route_map_add_set(index, command, arg);
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case RMAP_RULE_MISSING:
|
case RMAP_RULE_MISSING:
|
||||||
vty_out(vty, "%% [%s] Can't find rule.\n", frr_protonameinst);
|
if (vty)
|
||||||
|
vty_out(vty, "%% [%s] Can't find rule.\n", frr_protonameinst);
|
||||||
|
else
|
||||||
|
zlog_warn("Can't find rule: %s", command);
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
break;
|
|
||||||
case RMAP_COMPILE_ERROR:
|
case RMAP_COMPILE_ERROR:
|
||||||
vty_out(vty,
|
if (vty)
|
||||||
"%% [%s] Argument form is unsupported or malformed.\n",
|
vty_out(vty,
|
||||||
frr_protonameinst);
|
"%% [%s] Argument form is unsupported or malformed.\n",
|
||||||
|
frr_protonameinst);
|
||||||
|
else
|
||||||
|
zlog_warn("Argument form is unsupported or malformed: "
|
||||||
|
"%s %s", command, arg);
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
break;
|
|
||||||
case RMAP_COMPILE_SUCCESS:
|
case RMAP_COMPILE_SUCCESS:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -407,15 +426,20 @@ int generic_set_delete(struct vty *vty, struct route_map_index *index,
|
|||||||
ret = route_map_delete_set(index, command, arg);
|
ret = route_map_delete_set(index, command, arg);
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case RMAP_RULE_MISSING:
|
case RMAP_RULE_MISSING:
|
||||||
vty_out(vty, "%% [%s] Can't find rule.\n", frr_protonameinst);
|
if (vty)
|
||||||
|
vty_out(vty, "%% [%s] Can't find rule.\n", frr_protonameinst);
|
||||||
|
else
|
||||||
|
zlog_warn("Can't find rule: %s", command);
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
break;
|
|
||||||
case RMAP_COMPILE_ERROR:
|
case RMAP_COMPILE_ERROR:
|
||||||
vty_out(vty,
|
if (vty)
|
||||||
"%% [%s] Argument form is unsupported or malformed.\n",
|
vty_out(vty,
|
||||||
frr_protonameinst);
|
"%% [%s] Argument form is unsupported or malformed.\n",
|
||||||
|
frr_protonameinst);
|
||||||
|
else
|
||||||
|
zlog_warn("Argument form is unsupported or malformed: "
|
||||||
|
"%s %s", command, arg);
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
break;
|
|
||||||
case RMAP_COMPILE_SUCCESS:
|
case RMAP_COMPILE_SUCCESS:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user