diff options
author | Russ White <russ@riw.us> | 2022-12-13 14:54:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-13 14:54:13 +0100 |
commit | daa256700250ec0b4693f8820c7188123c2e0752 (patch) | |
tree | a01b7d2b24de32b77686d62fccfc51b8ee226141 /bgpd | |
parent | Merge pull request #12499 from opensourcerouting/ospf-vertex-leak (diff) | |
parent | bgpd: Adding BGP neighbor JSON output for neighbors never established a BGP a... (diff) | |
download | frr-daa256700250ec0b4693f8820c7188123c2e0752.tar.xz frr-daa256700250ec0b4693f8820c7188123c2e0752.zip |
Merge pull request #12447 from karlquan/master
BGP neighbor JSON output always displays hostname, nexthop and related keys
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_vty.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 7b9400118..e51977f0f 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -13003,9 +13003,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, if (p->hostname) { if (use_json) { - if (p->hostname) - json_object_string_add(json_neigh, "hostname", - p->hostname); + json_object_string_add(json_neigh, "hostname", + p->hostname); if (p->domainname) json_object_string_add(json_neigh, "domainname", @@ -13017,6 +13016,10 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, else vty_out(vty, "Hostname: %s\n", p->hostname); } + } else { + if (use_json) + json_object_string_add(json_neigh, "hostname", + "Unknown"); } /* Peer-group */ @@ -14578,6 +14581,17 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, p->shared_network ? "shared network" : "non shared network"); } + } else { + if (use_json) { + json_object_string_add(json_neigh, "nexthop", + "Unknown"); + json_object_string_add(json_neigh, "nexthopGlobal", + "Unknown"); + json_object_string_add(json_neigh, "nexthopLocal", + "Unknown"); + json_object_string_add(json_neigh, "bgpConnection", + "Unknown"); + } } /* Timer information. */ |