diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index af25d930d1a3..d159d96eda82 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -3411,13 +3411,15 @@ static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, bool uj) time_t now; json_object *json = NULL; json_object *json_iface = NULL; - json_object *json_row = NULL; + json_object *json_group = NULL; + json_object *json_groups = NULL; now = pim_time_monotonic_sec(); - if (uj) + if (uj) { json = json_object_new_object(); - else + json_groups = json_object_new_array(); + } else vty_out(vty, "Interface Address Group Mode Timer Srcs V Uptime \n"); @@ -3468,35 +3470,34 @@ static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, bool uj) json_iface); } - json_row = json_object_new_object(); - json_object_string_add( - json_row, "source", ifaddr_str); + json_group = json_object_new_object(); + json_object_string_add(json_group, + "source", + ifaddr_str); json_object_string_add( - json_row, "group", group_str); + json_group, "group", group_str); if (grp->igmp_version == 3) json_object_string_add( - json_row, "mode", + json_group, "mode", grp->group_filtermode_isexcl ? "EXCLUDE" : "INCLUDE"); - json_object_string_add(json_row, + json_object_string_add(json_group, "timer", hhmmss); json_object_int_add( - json_row, "sourcesCount", - grp->group_source_list - ? listcount( - grp->group_source_list) - : 0); - json_object_int_add(json_row, "version", + json_group, "sourcesCount", + grp->group_source_list ? listcount( + grp->group_source_list) + : 0); + json_object_int_add(json_group, + "version", grp->igmp_version); json_object_string_add( - json_row, "uptime", uptime); - json_object_object_add(json_iface, - group_str, - json_row); - + json_group, "uptime", uptime); + json_object_array_add(json_groups, + json_group); } else { vty_out(vty, "%-16s %-15s %-15s %4s %8s %4d %d %8s\n", @@ -3519,6 +3520,8 @@ static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, bool uj) } /* scan interfaces */ if (uj) { + if (json_iface) + json_object_object_add(json_iface, "groups", json_groups); 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_rp.c b/pimd/pim_rp.c index 355aa0704816..c16e99d66482 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -1289,6 +1289,10 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj) json_rp_rows = json_object_new_array(); json_row = json_object_new_object(); + json_object_string_add( + json_row, "rp_address", + inet_ntoa(rp_info->rp.rpf_addr.u + .prefix4)); if (rp_info->rp.source_nexthop.interface) json_object_string_add( json_row, "outboundInterface",