summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2024-11-05 12:14:02 -0600
committerGitHub <noreply@github.com>2024-11-05 12:14:02 -0600
commit530b71b0ace5040c02b08f66315936dab00cdbb7 (patch)
treea23b9012f88b3ddeebee74b59303f23a31195b73
parent02f4fef5ffd88923c63f219b9a118221ea800d80 (diff)
parent8d1ade44be3cb85afc31fa26cc51592e2fe7c41b (diff)
Merge pull request #17347 from FRRouting/mergify/bp/dev/10.2/pr-17305
bgpd: Treat numbered community-list only if it's in a range 1-500 (backport #17305)
-rw-r--r--bgpd/bgp_clist.c2
-rw-r--r--bgpd/bgp_clist.h4
2 files changed, 5 insertions, 1 deletions
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index ad154e638b..61ba527498 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -182,7 +182,7 @@ community_list_insert(struct community_list_handler *ch, const char *name,
}
/* In case of name is all digit character */
- if (i == strlen(name)) {
+ if (i == strlen(name) && number <= COMMUNITY_LIST_NUMBER_MAX) {
new->sort = COMMUNITY_LIST_NUMBER;
/* Set access_list to number list. */
diff --git a/bgpd/bgp_clist.h b/bgpd/bgp_clist.h
index 29bd880c93..7f35a6d53e 100644
--- a/bgpd/bgp_clist.h
+++ b/bgpd/bgp_clist.h
@@ -20,6 +20,10 @@
/* Number and string based community-list name. */
#define COMMUNITY_LIST_STRING 0
#define COMMUNITY_LIST_NUMBER 1
+/* The numbered community-list (including large/ext communities)
+ * have a range between 1-500.
+ */
+#define COMMUNITY_LIST_NUMBER_MAX 500
#define COMMUNITY_SEQ_NUMBER_AUTO -1