From: Louis Scalbert Date: Wed, 2 Oct 2024 12:38:15 +0000 (+0200) Subject: bgpd: fix printfrr_bp for non initialized peers X-Git-Tag: base_10.2~20^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b56cfc6c808d330a85a06421c7fc5f5f9066938f;p=mirror%2Ffrr.git bgpd: fix printfrr_bp for non initialized peers 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 --- diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index a3caa5a806..80b1ae39d4 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -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"); }