summaryrefslogtreecommitdiff
path: root/bgpd/bgp_attr_evpn.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-06-06 13:20:38 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-07-12 15:23:18 -0400
commitaadc0905054edac0fe88b35ae29236875d586cd8 (patch)
tree71c405efd33d784450ef4d8010c0aafbe5b63751 /bgpd/bgp_attr_evpn.c
parentd5424e5356955e543cb31243f69e38cf68e05a33 (diff)
bgpd: Refactor 'struct attr_extra' into 'struct attr'
Most of the attributes in 'struct attr_extra' allow for the more interesting cases of using bgp. The extra overhead of managing it will induce errors as we add more attributes and the extra memory overhead is negligible on anything but full bgp feeds. Additionally this greatly simplifies the code for the handling of data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> bgpd: Fix missing label set Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_attr_evpn.c')
-rw-r--r--bgpd/bgp_attr_evpn.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/bgpd/bgp_attr_evpn.c b/bgpd/bgp_attr_evpn.c
index e66fdde5f6..aa175bcf51 100644
--- a/bgpd/bgp_attr_evpn.c
+++ b/bgpd/bgp_attr_evpn.c
@@ -39,17 +39,14 @@ void bgp_add_routermac_ecom(struct attr *attr, struct ethaddr *routermac)
{
struct ecommunity_val routermac_ecom;
- if (attr->extra)
- {
- memset(&routermac_ecom, 0, sizeof(struct ecommunity_val));
- routermac_ecom.val[0] = ECOMMUNITY_ENCODE_EVPN;
- routermac_ecom.val[1] = ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC;
- memcpy(&routermac_ecom.val[2], routermac->octet, ETHER_ADDR_LEN);
- if (!attr->extra->ecommunity)
- attr->extra->ecommunity = ecommunity_new();
- ecommunity_add_val(attr->extra->ecommunity, &routermac_ecom);
- ecommunity_str (attr->extra->ecommunity);
- }
+ memset(&routermac_ecom, 0, sizeof(struct ecommunity_val));
+ routermac_ecom.val[0] = ECOMMUNITY_ENCODE_EVPN;
+ routermac_ecom.val[1] = ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC;
+ memcpy(&routermac_ecom.val[2], routermac->octet, ETHER_ADDR_LEN);
+ if (!attr->ecommunity)
+ attr->ecommunity = ecommunity_new();
+ ecommunity_add_val(attr->ecommunity, &routermac_ecom);
+ ecommunity_str (attr->ecommunity);
}
/* converts to an esi
@@ -119,7 +116,7 @@ bgp_attr_mac_mobility_seqnum (struct attr *attr, u_char *sticky)
int i;
u_char flags = 0;
- ecom = attr->extra->ecommunity;
+ ecom = attr->ecommunity;
if (!ecom || !ecom->size)
return 0;