]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Treat numbered community-list only if it's in a range 1-500
authorDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 30 Oct 2024 08:45:28 +0000 (10:45 +0200)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 5 Nov 2024 15:18:42 +0000 (15:18 +0000)
Before this patch, if we set something like:

```
bgp extcommunity-list expanded 1234 permit admin
```

In running config we have:

```
bgp extcommunity-list 1234 seq 5 permit admin
```

That leads to incorrect rendering, even more the line can't be deleted.

With this fix we treat numbered community-list only if it's inside the range
1-500, otherwise it's a non-numbered clist.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 4c1ee29116aff081f63b1fc7dad18cbfe1b8007f)

bgpd/bgp_clist.c
bgpd/bgp_clist.h

index f3c308afb9e3e0f7a66ce9c6ad7c96a46a7f26d0..cd7c21daf175adb97bd9d268ca98cf0d0454bc7c 100644 (file)
@@ -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. */
index 8e5d637babee0cf85fdb4e6e29d4df718245b175..b6a073e56c1b7c877463426e0af154d390cd5f6e 100644 (file)
 /* 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