diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2021-10-07 21:06:01 -0300 | 
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2021-10-08 10:03:01 -0300 | 
| commit | 3e63092b83c6710dd978b705537a2bb8c586ea8b (patch) | |
| tree | 17304c3f72ab98edab9b843f52b36246ecf613b0 /ospfd/ospf_ext.c | |
| parent | a792fa7b150831c1d2f70ddae580e6fc38a51ab0 (diff) | |
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_ext.c')
| -rw-r--r-- | ospfd/ospf_ext.c | 18 | 
1 files changed, 14 insertions, 4 deletions
diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c index 2d08eeece2..ea1506ea27 100644 --- a/ospfd/ospf_ext.c +++ b/ospfd/ospf_ext.c @@ -80,7 +80,8 @@ static struct ospf_ext_lp OspfEXT;   */  /* Extended Prefix Opaque LSA related callback functions */ -static void ospf_ext_pref_show_info(struct vty *vty, struct ospf_lsa *lsa); +static void ospf_ext_pref_show_info(struct vty *vty, struct json_object *json, +				    struct ospf_lsa *lsa);  static int ospf_ext_pref_lsa_originate(void *arg);  static struct ospf_lsa *ospf_ext_pref_lsa_refresh(struct ospf_lsa *lsa);  static void ospf_ext_pref_lsa_schedule(struct ext_itf *exti, @@ -90,7 +91,8 @@ static int ospf_ext_link_new_if(struct interface *ifp);  static int ospf_ext_link_del_if(struct interface *ifp);  static void ospf_ext_ism_change(struct ospf_interface *oi, int old_status);  static void ospf_ext_link_nsm_change(struct ospf_neighbor *nbr, int old_status); -static void ospf_ext_link_show_info(struct vty *vty, struct ospf_lsa *lsa); +static void ospf_ext_link_show_info(struct vty *vty, struct json_object *json, +				    struct ospf_lsa *lsa);  static int ospf_ext_link_lsa_originate(void *arg);  static struct ospf_lsa *ospf_ext_link_lsa_refresh(struct ospf_lsa *lsa);  static void ospf_ext_link_lsa_schedule(struct ext_itf *exti, @@ -1846,12 +1848,16 @@ static uint16_t show_vty_link_info(struct vty *vty, struct tlv_header *ext,  }  /* Extended Link TLVs */ -static void ospf_ext_link_show_info(struct vty *vty, struct ospf_lsa *lsa) +static void ospf_ext_link_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; @@ -1932,12 +1938,16 @@ static uint16_t show_vty_pref_info(struct vty *vty, struct tlv_header *ext,  }  /* Extended Prefix TLVs */ -static void ospf_ext_pref_show_info(struct vty *vty, struct ospf_lsa *lsa) +static void ospf_ext_pref_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;  | 
