summaryrefslogtreecommitdiff
path: root/lib/log_vty.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2021-11-16 13:29:44 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2021-11-16 18:51:22 +0100
commit0beb61abc21c082e18dc1f1d78e256ca57cff337 (patch)
tree874f8bb694d09032b926930c41094248762ca166 /lib/log_vty.c
parentdd2c81b8c09ac8c27ca909cf16640815941df31e (diff)
vtysh: dispatch unique-id backtrace cmd properly
i.e. to whoever cares, since some unique IDs (from libfrr) are valid everywhere but some others (from the daemons) only apply to specific daemons. (Default handling aborts on first error, so configuring any unique IDs that don't exist on the first daemon vtysh connects to just failed before this.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/log_vty.c')
-rw-r--r--lib/log_vty.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/log_vty.c b/lib/log_vty.c
index 9911323553..621949ab57 100644
--- a/lib/log_vty.c
+++ b/lib/log_vty.c
@@ -269,14 +269,14 @@ DEFUN_HIDDEN (no_config_log_monitor,
return CMD_SUCCESS;
}
-DEFPY (debug_uid_backtrace,
- debug_uid_backtrace_cmd,
- "[no] debug unique-id UID backtrace",
- NO_STR
- DEBUG_STR
- "Options per individual log message, by unique ID\n"
- "Log message unique ID (XXXXX-XXXXX)\n"
- "Add backtrace to log when message is printed\n")
+DEFPY_NOSH (debug_uid_backtrace,
+ debug_uid_backtrace_cmd,
+ "[no] debug unique-id UID backtrace",
+ NO_STR
+ DEBUG_STR
+ "Options per individual log message, by unique ID\n"
+ "Log message unique ID (XXXXX-XXXXX)\n"
+ "Add backtrace to log when message is printed\n")
{
struct xrefdata search, *xrd;
struct xrefdata_logmsg *xrdl;
@@ -285,10 +285,9 @@ DEFPY (debug_uid_backtrace,
strlcpy(search.uid, uid, sizeof(search.uid));
xrd = xrefdata_uid_find(&xrefdata_uid, &search);
- if (!xrd) {
- vty_out(vty, "%% no log message with ID \"%s\" found\n", uid);
- return CMD_WARNING;
- }
+ if (!xrd)
+ return CMD_ERR_NOTHING_TODO;
+
if (xrd->xref->type != XREFT_LOGMSG) {
vty_out(vty, "%% ID \"%s\" is not a log message\n", uid);
return CMD_WARNING;