summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_flowspec_vty.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2018-06-28 17:26:22 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2018-07-24 12:17:57 +0200
commitc26edcda4ea6340b812b9e3a3bdab911de7c44ac (patch)
treea23983c6ffc7af9945e5edde04362f7a9f4262b6 /bgpd/bgp_flowspec_vty.c
parentMerge pull request #2698 from sworleys/Netlink-Filter-AFI (diff)
downloadfrr-c26edcda4ea6340b812b9e3a3bdab911de7c44ac.tar.xz
frr-c26edcda4ea6340b812b9e3a3bdab911de7c44ac.zip
bgpd: flowspec pbr entries listed on the bgp information entry
Because one flowspec entry can create 1-N bgp pbr entries, the list is now updated and visible. Also, because the bgp_extra structure is used, this list is flushed when the bgp_extra structure is deleted. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_flowspec_vty.c')
-rw-r--r--bgpd/bgp_flowspec_vty.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/bgpd/bgp_flowspec_vty.c b/bgpd/bgp_flowspec_vty.c
index c695e7f12..3f450fc4e 100644
--- a/bgpd/bgp_flowspec_vty.c
+++ b/bgpd/bgp_flowspec_vty.c
@@ -332,16 +332,32 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
struct bgp_info_extra *extra = bgp_info_extra_get(binfo);
if (extra->bgp_fs_pbr) {
+ struct listnode *node;
struct bgp_pbr_match_entry *bpme;
struct bgp_pbr_match *bpm;
+ int unit = 0;
+ struct list *list_bpm;
- bpme = (struct bgp_pbr_match_entry *)extra->bgp_fs_pbr;
- bpm = bpme->backpointer;
- vty_out(vty, "\tinstalled in PBR");
- if (bpm)
- vty_out(vty, " (%s)\n", bpm->ipset_name);
- else
- vty_out(vty, "\n");
+ list_bpm = list_new();
+ if (listcount(extra->bgp_fs_pbr))
+ vty_out(vty, "\tinstalled in PBR");
+ for (ALL_LIST_ELEMENTS_RO(extra->bgp_fs_pbr,
+ node, bpme)) {
+ bpm = bpme->backpointer;
+ if (listnode_lookup(list_bpm, bpm))
+ continue;
+ listnode_add(list_bpm, bpm);
+ if (unit == 0)
+ vty_out(vty, " (");
+ else
+ vty_out(vty, ", ");
+ vty_out(vty, "%s", bpm->ipset_name);
+ unit++;
+ }
+ if (unit)
+ vty_out(vty, ")");
+ vty_out(vty, "\n");
+ list_delete_all_node(list_bpm);
} else
vty_out(vty, "\tnot installed in PBR\n");
}