summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_open.c
diff options
context:
space:
mode:
authorDinesh G Dutt <5016467+ddutt@users.noreply.github.com>2019-08-27 03:48:53 +0200
committerDinesh G Dutt <5016467+ddutt@users.noreply.github.com>2019-08-27 16:05:39 +0200
commit5cb5f4d04de6cfd844999179687670ac20fee690 (patch)
treea52c36142e6f8252fc50f2d413a5c8e8c9661555 /bgpd/bgp_open.c
parentMerge pull request #4880 from ddutt/master (diff)
downloadfrr-5cb5f4d04de6cfd844999179687670ac20fee690.tar.xz
frr-5cb5f4d04de6cfd844999179687670ac20fee690.zip
bgpd: Eliminate all incorrect formulations of afi/safi in JSON
In a number of places, the JSON output had invalid key names for AFI/SAFI. For example, the key name in JSON was "IPv4 Unicast" which is invalid as a JSON Key name. Many JSON tools such as those used in Ansible, jq etc. all fail to parse the output in these scenarios. The valid name is ipv4Unicast. There's already a routine afi_safi_json() defined to handle this change, but it was not consistently called. The non-JSON version was called afi_safi_print() and it merely returned the CLI version of the string, didn't print anything. This patch deals with this issue by: - Renaming afi_safi_print to get_afi_safi_str() - get_afi_safi_str takes an additional param, for_json which if true will return the JSON-valid string - Renaming afi_safi_json to get_afi_safi_json_str() - Creating a new routine get_afi_safi_vty_str() for printing to vty - Consistently using get_afi_safi_str() with the appropriate for_json value Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
Diffstat (limited to 'bgpd/bgp_open.c')
-rw-r--r--bgpd/bgp_open.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 64529f6ef..7e5e07099 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -503,7 +503,7 @@ static int bgp_capability_restart(struct peer *peer,
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%s Address family %s is%spreserved",
- peer->host, afi_safi_print(afi, safi),
+ peer->host, get_afi_safi_str(afi, safi, false),
CHECK_FLAG(
peer->af_cap[afi][safi],
PEER_CAP_RESTART_AF_PRESERVE_RCV)