summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2025-01-10 17:29:10 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2025-01-14 13:59:42 +0100
commitf19b8668b3cbbad6d14eb348c9b8a0f7ac6ac46f (patch)
tree5f0c3b2c69bdaeb1ebdbcf1bd1547110269fba96 /lib
parentMerge pull request #17840 from Jafaral/pim-acl-test (diff)
downloadfrr-f19b8668b3cbbad6d14eb348c9b8a0f7ac6ac46f.tar.xz
frr-f19b8668b3cbbad6d14eb348c9b8a0f7ac6ac46f.zip
bgpd: add 'match community-count' command to restrict comm count
Add a mechanism in route-map to filter out route-map which have a list of communities greater than the given number. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/routemap.h1
-rw-r--r--lib/routemap_cli.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/routemap.h b/lib/routemap.h
index 8dcc17ecc..1c0234831 100644
--- a/lib/routemap.h
+++ b/lib/routemap.h
@@ -310,6 +310,7 @@ DECLARE_QOBJ_TYPE(route_map);
(strmatch(C, "frr-bgp-route-map:ip-route-source"))
#define IS_MATCH_ROUTE_SRC_PL(C) \
(strmatch(C, "frr-bgp-route-map:ip-route-source-prefix-list"))
+#define IS_MATCH_COMMUNITY_LIMIT(C) (strmatch(C, "frr-bgp-route-map:match-community-limit"))
#define IS_MATCH_COMMUNITY(C) \
(strmatch(C, "frr-bgp-route-map:match-community"))
#define IS_MATCH_LCOMMUNITY(C) \
diff --git a/lib/routemap_cli.c b/lib/routemap_cli.c
index 69b942064..eb0170970 100644
--- a/lib/routemap_cli.c
+++ b/lib/routemap_cli.c
@@ -810,6 +810,10 @@ void route_map_condition_show(struct vty *vty, const struct lyd_node *dnode,
yang_dnode_get_string(
dnode,
"./rmap-match-condition/frr-bgp-route-map:list-name"));
+ } else if (IS_MATCH_COMMUNITY_LIMIT(condition)) {
+ vty_out(vty, " match community-limit %s\n",
+ yang_dnode_get_string(dnode,
+ "./rmap-match-condition/frr-bgp-route-map:community-limit"));
} else if (IS_MATCH_COMMUNITY(condition)) {
vty_out(vty, " match community %s",
yang_dnode_get_string(