Skip to content

Commit

Permalink
bfd: Improve state change log message.
Browse files Browse the repository at this point in the history
A log message like this one:

2024-01-09T06:45:17.201Z|00071|bfd(handler2)|INFO|ovn-0af536-0: BFD state
change: down->up "Neighbor Signaled Session Down"->"Neighbor Signaled Session
Down".

can be hard to read since '->' usually represents a status change, but
in this case the diagnostic code stays constant. Update the log message to
avoid such ambiguity. The log message for the above event become:

2024-01-09T06:45:16.211Z|00026|bfd(handler3)|INFO|ovn-0af536-0: BFD state
change: (bfd.SessionState: down, bfd.LocalDiag: "Neighbor Signaled Session
Down") -> (bfd.SessionState: up, bfd.LocalDiag: "Neighbor Signaled Session
Down")

Reported-by: Alex Stupnikov <astupnik@redhat.com>
Reported-at: https://bugzilla.redhat.com/2258496
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
drizzt authored and igsilya committed Mar 8, 2024
1 parent efbc37b commit 5ae5917
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1130,10 +1130,11 @@ bfd_set_state(struct bfd *bfd, enum state state, enum diag diag)
if (!VLOG_DROP_INFO(&rl)) {
struct ds ds = DS_EMPTY_INITIALIZER;

ds_put_format(&ds, "%s: BFD state change: %s->%s"
" \"%s\"->\"%s\".\n",
ds_put_format(&ds, "%s: BFD state change: (bfd.SessionState: %s,"
" bfd.LocalDiag: \"%s\") -> (bfd.SessionState: %s,"
" bfd.LocalDiag: \"%s\")\n",
bfd->name, bfd_state_str(bfd->state),
bfd_state_str(state), bfd_diag_str(bfd->diag),
bfd_diag_str(bfd->diag), bfd_state_str(state),
bfd_diag_str(diag));
bfd_put_details(&ds, bfd);
VLOG_INFO("%s", ds_cstr(&ds));
Expand Down

0 comments on commit 5ae5917

Please sign in to comment.