summaryrefslogtreecommitdiff
path: root/bgpd/bgp_attr.h
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-04-11 18:09:35 +0300
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-04-12 22:09:28 +0300
commit9d34440bf811a14d9dd47972b1c24428f18ff6b4 (patch)
tree3a04e82903a1c182f2ceceb10625eee5bd361679 /bgpd/bgp_attr.h
parent695c24c3b0fed1e3dc5d0ccd6bc91cc98301ee89 (diff)
bgpd: Reuse bgp_attr_set_[l]community() for setting attribute flags
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_attr.h')
-rw-r--r--bgpd/bgp_attr.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h
index 1f199da161..49702a0e31 100644
--- a/bgpd/bgp_attr.h
+++ b/bgpd/bgp_attr.h
@@ -528,6 +528,12 @@ static inline void bgp_attr_set_lcommunity(struct attr *attr,
struct lcommunity *lcomm)
{
attr->lcommunity = lcomm;
+
+ if (lcomm)
+ SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES));
+ else
+ UNSET_FLAG(attr->flag,
+ ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES));
}
static inline struct community *bgp_attr_get_community(const struct attr *attr)
@@ -539,6 +545,11 @@ static inline void bgp_attr_set_community(struct attr *attr,
struct community *comm)
{
attr->community = comm;
+
+ if (comm)
+ SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES));
+ else
+ UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES));
}
static inline struct ecommunity *