summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_route.c19
-rw-r--r--pimd/pim_cmd.c13
-rw-r--r--pimd/pim_zebra.c7
3 files changed, 25 insertions, 14 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index af71088b7d..6230560997 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -8158,8 +8158,8 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
if (use_json && header) {
vty_out(vty,
- "{ \"vrfId\": %d, \"vrfName\": \"%s\", \"tableVersion\": %" PRId64
- ", \"routerId\": \"%s\", \"routes\": { ",
+ "{\n \"vrfId\": %d,\n \"vrfName\": \"%s\",\n \"tableVersion\": %" PRId64
+ ",\n \"routerId\": \"%s\",\n \"routes\": { ",
bgp->vrf_id == VRF_UNKNOWN ? -1 : bgp->vrf_id,
bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT ? "Default"
: bgp->name,
@@ -8378,7 +8378,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
p->prefixlen);
vty_out(vty, "\"%s\": ", buf2);
vty_out(vty, "%s",
- json_object_to_json_string(json_paths));
+ json_object_to_json_string_ext(json_paths, JSON_C_TO_STRING_PRETTY));
json_object_free(json_paths);
first = 0;
}
@@ -9434,8 +9434,8 @@ static struct peer *peer_lookup_in_view(struct vty *vty, struct bgp *bgp,
"malformedAddressOrName",
ip_str);
vty_out(vty, "%s\n",
- json_object_to_json_string(
- json_no));
+ json_object_to_json_string_ext(
+ json_no, JSON_C_TO_STRING_PRETTY));
json_object_free(json_no);
} else
vty_out(vty,
@@ -9456,7 +9456,8 @@ static struct peer *peer_lookup_in_view(struct vty *vty, struct bgp *bgp,
json_object_string_add(json_no, "warning",
"No such neighbor");
vty_out(vty, "%s\n",
- json_object_to_json_string(json_no));
+ json_object_to_json_string_ext(json_no,
+ JSON_C_TO_STRING_PRETTY));
json_object_free(json_no);
} else
vty_out(vty, "No such neighbor\n");
@@ -9865,7 +9866,8 @@ static int bgp_peer_counts(struct vty *vty, struct peer *peer, afi_t afi,
json, "recommended",
"Please report this bug, with the above command output");
}
- vty_out(vty, "%s\n", json_object_to_json_string(json));
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(json,
+ JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
@@ -10243,7 +10245,8 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
output_count);
}
if (use_json) {
- vty_out(vty, "%s\n", json_object_to_json_string(json));
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(json,
+ JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index a9239c2835..10b68ab735 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -4252,11 +4252,16 @@ DEFUN (show_ip_pim_nexthop_lookup,
memset(&nexthop, 0, sizeof(nexthop));
if (pim_find_or_track_nexthop(vrf->info, &nht_p, NULL, NULL, &pnc))
- pim_ecmp_nexthop_search(vrf->info, &pnc, &nexthop, &nht_p, &grp,
- 0);
+ result = pim_ecmp_nexthop_search(vrf->info, &pnc, &nexthop,
+ &nht_p, &grp, 0);
else
- pim_ecmp_nexthop_lookup(vrf->info, &nexthop, vif_source, &nht_p,
- &grp, 0);
+ result = pim_ecmp_nexthop_lookup(vrf->info, &nexthop, vif_source,
+ &nht_p, &grp, 0);
+
+ if (!result) {
+ vty_out(vty, "Nexthop Lookup failed, no usable routes returned.\n");
+ return CMD_SUCCESS;
+ }
pim_addr_dump("<grp?>", &grp, grp_str, sizeof(grp_str));
pim_addr_dump("<nexthop?>", &nexthop.mrib_nexthop_addr,
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index bee6521b6c..04466258bb 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -599,7 +599,9 @@ void pim_scan_individual_oil(struct channel_oil *c_oil, int in_vif_index)
zlog_debug(
"%s %s: (S,G)=(%s,%s) input interface changed from %s vif_index=%d to %s vif_index=%d",
__FILE__, __PRETTY_FUNCTION__, source_str, group_str,
- old_iif->name, c_oil->oil.mfcc_parent, new_iif->name,
+ (old_iif) ? old_iif->name : "<old_iif?>",
+ c_oil->oil.mfcc_parent,
+ (new_iif) ? new_iif->name : "<new_iif?>",
input_iface_vif_index);
}
@@ -618,7 +620,8 @@ void pim_scan_individual_oil(struct channel_oil *c_oil, int in_vif_index)
zlog_debug(
"%s %s: (S,G)=(%s,%s) new iif loops to existing oif: %s vif_index=%d",
__FILE__, __PRETTY_FUNCTION__, source_str,
- group_str, new_iif->name,
+ group_str,
+ (new_iif) ? new_iif->name : "<new_iif?>",
input_iface_vif_index);
}
}