diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-05-14 03:48:17 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-06-28 15:38:47 +0200 |
commit | c26c6bc2d78a2fe76f27dcc9fbb5afc95c3a7626 (patch) | |
tree | b9058f04982a155d2a214e488e143bf1fac36597 /proto/rip | |
parent | a948cf9a5c338518773e6c98e895c829c469f56b (diff) |
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.
Diffstat (limited to 'proto/rip')
-rw-r--r-- | proto/rip/config.Y | 4 | ||||
-rw-r--r-- | proto/rip/rip.c | 6 |
2 files changed, 2 insertions, 8 deletions
diff --git a/proto/rip/config.Y b/proto/rip/config.Y index 6cea7dd0..55527feb 100644 --- a/proto/rip/config.Y +++ b/proto/rip/config.Y @@ -196,10 +196,10 @@ dynamic_attr: RIP_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RIP_TAG) CF_CLI_HELP(SHOW RIP, ..., [[Show information about RIP protocol]]); CF_CLI(SHOW RIP INTERFACES, optproto opttext, [<name>] [\"<interface>\"], [[Show information about RIP interfaces]]) -{ rip_show_interfaces(proto_get_named($4, &proto_rip), $5); }; +{ PROTO_WALK_CMD($4, &proto_rip, p) rip_show_interfaces(p, $5); }; CF_CLI(SHOW RIP NEIGHBORS, optproto opttext, [<name>] [\"<interface>\"], [[Show information about RIP neighbors]]) -{ rip_show_neighbors(proto_get_named($4, &proto_rip), $5); }; +{ PROTO_WALK_CMD($4, &proto_rip, p) rip_show_neighbors(p, $5); }; CF_CODE diff --git a/proto/rip/rip.c b/proto/rip/rip.c index f3dc6353..5c53ab1e 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -1232,7 +1232,6 @@ rip_show_interfaces(struct proto *P, const char *iff) if (p->p.proto_state != PS_UP) { cli_msg(-1021, "%s: is not up", p->p.name); - cli_msg(0, ""); return; } @@ -1256,8 +1255,6 @@ rip_show_interfaces(struct proto *P, const char *iff) cli_msg(-1021, "%-10s %-6s %6u %6u %7t", ifa->iface->name, (ifa->up ? "Up" : "Down"), ifa->cf->metric, nbrs, timer); } - - cli_msg(0, ""); } void @@ -1270,7 +1267,6 @@ rip_show_neighbors(struct proto *P, const char *iff) if (p->p.proto_state != PS_UP) { cli_msg(-1022, "%s: is not up", p->p.name); - cli_msg(0, ""); return; } @@ -1293,8 +1289,6 @@ rip_show_neighbors(struct proto *P, const char *iff) n->nbr->addr, ifa->iface->name, ifa->cf->metric, n->uc, timer); } } - - cli_msg(0, ""); } static void |