Quagga: Fixup cli and json keyword

The json keyword was being read incorrectly.
Basically some commands read a variable # of arguments
and in ospf the command values were being placed into
argc and argv.  With a variable # of arguments their
existed a possibility that less arguments would be read
from the cli than were being tested for in the command function
handler.  This caused core dumps in some situations.

All code to read to decide to use the json keyword has
been centralized through a function and all code
converted to use it, irrelevant if it exhibited the bug

Ticket: CM-8278
Reviewed by: CCR-3830
Testing: OSPF no longer crashes and all other test suites still run

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2015-11-18 15:36:04 -08:00
parent eb2674af89
commit db7c85284f
6 changed files with 303 additions and 491 deletions

View File

@ -760,12 +760,12 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
union sockunion su;
struct peer *peer;
int ret;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
ret = str2sockunion (argv[0], &su);
if (ret < 0)
{
if (use_json)
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
@ -781,7 +781,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
if (use_json)
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
@ -794,7 +794,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_neighbor, &su, 0, use_json);
return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_neighbor, &su, 0, uj);
}
DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
@ -815,12 +815,12 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
union sockunion su;
struct peer *peer;
struct prefix_rd prd;
u_char use_json = (argv[2] != NULL);
u_char uj = use_json(argc, argv);
ret = str2prefix_rd (argv[0], &prd);
if (! ret)
{
if (use_json)
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
@ -836,7 +836,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
ret = str2sockunion (argv[1], &su);
if (ret < 0)
{
if (use_json)
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
@ -852,7 +852,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
if (use_json)
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
@ -865,7 +865,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_neighbor, &su, 0, use_json);
return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_neighbor, &su, 0, uj);
}
DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
@ -884,12 +884,12 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
int ret;
struct peer *peer;
union sockunion su;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
ret = str2sockunion (argv[0], &su);
if (ret < 0)
{
if (use_json)
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
@ -904,7 +904,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
if (use_json)
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
@ -917,7 +917,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
return CMD_WARNING;
}
return show_adj_route_vpn (vty, peer, NULL, use_json);
return show_adj_route_vpn (vty, peer, NULL, uj);
}
DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
@ -938,12 +938,12 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
struct peer *peer;
struct prefix_rd prd;
union sockunion su;
u_char use_json = (argv[2] != NULL);
u_char uj = use_json(argc, argv);
ret = str2sockunion (argv[1], &su);
if (ret < 0)
{
if (use_json)
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
@ -958,7 +958,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
if (use_json)
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
@ -974,7 +974,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
ret = str2prefix_rd (argv[0], &prd);
if (! ret)
{
if (use_json)
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
@ -987,7 +987,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
return CMD_WARNING;
}
return show_adj_route_vpn (vty, peer, &prd, use_json);
return show_adj_route_vpn (vty, peer, &prd, uj);
}
void

File diff suppressed because it is too large Load Diff

View File

