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: docker/9.1.3~33^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=ba77ea13b86b5613ef897ed4bb29c6c8c0606769;p=matthieu%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 (cherry picked from commit b56cfc6c808d330a85a06421c7fc5f5f9066938f) --- diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 492092bac4..b8389457f8 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -8610,6 +8610,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"); }