summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_attr.c10
-rw-r--r--bgpd/bgp_attr.h12
-rw-r--r--bgpd/bgp_evpn.c4
-rw-r--r--bgpd/bgp_evpn_mh.c6
-rw-r--r--bgpd/bgp_mpath.c4
-rw-r--r--bgpd/bgp_mplsvpn.c3
-rw-r--r--bgpd/bgp_routemap.c4
-rw-r--r--bgpd/rfapi/rfapi.c4
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c3
9 files changed, 15 insertions, 35 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 310227f33a..628d700188 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1010,10 +1010,8 @@ struct attr *bgp_attr_aggregate_intern(
bgp_attr_set_community(&attr, community);
}
- if (ecommunity) {
+ if (ecommunity)
bgp_attr_set_ecommunity(&attr, ecommunity);
- attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
- }
if (lcommunity)
bgp_attr_set_lcommunity(&attr, lcommunity);
@@ -1097,12 +1095,10 @@ void bgp_attr_unintern_sub(struct attr *attr)
ecomm = bgp_attr_get_ecommunity(attr);
ecommunity_unintern(&ecomm);
- UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES));
bgp_attr_set_ecommunity(attr, NULL);
ipv6_ecomm = bgp_attr_get_ipv6_ecommunity(attr);
ecommunity_unintern(&ipv6_ecomm);
- UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_IPV6_EXT_COMMUNITIES));
bgp_attr_set_ipv6_ecommunity(attr, NULL);
lcomm = bgp_attr_get_lcommunity(attr);
@@ -2323,8 +2319,6 @@ bgp_attr_ext_communities(struct bgp_attr_parser_args *args)
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_OPT_ATTR_ERR,
args->total);
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
-
/* Extract DF election preference and mobility sequence number */
attr->df_pref = bgp_attr_df_pref_from_ec(attr, &attr->df_alg);
@@ -2394,8 +2388,6 @@ bgp_attr_ipv6_ext_communities(struct bgp_attr_parser_args *args)
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_OPT_ATTR_ERR,
args->total);
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_IPV6_EXT_COMMUNITIES);
-
return BGP_ATTR_PARSE_PROCEED;
}
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h
index 49702a0e31..4ed0ca5e7a 100644
--- a/bgpd/bgp_attr.h
+++ b/bgpd/bgp_attr.h
@@ -516,6 +516,11 @@ static inline void bgp_attr_set_ecommunity(struct attr *attr,
struct ecommunity *ecomm)
{
attr->ecommunity = ecomm;
+
+ if (ecomm)
+ SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES));
+ else
+ UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES));
}
static inline struct lcommunity *
@@ -562,6 +567,13 @@ static inline void bgp_attr_set_ipv6_ecommunity(struct attr *attr,
struct ecommunity *ipv6_ecomm)
{
attr->ipv6_ecommunity = ipv6_ecomm;
+
+ if (ipv6_ecomm)
+ SET_FLAG(attr->flag,
+ ATTR_FLAG_BIT(BGP_ATTR_IPV6_EXT_COMMUNITIES));
+ else
+ UNSET_FLAG(attr->flag,
+ ATTR_FLAG_BIT(BGP_ATTR_IPV6_EXT_COMMUNITIES));
}
static inline struct transit *bgp_attr_get_transit(const struct attr *attr)
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 9f3f8389ad..3224c1a2b0 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -759,8 +759,6 @@ static void build_evpn_type5_route_extcomm(struct bgp *bgp_vrf,
ecommunity_add_val(bgp_attr_get_ecommunity(attr), &eval_rmac,
true, true);
}
-
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
}
/*
@@ -870,8 +868,6 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr,
attr, ecommunity_merge(bgp_attr_get_ecommunity(attr),
&ecom_na));
}
-
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
}
/*
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c
index f6516d220c..d3460674be 100644
--- a/bgpd/bgp_evpn_mh.c
+++ b/bgpd/bgp_evpn_mh.c
@@ -622,8 +622,6 @@ static void bgp_evpn_type4_route_extcomm_build(struct bgp_evpn_es *es,
bgp_attr_set_ecommunity(
attr,
ecommunity_merge(bgp_attr_get_ecommunity(attr), &ecom_df));
-
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
}
/* Create or update local type-4 route */
@@ -904,8 +902,6 @@ bgp_evpn_type1_es_route_extcomm_build(struct bgp_evpn_es_frag *es_frag,
ecom));
}
}
-
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
}
/* Extended communities associated with EAD-per-EVI */
@@ -932,8 +928,6 @@ static void bgp_evpn_type1_evi_route_extcomm_build(struct bgp_evpn_es *es,
bgp_attr_set_ecommunity(
attr,
ecommunity_merge(bgp_attr_get_ecommunity(attr), ecom));
-
- attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
}
/* Update EVPN EAD (type-1) route -
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index 7ff0df7409..37d2c45215 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -908,10 +908,8 @@ void bgp_path_info_mpath_aggregate_update(struct bgp_path_info *new_best,
if (community) {
bgp_attr_set_community(&attr, community);
}
- if (ecomm) {
+ if (ecomm)
bgp_attr_set_ecommunity(&attr, ecomm);
- attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
- }
if (lcomm)
bgp_attr_set_lcommunity(&attr, lcomm);
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 08a68d0c12..defe367484 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -1147,7 +1147,6 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
.rtlist[BGP_VPN_POLICY_DIR_TOVPN]);
}
bgp_attr_set_ecommunity(&static_attr, new_ecom);
- SET_FLAG(static_attr.flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES));
if (debug && bgp_attr_get_ecommunity(&static_attr)) {
char *s = ecommunity_ecom2str(
@@ -1511,8 +1510,6 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
bgp_attr_set_ecommunity(&static_attr, new_ecom);
if (new_ecom->size == 0) {
- UNSET_FLAG(static_attr.flag,
- ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES));
ecommunity_free(&new_ecom);
bgp_attr_set_ecommunity(&static_attr, NULL);
}
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index df92a24ce1..6ab753f476 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -2584,7 +2584,6 @@ route_set_ecommunity(void *rule, const struct prefix *prefix, void *object)
attr = path->attr;
if (rcs->none) {
- attr->flag &= ~(ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES));
bgp_attr_set_ecommunity(attr, NULL);
return RMAP_OKAY;
}
@@ -2611,8 +2610,6 @@ route_set_ecommunity(void *rule, const struct prefix *prefix, void *object)
/* will be intern()'d or attr_flush()'d by bgp_update_main() */
bgp_attr_set_ecommunity(path->attr, new_ecom);
- path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
-
return RMAP_OKAY;
}
@@ -2774,7 +2771,6 @@ route_set_ecommunity_lb(void *rule, const struct prefix *prefix, void *object)
/* new_ecom will be intern()'d or attr_flush()'d in call stack */
bgp_attr_set_ecommunity(path->attr, new_ecom);
- path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
/* Mark that route-map has set link bandwidth; used in attribute
* setting decisions.
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index c96c321d76..3aa8868374 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -832,9 +832,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
struct ecommunity *ecomm = bgp_attr_get_ecommunity(&attr);
- if (ecomm->size) {
- attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
- } else {
+ if (!ecomm->size) {
ecommunity_free(&ecomm);
bgp_attr_set_ecommunity(&attr, NULL);
}
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index f4f2e11391..c479b4d65a 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -650,9 +650,6 @@ encap_attr_export(struct attr *new, struct attr *orig,
} else {
bgp_attr_set_ecommunity(new, ecom_ro);
}
- if (ecom_ro) {
- new->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
- }
/*
* Set MED