summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2024-11-05 14:26:50 -0500
committerGitHub <noreply@github.com>2024-11-05 14:26:50 -0500
commitdd3e867f487a711d1328eed120bac6d1f57cc882 (patch)
tree487355d1cbead2b8174d6d31b969fbae432411b9
parent628eaf6b81cfa9a62bd096db83f4f92b25123d8e (diff)
parent6e58833466f006555bf581e2123805e47ceac347 (diff)
Merge pull request #17350 from FRRouting/mergify/bp/stable/9.1/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 e522307134..634775cfd3 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -181,7 +181,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 a435b92ce1..f0ca90bdef 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