From 94d4c685c5967087cea5959dd7c238bc7b9134fa Mon Sep 17 00:00:00 2001 From: Don Slice Date: Thu, 30 Aug 2018 15:54:46 +0000 Subject: [PATCH] bgpd/ospfd: resolve warnings for bgp/ospf json commit Signed-off-by: Don Slice --- bgpd/bgp_damp.h | 6 ++++-- bgpd/bgp_open.h | 4 ++-- bgpd/bgp_route.h | 5 +++-- bgpd/bgp_vty.c | 13 ++++++------- bgpd/bgpd.h | 3 ++- lib/plist.h | 3 ++- ospfd/ospf_vty.c | 41 +++++++++++++++++++++++------------------ 7 files changed, 42 insertions(+), 33 deletions(-) diff --git a/bgpd/bgp_damp.h b/bgpd/bgp_damp.h index 77e4cd3e8..8326bae69 100644 --- a/bgpd/bgp_damp.h +++ b/bgpd/bgp_damp.h @@ -140,8 +140,10 @@ extern int bgp_damp_decay(time_t, int); extern void bgp_config_write_damp(struct vty *); extern void bgp_damp_info_vty(struct vty *, struct bgp_info *, json_object *json_path); -extern const char *bgp_damp_reuse_time_vty(struct vty *, struct bgp_info *, - char *, size_t, bool, json_object *); +extern const char *bgp_damp_reuse_time_vty(struct vty *vty, + struct bgp_info *binfo, + char *timebuf, size_t len, + bool use_json, json_object *json); extern int bgp_show_dampening_parameters(struct vty *vty, afi_t, safi_t); #endif /* _QUAGGA_BGP_DAMP_H */ diff --git a/bgpd/bgp_open.h b/bgpd/bgp_open.h index fd899bf4c..0fc321bdf 100644 --- a/bgpd/bgp_open.h +++ b/bgpd/bgp_open.h @@ -86,8 +86,8 @@ struct graceful_restart_af { extern int bgp_open_option_parse(struct peer *, uint8_t, int *); extern void bgp_open_capability(struct stream *, struct peer *); -extern void bgp_capability_vty_out(struct vty *, struct peer *, bool, - json_object *); +extern void bgp_capability_vty_out(struct vty *vty, struct peer *peer, + bool use_json, json_object *json_neigh); extern as_t peek_for_as4_capability(struct peer *, uint8_t); #endif /* _QUAGGA_BGP_OPEN_H */ diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index c4f3ad112..476bb3aa0 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -435,8 +435,9 @@ extern void route_vty_out(struct vty *, struct prefix *, struct bgp_info *, int, safi_t, json_object *); extern void route_vty_out_tag(struct vty *, struct prefix *, struct bgp_info *, int, safi_t, json_object *); -extern void route_vty_out_tmp(struct vty *, struct prefix *, struct attr *, - safi_t, bool, json_object *); +extern void route_vty_out_tmp(struct vty *vty, struct prefix *p, + struct attr *attr, safi_t safi, bool use_json, + json_object *json_ar); extern void route_vty_out_overlay(struct vty *vty, struct prefix *p, struct bgp_info *binfo, int display, json_object *json); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 381cd0e09..77c6167e2 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -10744,7 +10744,7 @@ static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp, } if (type != show_peer && !nbr_output && !use_json) - vty_out(vty, "%% No BGP neighbors found \n"); + vty_out(vty, "%% No BGP neighbors found\n"); if (use_json) { vty_out(vty, "%s\n", json_object_to_json_string_ext( @@ -11045,14 +11045,13 @@ static int bgp_show_route_leak_vty(struct vty *vty, const char *name, afi_t afi, json_object_free(json); return CMD_WARNING; - } else { - /* Provide context for the block */ - json_object_string_add(json, "vrf", - name ? name : "default"); - json_object_string_add(json, "afiSafi", - afi_safi_print(afi, safi)); } + /* Provide context for the block */ + json_object_string_add(json, "vrf", name ? name : "default"); + json_object_string_add(json, "afiSafi", + afi_safi_print(afi, safi)); + if (!CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_VRF_TO_VRF_IMPORT)) { json_object_string_add(json, "importFromVrfs", "none"); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 06a7968c5..8a9974139 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1513,7 +1513,8 @@ extern struct peer *peer_create(union sockunion *, const char *, struct bgp *, struct peer_group *); extern struct peer *peer_create_accept(struct bgp *); extern void peer_xfer_config(struct peer *dst, struct peer *src); -extern char *peer_uptime(time_t, char *, size_t, bool, json_object *); +extern char *peer_uptime(time_t uptime2, char *buf, size_t len, bool use_json, + json_object *json); extern int bgp_config_write(struct vty *); diff --git a/lib/plist.h b/lib/plist.h index 7933b8a92..8a4fa8d3c 100644 --- a/lib/plist.h +++ b/lib/plist.h @@ -72,6 +72,7 @@ extern struct stream *prefix_bgp_orf_entry(struct stream *, uint8_t, uint8_t); extern int prefix_bgp_orf_set(char *, afi_t, struct orf_prefix *, int, int); extern void prefix_bgp_orf_remove_all(afi_t, char *); -extern int prefix_bgp_show_prefix_list(struct vty *, afi_t, char *, bool); +extern int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name, + bool use_json); #endif /* _QUAGGA_PLIST_H */ diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 8785e6f4a..f596662aa 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -3263,6 +3263,7 @@ DEFUN (show_ip_ospf, if (vrf_name) { bool ospf_output = FALSE; use_vrf = 1; + if (all_vrf) { for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) @@ -3288,7 +3289,7 @@ DEFUN (show_ip_ospf, json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -3302,7 +3303,7 @@ DEFUN (show_ip_ospf, json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -3965,7 +3966,7 @@ DEFUN (show_ip_ospf_interface, json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else if (!ospf) - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return ret; } @@ -3977,7 +3978,7 @@ DEFUN (show_ip_ospf_interface, json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -3994,7 +3995,7 @@ DEFUN (show_ip_ospf_interface, json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -6339,6 +6340,7 @@ DEFUN (show_ip_ospf_database_max, if (vrf_name) { bool ospf_output = FALSE; use_vrf = 1; + if (all_vrf) { for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) @@ -6354,7 +6356,7 @@ DEFUN (show_ip_ospf_database_max, } else { ospf = ospf_lookup_by_inst_name(inst, vrf_name); if (ospf == NULL || !ospf->oi_running) { - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } ret = (show_ip_ospf_database_common( @@ -6365,7 +6367,7 @@ DEFUN (show_ip_ospf_database_max, /* Display default ospf (instance 0) info */ ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); if (ospf == NULL || !ospf->oi_running) { - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -6429,7 +6431,7 @@ DEFUN (show_ip_ospf_instance_database, } else { ospf = ospf_lookup_by_inst_name(inst, vrf_name); if ((ospf == NULL) || !ospf->oi_running) { - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -6440,7 +6442,7 @@ DEFUN (show_ip_ospf_instance_database, /* Display default ospf (instance 0) info */ ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); if (ospf == NULL || !ospf->oi_running) { - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -6473,7 +6475,7 @@ DEFUN (show_ip_ospf_instance_database_max, return CMD_NOT_MY_INSTANCE; if (!ospf->oi_running) { - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -6565,7 +6567,7 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, if (ospf == NULL) return CMD_NOT_MY_INSTANCE; if (!ospf->oi_running) { - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -6578,6 +6580,7 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, if (vrf_name) { bool ospf_output = FALSE; use_vrf = 1; + if (all_vrf) { for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) @@ -6592,7 +6595,7 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, } else { ospf = ospf_lookup_by_inst_name(inst, vrf_name); if ((ospf == NULL) || !ospf->oi_running) { - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -6603,7 +6606,7 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, /* Display default ospf (instance 0) info */ ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); if (ospf == NULL || !ospf->oi_running) { - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -9345,6 +9348,7 @@ DEFUN (show_ip_ospf_border_routers, if (vrf_name) { bool ospf_output = FALSE; use_vrf = 1; + if (all_vrf) { for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) @@ -9356,11 +9360,11 @@ DEFUN (show_ip_ospf_border_routers, } if (!ospf_output) - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); } else { ospf = ospf_lookup_by_inst_name(inst, vrf_name); if (ospf == NULL || !ospf->oi_running) { - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -9371,7 +9375,7 @@ DEFUN (show_ip_ospf_border_routers, /* Display default ospf (instance 0) info */ ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); if (ospf == NULL || !ospf->oi_running) { - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -9487,6 +9491,7 @@ DEFUN (show_ip_ospf_route, if (vrf_name) { bool ospf_output = FALSE; use_vrf = 1; + if (all_vrf) { for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { if (!ospf->oi_running) @@ -9514,7 +9519,7 @@ DEFUN (show_ip_ospf_route, json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } @@ -9528,7 +9533,7 @@ DEFUN (show_ip_ospf_route, json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else - vty_out(vty, "%% OSPF instance not found \n"); + vty_out(vty, "%% OSPF instance not found\n"); return CMD_SUCCESS; } -- 2.39.5