@ -8485,8 +8485,8 @@ DEFUN (show_ip_bgp_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[0] != NULL);
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, use_json);
u_char uj = use_json(argc, argv);
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj);
}
DEFUN (show_ip_bgp_instance_summary,
@ -8500,8 +8500,8 @@ DEFUN (show_ip_bgp_instance_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[1] != NULL);
return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, use_json);
u_char uj = use_json(argc, argv);
return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj);
}
DEFUN (show_ip_bgp_ipv4_summary,
@ -8516,11 +8516,11 @@ DEFUN (show_ip_bgp_ipv4_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
if (strncmp (argv[0], "m", 1) == 0)
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, use_json);
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj);
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, use_json);
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj);
}
ALIAS (show_ip_bgp_ipv4_summary,
@ -8547,11 +8547,11 @@ DEFUN (show_ip_bgp_instance_ipv4_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[2] != NULL);
u_char uj = use_json(argc, argv);
if (strncmp (argv[1], "m", 1) == 0)
return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, use_json);
return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj);
else
return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, use_json);
return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj);
}
ALIAS (show_ip_bgp_instance_ipv4_summary,
@ -8577,8 +8577,8 @@ DEFUN (show_ip_bgp_vpnv4_all_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[0] != NULL);
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json);
u_char uj = use_json(argc, argv);
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
}
DEFUN (show_ip_bgp_vpnv4_rd_summary,
@ -8595,7 +8595,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_summary,
{
int ret;
struct prefix_rd prd;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
ret = str2prefix_rd (argv[0], &prd);
if (! ret)
@ -8604,7 +8604,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_summary,
return CMD_WARNING;
}
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json);
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
}
#ifdef HAVE_IPV6
@ -8616,8 +8616,7 @@ DEFUN (show_bgp_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[0] != NULL);
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json);
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
}
DEFUN (show_bgp_instance_summary,
@ -8630,8 +8629,7 @@ DEFUN (show_bgp_instance_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[1] != NULL);
return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json);
return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
}
ALIAS (show_bgp_summary,
@ -8663,11 +8661,11 @@ DEFUN (show_bgp_ipv6_safi_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
if (strncmp (argv[0], "m", 1) == 0)
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, use_json);
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj);
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json);
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj);
}
DEFUN (show_bgp_instance_ipv6_safi_summary,
@ -8683,11 +8681,11 @@ DEFUN (show_bgp_instance_ipv6_safi_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[2] != NULL);
u_char uj = use_json(argc, argv);
if (strncmp (argv[1], "m", 1) == 0)
return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, use_json);
return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, uj);
return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json);
return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, uj);
}
/* old command */
@ -8700,8 +8698,8 @@ DEFUN (show_ipv6_bgp_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[0] != NULL);
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json);
u_char uj = use_json(argc, argv);
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj);
}
/* old command */
@ -8714,8 +8712,8 @@ DEFUN (show_ipv6_mbgp_summary,
"Summary of BGP neighbor status\n"
"JavaScript Object Notation\n")
{
u_char use_json = (argv[0] != NULL);
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, use_json);
u_char uj = use_json(argc, argv);
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj);
}
#endif /* HAVE_IPV6 */
@ -10468,14 +10466,9 @@ DEFUN (show_ip_bgp_neighbors,
"Detailed information on TCP and BGP neighbor connections\n"
"JavaScript Object Notation\n")
{
u_char use_json;
u_char uj = use_json(argc, argv);
if (argv[argc - 1] && strcmp(argv[argc - 1], "json") == 0)
use_json = 1;
else
use_json = 0;
return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, use_json);
return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj);
}
ALIAS (show_ip_bgp_neighbors,
@ -10542,14 +10535,9 @@ DEFUN (show_ip_bgp_neighbors_peer,
"Neighbor on bgp configured interface\n"
"JavaScript Object Notation\n")
{
u_char use_json;
u_char uj = use_json(argc, argv);
if (argv[argc - 1] && strcmp(argv[argc - 1], "json") == 0)
use_json = 1;
else
use_json = 0;
return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], use_json);
return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj);
}
ALIAS (show_ip_bgp_neighbors_peer,
@ -10625,14 +10613,9 @@ DEFUN (show_ip_bgp_instance_neighbors,
"Detailed information on TCP and BGP neighbor connections\n"
"JavaScript Object Notation\n")
{
u_char use_json;
u_char uj = use_json(argc, argv);
if (argv[1] && strcmp(argv[1], "json") == 0)
use_json = 1;
else
use_json = 0;
return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL, use_json);
return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL, uj);
}
ALIAS (show_ip_bgp_instance_neighbors,
@ -10670,14 +10653,9 @@ DEFUN (show_ip_bgp_instance_neighbors_peer,
"Neighbor on bgp configured interface\n"
"JavaScript Object Notation\n")
{
u_char use_json;
u_char uj = use_json(argc, argv);
if (argv[2] && strcmp(argv[2], "json") == 0)
use_json = 1;
else
use_json = 0;
return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1], use_json);
return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1], uj);
}
ALIAS (show_ip_bgp_instance_neighbors_peer,

View File

@ -19,8 +19,26 @@
* 02111-1307, USA.
*/
#include <string.h>
#include "lib/json.h"
/*
* This function assumes that the json keyword
* is the *last* keyword on the line no matter
* what.
*/
int
use_json (const int argc, const char *argv[])
{
if (argc == 0)
return 0;
if (argv[argc-1] && strcmp(argv[argc-1], "json") == 0)
return 1;
return 0;
}
void
json_object_string_add(struct json_object* obj, const char *key,
const char *s)

View File

@ -24,6 +24,7 @@
#include <json/json.h>
extern int use_json(const int argc, const char *argv[]);
extern void json_object_string_add(struct json_object* obj, const char *key,
const char *s);
extern void json_object_int_add(struct json_object* obj, const char *key,

View File

@ -63,7 +63,6 @@ static const char *ospf_network_type_str[] =
"LOOPBACK"
};
/* Utility functions. */
static int
ospf_str2area_id (const char *str, struct in_addr *area_id, int *format)
@ -3517,12 +3516,12 @@ DEFUN (show_ip_ospf,
"JavaScript Object Notation\n")
{
struct ospf *ospf;
u_char use_json = (argv[0] != NULL);
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return (show_ip_ospf_common(vty, ospf, use_json));
return (show_ip_ospf_common(vty, ospf, uj));
}
DEFUN (show_ip_ospf_instance,
@ -3536,13 +3535,13 @@ DEFUN (show_ip_ospf_instance,
{
struct ospf *ospf;
u_short instance = 0;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
VTY_GET_INTEGER ("Instance", instance, argv[0]);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return (show_ip_ospf_common(vty, ospf, use_json));
return (show_ip_ospf_common(vty, ospf, uj));
}
static void
@ -3912,18 +3911,12 @@ DEFUN (show_ip_ospf_interface,
"JavaScript Object Notation\n")
{
struct ospf *ospf;
u_char use_json;
if ((argv[0] && strcmp(argv[0], "json") == 0) ||
(argv[1] && strcmp(argv[1], "json") == 0))
use_json = 1;
else
use_json = 0;
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_interface_common(vty, ospf, argc, argv, 0, use_json);
return show_ip_ospf_interface_common(vty, ospf, argc, argv, 0, uj);
}
DEFUN (show_ip_ospf_instance_interface,
@ -3939,19 +3932,13 @@ DEFUN (show_ip_ospf_instance_interface,
{
struct ospf *ospf;
u_short instance = 0;
u_char use_json;
if ((argv[1] && strcmp(argv[1], "json") == 0) ||
(argv[2] && strcmp(argv[2], "json") == 0))
use_json = 1;
else
use_json = 0;
u_char uj = use_json(argc, argv);
VTY_GET_INTEGER ("Instance", instance, argv[0]);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_interface_common(vty, ospf, argc, argv, 1, use_json);
return show_ip_ospf_interface_common(vty, ospf, argc, argv, 1, uj);
}
static void
@ -4080,12 +4067,12 @@ DEFUN (show_ip_ospf_neighbor,
"JavaScript Object Notation\n")
{
struct ospf *ospf;
u_char use_json = (argv[0] != NULL);
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_common(vty, ospf, use_json);
return show_ip_ospf_neighbor_common(vty, ospf, uj);
}
@ -4101,13 +4088,13 @@ DEFUN (show_ip_ospf_instance_neighbor,
{
struct ospf *ospf;
u_short instance = 0;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
VTY_GET_INTEGER ("Instance", instance, argv[0]);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_common(vty, ospf, use_json);
return show_ip_ospf_neighbor_common(vty, ospf, uj);
}
static int
@ -4192,12 +4179,12 @@ DEFUN (show_ip_ospf_neighbor_all,
"JavaScript Object Notation\n")
{
struct ospf *ospf;
u_char use_json = (argv[0] != NULL);
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_all_common(vty, ospf, use_json);
return show_ip_ospf_neighbor_all_common(vty, ospf, uj);
}
DEFUN (show_ip_ospf_instance_neighbor_all,
@ -4213,13 +4200,13 @@ DEFUN (show_ip_ospf_instance_neighbor_all,
{
struct ospf *ospf;
u_short instance = 0;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
VTY_GET_INTEGER ("Instance", instance, argv[0]);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_all_common(vty, ospf, use_json);
return show_ip_ospf_neighbor_all_common(vty, ospf, uj);
}
static int
@ -4286,12 +4273,12 @@ DEFUN (show_ip_ospf_neighbor_int,
"JavaScript Object Notation\n")
{
struct ospf *ospf;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_int_common(vty, ospf, 0, argv, use_json);
return show_ip_ospf_neighbor_int_common(vty, ospf, 0, argv, uj);
}
DEFUN (show_ip_ospf_instance_neighbor_int,
@ -4307,13 +4294,13 @@ DEFUN (show_ip_ospf_instance_neighbor_int,
{
struct ospf *ospf;
u_short instance = 0;
u_char use_json = (argv[2] != NULL);
u_char uj = use_json(argc, argv);
VTY_GET_INTEGER ("Instance", instance, argv[0]);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_int_common(vty, ospf, 1, argv, use_json);
return show_ip_ospf_neighbor_int_common(vty, ospf, 1, argv, uj);
}
static void
@ -4652,12 +4639,12 @@ DEFUN (show_ip_ospf_neighbor_id,
"JavaScript Object Notation\n")
{
struct ospf *ospf;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_id_common(vty, ospf, 0, argv, use_json);
return show_ip_ospf_neighbor_id_common(vty, ospf, 0, argv, uj);
}
DEFUN (show_ip_ospf_instance_neighbor_id,
@ -4673,13 +4660,13 @@ DEFUN (show_ip_ospf_instance_neighbor_id,
{
struct ospf *ospf;
u_short instance = 0;
u_char use_json = (argv[2] != NULL);
u_char uj = use_json(argc, argv);
VTY_GET_INTEGER ("Instance", instance, argv[0]);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_id_common(vty, ospf, 1, argv, use_json);
return show_ip_ospf_neighbor_id_common(vty, ospf, 1, argv, uj);
}
static int
@ -4743,12 +4730,12 @@ DEFUN (show_ip_ospf_neighbor_detail,
"JavaScript Object Notation\n")
{
struct ospf *ospf;
u_char use_json = (argv[0] != NULL);
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_detail_common(vty, ospf, use_json);
return show_ip_ospf_neighbor_detail_common(vty, ospf, uj);
}
DEFUN (show_ip_ospf_instance_neighbor_detail,
@ -4764,13 +4751,13 @@ DEFUN (show_ip_ospf_instance_neighbor_detail,
{
struct ospf *ospf;
u_short instance = 0;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
VTY_GET_INTEGER ("Instance", instance, argv[0]);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_detail_common(vty, ospf, use_json);
return show_ip_ospf_neighbor_detail_common(vty, ospf, uj);
}
static int
@ -4841,12 +4828,12 @@ DEFUN (show_ip_ospf_neighbor_detail_all,
"JavaScript Object Notation\n")
{
struct ospf *ospf;
u_char use_json = (argv[0] != NULL);;
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_detail_all_common(vty, ospf, use_json);
return show_ip_ospf_neighbor_detail_all_common(vty, ospf, uj);
}
DEFUN (show_ip_ospf_instance_neighbor_detail_all,
@ -4863,13 +4850,13 @@ DEFUN (show_ip_ospf_instance_neighbor_detail_all,
{
struct ospf *ospf;
u_short instance = 0;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
VTY_GET_INTEGER ("Instance", instance, argv[0]);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_detail_all_common(vty, ospf, use_json);
return show_ip_ospf_neighbor_detail_all_common(vty, ospf, uj);
}
static int
@ -4943,12 +4930,12 @@ DEFUN (show_ip_ospf_neighbor_int_detail,
"JavaScript Object Notation\n")
{
struct ospf *ospf;
u_char use_json = (argv[1] != NULL);
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_int_detail_common(vty, ospf, 0, argv, use_json);
return show_ip_ospf_neighbor_int_detail_common(vty, ospf, 0, argv, uj);
}
DEFUN (show_ip_ospf_instance_neighbor_int_detail,
@ -4965,13 +4952,13 @@ DEFUN (show_ip_ospf_instance_neighbor_int_detail,
{
struct ospf *ospf;
u_short instance = 0;
u_char use_json = (argv[2] != NULL);
u_char uj = use_json(argc, argv);
VTY_GET_INTEGER ("Instance", instance, argv[0]);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return show_ip_ospf_neighbor_int_detail_common(vty, ospf, 1, argv, use_json);
return show_ip_ospf_neighbor_int_detail_common(vty, ospf, 1, argv, uj);
}
/* Show functions */