summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/printconf.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-05-31 09:45:34 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-05-31 09:45:34 +0000
commit563a9d379cfd330c61d33ef1465109222f360446 (patch)
tree44f00e6d0837c310895133443265ab5b49f10699 /usr.sbin/bgpd/printconf.c
parent8ffdc5bcaf439b3b297ad3e4c5803e2dbc062f65 (diff)
Implement a max communities filter match
When max-communities X is set on a filterrule the filter will match when more than X communities are present in the path. In other words max-communities 0 means no communities are allowed and max-communities 3 limits it up to 3 communities. There is max-communities, max-ext-communities and max-large-communities for each of the 3 community attributes. These three max checks can be used together. OK tb@ job@
Diffstat (limited to 'usr.sbin/bgpd/printconf.c')
-rw-r--r--usr.sbin/bgpd/printconf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/printconf.c b/usr.sbin/bgpd/printconf.c
index 1ad98e4ea49..3a20405ef82 100644
--- a/usr.sbin/bgpd/printconf.c
+++ b/usr.sbin/bgpd/printconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printconf.c,v 1.151 2022/05/25 16:03:34 claudio Exp $ */
+/* $OpenBSD: printconf.c,v 1.152 2022/05/31 09:45:33 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -925,6 +925,13 @@ print_rule(struct bgpd_config *conf, struct filter_rule *r)
}
}
+ if (r->match.maxcomm != 0)
+ printf("max-communities %d ", r->match.maxcomm - 1);
+ if (r->match.maxextcomm != 0)
+ printf("max-ext-communities %d ", r->match.maxextcomm - 1);
+ if (r->match.maxlargecomm != 0)
+ printf("max-large-communities %d ", r->match.maxlargecomm - 1);
+
print_set(&r->set);
printf("\n");