From c26c6bc2d78a2fe76f27dcc9fbb5afc95c3a7626 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Thu, 14 May 2020 03:48:17 +0200 Subject: Show info from multiple protocols when protocol is not specified Most commands like 'show ospf neighbors' fail when protocol is not specified and there are multiple instances of given protocol type. This is annoying in BIRD 2, as many protocols have IPv4 and IPv6 instances. The patch changes that by showing output from all protocol instances of appropriate type. Note that the patch also removes terminating cli_msg() call from these commands and moves it to the common iterating code. --- proto/ospf/config.Y | 6 +++--- proto/ospf/ospf.c | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'proto/ospf') diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y index ce9245a1..fd2cfe8a 100644 --- a/proto/ospf/config.Y +++ b/proto/ospf/config.Y @@ -513,13 +513,13 @@ dynamic_attr: OSPF_ROUTER_ID { $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUA CF_CLI_HELP(SHOW OSPF, ..., [[Show information about OSPF protocol]]); CF_CLI(SHOW OSPF, optproto, [], [[Show information about OSPF protocol]]) -{ ospf_sh(proto_get_named($3, &proto_ospf)); }; +{ PROTO_WALK_CMD($3, &proto_ospf, p) ospf_sh(p); }; CF_CLI(SHOW OSPF NEIGHBORS, optproto opttext, [] [\"\"], [[Show information about OSPF neighbors]]) -{ ospf_sh_neigh(proto_get_named($4, &proto_ospf), $5); }; +{ PROTO_WALK_CMD($4, &proto_ospf, p) ospf_sh_neigh(p, $5); }; CF_CLI(SHOW OSPF INTERFACE, optproto opttext, [] [\"\"], [[Show information about interface]]) -{ ospf_sh_iface(proto_get_named($4, &proto_ospf), $5); }; +{ PROTO_WALK_CMD($4, &proto_ospf, p) ospf_sh_iface(p, $5); }; CF_CLI_HELP(SHOW OSPF TOPOLOGY, [all] [], [[Show information about OSPF network topology]]) diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index c8ed0e06..ba8c2e2b 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -800,7 +800,6 @@ ospf_sh_neigh(struct proto *P, const char *iff) if (p->p.proto_state != PS_UP) { cli_msg(-1013, "%s: is not up", p->p.name); - cli_msg(0, ""); return; } @@ -811,7 +810,6 @@ ospf_sh_neigh(struct proto *P, const char *iff) if ((iff == NULL) || patmatch(iff, ifa->ifname)) WALK_LIST(n, ifa->neigh_list) ospf_sh_neigh_info(n); - cli_msg(0, ""); } void @@ -826,7 +824,6 @@ ospf_sh(struct proto *P) if (p->p.proto_state != PS_UP) { cli_msg(-1014, "%s: is not up", p->p.name); - cli_msg(0, ""); return; } @@ -896,7 +893,6 @@ ospf_sh(struct proto *P) FIB_WALK_END; } - cli_msg(0, ""); } void @@ -908,7 +904,6 @@ ospf_sh_iface(struct proto *P, const char *iff) if (p->p.proto_state != PS_UP) { cli_msg(-1015, "%s: is not up", p->p.name); - cli_msg(0, ""); return; } @@ -916,7 +911,6 @@ ospf_sh_iface(struct proto *P, const char *iff) WALK_LIST(ifa, p->iface_list) if ((iff == NULL) || patmatch(iff, ifa->ifname)) ospf_iface_info(ifa); - cli_msg(0, ""); } /* lsa_compare_for_state() - Compare function for 'show ospf state' -- cgit v1.2.3