summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_updgrp.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 03:04:09 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 03:04:09 +0200
commit8fe8a7f6fbb9977b33addcd8d8ec88355bcaa583 (patch)
treee661a92a7995a87ddeac6a87c8f56b422bc21de9 /bgpd/bgp_updgrp.c
parentBGP: More connected NHT fixups (diff)
downloadfrr-8fe8a7f6fbb9977b33addcd8d8ec88355bcaa583.tar.xz
frr-8fe8a7f6fbb9977b33addcd8d8ec88355bcaa583.zip
BGP: Fix update-groups commands to match neighbors
show update-groups summary was mislabeled. What it displays is not a summary at all, but the detailed info about all update-groups. Furthermore, there was no way to get detailed info about a specific subgroup. This patch renames "show * update-groups summary" to "show * update-groups" and adds an option to see the info specific to a subgroup only. It also validates the subgroup-id. show * update-groups summary will be added separately.
Diffstat (limited to 'bgpd/bgp_updgrp.c')
-rw-r--r--bgpd/bgp_updgrp.c46
1 files changed, 43 insertions, 3 deletions
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index 6d18e8346..667a30c6d 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -521,10 +521,42 @@ subgroup_total_packets_enqueued (struct update_subgroup *subgrp)
static int
update_group_show_walkcb (struct update_group *updgrp, void *arg)
{
- struct vty *vty = arg;
+ struct updwalk_context *ctx = arg;
+ struct vty *vty;
struct update_subgroup *subgrp;
struct peer_af *paf;
struct bgp_filter *filter;
+ int match = 0;
+
+ if (!ctx)
+ return;
+
+ if (ctx->subgrp_id)
+ {
+ UPDGRP_FOREACH_SUBGRP (updgrp, subgrp)
+ {
+ if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
+ continue;
+ else
+ {
+ match = 1;
+ break;
+ }
+ }
+ }
+ else
+ {
+ match = 1;
+ }
+
+ if (!match)
+ {
+ /* Since this routine is invoked from a walk, we cannot signal any */
+ /* error here, can only return. */
+ return CMD_SUCCESS;
+ }
+
+ vty = ctx->vty;
vty_out (vty, "Update-group %llu:%s", updgrp->id, VTY_NEWLINE);
vty_out (vty, " Created: %s", timestamp_string (updgrp->uptime));
@@ -546,6 +578,8 @@ update_group_show_walkcb (struct update_group *updgrp, void *arg)
UPDGRP_FOREACH_SUBGRP (updgrp, subgrp)
{
+ if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
+ continue;
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, " Update-subgroup %llu:%s", subgrp->id, VTY_NEWLINE);
vty_out (vty, " Created: %s", timestamp_string (subgrp->uptime));
@@ -1526,9 +1560,15 @@ update_group_init (struct bgp *bgp)
}
void
-update_group_show (struct bgp *bgp, afi_t afi, safi_t safi, struct vty *vty)
+update_group_show (struct bgp *bgp, afi_t afi, safi_t safi, struct vty *vty,
+ u_int64_t subgrp_id)
{
- update_group_af_walk (bgp, afi, safi, update_group_show_walkcb, vty);
+ struct updwalk_context ctx;
+ memset (&ctx, 0, sizeof (ctx));
+ ctx.vty = vty;
+ ctx.subgrp_id = subgrp_id;
+
+ update_group_af_walk (bgp, afi, safi, update_group_show_walkcb, &ctx);
}
/*