return jhash(cluster->list, cluster->length, 0);
}
-static int cluster_hash_cmp(const void *p1, const void *p2)
+static bool cluster_hash_cmp(const void *p1, const void *p2)
{
const struct cluster_list *cluster1 = p1;
const struct cluster_list *cluster2 = p2;
return jhash(encap->value, encap->length, 0);
}
-static int encap_hash_cmp(const void *p1, const void *p2)
+static bool encap_hash_cmp(const void *p1, const void *p2)
{
return encap_same((const struct bgp_attr_encap_subtlv *)p1,
(const struct bgp_attr_encap_subtlv *)p2);
return jhash(transit->val, transit->length, 0);
}
-static int transit_hash_cmp(const void *p1, const void *p2)
+static bool transit_hash_cmp(const void *p1, const void *p2)
{
const struct transit *transit1 = p1;
const struct transit *transit2 = p2;
return key;
}
-int attrhash_cmp(const void *p1, const void *p2)
+bool attrhash_cmp(const void *p1, const void *p2)
{
const struct attr *attr1 = p1;
const struct attr *attr2 = p2;
&& overlay_index_same(attr1, attr2)
&& attr1->nh_ifindex == attr2->nh_ifindex
&& attr1->nh_lla_ifindex == attr2->nh_lla_ifindex)
- return 1;
+ return true;
}
- return 0;
+ return false;
}
static void attrhash_init(void)
/* Create the attributes for an aggregate */
struct attr *bgp_attr_aggregate_intern(struct bgp *bgp, uint8_t origin,
struct aspath *aspath,
- struct community *community, int as_set,
- uint8_t atomic_aggregate)
+ struct community *community,
+ struct ecommunity *ecommunity,
+ struct lcommunity *lcommunity,
+ int as_set, uint8_t atomic_aggregate)
{
struct attr attr;
struct attr *new;
attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES);
}
+ if (ecommunity) {
+ attr.ecommunity = ecommunity;
+ attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
+ }
+
+ if (lcommunity) {
+ attr.lcommunity = lcommunity;
+ attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES);
+ }
+
if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
bgp_attr_add_gshut_community(&attr);
}
aspath_free(new->aspath);
if (new->community != old->community)
- community_free(new->community);
+ community_free(&new->community);
if (new->ecommunity != old->ecommunity)
ecommunity_free(&new->ecommunity);
aspath_free(attr->aspath);
attr->aspath = NULL;
}
- if (attr->community && !attr->community->refcnt) {
- community_free(attr->community);
- attr->community = NULL;
- }
-
+ if (attr->community && !attr->community->refcnt)
+ community_free(&attr->community);
if (attr->ecommunity && !attr->ecommunity->refcnt)
ecommunity_free(&attr->ecommunity);
if (attr->lcommunity && !attr->lcommunity->refcnt)
* - for consistency in rx processing
*
* The following comment is to signal GCC this intention
- * and supress the warning
+ * and suppress the warning
*/
/* FALLTHRU */
case BGP_ATTR_NHLEN_IPV4:
return ret;
}
- /* If hard error occured immediately return to the caller. */
+ /* If hard error occurred immediately return to the caller. */
if (ret == BGP_ATTR_PARSE_ERROR) {
flog_warn(EC_BGP_ATTRIBUTE_PARSE_ERROR,
"%s: Attribute %s, parse error", peer->host,
num_labels = 1;
}
- return bgp_packet_mpattr_prefix(s, afi, safi, p, prd, label, num_labels,
- addpath_encode, addpath_tx_id, attr);
+ bgp_packet_mpattr_prefix(s, afi, safi, p, prd, label, num_labels,
+ addpath_encode, addpath_tx_id, attr);
}
void bgp_packet_mpunreach_end(struct stream *s, size_t attrlen_pnt)