summaryrefslogtreecommitdiffstats
path: root/bgpd/bgpd.c
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2024-10-02 14:38:15 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2024-10-02 14:50:28 +0200
commitb56cfc6c808d330a85a06421c7fc5f5f9066938f (patch)
tree8b3e2fbad2d05850ed4a591a0ad48e09d77e168b /bgpd/bgpd.c
parentMerge pull request #16968 from opensourcerouting/bfd-no-commands (diff)
downloadfrr-b56cfc6c808d330a85a06421c7fc5f5f9066938f.tar.xz
frr-b56cfc6c808d330a85a06421c7fc5f5f9066938f.zip
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 <louis.scalbert@6wind.com>
Diffstat (limited to '')
-rw-r--r--bgpd/bgpd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index a3caa5a80..80b1ae39d 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");
}