summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_ri.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2021-10-08 02:06:01 +0200
committerRenato Westphal <renato@opensourcerouting.org>2021-10-08 15:03:01 +0200
commit3e63092b83c6710dd978b705537a2bb8c586ea8b (patch)
tree17304c3f72ab98edab9b843f52b36246ecf613b0 /ospfd/ospf_ri.c
parentospfd: display detailed information about opaque LSAs in JSON format (diff)
downloadfrr-3e63092b83c6710dd978b705537a2bb8c586ea8b.tar.xz
frr-3e63092b83c6710dd978b705537a2bb8c586ea8b.zip
ospfd: fix display of plain-text data on "show ... json" commands
Add a 'json' parameter to the 'show_opaque_info' callback definition, and update all instances of that callback to not display plain-text data when the user requested JSON data. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospf_ri.c')
-rw-r--r--ospfd/ospf_ri.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c
index 602f98d14..0efa6ca4d 100644
--- a/ospfd/ospf_ri.c
+++ b/ospfd/ospf_ri.c
@@ -73,7 +73,9 @@ static struct ospf_router_info OspfRI;
static void ospf_router_info_ism_change(struct ospf_interface *oi,
int old_status);
static void ospf_router_info_config_write_router(struct vty *vty);
-static void ospf_router_info_show_info(struct vty *vty, struct ospf_lsa *lsa);
+static void ospf_router_info_show_info(struct vty *vty,
+ struct json_object *json,
+ struct ospf_lsa *lsa);
static int ospf_router_info_lsa_originate(void *arg);
static struct ospf_lsa *ospf_router_info_lsa_refresh(struct ospf_lsa *lsa);
static void ospf_router_info_lsa_schedule(struct ospf_ri_area_info *ai,
@@ -1552,12 +1554,17 @@ static uint16_t show_vty_sr_msd(struct vty *vty, struct tlv_header *tlvh)
return TLV_SIZE(tlvh);
}
-static void ospf_router_info_show_info(struct vty *vty, struct ospf_lsa *lsa)
+static void ospf_router_info_show_info(struct vty *vty,
+ struct json_object *json,
+ struct ospf_lsa *lsa)
{
struct lsa_header *lsah = lsa->data;
struct tlv_header *tlvh;
uint16_t length = 0, sum = 0;
+ if (json)
+ return;
+
/* Initialize TLV browsing */
length = lsa->size - OSPF_LSA_HEADER_SIZE;