summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2023-07-11 10:20:04 -0400
committerGitHub <noreply@github.com>2023-07-11 10:20:04 -0400
commit91336417f52280e9605aaeec73f9ff13e10df650 (patch)
treee5dd00bf7af05f0f20817f54b5e19fcceb211190
parent220d7b1a899b74eee18c9f8d4ff9a4f38ec2c0fc (diff)
parentc10d1c8acacfc9406031cab2e69acd4fe33b76e9 (diff)
Merge pull request #13947 from opensourcerouting/feature/bgpd_show_version_if_description_is_not_defined
bgpd: Show neighbors software version if description is not set
-rw-r--r--bgpd/bgp_vty.c13
-rw-r--r--lib/asn.h8
2 files changed, 15 insertions, 6 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 762b4ae44a..7942797528 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -11854,7 +11854,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
&peer->ibuf->count,
memory_order_relaxed);
- vty_out(vty, "4 ");
+ vty_out(vty, "4");
vty_out(vty, ASN_FORMAT_SPACE(bgp->asnotation),
&peer->as);
if (show_wide)
@@ -11930,14 +11930,23 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
}
/* Make sure `Desc` column is the lastest in
* the output.
+ * If the description is not set, try
+ * to print the software version if the
+ * capability is enabled and received.
*/
if (peer->desc)
vty_out(vty, " %s",
bgp_peer_description_stripped(
peer->desc,
show_wide ? 64 : 20));
- else
+ else if (peer->soft_version) {
+ vty_out(vty, " %s",
+ bgp_peer_description_stripped(
+ peer->soft_version,
+ show_wide ? 64 : 20));
+ } else {
vty_out(vty, " N/A");
+ }
vty_out(vty, "\n");
}
diff --git a/lib/asn.h b/lib/asn.h
index 81a42c658d..a7394fa52b 100644
--- a/lib/asn.h
+++ b/lib/asn.h
@@ -66,10 +66,10 @@ extern char *asn_asn2string(const as_t *as, char *buf, size_t len,
((mode == ASNOTATION_DOT) ? "%pASD" : \
((mode == ASNOTATION_DOTPLUS) ? "%pASE" : \
"%pASP"))
-#define ASN_FORMAT_SPACE(mode) \
- ((mode == ASNOTATION_DOT) ? "%10pASD" : \
- ((mode == ASNOTATION_DOTPLUS) ? "%10pASE" : \
- "%10pASP"))
+#define ASN_FORMAT_SPACE(mode) \
+ ((mode == ASNOTATION_DOT) \
+ ? "%11pASD" \
+ : ((mode == ASNOTATION_DOTPLUS) ? "%11pASE" : "%11pASP"))
/* for test */
extern void asn_relax_as_zero(bool relax);