diff options
author | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2023-09-12 22:12:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-12 22:12:15 +0200 |
commit | 7e43a5bf2e1f5b9ea0f8013795bfbd0ea8a3a8e6 (patch) | |
tree | e070f0ed297e6dc187cb05e51dc9595e0c1c63ac | |
parent | Merge pull request #14397 from manojvn/mgmt_sb_commands (diff) | |
parent | bgpd: BGP_ATTR_MAX can be 255, allow using it for path attr discard/withdraw ... (diff) | |
download | frr-7e43a5bf2e1f5b9ea0f8013795bfbd0ea8a3a8e6.tar.xz frr-7e43a5bf2e1f5b9ea0f8013795bfbd0ea8a3a8e6.zip |
Merge pull request #14399 from opensourcerouting/fix/bgpd_handle_BGP_MAX_ATTR
bgpd: BGP_ATTR_MAX can be 255, allow using it for path attr
-rw-r--r-- | bgpd/bgp_attr.c | 8 | ||||
-rw-r--r-- | bgpd/bgpd.c | 4 | ||||
-rw-r--r-- | bgpd/bgpd.h | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 0511fe8c3..791623344 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -5151,7 +5151,7 @@ void bgp_path_attribute_discard_vty(struct vty *vty, struct peer *peer, * then flush all. */ if (!discard_attrs) { - for (i = 0; i < BGP_ATTR_MAX; i++) + for (i = 1; i <= BGP_ATTR_MAX; i++) peer->discard_attrs[i] = false; goto discard_soft_clear; } @@ -5160,7 +5160,7 @@ void bgp_path_attribute_discard_vty(struct vty *vty, struct peer *peer, frrstr_split(discard_attrs, " ", &attributes, &num_attributes); if (set) - for (i = 0; i < BGP_ATTR_MAX; i++) + for (i = 1; i <= BGP_ATTR_MAX; i++) peer->discard_attrs[i] = false; for (i = 0; i < num_attributes; i++) { @@ -5220,7 +5220,7 @@ void bgp_path_attribute_withdraw_vty(struct vty *vty, struct peer *peer, * then flush all. */ if (!withdraw_attrs) { - for (i = 0; i < BGP_ATTR_MAX; i++) + for (i = 1; i <= BGP_ATTR_MAX; i++) peer->withdraw_attrs[i] = false; goto withdraw_soft_clear; } @@ -5229,7 +5229,7 @@ void bgp_path_attribute_withdraw_vty(struct vty *vty, struct peer *peer, frrstr_split(withdraw_attrs, " ", &attributes, &num_attributes); if (set) - for (i = 0; i < BGP_ATTR_MAX; i++) + for (i = 1; i <= BGP_ATTR_MAX; i++) peer->withdraw_attrs[i] = false; for (i = 0; i < num_attributes; i++) { diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index a518137f3..895f36f99 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -4337,7 +4337,7 @@ bool bgp_path_attribute_discard(struct peer *peer, char *buf, size_t size) buf[0] = '\0'; - for (unsigned int i = 0; i < BGP_ATTR_MAX; i++) { + for (unsigned int i = 1; i <= BGP_ATTR_MAX; i++) { if (peer->discard_attrs[i]) snprintf(buf + strlen(buf), size - strlen(buf), "%s%d", (strlen(buf) > 0) ? " " : "", i); @@ -4357,7 +4357,7 @@ bool bgp_path_attribute_treat_as_withdraw(struct peer *peer, char *buf, buf[0] = '\0'; - for (unsigned int i = 0; i < BGP_ATTR_MAX; i++) { + for (unsigned int i = 1; i <= BGP_ATTR_MAX; i++) { if (peer->withdraw_attrs[i]) snprintf(buf + strlen(buf), size - strlen(buf), "%s%d", (strlen(buf) > 0) ? " " : "", i); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 012a11ec0..c3e55b711 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1809,10 +1809,10 @@ struct peer { #define BGP_ATTR_MAX 255 /* Path attributes discard */ - bool discard_attrs[BGP_ATTR_MAX]; + bool discard_attrs[BGP_ATTR_MAX + 1]; /* Path attributes treat-as-withdraw */ - bool withdraw_attrs[BGP_ATTR_MAX]; + bool withdraw_attrs[BGP_ATTR_MAX + 1]; /* BGP Software Version Capability */ #define BGP_MAX_SOFT_VERSION 64 |