summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-06-20 11:39:07 -0400
committerGitHub <noreply@github.com>2018-06-20 11:39:07 -0400
commit76cd18c9ddfbdb8f36b60fac61ebb4d64d12d079 (patch)
tree77bf5d72e5322ecbfdd4eb97bcdcb3b9014dc06a
parent418a4330c6ee7e53901eb96ec93023905220be9b (diff)
parent06e896446473041c003e97acc79231dc166ccf13 (diff)
Merge pull request #2498 from pacovn/Coverity_1470098_Logically_dead_code
bgpd: json output fix (Coverity 1470098)
-rw-r--r--bgpd/bgp_vpn.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/bgpd/bgp_vpn.c b/bgpd/bgp_vpn.c
index 351f91dd1a..cc05194703 100644
--- a/bgpd/bgp_vpn.c
+++ b/bgpd/bgp_vpn.c
@@ -223,21 +223,27 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer,
}
rd_header = 0;
}
- route_vty_out_tmp(vty, &rm->p, attr,
- SAFI_MPLS_VPN,
- use_json, json_array);
+ if (use_json) {
+ char buf_a[BUFSIZ];
+ char buf_b[BUFSIZ];
+
+ sprintf(buf_a, "%s/%d",
+ inet_ntop(rm->p.family,
+ rm->p.u.val,
+ buf_b,
+ BUFSIZ),
+ rm->p.prefixlen);
+ json_object_object_add(
+ json_routes, buf_a,
+ json_array);
+ } else {
+ route_vty_out_tmp(
+ vty, &rm->p, attr,
+ SAFI_MPLS_VPN, use_json,
+ json_array);
+ }
}
}
- if (use_json && rm) {
- char buf_a[BUFSIZ];
- char buf_b[BUFSIZ];
- sprintf(buf_a, "%s/%d",
- inet_ntop(rm->p.family, rm->p.u.val,
- buf_b, BUFSIZ),
- rm->p.prefixlen);
- json_object_object_add(json_routes, buf_a,
- json_array);
- }
}
}
if (use_json) {