Skip to content

Commit

Permalink
bgpd: fix printfrr_bp for non initialized peers
Browse files Browse the repository at this point in the history
Fix printfrr_bp for non initialized peers. For example:

> Sep 26 17:56:44 r1 bgpd[26295]: [GJPH1-W8PZV] Resetting peer (null)(Unknown) due to change in addpath config

Is now:

> Oct 02 14:00:59 r1 bgpd[12795]: [MNE5N-K0G4Z] Resetting peer 2.2.2.2 due to change in addpath config

Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
louis-6wind committed Oct 2, 2024
1 parent cbd4c87 commit b56cfc6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8901,6 +8901,12 @@ static ssize_t printfrr_bp(struct fbuf *buf, struct printfrr_eargs *ea,
if (!peer)
return bputs(buf, "(null)");

if (!peer->host) {
if (peer->conf_if)
return bprintfrr(buf, "%s", peer->conf_if);
return bprintfrr(buf, "%pSU", &peer->connection->su);
}

return bprintfrr(buf, "%s(%s)", peer->host,
peer->hostname ? peer->hostname : "Unknown");
}
Expand Down

0 comments on commit b56cfc6

Please sign in to comment.