summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_attr.c795
-rw-r--r--bgpd/bgp_attr.h72
-rw-r--r--bgpd/bgp_attr_evpn.c21
-rw-r--r--bgpd/bgp_debug.c53
-rw-r--r--bgpd/bgp_encap_tlv.c65
-rw-r--r--bgpd/bgp_evpn.c67
-rw-r--r--bgpd/bgp_label.c6
-rw-r--r--bgpd/bgp_memory.c1
-rw-r--r--bgpd/bgp_memory.h1
-rw-r--r--bgpd/bgp_mpath.c62
-rw-r--r--bgpd/bgp_nht.c6
-rw-r--r--bgpd/bgp_packet.c7
-rw-r--r--bgpd/bgp_route.c412
-rw-r--r--bgpd/bgp_route.h4
-rw-r--r--bgpd/bgp_routemap.c100
-rw-r--r--bgpd/bgp_snmp.c10
-rw-r--r--bgpd/bgp_updgrp_adv.c13
-rw-r--r--bgpd/bgp_vty.c5
-rw-r--r--bgpd/bgp_zebra.c42
-rw-r--r--bgpd/rfapi/rfapi.c47
-rw-r--r--bgpd/rfapi/rfapi_encap_tlv.c14
-rw-r--r--bgpd/rfapi/rfapi_import.c282
-rw-r--r--bgpd/rfapi/rfapi_rib.c8
-rw-r--r--bgpd/rfapi/rfapi_vty.c38
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c62
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c37
26 files changed, 919 insertions, 1311 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index e62d1bb0aa..4d828d2822 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -270,17 +270,17 @@ encap_free(struct bgp_attr_encap_subtlv *p)
void
bgp_attr_flush_encap(struct attr *attr)
{
- if (!attr || !attr->extra)
+ if (!attr)
return;
- if (attr->extra->encap_subtlvs) {
- encap_free(attr->extra->encap_subtlvs);
- attr->extra->encap_subtlvs = NULL;
+ if (attr->encap_subtlvs) {
+ encap_free(attr->encap_subtlvs);
+ attr->encap_subtlvs = NULL;
}
#if ENABLE_BGP_VNC
- if (attr->extra->vnc_subtlvs) {
- encap_free(attr->extra->vnc_subtlvs);
- attr->extra->vnc_subtlvs = NULL;
+ if (attr->vnc_subtlvs) {
+ encap_free(attr->vnc_subtlvs);
+ attr->vnc_subtlvs = NULL;
}
#endif
}
@@ -424,15 +424,15 @@ encap_finish (void)
}
static bool
-overlay_index_same(const struct attr_extra *ae1, const struct attr_extra *ae2)
+overlay_index_same(const struct attr *a1, const struct attr *a2)
{
- if(!ae1 && ae2)
+ if(!a1 && a2)
return false;
- if(!ae2 && ae1)
+ if(!a2 && a1)
return false;
- if(!ae1 && !ae2)
+ if(!a1 && !a2)
return true;
- return !memcmp(&(ae1->evpn_overlay), &(ae2->evpn_overlay), sizeof(struct overlay_index));
+ return !memcmp(&(a1->evpn_overlay), &(a2->evpn_overlay), sizeof(struct overlay_index));
}
/* Unknown transit attribute. */
@@ -532,34 +532,6 @@ transit_finish (void)
/* Attribute hash routines. */
static struct hash *attrhash;
-static struct attr_extra *
-bgp_attr_extra_new (void)
-{
- struct attr_extra *extra;
- extra = XCALLOC (MTYPE_ATTR_EXTRA, sizeof (struct attr_extra));
- extra->label_index = BGP_INVALID_LABEL_INDEX;
- extra->label = MPLS_INVALID_LABEL;
- return extra;
-}
-
-void
-bgp_attr_extra_free (struct attr *attr)
-{
- if (attr->extra)
- {
- XFREE (MTYPE_ATTR_EXTRA, attr->extra);
- attr->extra = NULL;
- }
-}
-
-struct attr_extra *
-bgp_attr_extra_get (struct attr *attr)
-{
- if (!attr->extra)
- attr->extra = bgp_attr_extra_new();
- return attr->extra;
-}
-
/* Shallow copy of an attribute
* Though, not so shallow that it doesn't copy the contents
* of the attr_extra pointed to by 'extra'
@@ -567,33 +539,7 @@ bgp_attr_extra_get (struct attr *attr)
void
bgp_attr_dup (struct attr *new, struct attr *orig)
{
- struct attr_extra *extra = new->extra;
-
*new = *orig;
- /* if caller provided attr_extra space, use it in any case.
- *
- * This is neccesary even if orig->extra equals NULL, because otherwise
- * memory may be later allocated on the heap by bgp_attr_extra_get.
- *
- * That memory would eventually be leaked, because the caller must not
- * call bgp_attr_extra_free if he provided attr_extra on the stack.
- */
- if (extra)
- {
- new->extra = extra;
- memset(new->extra, 0, sizeof(struct attr_extra));
- new->extra->label_index = BGP_INVALID_LABEL_INDEX;
- new->extra->label = MPLS_INVALID_LABEL;
-
- if (orig->extra) {
- *new->extra = *orig->extra;
- }
- }
- else if (orig->extra)
- {
- new->extra = bgp_attr_extra_new();
- *new->extra = *orig->extra;
- }
}
void
@@ -605,21 +551,18 @@ bgp_attr_deep_dup (struct attr *new, struct attr *orig)
if (orig->community)
new->community = community_dup(orig->community);
- if (orig->extra)
- {
- if (orig->extra->ecommunity)
- new->extra->ecommunity = ecommunity_dup(orig->extra->ecommunity);
- if (orig->extra->cluster)
- new->extra->cluster = cluster_dup(orig->extra->cluster);
- if (orig->extra->transit)
- new->extra->transit = transit_dup(orig->extra->transit);
- if (orig->extra->encap_subtlvs)
- new->extra->encap_subtlvs = encap_tlv_dup(orig->extra->encap_subtlvs);
+ if (orig->ecommunity)
+ new->ecommunity = ecommunity_dup(orig->ecommunity);
+ if (orig->cluster)
+ new->cluster = cluster_dup(orig->cluster);
+ if (orig->transit)
+ new->transit = transit_dup(orig->transit);
+ if (orig->encap_subtlvs)
+ new->encap_subtlvs = encap_tlv_dup(orig->encap_subtlvs);
#if ENABLE_BGP_VNC
- if (orig->extra->vnc_subtlvs)
- new->extra->vnc_subtlvs = encap_tlv_dup(orig->extra->vnc_subtlvs);
+ if (orig->vnc_subtlvs)
+ new->vnc_subtlvs = encap_tlv_dup(orig->vnc_subtlvs);
#endif
- }
}
void
@@ -631,21 +574,18 @@ bgp_attr_deep_free (struct attr *attr)
if (attr->community)
community_free(attr->community);
- if (attr->extra)
- {
- if (attr->extra->ecommunity)
- ecommunity_free(&attr->extra->ecommunity);
- if (attr->extra->cluster)
- cluster_free(attr->extra->cluster);
- if (attr->extra->transit)
- transit_free(attr->extra->transit);
- if (attr->extra->encap_subtlvs)
- encap_free(attr->extra->encap_subtlvs);
+ if (attr->ecommunity)
+ ecommunity_free(&attr->ecommunity);
+ if (attr->cluster)
+ cluster_free(attr->cluster);
+ if (attr->transit)
+ transit_free(attr->transit);
+ if (attr->encap_subtlvs)
+ encap_free(attr->encap_subtlvs);
#if ENABLE_BGP_VNC
- if (attr->extra->vnc_subtlvs)
- encap_free(attr->extra->vnc_subtlvs);
+ if (attr->vnc_subtlvs)
+ encap_free(attr->vnc_subtlvs);
#endif
- }
}
unsigned long int
@@ -664,7 +604,6 @@ unsigned int
attrhash_key_make (void *p)
{
const struct attr *attr = (struct attr *) p;
- const struct attr_extra *extra = attr->extra;
uint32_t key = 0;
#define MIX(val) key = jhash_1word(val, key)
@@ -678,43 +617,37 @@ attrhash_key_make (void *p)
key += attr->med;
key += attr->local_pref;
- if (extra)
- {
- MIX(extra->aggregator_as);
- MIX(extra->aggregator_addr.s_addr);
- MIX(extra->weight);
- MIX(extra->mp_nexthop_global_in.s_addr);
- MIX(extra->originator_id.s_addr);
- MIX(extra->tag);
- MIX(extra->label);
- MIX(extra->label_index);
- }
-
+ MIX(attr->aggregator_as);
+ MIX(attr->aggregator_addr.s_addr);
+ MIX(attr->weight);
+ MIX(attr->mp_nexthop_global_in.s_addr);
+ MIX(attr->originator_id.s_addr);
+ MIX(attr->tag);
+ MIX(attr->label);
+ MIX(attr->label_index);
+
if (attr->aspath)
MIX(aspath_key_make (attr->aspath));
if (attr->community)
MIX(community_hash_make (attr->community));
-
- if (extra)
- {
- if (extra->lcommunity)
- MIX(lcommunity_hash_make (extra->lcommunity));
- if (extra->ecommunity)
- MIX(ecommunity_hash_make (extra->ecommunity));
- if (extra->cluster)
- MIX(cluster_hash_key_make (extra->cluster));
- if (extra->transit)
- MIX(transit_hash_key_make (extra->transit));
- if (extra->encap_subtlvs)
- MIX(encap_hash_key_make (extra->encap_subtlvs));
+
+ if (attr->lcommunity)
+ MIX(lcommunity_hash_make (attr->lcommunity));
+ if (attr->ecommunity)
+ MIX(ecommunity_hash_make (attr->ecommunity));
+ if (attr->cluster)
+ MIX(cluster_hash_key_make (attr->cluster));
+ if (attr->transit)
+ MIX(transit_hash_key_make (attr->transit));
+ if (attr->encap_subtlvs)
+ MIX(encap_hash_key_make (attr->encap_subtlvs));
#if ENABLE_BGP_VNC
- if (extra->vnc_subtlvs)
- MIX(encap_hash_key_make (extra->vnc_subtlvs));
+ if (attr->vnc_subtlvs)
+ MIX(encap_hash_key_make (attr->vnc_subtlvs));
#endif
- MIX(extra->mp_nexthop_len);
- key = jhash(extra->mp_nexthop_global.s6_addr, IPV6_MAX_BYTELEN, key);
- key = jhash(extra->mp_nexthop_local.s6_addr, IPV6_MAX_BYTELEN, key);
- }
+ MIX(attr->mp_nexthop_len);
+ key = jhash(attr->mp_nexthop_global.s6_addr, IPV6_MAX_BYTELEN, key);
+ key = jhash(attr->mp_nexthop_local.s6_addr, IPV6_MAX_BYTELEN, key);
return key;
}
@@ -734,38 +667,30 @@ attrhash_cmp (const void *p1, const void *p2)
&& attr1->local_pref == attr2->local_pref
&& attr1->rmap_change_flags == attr2->rmap_change_flags)
{
- const struct attr_extra *ae1 = attr1->extra;
- const struct attr_extra *ae2 = attr2->extra;
-
- if (ae1 && ae2
- && ae1->aggregator_as == ae2->aggregator_as
- && ae1->aggregator_addr.s_addr == ae2->aggregator_addr.s_addr
- && ae1->weight == ae2->weight
- && ae1->tag == ae2->tag
- && ae1->label_index == ae2->label_index
- && ae1->mp_nexthop_len == ae2->mp_nexthop_len
- && IPV6_ADDR_SAME (&ae1->mp_nexthop_global, &ae2->mp_nexthop_global)
- && IPV6_ADDR_SAME (&ae1->mp_nexthop_local, &ae2->mp_nexthop_local)
- && IPV4_ADDR_SAME (&ae1->mp_nexthop_global_in, &ae2->mp_nexthop_global_in)
- && ae1->ecommunity == ae2->ecommunity
- && ae1->lcommunity == ae2->lcommunity
- && ae1->cluster == ae2->cluster
- && ae1->transit == ae2->transit
- && (ae1->encap_tunneltype == ae2->encap_tunneltype)
- && encap_same(ae1->encap_subtlvs, ae2->encap_subtlvs)
+ if (attr1->aggregator_as == attr2->aggregator_as
+ && attr1->aggregator_addr.s_addr == attr2->aggregator_addr.s_addr
+ && attr1->weight == attr2->weight
+ && attr1->tag == attr2->tag
+ && attr1->label_index == attr2->label_index
+ && attr1->mp_nexthop_len == attr2->mp_nexthop_len
+ && IPV6_ADDR_SAME (&attr1->mp_nexthop_global, &attr2->mp_nexthop_global)
+ && IPV6_ADDR_SAME (&attr1->mp_nexthop_local, &attr2->mp_nexthop_local)
+ && IPV4_ADDR_SAME (&attr1->mp_nexthop_global_in, &attr2->mp_nexthop_global_in)
+ && attr1->ecommunity == attr2->ecommunity
+ && attr1->lcommunity == attr2->lcommunity
+ && attr1->cluster == attr2->cluster
+ && attr1->transit == attr2->transit
+ && (attr1->encap_tunneltype == attr2->encap_tunneltype)
+ && encap_same(attr1->encap_subtlvs, attr2->encap_subtlvs)
#if ENABLE_BGP_VNC
- && encap_same(ae1->vnc_subtlvs, ae2->vnc_subtlvs)
+ && encap_same(attr1->vnc_subtlvs, attr2->vnc_subtlvs)
#endif
- && IPV4_ADDR_SAME (&ae1->originator_id, &ae2->originator_id)
- && overlay_index_same(ae1, ae2))
+ && IPV4_ADDR_SAME (&attr1->originator_id, &attr2->originator_id)
+ && overlay_index_same(attr1, attr2))
return 1;
- else if (ae1 || ae2)
- return 0;
- /* neither attribute has extra attributes, so they're same */
- return 1;
}
- else
- return 0;
+
+ return 0;
}
static void
@@ -780,7 +705,6 @@ attrhash_init (void)
static void
attr_vfree (void *attr)
{
- bgp_attr_extra_free ((struct attr *)attr);
XFREE (MTYPE_ATTR, attr);
}
@@ -813,24 +737,19 @@ attr_show_all (struct vty *vty)
static void *
bgp_attr_hash_alloc (void *p)
{
- const struct attr * val = (const struct attr *) p;
+ struct attr * val = (struct attr *) p;
struct attr *attr;
attr = XMALLOC (MTYPE_ATTR, sizeof (struct attr));
*attr = *val;
- if (val->extra)
- {
- attr->extra = bgp_attr_extra_new ();
- *attr->extra = *val->extra;
- if (val->extra->encap_subtlvs) {
- val->extra->encap_subtlvs = NULL;
- }
+ if (val->encap_subtlvs) {
+ val->encap_subtlvs = NULL;
+ }
#if ENABLE_BGP_VNC
- if (val->extra->vnc_subtlvs) {
- val->extra->vnc_subtlvs = NULL;
- }
+ if (val->vnc_subtlvs) {
+ val->vnc_subtlvs = NULL;
+ }
#endif
- }
attr->refcnt = 0;
return attr;
}
@@ -856,56 +775,51 @@ bgp_attr_intern (struct attr *attr)
else
attr->community->refcnt++;
}
- if (attr->extra)
+
+ if (attr->ecommunity)
{
- struct attr_extra *attre = attr->extra;
-
- if (attre->ecommunity)
- {
- if (! attre->ecommunity->refcnt)
- attre->ecommunity = ecommunity_intern (attre->ecommunity);
- else
- attre->ecommunity->refcnt++;
-
- }
- if (attre->lcommunity)
- {
- if (! attre->lcommunity->refcnt)
- attre->lcommunity = lcommunity_intern (attre->lcommunity);
- else
- attre->lcommunity->refcnt++;
- }
- if (attre->cluster)
- {
- if (! attre->cluster->refcnt)
- attre->cluster = cluster_intern (attre->cluster);
- else
- attre->cluster->refcnt++;
- }
- if (attre->transit)
- {
- if (! attre->transit->refcnt)
- attre->transit = transit_intern (attre->transit);
- else
- attre->transit->refcnt++;
- }
- if (attre->encap_subtlvs)
- {
- if (! attre->encap_subtlvs->refcnt)
- attre->encap_subtlvs = encap_intern (attre->encap_subtlvs, ENCAP_SUBTLV_TYPE);
- else
- attre->encap_subtlvs->refcnt++;
- }
+ if (! attr->ecommunity->refcnt)
+ attr->ecommunity = ecommunity_intern (attr->ecommunity);
+ else
+ attr->ecommunity->refcnt++;
+ }
+ if (attr->lcommunity)
+ {
+ if (! attr->lcommunity->refcnt)
+ attr->lcommunity = lcommunity_intern (attr->lcommunity);
+ else
+ attr->lcommunity->refcnt++;
+ }
+ if (attr->cluster)
+ {
+ if (! attr->cluster->refcnt)
+ attr->cluster = cluster_intern (attr->cluster);
+ else
+ attr->cluster->refcnt++;
+ }
+ if (attr->transit)
+ {
+ if (! attr->transit->refcnt)
+ attr->transit = transit_intern (attr->transit);
+ else
+ attr->transit->refcnt++;
+ }
+ if (attr->encap_subtlvs)
+ {
+ if (! attr->encap_subtlvs->refcnt)
+ attr->encap_subtlvs = encap_intern (attr->encap_subtlvs, ENCAP_SUBTLV_TYPE);
+ else
+ attr->encap_subtlvs->refcnt++;
+ }
#if ENABLE_BGP_VNC
- if (attre->vnc_subtlvs)
- {
- if (! attre->vnc_subtlvs->refcnt)
- attre->vnc_subtlvs = encap_intern (attre->vnc_subtlvs, VNC_SUBTLV_TYPE);
- else
- attre->vnc_subtlvs->refcnt++;
- }
-#endif
+ if (attr->vnc_subtlvs)
+ {
+ if (! attr->vnc_subtlvs->refcnt)
+ attr->vnc_subtlvs = encap_intern (attr->vnc_subtlvs, VNC_SUBTLV_TYPE);
+ else
+ attr->vnc_subtlvs->refcnt++;
}
+#endif
find = (struct attr *) hash_get (attrhash, attr, bgp_attr_hash_alloc);
find->refcnt++;
@@ -932,26 +846,23 @@ bgp_attr_refcount (struct attr *attr)
if (attr->community)
attr->community->refcnt++;
- if (attr->extra)
- {
- struct attr_extra *attre = attr->extra;
- if (attre->ecommunity)
- attre->ecommunity->refcnt++;
+ if (attr->ecommunity)
+ attr->ecommunity->refcnt++;
- if (attre->cluster)
- attre->cluster->refcnt++;
+ if (attr->cluster)
+ attr->cluster->refcnt++;
- if (attre->transit)
- attre->transit->refcnt++;
+ if (attr->transit)
+ attr->transit->refcnt++;
- if (attre->encap_subtlvs)
- attre->encap_subtlvs->refcnt++;
+ if (attr->encap_subtlvs)
+ attr->encap_subtlvs->refcnt++;
#if ENABLE_BGP_VNC
- if (attre->vnc_subtlvs)
- attre->vnc_subtlvs->refcnt++;
+ if (attr->vnc_subtlvs)
+ attr->vnc_subtlvs->refcnt++;
#endif
- }
+
attr->refcnt++;
return attr;
}
@@ -961,18 +872,17 @@ struct attr *
bgp_attr_default_set (struct attr *attr, u_char origin)
{
memset (attr, 0, sizeof (struct attr));
- bgp_attr_extra_get (attr);
attr->origin = origin;
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_ORIGIN);
attr->aspath = aspath_empty ();
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AS_PATH);
- attr->extra->weight = BGP_ATTR_DEFAULT_WEIGHT;
- attr->extra->tag = 0;
- attr->extra->label_index = BGP_INVALID_LABEL_INDEX;
- attr->extra->label = MPLS_INVALID_LABEL;
+ attr->weight = BGP_ATTR_DEFAULT_WEIGHT;
+ attr->tag = 0;
+ attr->label_index = BGP_INVALID_LABEL_INDEX;
+ attr->label = MPLS_INVALID_LABEL;
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
- attr->extra->mp_nexthop_len = IPV6_MAX_BYTELEN;
+ attr->mp_nexthop_len = IPV6_MAX_BYTELEN;
return attr;
}
@@ -986,11 +896,8 @@ bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
{
struct attr attr;
struct attr *new;
- struct attr_extra attre;
memset (&attr, 0, sizeof (struct attr));
- memset (&attre, 0, sizeof (struct attr_extra));
- attr.extra = &attre;
/* Origin attribute. */
attr.origin = origin;
@@ -1012,18 +919,20 @@ bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES);
}
- attre.label_index = BGP_INVALID_LABEL_INDEX;
- attre.label = MPLS_INVALID_LABEL;
- attre.weight = BGP_ATTR_DEFAULT_WEIGHT;
- attre.mp_nexthop_len = IPV6_MAX_BYTELEN;
+ attr.label_index = BGP_INVALID_LABEL_INDEX;
+ attr.label = MPLS_INVALID_LABEL;
+ attr.weight = BGP_ATTR_DEFAULT_WEIGHT;
+ attr.mp_nexthop_len = IPV6_MAX_BYTELEN;
if (! as_set || atomic_aggregate)
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE);
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR);
if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION))
- attre.aggregator_as = bgp->confed_id;
+ attr.aggregator_as = bgp->confed_id;
else
- attre.aggregator_as = bgp->as;
- attre.aggregator_addr = bgp->router_id;
+ attr.aggregator_as = bgp->as;
+ attr.aggregator_addr = bgp->router_id;
+ attr.label_index = BGP_INVALID_LABEL_INDEX;
+ attr.label = MPLS_INVALID_LABEL;
new = bgp_attr_intern (&attr);
@@ -1044,31 +953,28 @@ bgp_attr_unintern_sub (struct attr *attr)
community_unintern (&attr->community);
UNSET_FLAG(attr->flag, ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES));
- if (attr->extra)
- {
- if (attr->extra->ecommunity)
- ecommunity_unintern (&attr->extra->ecommunity);
- UNSET_FLAG(attr->flag, ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES));
+ if (attr->ecommunity)
+ ecommunity_unintern (&attr->ecommunity);
+ UNSET_FLAG(attr->flag, ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES));
- if (attr->extra->lcommunity)
- lcommunity_unintern (&attr->extra->lcommunity);
- UNSET_FLAG(attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES));
+ if (attr->lcommunity)
+ lcommunity_unintern (&attr->lcommunity);
+ UNSET_FLAG(attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES));
- if (attr->extra->cluster)
- cluster_unintern (attr->extra->cluster);
- UNSET_FLAG(attr->flag, ATTR_FLAG_BIT (BGP_ATTR_CLUSTER_LIST));
-
- if (attr->extra->transit)
- transit_unintern (attr->extra->transit);
+ if (attr->cluster)
+ cluster_unintern (attr->cluster);
+ UNSET_FLAG(attr->flag, ATTR_FLAG_BIT (BGP_ATTR_CLUSTER_LIST));
+
+ if (attr->transit)
+ transit_unintern (attr->transit);
- if (attr->extra->encap_subtlvs)
- encap_unintern (&attr->extra->encap_subtlvs, ENCAP_SUBTLV_TYPE);
+ if (attr->encap_subtlvs)
+ encap_unintern (&attr->encap_subtlvs, ENCAP_SUBTLV_TYPE);
#if ENABLE_BGP_VNC
- if (attr->extra->vnc_subtlvs)
- encap_unintern (&attr->extra->vnc_subtlvs, VNC_SUBTLV_TYPE);
+ if (attr->vnc_subtlvs)
+ encap_unintern (&attr->vnc_subtlvs, VNC_SUBTLV_TYPE);
#endif
- }
}
/* Free bgp attribute and aspath. */
@@ -1078,25 +984,17 @@ bgp_attr_unintern (struct attr **pattr)
struct attr *attr = *pattr;
struct attr *ret;
struct attr tmp;
- struct attr_extra tmp_extra;
-
+
/* Decrement attribute reference. */
attr->refcnt--;
-
+
tmp = *attr;
- if (attr->extra)
- {
- tmp.extra = &tmp_extra;
- memcpy (tmp.extra, attr->extra, sizeof (struct attr_extra));
- }
-
/* If reference becomes zero then free attribute object. */
if (attr->refcnt == 0)
{
ret = hash_release (attrhash, attr);
assert (ret != NULL);
- bgp_attr_extra_free (attr);
XFREE (MTYPE_ATTR, attr);
*pattr = NULL;
}
@@ -1117,37 +1015,33 @@ bgp_attr_flush (struct attr *attr)
community_free (attr->community);
attr->community = NULL;
}
- if (attr->extra)
- {
- struct attr_extra *attre = attr->extra;
- if (attre->ecommunity && ! attre->ecommunity->refcnt)
- ecommunity_free (&attre->ecommunity);
- if (attre->lcommunity && ! attre->lcommunity->refcnt)
- lcommunity_free (&attre->lcommunity);
- if (attre->cluster && ! attre->cluster->refcnt)
- {
- cluster_free (attre->cluster);
- attre->cluster = NULL;
- }
- if (attre->transit && ! attre->transit->refcnt)
- {
- transit_free (attre->transit);
- attre->transit = NULL;
- }
- if (attre->encap_subtlvs && ! attre->encap_subtlvs->refcnt)
- {
- encap_free(attre->encap_subtlvs);
- attre->encap_subtlvs = NULL;
- }
+ if (attr->ecommunity && ! attr->ecommunity->refcnt)
+ ecommunity_free (&attr->ecommunity);
+ if (attr->lcommunity && ! attr->lcommunity->refcnt)
+ lcommunity_free (&attr->lcommunity);
+ if (attr->cluster && ! attr->cluster->refcnt)
+ {
+ cluster_free (attr->cluster);
+ attr->cluster = NULL;
+ }
+ if (attr->transit && ! attr->transit->refcnt)
+ {
+ transit_free (attr->transit);
+ attr->transit = NULL;
+ }
+ if (attr->encap_subtlvs && ! attr->encap_subtlvs->refcnt)
+ {
+ encap_free(attr->encap_subtlvs);
+ attr->encap_subtlvs = NULL;
+ }
#if ENABLE_BGP_VNC
- if (attre->vnc_subtlvs && ! attre->vnc_subtlvs->refcnt)
- {
- encap_free(attre->vnc_subtlvs);
- attre->vnc_subtlvs = NULL;
- }
-#endif
+ if (attr->vnc_subtlvs && ! attr->vnc_subtlvs->refcnt)
+ {
+ encap_free(attr->vnc_subtlvs);
+ attr->vnc_subtlvs = NULL;
}
+#endif
}
/* Implement draft-scudder-idr-optional-transitive behaviour and
@@ -1630,7 +1524,6 @@ bgp_attr_aggregator (struct bgp_attr_parser_args *args)
const bgp_size_t length = args->length;
int wantedlen = 6;
- struct attr_extra *attre = bgp_attr_extra_get (attr);
/* peer with AS4 will send 4 Byte AS, peer without will send 2 Byte */
if (CHECK_FLAG (peer->cap, PEER_CAP_AS4_RCV))
@@ -1645,10 +1538,10 @@ bgp_attr_aggregator (struct bgp_attr_parser_args *args)
}
if ( CHECK_FLAG (peer->cap, PEER_CAP_AS4_RCV ) )
- attre->aggregator_as = stream_getl (peer->ibuf);
+ attr->aggregator_as = stream_getl (peer->ibuf);
else
- attre->aggregator_as = stream_getw (peer->ibuf);
- attre->aggregator_addr.s_addr = stream_get_ipv4 (peer->ibuf);
+ attr->aggregator_as = stream_getw (peer->ibuf);
+ attr->aggregator_addr.s_addr = stream_get_ipv4 (peer->ibuf);
/* Set atomic aggregate flag. */
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR);
@@ -1692,7 +1585,6 @@ bgp_attr_munge_as4_attrs (struct peer *const peer,
{
int ignore_as4_path = 0;
struct aspath *newpath;
- struct attr_extra *attre = attr->extra;
if (!attr->aspath)
{
@@ -1732,8 +1624,6 @@ bgp_attr_munge_as4_attrs (struct peer *const peer,
{
if (attr->flag & (ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR) ) )
{
- assert (attre);
-
/* received both.
* if the as_number in aggregator is not AS_TRANS,
* then AS4_AGGREGATOR and AS4_PATH shall be ignored
@@ -1746,7 +1636,7 @@ bgp_attr_munge_as4_attrs (struct peer *const peer,
* Aggregating node and the AS_PATH is to be
* constructed "as in all other cases"
*/
- if (attre->aggregator_as != BGP_AS_TRANS)
+ if (attr->aggregator_as != BGP_AS_TRANS)
{
/* ignore */
if ( BGP_DEBUG(as4, AS4))
@@ -1759,8 +1649,8 @@ bgp_attr_munge_as4_attrs (struct peer *const peer,
else
{
/* "New_aggregator shall be taken as aggregator" */
- attre->aggregator_as = as4_aggregator;
- attre->aggregator_addr.s_addr = as4_aggregator_addr->s_addr;
+ attr->aggregator_as = as4_aggregator;
+ attr->aggregator_addr.s_addr = as4_aggregator_addr->s_addr;
}
}
else
@@ -1774,7 +1664,7 @@ bgp_attr_munge_as4_attrs (struct peer *const peer,
zlog_debug ("[AS4] %s BGP not AS4 capable peer send"
" AS4_AGGREGATOR but no AGGREGATOR, will take"
" it as if AGGREGATOR with AS_TRANS had been there", peer->host);
- (attre = bgp_attr_extra_get (attr))->aggregator_as = as4_aggregator;
+ attr->aggregator_as = as4_aggregator;
/* sweep it under the carpet and simulate a "good" AGGREGATOR */
attr->flag |= (ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR));
}
@@ -1838,8 +1728,7 @@ bgp_attr_originator_id (struct bgp_attr_parser_args *args)
args->total);
}
- (bgp_attr_extra_get (attr))->originator_id.s_addr
- = stream_get_ipv4 (peer->ibuf);
+ attr->originator_id.s_addr = stream_get_ipv4 (peer->ibuf);
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID);
@@ -1863,8 +1752,7 @@ bgp_attr_cluster_list (struct bgp_attr_parser_args *args)
args->total);
}
- (bgp_attr_extra_get (attr))->cluster
- = cluster_parse ((struct in_addr *)stream_pnt (peer->ibuf), length);
+ attr->cluster = cluster_parse ((struct in_addr *)stream_pnt (peer->ibuf), length);
/* XXX: Fix cluster_parse to use stream API and then remove this */
stream_forward_getp (peer->ibuf, length);
@@ -1888,7 +1776,6 @@ bgp_mp_reach_parse (struct bgp_attr_parser_args *args,
struct peer *const peer = args->peer;
struct attr *const attr = args->attr;
const bgp_size_t length = args->length;
- struct attr_extra *attre = bgp_attr_extra_get(attr);
/* Set end of packet. */
s = BGP_INPUT(peer);
@@ -1921,53 +1808,53 @@ bgp_mp_reach_parse (struct bgp_attr_parser_args *args,
}
/* Get nexthop length. */
- attre->mp_nexthop_len = stream_getc (s);
+ attr->mp_nexthop_len = stream_getc (s);
- if (LEN_LEFT < attre->mp_nexthop_len)
+ if (LEN_LEFT < attr->mp_nexthop_len)
{
zlog_info ("%s: %s, MP nexthop length, %u, goes past end of attribute",
- __func__, peer->host, attre->mp_nexthop_len);
+ __func__, peer->host, attr->mp_nexthop_len);
return BGP_ATTR_PARSE_ERROR_NOTIFYPLS;
}
/* Nexthop length check. */
- switch (attre->mp_nexthop_len)
+ switch (attr->mp_nexthop_len)
{
case BGP_ATTR_NHLEN_IPV4:
- stream_get (&attre->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN);
+ stream_get (&attr->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN);
/* Probably needed for RFC 2283 */
if (attr->nexthop.s_addr == 0)
- memcpy(&attr->nexthop.s_addr, &attre->mp_nexthop_global_in, IPV4_MAX_BYTELEN);
+ memcpy(&attr->nexthop.s_addr, &attr->mp_nexthop_global_in, IPV4_MAX_BYTELEN);
break;
case BGP_ATTR_NHLEN_VPNV4:
stream_getl (s); /* RD high */
stream_getl (s); /* RD low */
- stream_get (&attre->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN);
+ stream_get (&attr->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN);
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL:
case BGP_ATTR_NHLEN_VPNV6_GLOBAL:
- if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV6_GLOBAL)
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV6_GLOBAL)
{
stream_getl (s); /* RD high */
stream_getl (s); /* RD low */
}
- stream_get (&attre->mp_nexthop_global, s, IPV6_MAX_BYTELEN);
+ stream_get (&attr->mp_nexthop_global, s, IPV6_MAX_BYTELEN);
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL:
case BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL:
- if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL)
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL)
{
stream_getl (s); /* RD high */
stream_getl (s); /* RD low */
}
- stream_get (&attre->mp_nexthop_global, s, IPV6_MAX_BYTELEN);
- if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL)
+ stream_get (&attr->mp_nexthop_global, s, IPV6_MAX_BYTELEN);
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL)
{
stream_getl (s); /* RD high */
stream_getl (s); /* RD low */
}
- stream_get (&attre->mp_nexthop_local, s, IPV6_MAX_BYTELEN);
- if (! IN6_IS_ADDR_LINKLOCAL (&attre->mp_nexthop_local))
+ stream_get (&attr->mp_nexthop_local, s, IPV6_MAX_BYTELEN);
+ if (! IN6_IS_ADDR_LINKLOCAL (&attr->mp_nexthop_local))
{
char buf1[INET6_ADDRSTRLEN];
char buf2[INET6_ADDRSTRLEN];
@@ -1975,17 +1862,17 @@ bgp_mp_reach_parse (struct bgp_attr_parser_args *args,
if (bgp_debug_update(peer, NULL, NULL, 1))
zlog_debug ("%s rcvd nexthops %s, %s -- ignoring non-LL value",
peer->host,
- inet_ntop (AF_INET6, &attre->mp_nexthop_global,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_global,
buf1, INET6_ADDRSTRLEN),
- inet_ntop (AF_INET6, &attre->mp_nexthop_local,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_local,
buf2, INET6_ADDRSTRLEN));
- attre->mp_nexthop_len = IPV6_MAX_BYTELEN;
+ attr->mp_nexthop_len = IPV6_MAX_BYTELEN;
}
break;
default:
zlog_info ("%s: (%s) Wrong multiprotocol next hop length: %d",
- __func__, peer->host, attre->mp_nexthop_len);
+ __func__, peer->host, attr->mp_nexthop_len);
return BGP_ATTR_PARSE_ERROR_NOTIFYPLS;
}
@@ -2087,18 +1974,16 @@ bgp_attr_large_community (struct bgp_attr_parser_args *args)
*/
if (length == 0)
{
- if (attr->extra)
- attr->extra->lcommunity = NULL;
+ attr->lcommunity = NULL;
/* Empty extcomm doesn't seem to be invalid per se */
return BGP_ATTR_PARSE_PROCEED;
}
- (bgp_attr_extra_get (attr))->lcommunity =
- lcommunity_parse ((u_int8_t *)stream_pnt (peer->ibuf), length);
+ attr->lcommunity = lcommunity_parse ((u_int8_t *)stream_pnt (peer->ibuf), length);
/* XXX: fix ecommunity_parse to use stream API */
stream_forward_getp (peer->ibuf, length);
- if (attr->extra && !attr->extra->lcommunity)
+ if (!attr->lcommunity)
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_OPT_ATTR_ERR,
args->total);
@@ -2119,18 +2004,16 @@ bgp_attr_ext_communities (struct bgp_attr_parser_args *args)
if (length == 0)
{
- if (attr->extra)
- attr->extra->ecommunity = NULL;
+ attr->ecommunity = NULL;
/* Empty extcomm doesn't seem to be invalid per se */
return BGP_ATTR_PARSE_PROCEED;
}
- (bgp_attr_extra_get (attr))->ecommunity =
- ecommunity_parse ((u_int8_t *)stream_pnt (peer->ibuf), length);
+ attr->ecommunity = ecommunity_parse ((u_int8_t *)stream_pnt (peer->ibuf), length);
/* XXX: fix ecommunity_parse to use stream API */
stream_forward_getp (peer->ibuf, length);
- if (attr->extra && !attr->extra->ecommunity)
+ if (!attr->ecommunity)
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_OPT_ATTR_ERR,
args->total);
@@ -2138,8 +2021,8 @@ bgp_attr_ext_communities (struct bgp_attr_parser_args *args)
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES);
/* Extract MAC mobility sequence number, if any. */
- attr->extra->mm_seqnum = bgp_attr_mac_mobility_seqnum (attr, &sticky);
- attr->extra->sticky = sticky;
+ attr->mm_seqnum = bgp_attr_mac_mobility_seqnum (attr, &sticky);
+ attr->sticky = sticky;
return BGP_ATTR_PARSE_PROCEED;
}
@@ -2155,7 +2038,6 @@ bgp_attr_encap(
u_char *startp)
{
bgp_size_t total;
- struct attr_extra *attre = NULL;
struct bgp_attr_encap_subtlv *stlv_last = NULL;
uint16_t tunneltype = 0;
@@ -2230,37 +2112,30 @@ bgp_attr_encap(
length -= sublength;
/* attach tlv to encap chain */
- if (!attre) {
- attre = bgp_attr_extra_get(attr);
- if (BGP_ATTR_ENCAP == type) {
- for (stlv_last = attre->encap_subtlvs; stlv_last && stlv_last->next;
- stlv_last = stlv_last->next);
- if (stlv_last) {
- stlv_last->next = tlv;
- } else {
- attre->encap_subtlvs = tlv;
- }
+ if (BGP_ATTR_ENCAP == type) {
+ for (stlv_last = attr->encap_subtlvs; stlv_last && stlv_last->next;
+ stlv_last = stlv_last->next);
+ if (stlv_last) {
+ stlv_last->next = tlv;
+ } else {
+ attr->encap_subtlvs = tlv;
+ }
#if ENABLE_BGP_VNC
- } else {
- for (stlv_last = attre->vnc_subtlvs; stlv_last && stlv_last->next;
- stlv_last = stlv_last->next);
- if (stlv_last) {
- stlv_last->next = tlv;
- } else {
- attre->vnc_subtlvs = tlv;
- }
-#endif
- }
} else {
- stlv_last->next = tlv;
+ for (stlv_last = attr->vnc_subtlvs; stlv_last && stlv_last->next;
+ stlv_last = stlv_last->next);
+ if (stlv_last) {
+ stlv_last->next = tlv;
+ } else {
+ attr->vnc_subtlvs = tlv;
+ }
+#endif
}
- stlv_last = tlv;
+ stlv_last->next = tlv;
}
if (BGP_ATTR_ENCAP == type) {
- if (!attre)
- attre = bgp_attr_extra_get(attr);
- attre->encap_tunneltype = tunneltype;
+ attr->encap_tunneltype = tunneltype;
}
if (length) {
@@ -2319,14 +2194,14 @@ bgp_attr_prefix_sid (struct bgp_attr_parser_args *args, struct bgp_nlri *mp_upda
args->total);
/* Store label index; subsequently, we'll check on address-family */
- (bgp_attr_extra_get (attr))->label_index = label_index;
+ attr->label_index = label_index;
/*
* Ignore the Label index attribute unless received for labeled-unicast
* SAFI.
*/
if (!mp_update->length || mp_update->safi != SAFI_LABELED_UNICAST)
- attr->extra->label_index = BGP_INVALID_LABEL_INDEX;
+ attr->label_index = BGP_INVALID_LABEL_INDEX;
}
/* Placeholder code for the IPv6 SID type */
@@ -2382,7 +2257,6 @@ bgp_attr_unknown (struct bgp_attr_parser_args *args)
{
bgp_size_t total = args->total;
struct transit *transit;
- struct attr_extra *attre;
struct peer *const peer = args->peer;
struct attr *const attr = args->attr;
u_char *const startp = args->startp;
@@ -2420,10 +2294,10 @@ bgp_attr_unknown (struct bgp_attr_parser_args *args)
SET_FLAG (*startp, BGP_ATTR_FLAG_PARTIAL);
/* Store transitive attribute to the end of attr->transit. */
- if (! ((attre = bgp_attr_extra_get(attr))->transit) )
- attre->transit = XCALLOC (MTYPE_TRANSIT, sizeof (struct transit));
+ if (!attr->transit)
+ attr->transit = XCALLOC (MTYPE_TRANSIT, sizeof (struct transit));
- transit = attre->transit;
+ transit = attr->transit;
if (transit->val)
transit->val = XREALLOC (MTYPE_TRANSIT_VAL, transit->val,
@@ -2805,18 +2679,15 @@ bgp_attr_parse (struct peer *peer, struct attr *attr, bgp_size_t size,
if (ret != BGP_ATTR_PARSE_PROCEED)
return ret;
}
- if (attr->extra)
- {
- /* Finally intern unknown attribute. */
- if (attr->extra->transit)
- attr->extra->transit = transit_intern (attr->extra->transit);
- if (attr->extra->encap_subtlvs)
- attr->extra->encap_subtlvs = encap_intern (attr->extra->encap_subtlvs, ENCAP_SUBTLV_TYPE);
+ /* Finally intern unknown attribute. */
+ if (attr->transit)
+ attr->transit = transit_intern (attr->transit);
+ if (attr->encap_subtlvs)
+ attr->encap_subtlvs = encap_intern (attr->encap_subtlvs, ENCAP_SUBTLV_TYPE);
#if ENABLE_BGP_VNC
- if (attr->extra->vnc_subtlvs)
- attr->extra->vnc_subtlvs = encap_intern (attr->extra->vnc_subtlvs, VNC_SUBTLV_TYPE);
+ if (attr->vnc_subtlvs)
+ attr->vnc_subtlvs = encap_intern (attr->vnc_subtlvs, VNC_SUBTLV_TYPE);
#endif
- }
return BGP_ATTR_PARSE_PROCEED;
}
@@ -2853,7 +2724,7 @@ bgp_packet_mpattr_start (struct stream *s, struct peer *peer,
else if (safi == SAFI_LABELED_UNICAST)
nh_afi = afi;
else
- nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->extra->mp_nexthop_len);
+ nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->mp_nexthop_len);
/* Nexthop */
bpacket_attr_vec_arr_set_vec (vecarr, BGP_ATTR_VEC_NH, s, attr);
@@ -2872,12 +2743,12 @@ bgp_packet_mpattr_start (struct stream *s, struct peer *peer,
stream_putc (s, 12);
stream_putl (s, 0); /* RD = 0, per RFC */
stream_putl (s, 0);
- stream_put (s, &attr->extra->mp_nexthop_global_in, 4);
+ stream_put (s, &attr->mp_nexthop_global_in, 4);
break;
case SAFI_ENCAP:
case SAFI_EVPN:
stream_putc (s, 4);
- stream_put (s, &attr->extra->mp_nexthop_global_in, 4);
+ stream_put (s, &attr->mp_nexthop_global_in, 4);
break;
default:
break;
@@ -2891,45 +2762,37 @@ bgp_packet_mpattr_start (struct stream *s, struct peer *peer,
case SAFI_LABELED_UNICAST:
case SAFI_EVPN:
{
- struct attr_extra *attre = attr->extra;
-
- assert (attr->extra);
-
- if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
stream_putc (s, BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL);
- stream_put (s, &attre->mp_nexthop_global, IPV6_MAX_BYTELEN);
- stream_put (s, &attre->mp_nexthop_local, IPV6_MAX_BYTELEN);
+ stream_put (s, &attr->mp_nexthop_global, IPV6_MAX_BYTELEN);
+ stream_put (s, &attr->mp_nexthop_local, IPV6_MAX_BYTELEN);
} else {
stream_putc (s, IPV6_MAX_BYTELEN);
- stream_put (s, &attre->mp_nexthop_global, IPV6_MAX_BYTELEN);
+ stream_put (s, &attr->mp_nexthop_global, IPV6_MAX_BYTELEN);
}
}
break;
case SAFI_MPLS_VPN:
{
- struct attr_extra *attre = attr->extra;
-
- assert (attr->extra);
- if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL) {
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL) {
stream_putc (s, 24);
stream_putl (s, 0); /* RD = 0, per RFC */
stream_putl (s, 0);
- stream_put (s, &attre->mp_nexthop_global, IPV6_MAX_BYTELEN);
- } else if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
+ stream_put (s, &attr->mp_nexthop_global, IPV6_MAX_BYTELEN);
+ } else if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
stream_putc (s, 48);
stream_putl (s, 0); /* RD = 0, per RFC */
stream_putl (s, 0);
- stream_put (s, &attre->mp_nexthop_global, IPV6_MAX_BYTELEN);
+ stream_put (s, &attr->mp_nexthop_global, IPV6_MAX_BYTELEN);
stream_putl (s, 0); /* RD = 0, per RFC */
stream_putl (s, 0);
- stream_put (s, &attre->mp_nexthop_local, IPV6_MAX_BYTELEN);
+ stream_put (s, &attr->mp_nexthop_local, IPV6_MAX_BYTELEN);
}
}
break;
case SAFI_ENCAP:
- assert (attr->extra);
stream_putc (s, IPV6_MAX_BYTELEN);
- stream_put (s, &attr->extra->mp_nexthop_global, IPV6_MAX_BYTELEN);
+ stream_put (s, &attr->mp_nexthop_global, IPV6_MAX_BYTELEN);
break;
default:
break;
@@ -2937,7 +2800,7 @@ bgp_packet_mpattr_start (struct stream *s, struct peer *peer,
break;
default:
zlog_err ("Bad nexthop when sening to %s, AFI %u SAFI %u nhlen %d",
- peer->host, afi, safi, attr->extra->mp_nexthop_len);
+ peer->host, afi, safi, attr->mp_nexthop_len);
break;
}
@@ -3007,16 +2870,16 @@ bgp_packet_mpattr_tea(
struct bgp_attr_encap_subtlv *st;
const char *attrname;
- if (!attr || !attr->extra ||
+ if (!attr ||
(attrtype == BGP_ATTR_ENCAP &&
- (!attr->extra->encap_tunneltype ||
- attr->extra->encap_tunneltype == BGP_ENCAP_TYPE_MPLS)))
+ (!attr->encap_tunneltype ||
+ attr->encap_tunneltype == BGP_ENCAP_TYPE_MPLS)))
return;
switch (attrtype) {
case BGP_ATTR_ENCAP:
attrname = "Tunnel Encap";
- subtlvs = attr->extra->encap_subtlvs;
+ subtlvs = attr->encap_subtlvs;
if (subtlvs == NULL) /* nothing to do */
return;
/*
@@ -3032,7 +2895,7 @@ bgp_packet_mpattr_tea(
#if ENABLE_BGP_VNC
case BGP_ATTR_VNC:
attrname = "VNC";
- subtlvs = attr->extra->vnc_subtlvs;
+ subtlvs = attr->vnc_subtlvs;
if (subtlvs == NULL) /* nothing to do */
return;
attrlenfield = 0; /* no outer T + L */
@@ -3071,7 +2934,7 @@ bgp_packet_mpattr_tea(
if (attrtype == BGP_ATTR_ENCAP) {
/* write outer T+L */
- stream_putw(s, attr->extra->encap_tunneltype);
+ stream_putw(s, attr->encap_tunneltype);
stream_putw(s, attrlenfield - 4);
}
@@ -3260,8 +3123,6 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
/* Aggregator. */
if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR))
{
- assert (attr->extra);
-
/* Common to BGP_ATTR_AGGREGATOR, regardless of ASN size */
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_TRANS);
stream_putc (s, BGP_ATTR_AGGREGATOR);
@@ -3270,7 +3131,7 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
{
/* AS4 capable peer */
stream_putc (s, 8);
- stream_putl (s, attr->extra->aggregator_as);
+ stream_putl (s, attr->aggregator_as);
}
else
{
@@ -3278,7 +3139,7 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
stream_putc (s, 6);
/* Is ASN representable in 2-bytes? Or must AS_TRANS be used? */
- if ( attr->extra->aggregator_as > 65535 )
+ if ( attr->aggregator_as > 65535 )
{
stream_putw (s, BGP_AS_TRANS);
@@ -3289,9 +3150,9 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
send_as4_aggregator = 1;
}
else
- stream_putw (s, (u_int16_t) attr->extra->aggregator_as);
+ stream_putw (s, (u_int16_t) attr->aggregator_as);
}
- stream_put_ipv4 (s, attr->extra->aggregator_addr.s_addr);
+ stream_put_ipv4 (s, attr->aggregator_addr.s_addr);
}
/* Community attribute. */
@@ -3316,23 +3177,22 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
/*
* Large Community attribute.
*/
- if (attr->extra &&
- CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY)
+ if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY)
&& (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES)))
{
- if (attr->extra->lcommunity->size * 12 > 255)
+ if (attr->lcommunity->size * 12 > 255)
{
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_TRANS|BGP_ATTR_FLAG_EXTLEN);
stream_putc (s, BGP_ATTR_LARGE_COMMUNITIES);
- stream_putw (s, attr->extra->lcommunity->size * 12);
+ stream_putw (s, attr->lcommunity->size * 12);
}
else
{
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_TRANS);
stream_putc (s, BGP_ATTR_LARGE_COMMUNITIES);
- stream_putc (s, attr->extra->lcommunity->size * 12);
+ stream_putc (s, attr->lcommunity->size * 12);
}
- stream_put (s, attr->extra->lcommunity->val, attr->extra->lcommunity->size * 12);
+ stream_put (s, attr->lcommunity->val, attr->lcommunity->size * 12);
}
/* Route Reflector. */
@@ -3346,7 +3206,7 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
stream_putc (s, 4);
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))
- stream_put_in_addr (s, &attr->extra->originator_id);
+ stream_put_in_addr (s, &attr->originator_id);
else
stream_put_in_addr (s, &from->remote_id);
@@ -3354,16 +3214,16 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL);
stream_putc (s, BGP_ATTR_CLUSTER_LIST);
- if (attr->extra && attr->extra->cluster)
+ if (attr->cluster)
{
- stream_putc (s, attr->extra->cluster->length + 4);
+ stream_putc (s, attr->cluster->length + 4);
/* If this peer configuration's parent BGP has cluster_id. */
if (bgp->config & BGP_CONFIG_CLUSTER_ID)
stream_put_in_addr (s, &bgp->cluster_id);
else
stream_put_in_addr (s, &bgp->router_id);
- stream_put (s, attr->extra->cluster->list,
- attr->extra->cluster->length);
+ stream_put (s, attr->cluster->list,
+ attr->cluster->length);
}
else
{
@@ -3380,26 +3240,22 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)
&& (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES)))
{
- struct attr_extra *attre = attr->extra;
-
- assert (attre);
-
if (peer->sort == BGP_PEER_IBGP
|| peer->sort == BGP_PEER_CONFED)
{
- if (attre->ecommunity->size * 8 > 255)
+ if (attr->ecommunity->size * 8 > 255)
{
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_TRANS|BGP_ATTR_FLAG_EXTLEN);
stream_putc (s, BGP_ATTR_EXT_COMMUNITIES);
- stream_putw (s, attre->ecommunity->size * 8);
+ stream_putw (s, attr->ecommunity->size * 8);
}
else
{
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_TRANS);
stream_putc (s, BGP_ATTR_EXT_COMMUNITIES);
- stream_putc (s, attre->ecommunity->size * 8);
+ stream_putc (s, attr->ecommunity->size * 8);
}
- stream_put (s, attre->ecommunity->val, attre->ecommunity->size * 8);
+ stream_put (s, attr->ecommunity->val, attr->ecommunity->size * 8);
}
else
{
@@ -3408,9 +3264,9 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
int ecom_tr_size = 0;
int i;
- for (i = 0; i < attre->ecommunity->size; i++)
+ for (i = 0; i < attr->ecommunity->size; i++)
{
- pnt = attre->ecommunity->val + (i * 8);
+ pnt = attr->ecommunity->val + (i * 8);
tbit = *pnt;
if (CHECK_FLAG (tbit, ECOMMUNITY_FLAG_NON_TRANSITIVE))
@@ -3434,9 +3290,9 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
stream_putc (s, ecom_tr_size * 8);
}
- for (i = 0; i < attre->ecommunity->size; i++)
+ for (i = 0; i < attr->ecommunity->size; i++)
{
- pnt = attre->ecommunity->val + (i * 8);
+ pnt = attr->ecommunity->val + (i * 8);
tbit = *pnt;
if (CHECK_FLAG (tbit, ECOMMUNITY_FLAG_NON_TRANSITIVE))
@@ -3455,8 +3311,7 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
{
u_int32_t label_index;
- assert (attr->extra);
- label_index = attr->extra->label_index;
+ label_index = attr->label_index;
if (label_index != BGP_INVALID_LABEL_INDEX)
{
@@ -3500,8 +3355,6 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
if ( send_as4_aggregator )
{
- assert (attr->extra);
-
/* send AS4_AGGREGATOR, at this place */
/* this section of code moved here in order to ensure the correct
* *ascending* order of attributes
@@ -3509,8 +3362,8 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_TRANS);
stream_putc (s, BGP_ATTR_AS4_AGGREGATOR);
stream_putc (s, 8);
- stream_putl (s, attr->extra->aggregator_as);
- stream_put_ipv4 (s, attr->extra->aggregator_addr.s_addr);
+ stream_putl (s, attr->aggregator_as);
+ stream_put_ipv4 (s, attr->aggregator_addr.s_addr);
}
if (((afi == AFI_IP || afi == AFI_IP6) &&
@@ -3527,8 +3380,8 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
}
/* Unknown transit attribute. */
- if (attr->extra && attr->extra->transit)
- stream_put (s, attr->extra->transit->val, attr->extra->transit->length);
+ if (attr->transit)
+ stream_put (s, attr->transit->val, attr->transit->length);
/* Return total size of attribute. */
return stream_get_endp (s) - cp;
@@ -3678,12 +3531,11 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr,
/* Aggregator. */
if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR))
{
- assert (attr->extra);
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_TRANS);
stream_putc (s, BGP_ATTR_AGGREGATOR);
stream_putc (s, 8);
- stream_putl (s, attr->extra->aggregator_as);
- stream_put_ipv4 (s, attr->extra->aggregator_addr.s_addr);
+ stream_putl (s, attr->aggregator_as);
+ stream_put_ipv4 (s, attr->aggregator_addr.s_addr);
}
/* Community attribute. */
@@ -3705,32 +3557,31 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr,
}
/* Large Community attribute. */
- if (attr->extra && attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES))
+ if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES))
{
- if (attr->extra->lcommunity->size * 12 > 255)
+ if (attr->lcommunity->size * 12 > 255)
{
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_TRANS|BGP_ATTR_FLAG_EXTLEN);
stream_putc (s, BGP_ATTR_LARGE_COMMUNITIES);
- stream_putw (s, attr->extra->lcommunity->size * 12);
+ stream_putw (s, attr->lcommunity->size * 12);
}
else
{
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_TRANS);
stream_putc (s, BGP_ATTR_LARGE_COMMUNITIES);
- stream_putc (s, attr->extra->lcommunity->size * 12);
+ stream_putc (s, attr->lcommunity->size * 12);
}
- stream_put (s, attr->extra->lcommunity->val, attr->extra->lcommunity->size * 12);
+ stream_put (s, attr->lcommunity->val, attr->lcommunity->size * 12);
}
/* Add a MP_NLRI attribute to dump the IPv6 next hop */
- if (prefix != NULL && prefix->family == AF_INET6 && attr->extra &&
- (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL ||
- attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) )
+ if (prefix != NULL && prefix->family == AF_INET6 &&
+ (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL ||
+ attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) )
{
int sizep;
- struct attr_extra *attre = attr->extra;
-
+
stream_putc(s, BGP_ATTR_FLAG_OPTIONAL);
stream_putc(s, BGP_ATTR_MP_REACH_NLRI);
sizep = stream_get_endp (s);
@@ -3741,10 +3592,10 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr,
stream_putc(s, SAFI_UNICAST); /* SAFI */
/* Next hop */
- stream_putc(s, attre->mp_nexthop_len);
- stream_put(s, &attre->mp_nexthop_global, IPV6_MAX_BYTELEN);
- if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
- stream_put(s, &attre->mp_nexthop_local, IPV6_MAX_BYTELEN);
+ stream_putc(s, attr->mp_nexthop_len);
+ stream_put(s, &attr->mp_nexthop_global, IPV6_MAX_BYTELEN);
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ stream_put(s, &attr->mp_nexthop_local, IPV6_MAX_BYTELEN);
/* SNPA */
stream_putc(s, 0);
@@ -3759,9 +3610,7 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr,
/* Prefix SID */
if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_PREFIX_SID))
{
- assert (attr->extra);
-
- if (attr->extra->label_index != BGP_INVALID_LABEL_INDEX)
+ if (attr->label_index != BGP_INVALID_LABEL_INDEX)
{
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_TRANS);
stream_putc (s, BGP_ATTR_PREFIX_SID);
@@ -3770,7 +3619,7 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr,
stream_putc (s, BGP_PREFIX_SID_LABEL_INDEX_LENGTH);
stream_putc (s, 0); // reserved
stream_putw (s, 0); // flags
- stream_putl (s, attr->extra->label_index);
+ stream_putl (s, attr->label_index);
}
}
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h
index c7dca435ba..99c6a6b79f 100644
--- a/bgpd/bgp_attr.h
+++ b/bgpd/bgp_attr.h
@@ -98,13 +98,35 @@ struct overlay_index
union gw_addr gw_ip;
};
-/* Additional/uncommon BGP attributes.
- * lazily allocated as and when a struct attr
- * requires it.
- */
-struct attr_extra
+/* BGP core attribute structure. */
+struct attr
{
- /* Multi-Protocol Nexthop, AFI IPv6 */
+ /* AS Path structure */
+ struct aspath *aspath;
+
+ /* Community structure */
+ struct community *community;
+
+ /* Reference count of this attribute. */
+ unsigned long refcnt;
+
+ /* Flag of attribute is set or not. */
+ uint64_t flag;
+
+ /* Apart from in6_addr, the remaining static attributes */
+ struct in_addr nexthop;
+ u_int32_t med;
+ u_int32_t local_pref;
+ ifindex_t nh_ifindex;
+
+ /* Path origin attribute */
+ u_char origin;
+
+ /* has the route-map changed any attribute?
+ Used on the peer outbound side. */
+ u_int32_t rmap_change_flags;
+
+ /* Multi-Protocol Nexthop, AFI IPv6 */
struct in6_addr mp_nexthop_global;
struct in6_addr mp_nexthop_local;
@@ -165,38 +187,6 @@ struct attr_extra
u_int32_t mm_seqnum;
};
-/* BGP core attribute structure. */
-struct attr
-{
- /* AS Path structure */
- struct aspath *aspath;
-
- /* Community structure */
- struct community *community;
-
- /* Lazily allocated pointer to extra attributes */
- struct attr_extra *extra;
-
- /* Reference count of this attribute. */
- unsigned long refcnt;
-
- /* Flag of attribute is set or not. */
- uint64_t flag;
-
- /* Apart from in6_addr, the remaining static attributes */
- struct in_addr nexthop;
- u_int32_t med;
- u_int32_t local_pref;
- ifindex_t nh_ifindex;
-
- /* Path origin attribute */
- u_char origin;
-
- /* has the route-map changed any attribute?
- Used on the peer outbound side. */
- u_int32_t rmap_change_flags;
-};
-
/* rmap_change_flags definition */
#define BATTR_RMAP_IPV4_NHOP_CHANGED (1 << 0)
#define BATTR_RMAP_NEXTHOP_PEER_ADDRESS (1 << 1)
@@ -226,7 +216,7 @@ struct transit
#define BGP_CLUSTER_LIST_LENGTH(attr) \
(((attr)->flag & ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST)) ? \
- (attr)->extra->cluster->length : 0)
+ (attr)->cluster->length : 0)
typedef enum {
BGP_ATTR_PARSE_PROCEED = 0,
@@ -245,8 +235,6 @@ extern void bgp_attr_finish (void);
extern bgp_attr_parse_ret_t bgp_attr_parse (struct peer *, struct attr *,
bgp_size_t, struct bgp_nlri *,
struct bgp_nlri *);
-extern struct attr_extra *bgp_attr_extra_get (struct attr *);
-extern void bgp_attr_extra_free (struct attr *);
extern void bgp_attr_dup (struct attr *, struct attr *);
extern void bgp_attr_deep_dup (struct attr *, struct attr *);
extern void bgp_attr_deep_free (struct attr *);
@@ -342,7 +330,7 @@ bgp_rmap_nhop_changed(u_int32_t out_rmap_flags, u_int32_t in_rmap_flags)
static inline u_int32_t
mac_mobility_seqnum (struct attr *attr)
{
- return (attr && attr->extra) ? attr->extra->mm_seqnum : 0;
+ return (attr) ? attr->mm_seqnum : 0;
}
#endif /* _QUAGGA_BGP_ATTR_H */
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;
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index a48df5c0c8..e4495c488c 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -387,6 +387,8 @@ bgp_debug_peer_updout_enabled(char *host)
int
bgp_dump_attr (struct attr *attr, char *buf, size_t size)
{
+ char addrbuf[BUFSIZ];
+
if (! attr)
return 0;
@@ -397,73 +399,68 @@ bgp_dump_attr (struct attr *attr, char *buf, size_t size)
snprintf (buf + strlen (buf), size - strlen (buf), ", origin %s",
bgp_origin_str[attr->origin]);
- if (attr->extra)
- {
- char addrbuf[BUFSIZ];
-
- /* Add MP case. */
- if (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL
- || attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
- snprintf (buf + strlen (buf), size - strlen (buf), ", mp_nexthop %s",
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
- addrbuf, BUFSIZ));
+ /* Add MP case. */
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL
+ || attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ snprintf (buf + strlen (buf), size - strlen (buf), ", mp_nexthop %s",
+ inet_ntop (AF_INET6, &attr->mp_nexthop_global,
+ addrbuf, BUFSIZ));
- if (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
- snprintf (buf + strlen (buf), size - strlen (buf), "(%s)",
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local,
- addrbuf, BUFSIZ));
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ snprintf (buf + strlen (buf), size - strlen (buf), "(%s)",
+ inet_ntop (AF_INET6, &attr->mp_nexthop_local,
+ addrbuf, BUFSIZ));
- if (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV4)
- snprintf (buf, size, "nexthop %s", inet_ntoa (attr->nexthop));
- }
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV4)
+ snprintf (buf, size, "nexthop %s", inet_ntoa (attr->nexthop));
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF)))
snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %u",
attr->local_pref);
- if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC)))
+ if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC)))
snprintf (buf + strlen (buf), size - strlen (buf), ", metric %u",
attr->med);
- if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES)))
+ if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES)))
snprintf (buf + strlen (buf), size - strlen (buf), ", community %s",
community_str (attr->community));
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES)))
snprintf (buf + strlen (buf), size - strlen (buf), ", extcommunity %s",
- ecommunity_str (attr->extra->ecommunity));
+ ecommunity_str (attr->ecommunity));
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE)))
snprintf (buf + strlen (buf), size - strlen (buf), ", atomic-aggregate");
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR)))
snprintf (buf + strlen (buf), size - strlen (buf), ", aggregated by %u %s",
- attr->extra->aggregator_as,
- inet_ntoa (attr->extra->aggregator_addr));
+ attr->aggregator_as,
+ inet_ntoa (attr->aggregator_addr));
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID)))
snprintf (buf + strlen (buf), size - strlen (buf), ", originator %s",
- inet_ntoa (attr->extra->originator_id));
+ inet_ntoa (attr->originator_id));
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_CLUSTER_LIST)))
{
int i;
snprintf (buf + strlen (buf), size - strlen (buf), ", clusterlist");
- for (i = 0; i < attr->extra->cluster->length / 4; i++)
+ for (i = 0; i < attr->cluster->length / 4; i++)
snprintf (buf + strlen (buf), size - strlen (buf), " %s",
- inet_ntoa (attr->extra->cluster->list[i]));
+ inet_ntoa (attr->cluster->list[i]));
}
- if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AS_PATH)))
+ if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AS_PATH)))
snprintf (buf + strlen (buf), size - strlen (buf), ", path %s",
aspath_print (attr->aspath));
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_PREFIX_SID)))
{
- if (attr->extra->label_index != BGP_INVALID_LABEL_INDEX)
+ if (attr->label_index != BGP_INVALID_LABEL_INDEX)
snprintf (buf + strlen (buf), size - strlen (buf), ", label-index %u",
- attr->extra->label_index);
+ attr->label_index);
}
if (strlen (buf) > 1)
diff --git a/bgpd/bgp_encap_tlv.c b/bgpd/bgp_encap_tlv.c
index eee2cb72c3..89194980d1 100644
--- a/bgpd/bgp_encap_tlv.c
+++ b/bgpd/bgp_encap_tlv.c
@@ -238,7 +238,7 @@ subtlv_encode_remote_endpoint(
if (last) {\
last->next = new;\
} else {\
- extra->encap_subtlvs = new;\
+ attr->encap_subtlvs = new;\
}\
last = new;\
}\
@@ -249,13 +249,12 @@ bgp_encap_type_l2tpv3overip_to_tlv(
struct bgp_encap_type_l2tpv3_over_ip *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
struct bgp_attr_encap_subtlv *last;
/* advance to last subtlv */
- for (last = extra->encap_subtlvs; last && last->next; last = last->next);
+ for (last = attr->encap_subtlvs; last && last->next; last = last->next);
- extra->encap_tunneltype = BGP_ENCAP_TYPE_L2TPV3_OVER_IP;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_L2TPV3_OVER_IP;
assert(CHECK_FLAG(bet->valid_subtlvs, BGP_TEA_SUBTLV_ENCAP));
@@ -270,13 +269,12 @@ bgp_encap_type_gre_to_tlv(
struct bgp_encap_type_gre *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
struct bgp_attr_encap_subtlv *last;
/* advance to last subtlv */
- for (last = extra->encap_subtlvs; last && last->next; last = last->next);
+ for (last = attr->encap_subtlvs; last && last->next; last = last->next);
- extra->encap_tunneltype = BGP_ENCAP_TYPE_GRE;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_GRE;
ENC_SUBTLV(BGP_TEA_SUBTLV_ENCAP, subtlv_encode_encap_gre, st_encap);
ENC_SUBTLV(BGP_TEA_SUBTLV_PROTO_TYPE, subtlv_encode_proto_type, st_proto);
@@ -289,13 +287,12 @@ bgp_encap_type_ip_in_ip_to_tlv(
struct bgp_encap_type_ip_in_ip *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
struct bgp_attr_encap_subtlv *last;
/* advance to last subtlv */
- for (last = extra->encap_subtlvs; last && last->next; last = last->next);
+ for (last = attr->encap_subtlvs; last && last->next; last = last->next);
- extra->encap_tunneltype = BGP_ENCAP_TYPE_IP_IN_IP;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_IP_IN_IP;
ENC_SUBTLV(BGP_TEA_SUBTLV_PROTO_TYPE, subtlv_encode_proto_type, st_proto);
ENC_SUBTLV(BGP_TEA_SUBTLV_COLOR, subtlv_encode_color, st_color);
@@ -307,13 +304,12 @@ bgp_encap_type_transmit_tunnel_endpoint(
struct bgp_encap_type_transmit_tunnel_endpoint *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
struct bgp_attr_encap_subtlv *last;
/* advance to last subtlv */
- for (last = extra->encap_subtlvs; last && last->next; last = last->next);
+ for (last = attr->encap_subtlvs; last && last->next; last = last->next);
- extra->encap_tunneltype = BGP_ENCAP_TYPE_TRANSMIT_TUNNEL_ENDPOINT;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_TRANSMIT_TUNNEL_ENDPOINT;
/* no subtlvs for this type */
}
@@ -323,13 +319,12 @@ bgp_encap_type_ipsec_in_tunnel_mode_to_tlv(
struct bgp_encap_type_ipsec_in_tunnel_mode *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
struct bgp_attr_encap_subtlv *last;
/* advance to last subtlv */
- for (last = extra->encap_subtlvs; last && last->next; last = last->next);
+ for (last = attr->encap_subtlvs; last && last->next; last = last->next);
- extra->encap_tunneltype = BGP_ENCAP_TYPE_IPSEC_IN_TUNNEL_MODE;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_IPSEC_IN_TUNNEL_MODE;
ENC_SUBTLV(BGP_TEA_SUBTLV_IPSEC_TA, subtlv_encode_ipsec_ta, st_ipsec_ta);
}
@@ -339,13 +334,12 @@ bgp_encap_type_ip_in_ip_tunnel_with_ipsec_transport_mode_to_tlv(
struct bgp_encap_type_ip_in_ip_tunnel_with_ipsec_transport_mode *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
struct bgp_attr_encap_subtlv *last;
/* advance to last subtlv */
- for (last = extra->encap_subtlvs; last && last->next; last = last->next);
+ for (last = attr->encap_subtlvs; last && last->next; last = last->next);
- extra->encap_tunneltype = BGP_ENCAP_TYPE_IP_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_IP_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE;
ENC_SUBTLV(BGP_TEA_SUBTLV_IPSEC_TA, subtlv_encode_ipsec_ta, st_ipsec_ta);
}
@@ -355,13 +349,12 @@ bgp_encap_type_mpls_in_ip_tunnel_with_ipsec_transport_mode_to_tlv(
struct bgp_encap_type_mpls_in_ip_tunnel_with_ipsec_transport_mode *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
struct bgp_attr_encap_subtlv *last;
/* advance to last subtlv */
- for (last = extra->encap_subtlvs; last && last->next; last = last->next);
+ for (last = attr->encap_subtlvs; last && last->next; last = last->next);
- extra->encap_tunneltype = BGP_ENCAP_TYPE_MPLS_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_MPLS_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE;
ENC_SUBTLV(BGP_TEA_SUBTLV_IPSEC_TA, subtlv_encode_ipsec_ta, st_ipsec_ta);
}
@@ -371,13 +364,12 @@ bgp_encap_type_pbb_to_tlv(
struct bgp_encap_type_pbb *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
struct bgp_attr_encap_subtlv *last;
/* advance to last subtlv */
- for (last = extra->encap_subtlvs; last && last->next; last = last->next);
+ for (last = attr->encap_subtlvs; last && last->next; last = last->next);
- extra->encap_tunneltype = BGP_ENCAP_TYPE_PBB;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_PBB;
assert(CHECK_FLAG(bet->valid_subtlvs, BGP_TEA_SUBTLV_ENCAP));
ENC_SUBTLV(BGP_TEA_SUBTLV_ENCAP, subtlv_encode_encap_pbb, st_encap);
@@ -388,16 +380,15 @@ bgp_encap_type_vxlan_to_tlv(
struct bgp_encap_type_vxlan *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
struct bgp_attr_encap_subtlv *tlv;
uint32_t vnid;
- extra->encap_tunneltype = BGP_ENCAP_TYPE_VXLAN;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_VXLAN;
if(bet == NULL ||!bet->vnid)
return;
- if(extra->encap_subtlvs)
- XFREE(MTYPE_ENCAP_TLV, extra->encap_subtlvs);
+ if(attr->encap_subtlvs)
+ XFREE(MTYPE_ENCAP_TLV, attr->encap_subtlvs);
tlv = XCALLOC (MTYPE_ENCAP_TLV, sizeof(struct bgp_attr_encap_subtlv)-1+12);
tlv->type = 1; /* encapsulation type */
tlv->length = 12;
@@ -411,7 +402,7 @@ bgp_encap_type_vxlan_to_tlv(
char *ptr = (char *)&tlv->value + 4;
memcpy( ptr, bet->mac_address, 6);
}
- extra->encap_subtlvs = tlv;
+ attr->encap_subtlvs = tlv;
return;
}
@@ -420,9 +411,7 @@ bgp_encap_type_nvgre_to_tlv(
struct bgp_encap_type_nvgre *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
-
- extra->encap_tunneltype = BGP_ENCAP_TYPE_NVGRE;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_NVGRE;
}
void
@@ -438,9 +427,7 @@ bgp_encap_type_mpls_in_gre_to_tlv(
struct bgp_encap_type_mpls_in_gre *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
-
- extra->encap_tunneltype = BGP_ENCAP_TYPE_MPLS_IN_GRE;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_MPLS_IN_GRE;
}
void
@@ -448,9 +435,8 @@ bgp_encap_type_vxlan_gpe_to_tlv(
struct bgp_encap_type_vxlan_gpe *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
- extra->encap_tunneltype = BGP_ENCAP_TYPE_VXLAN_GPE;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_VXLAN_GPE;
}
void
@@ -458,9 +444,8 @@ bgp_encap_type_mpls_in_udp_to_tlv(
struct bgp_encap_type_mpls_in_udp *bet, /* input structure */
struct attr *attr)
{
- struct attr_extra *extra = bgp_attr_extra_get(attr);
- extra->encap_tunneltype = BGP_ENCAP_TYPE_MPLS_IN_UDP;
+ attr->encap_tunneltype = BGP_ENCAP_TYPE_MPLS_IN_UDP;
}
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index d012952784..46e97cc50d 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -450,7 +450,6 @@ bgp_zebra_send_remote_vtep (struct bgp *bgp, struct bgpevpn *vpn,
static void
build_evpn_route_extcomm (struct bgpevpn *vpn, struct attr *attr)
{
- struct attr_extra *attre;
struct ecommunity ecom_encap;
struct ecommunity ecom_sticky;
struct ecommunity_val eval;
@@ -460,8 +459,6 @@ build_evpn_route_extcomm (struct bgpevpn *vpn, struct attr *attr)
struct ecommunity *ecom;
u_int32_t seqnum;
- attre = bgp_attr_extra_get (attr);
-
/* Encap */
tnl_type = BGP_ENCAP_TYPE_VXLAN;
memset (&ecom_encap, 0, sizeof (ecom_encap));
@@ -470,20 +467,20 @@ build_evpn_route_extcomm (struct bgpevpn *vpn, struct attr *attr)
ecom_encap.val = (u_int8_t *)eval.val;
/* Add Encap */
- attre->ecommunity = ecommunity_dup (&ecom_encap);
+ attr->ecommunity = ecommunity_dup (&ecom_encap);
/* Add the export RTs */
for (ALL_LIST_ELEMENTS (vpn->export_rtl, node, nnode, ecom))
- attre->ecommunity = ecommunity_merge (attre->ecommunity, ecom);
+ attr->ecommunity = ecommunity_merge (attr->ecommunity, ecom);
- if (attre->sticky)
+ if (attr->sticky)
{
seqnum = 0;
memset (&ecom_sticky, 0, sizeof (ecom_sticky));
encode_mac_mobility_extcomm(1, seqnum, &eval_sticky);
ecom_sticky.size = 1;
ecom_sticky.val = (u_int8_t *)eval_sticky.val;
- attre->ecommunity = ecommunity_merge (attre->ecommunity, &ecom_sticky);
+ attr->ecommunity = ecommunity_merge (attr->ecommunity, &ecom_sticky);
}
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES);
@@ -495,7 +492,6 @@ build_evpn_route_extcomm (struct bgpevpn *vpn, struct attr *attr)
static void
add_mac_mobility_to_attr (u_int32_t seq_num, struct attr *attr)
{
- struct attr_extra *attre;
struct ecommunity ecom_tmp;
struct ecommunity_val eval;
struct ecommunity *ecom_mm;
@@ -504,25 +500,23 @@ add_mac_mobility_to_attr (u_int32_t seq_num, struct attr *attr)
int type = 0;
int sub_type = 0;
- attre = bgp_attr_extra_get (attr);
-
/* Build MM */
encode_mac_mobility_extcomm (0, seq_num, &eval);
/* Find current MM ecommunity */
ecom_mm = NULL;
- if (attre->ecommunity)
+ if (attr->ecommunity)
{
- for (i = 0; i < attre->ecommunity->size; i++)
+ for (i = 0; i < attr->ecommunity->size; i++)
{
- pnt = attre->ecommunity->val + (i * 8);
+ pnt = attr->ecommunity->val + (i * 8);
type = *pnt++;
sub_type = *pnt++;
if (type == ECOMMUNITY_ENCODE_EVPN && sub_type == ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY)
{
- ecom_mm = (struct ecommunity*) attre->ecommunity->val + (i * 8);
+ ecom_mm = (struct ecommunity*) attr->ecommunity->val + (i * 8);
break;
}
}
@@ -540,7 +534,7 @@ add_mac_mobility_to_attr (u_int32_t seq_num, struct attr *attr)
ecom_tmp.size = 1;
ecom_tmp.val = (u_int8_t *)eval.val;
- attre->ecommunity = ecommunity_merge (attre->ecommunity, &ecom_tmp);
+ attr->ecommunity = ecommunity_merge (attr->ecommunity, &ecom_tmp);
}
}
@@ -645,7 +639,7 @@ evpn_route_select_install (struct bgp *bgp, struct bgpevpn *vpn,
if (bgp_zebra_has_route_changed (rn, old_select))
ret = evpn_zebra_install (bgp, vpn, (struct prefix_evpn *)&rn->p,
old_select->attr->nexthop,
- old_select->attr->extra->sticky);
+ old_select->attr->sticky);
UNSET_FLAG (old_select->flags, BGP_INFO_MULTIPATH_CHG);
bgp_zebra_clear_route_change_flags (rn);
return ret;
@@ -675,7 +669,7 @@ evpn_route_select_install (struct bgp *bgp, struct bgpevpn *vpn,
{
ret = evpn_zebra_install (bgp, vpn, (struct prefix_evpn *) &rn->p,
new_select->attr->nexthop,
- new_select->attr->extra->sticky);
+ new_select->attr->sticky);
/* If an old best existed and it was a "local" route, the only reason
* it would be supplanted is due to MAC mobility procedures. So, we
* need to do an implicit delete and withdraw that route from peers.
@@ -727,7 +721,7 @@ evpn_route_is_sticky (struct bgp *bgp, struct bgp_node *rn)
if (!local_ri)
return 0;
- return local_ri->attr->extra->sticky;
+ return local_ri->attr->sticky;
}
/*
@@ -801,8 +795,8 @@ update_evpn_route_entry (struct bgp *bgp, struct bgpevpn *vpn, afi_t afi,
attr_new = bgp_attr_intern (attr);
/* Extract MAC mobility sequence number, if any. */
- attr_new->extra->mm_seqnum = bgp_attr_mac_mobility_seqnum (attr_new, &sticky);
- attr_new->extra->sticky = sticky;
+ attr_new->mm_seqnum = bgp_attr_mac_mobility_seqnum (attr_new, &sticky);
+ attr_new->sticky = sticky;
/* Create new route with its attribute. */
tmp_ri = info_make (ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
@@ -866,9 +860,9 @@ update_evpn_route (struct bgp *bgp, struct bgpevpn *vpn,
/* Build path-attribute for this route. */
bgp_attr_default_set (&attr, BGP_ORIGIN_IGP);
attr.nexthop = vpn->originator_ip;
- attr.extra->mp_nexthop_global_in = vpn->originator_ip;
- attr.extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV4;
- attr.extra->sticky = sticky;
+ attr.mp_nexthop_global_in = vpn->originator_ip;
+ attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4;
+ attr.sticky = sticky;
/* Set up RT and ENCAP extended community. */
build_evpn_route_extcomm (vpn, &attr);
@@ -910,7 +904,6 @@ update_evpn_route (struct bgp *bgp, struct bgpevpn *vpn,
/* Unintern temporary. */
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
return 0;
}
@@ -1017,12 +1010,12 @@ update_all_type2_routes (struct bgp *bgp, struct bgpevpn *vpn)
bgp_attr_default_set (&attr, BGP_ORIGIN_IGP);
bgp_attr_default_set (&attr_sticky, BGP_ORIGIN_IGP);
attr.nexthop = vpn->originator_ip;
- attr.extra->mp_nexthop_global_in = vpn->originator_ip;
- attr.extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV4;
+ attr.mp_nexthop_global_in = vpn->originator_ip;
+ attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4;
attr_sticky.nexthop = vpn->originator_ip;
- attr_sticky.extra->mp_nexthop_global_in = vpn->originator_ip;
- attr_sticky.extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV4;
- attr_sticky.extra->sticky = 1;
+ attr_sticky.mp_nexthop_global_in = vpn->originator_ip;
+ attr_sticky.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4;
+ attr_sticky.sticky = 1;
/* Set up RT, ENCAP and sticky MAC extended community. */
build_evpn_route_extcomm (vpn, &attr);
@@ -1073,8 +1066,6 @@ update_all_type2_routes (struct bgp *bgp, struct bgpevpn *vpn)
/* Unintern temporary. */
aspath_unintern (&attr.aspath);
aspath_unintern (&attr_sticky.aspath);
- bgp_attr_extra_free (&attr);
- bgp_attr_extra_free (&attr_sticky);
return 0;
}
@@ -1376,7 +1367,7 @@ is_route_matching_for_vni (struct bgp *bgp, struct bgpevpn *vpn,
if (!(attr->flag & ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES)))
return 0;
- ecom = attr->extra->ecommunity;
+ ecom = attr->ecommunity;
if (!ecom || !ecom->size)
return 0;
@@ -1592,7 +1583,7 @@ install_uninstall_evpn_route (struct bgp *bgp, afi_t afi, safi_t safi,
if (!(attr->flag & ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES)))
return 0;
- ecom = attr->extra->ecommunity;
+ ecom = attr->ecommunity;
if (!ecom || !ecom->size)
return -1;
@@ -2095,8 +2086,8 @@ evpn_mpattr_encode_type5 (struct stream *s, struct prefix *p,
/* Prefix contains RD, ESI, EthTag, IP length, IP, GWIP and VNI */
stream_putc(s, 8 + 10 + 4 + 1 + len + 3);
stream_put(s, prd->val, 8);
- if (attr && attr->extra)
- stream_put(s, &(attr->extra->evpn_overlay.eth_s_id), 10);
+ if (attr && attr)
+ stream_put(s, &(attr->evpn_overlay.eth_s_id), 10);
else
stream_put(s, &temp, 10);
stream_putl(s, p_evpn_p->eth_tag);
@@ -2105,12 +2096,12 @@ evpn_mpattr_encode_type5 (struct stream *s, struct prefix *p,
stream_put_ipv4(s, p_evpn_p->ip.ipaddr_v4.s_addr);
else
stream_put(s, &p_evpn_p->ip.ipaddr_v6, 16);
- if (attr && attr->extra)
+ if (attr && attr)
{
if (IS_IPADDR_V4(&p_evpn_p->ip))
- stream_put_ipv4(s, attr->extra->evpn_overlay.gw_ip.ipv4. s_addr);
+ stream_put_ipv4(s, attr->evpn_overlay.gw_ip.ipv4. s_addr);
else
- stream_put(s, &(attr->extra->evpn_overlay.gw_ip.ipv6), 16);
+ stream_put(s, &(attr->evpn_overlay.gw_ip.ipv6), 16);
}
else
{
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index fc0654f186..27533a5815 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -151,12 +151,10 @@ bgp_reg_dereg_for_label (struct bgp_node *rn, struct bgp_info *ri,
assert (ri);
if (ri->attr->flag & ATTR_FLAG_BIT (BGP_ATTR_PREFIX_SID))
{
- assert (ri->attr->extra);
-
- if (ri->attr->extra->label_index != BGP_INVALID_LABEL_INDEX)
+ if (ri->attr->label_index != BGP_INVALID_LABEL_INDEX)
{
flags |= ZEBRA_FEC_REGISTER_LABEL_INDEX;
- stream_putl (s, ri->attr->extra->label_index);
+ stream_putl (s, ri->attr->label_index);
}
}
SET_FLAG (rn->flags, BGP_NODE_REGISTERED_FOR_LABEL);
diff --git a/bgpd/bgp_memory.c b/bgpd/bgp_memory.c
index 1913706587..6da9ff8682 100644
--- a/bgpd/bgp_memory.c
+++ b/bgpd/bgp_memory.c
@@ -43,7 +43,6 @@ DEFINE_MTYPE(BGPD, BGP_UPDGRP, "BGP update group")
DEFINE_MTYPE(BGPD, BGP_UPD_SUBGRP, "BGP update subgroup")
DEFINE_MTYPE(BGPD, BGP_PACKET, "BGP packet")
DEFINE_MTYPE(BGPD, ATTR, "BGP attribute")
-DEFINE_MTYPE(BGPD, ATTR_EXTRA, "BGP extra attributes")
DEFINE_MTYPE(BGPD, AS_PATH, "BGP aspath")
DEFINE_MTYPE(BGPD, AS_SEG, "BGP aspath seg")
DEFINE_MTYPE(BGPD, AS_SEG_DATA, "BGP aspath segment data")
diff --git a/bgpd/bgp_memory.h b/bgpd/bgp_memory.h
index 185369d230..152cfaeaf2 100644
--- a/bgpd/bgp_memory.h
+++ b/bgpd/bgp_memory.h
@@ -39,7 +39,6 @@ DECLARE_MTYPE(BGP_UPDGRP)
DECLARE_MTYPE(BGP_UPD_SUBGRP)
DECLARE_MTYPE(BGP_PACKET)
DECLARE_MTYPE(ATTR)
-DECLARE_MTYPE(ATTR_EXTRA)
DECLARE_MTYPE(AS_PATH)
DECLARE_MTYPE(AS_SEG)
DECLARE_MTYPE(AS_SEG_DATA)
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index 34690ac776..7ea5c9e773 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -106,35 +106,31 @@ bgp_maximum_paths_unset (struct bgp *bgp, afi_t afi, safi_t safi,
int
bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2)
{
- struct attr_extra *ae1, *ae2;
int compare;
- ae1 = bi1->attr->extra;
- ae2 = bi2->attr->extra;
-
compare = IPV4_ADDR_CMP (&bi1->attr->nexthop, &bi2->attr->nexthop);
- if (!compare && ae1 && ae2)
+ if (!compare)
{
- if (ae1->mp_nexthop_len == ae2->mp_nexthop_len)
+ if (bi1->attr->mp_nexthop_len == bi2->attr->mp_nexthop_len)
{
- switch (ae1->mp_nexthop_len)
+ switch (bi1->attr->mp_nexthop_len)
{
case BGP_ATTR_NHLEN_IPV4:
case BGP_ATTR_NHLEN_VPNV4:
- compare = IPV4_ADDR_CMP (&ae1->mp_nexthop_global_in,
- &ae2->mp_nexthop_global_in);
+ compare = IPV4_ADDR_CMP (&bi1->attr->mp_nexthop_global_in,
+ &bi2->attr->mp_nexthop_global_in);
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL:
case BGP_ATTR_NHLEN_VPNV6_GLOBAL:
- compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_global,
- &ae2->mp_nexthop_global);
+ compare = IPV6_ADDR_CMP (&bi1->attr->mp_nexthop_global,
+ &bi2->attr->mp_nexthop_global);
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL:
- compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_global,
- &ae2->mp_nexthop_global);
+ compare = IPV6_ADDR_CMP (&bi1->attr->mp_nexthop_global,
+ &bi2->attr->mp_nexthop_global);
if (!compare)
- compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_local,
- &ae2->mp_nexthop_local);
+ compare = IPV6_ADDR_CMP (&bi1->attr->mp_nexthop_local,
+ &bi2->attr->mp_nexthop_local);
break;
}
}
@@ -142,14 +138,14 @@ bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2)
/* This can happen if one IPv6 peer sends you global and link-local
* nexthops but another IPv6 peer only sends you global
*/
- else if (ae1->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL ||
- ae1->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ else if (bi1->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL ||
+ bi1->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
{
- compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_global,
- &ae2->mp_nexthop_global);
+ compare = IPV6_ADDR_CMP (&bi1->attr->mp_nexthop_global,
+ &bi2->attr->mp_nexthop_global);
if (!compare)
{
- if (ae1->mp_nexthop_len < ae2->mp_nexthop_len)
+ if (bi1->attr->mp_nexthop_len < bi2->attr->mp_nexthop_len)
compare = -1;
else
compare = 1;
@@ -663,7 +659,6 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best,
struct community *community, *commerge;
struct ecommunity *ecomm, *ecommerge;
struct lcommunity *lcomm, *lcommerge;
- struct attr_extra *ae;
struct attr attr = { 0 };
if (old_best && (old_best != new_best) &&
@@ -697,9 +692,8 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best,
aspath = aspath_dup (attr.aspath);
origin = attr.origin;
community = attr.community ? community_dup (attr.community) : NULL;
- ae = attr.extra;
- ecomm = (ae && ae->ecommunity) ? ecommunity_dup (ae->ecommunity) : NULL;
- lcomm = (ae && ae->lcommunity) ? lcommunity_dup (ae->lcommunity) : NULL;
+ ecomm = (attr.ecommunity) ? ecommunity_dup (attr.ecommunity) : NULL;
+ lcomm = (attr.lcommunity) ? lcommunity_dup (attr.lcommunity) : NULL;
for (mpinfo = bgp_info_mpath_first (new_best); mpinfo;
mpinfo = bgp_info_mpath_next (mpinfo))
@@ -723,28 +717,27 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best,
community = community_dup (mpinfo->attr->community);
}
- ae = mpinfo->attr->extra;
- if (ae && ae->ecommunity)
+ if (mpinfo->attr->ecommunity)
{
if (ecomm)
{
- ecommerge = ecommunity_merge (ecomm, ae->ecommunity);
+ ecommerge = ecommunity_merge (ecomm, mpinfo->attr->ecommunity);
ecomm = ecommunity_uniq_sort (ecommerge);
ecommunity_free (&ecommerge);
}
else
- ecomm = ecommunity_dup (ae->ecommunity);
+ ecomm = ecommunity_dup (mpinfo->attr->ecommunity);
}
- if (ae && ae->lcommunity)
+ if (mpinfo->attr->lcommunity)
{
if (lcomm)
{
- lcommerge = lcommunity_merge (lcomm, ae->lcommunity);
+ lcommerge = lcommunity_merge (lcomm, mpinfo->attr->lcommunity);
lcomm = lcommunity_uniq_sort (lcommerge);
lcommunity_free (&lcommerge);
}
else
- lcomm = lcommunity_dup (ae->lcommunity);
+ lcomm = lcommunity_dup (mpinfo->attr->lcommunity);
}
}
@@ -757,21 +750,18 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best,
}
if (ecomm)
{
- ae = bgp_attr_extra_get (&attr);
- ae->ecommunity = ecomm;
+ attr.ecommunity = ecomm;
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES);
}
/* Zap multipath attr nexthop so we set nexthop to self */
attr.nexthop.s_addr = 0;
- if (attr.extra)
- memset (&attr.extra->mp_nexthop_global, 0, sizeof (struct in6_addr));
+ memset (&attr.mp_nexthop_global, 0, sizeof (struct in6_addr));
/* TODO: should we set ATOMIC_AGGREGATE and AGGREGATOR? */
}
new_attr = bgp_attr_intern (&attr);
- bgp_attr_extra_free (&attr);
if (new_attr != bgp_info_mpath_attr (new_best))
{
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 341bb0abb5..3feb42246d 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -532,8 +532,8 @@ make_prefix (int afi, struct bgp_info *ri, struct prefix *p)
break;
case AFI_IP6:
/* We don't register link local NH */
- if (ri->attr->extra->mp_nexthop_len != BGP_ATTR_NHLEN_IPV6_GLOBAL
- || IN6_IS_ADDR_LINKLOCAL (&ri->attr->extra->mp_nexthop_global))
+ if (ri->attr->mp_nexthop_len != BGP_ATTR_NHLEN_IPV6_GLOBAL
+ || IN6_IS_ADDR_LINKLOCAL (&ri->attr->mp_nexthop_global))
return -1;
p->family = AF_INET6;
@@ -545,7 +545,7 @@ make_prefix (int afi, struct bgp_info *ri, struct prefix *p)
}
else
{
- p->u.prefix6 = ri->attr->extra->mp_nexthop_global;
+ p->u.prefix6 = ri->attr->mp_nexthop_global;
p->prefixlen = IPV6_MAX_BITLEN;
}
break;
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 0c31d6e9f3..2b48b34e13 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1364,7 +1364,6 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
u_char *end;
struct stream *s;
struct attr attr;
- struct attr_extra extra;
bgp_size_t attribute_len;
bgp_size_t update_len;
bgp_size_t withdraw_len;
@@ -1389,11 +1388,9 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
/* Set initial values. */
memset (&attr, 0, sizeof (struct attr));
- memset (&extra, 0, sizeof (struct attr_extra));
- extra.label_index = BGP_INVALID_LABEL_INDEX;
- extra.label = MPLS_INVALID_LABEL;
+ attr.label_index = BGP_INVALID_LABEL_INDEX;
+ attr.label = MPLS_INVALID_LABEL;
memset (&nlris, 0, sizeof (nlris));
- attr.extra = &extra;
memset (peer->rcvd_attr_str, 0, BUFSIZ);
peer->rcvd_attr_printed = 0;
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index cd21c25c77..fabea1f113 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -330,7 +330,7 @@ bgp_pcount_adjust (struct bgp_node *rn, struct bgp_info *ri)
static int
bgp_label_index_differs (struct bgp_info *ri1, struct bgp_info *ri2)
{
- return (!(ri1->attr->extra->label_index == ri2->attr->extra->label_index));
+ return (!(ri1->attr->label_index == ri2->attr->label_index));
}
/* Set/unset bgp_info flags, adjusting any other state as needed.
@@ -392,7 +392,6 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
char *pfx_buf, afi_t afi, safi_t safi)
{
struct attr *newattr, *existattr;
- struct attr_extra *newattre, *existattre;
bgp_peer_sort_t new_sort;
bgp_peer_sort_t exist_sort;
u_int32_t new_pref;
@@ -443,8 +442,6 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
newattr = new->attr;
existattr = exist->attr;
- newattre = newattr->extra;
- existattre = existattr->extra;
/* For EVPN routes, we cannot just go by local vs remote, we have to
* look at the MAC mobility sequence number, if present.
@@ -457,7 +454,7 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
* consistency in this scenario we are going to prefer the path with the
* sticky flag.
*/
- if (newattre->sticky != existattre->sticky)
+ if (newattr->sticky != existattr->sticky)
{
if (!debug)
{
@@ -466,14 +463,14 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
bgp_info_path_with_addpath_rx_str (exist, exist_buf);
}
- if (newattre->sticky && !existattre->sticky)
+ if (newattr->sticky && !existattr->sticky)
{
zlog_warn("%s: %s wins over %s due to sticky MAC flag",
pfx_buf, new_buf, exist_buf);
return 1;
}
- if (!newattre->sticky && existattre->sticky)
+ if (!newattr->sticky && existattr->sticky)
{
zlog_warn("%s: %s loses to %s due to sticky MAC flag",
pfx_buf, new_buf, exist_buf);
@@ -504,10 +501,8 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
/* 1. Weight check. */
new_weight = exist_weight = 0;
- if (newattre)
- new_weight = newattre->weight;
- if (existattre)
- exist_weight = existattre->weight;
+ new_weight = newattr->weight;
+ exist_weight = existattr->weight;
if (new_weight > exist_weight)
{
@@ -877,11 +872,11 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
* used for the comparision, it will decide which path is better.
*/
if (newattr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))
- new_id.s_addr = newattre->originator_id.s_addr;
+ new_id.s_addr = newattr->originator_id.s_addr;
else
new_id.s_addr = new->peer->remote_id.s_addr;
if (existattr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))
- exist_id.s_addr = existattre->originator_id.s_addr;
+ exist_id.s_addr = existattr->originator_id.s_addr;
else
exist_id.s_addr = exist->peer->remote_id.s_addr;
@@ -1105,14 +1100,14 @@ bgp_cluster_filter (struct peer *peer, struct attr *attr)
{
struct in_addr cluster_id;
- if (attr->extra && attr->extra->cluster)
+ if (attr->cluster)
{
if (peer->bgp->config & BGP_CONFIG_CLUSTER_ID)
cluster_id = peer->bgp->cluster_id;
else
cluster_id = peer->bgp->router_id;
- if (cluster_loop_check (attr->extra->cluster, cluster_id))
+ if (cluster_loop_check (attr->cluster, cluster_id))
return 1;
}
return 0;
@@ -1131,7 +1126,7 @@ bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
/* Apply default weight value. */
if (peer->weight[afi][safi])
- (bgp_attr_extra_get (attr))->weight = peer->weight[afi][safi];
+ attr->weight = peer->weight[afi][safi];
if (rmap_name)
{
@@ -1188,7 +1183,7 @@ bgp_output_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
/* Apply default weight value. */
if (peer->weight[afi][safi])
- (bgp_attr_extra_get (attr))->weight = peer->weight[afi][safi];
+ attr->weight = peer->weight[afi][safi];
if (rmap_name)
{
@@ -1287,7 +1282,7 @@ subgroup_announce_reset_nhop (u_char family, struct attr *attr)
if (family == AF_INET)
attr->nexthop.s_addr = 0;
if (family == AF_INET6)
- memset (&attr->extra->mp_nexthop_global, 0, IPV6_MAX_BYTELEN);
+ memset (&attr->mp_nexthop_global, 0, IPV6_MAX_BYTELEN);
}
int
@@ -1416,7 +1411,7 @@ subgroup_announce_check (struct bgp_node *rn, struct bgp_info *ri,
peer's id. */
if (onlypeer &&
riattr->flag & ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID) &&
- (IPV4_ADDR_SAME (&onlypeer->remote_id, &riattr->extra->originator_id)))
+ (IPV4_ADDR_SAME (&onlypeer->remote_id, &riattr->originator_id)))
{
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug ("%s [Update:SEND] %s originator-id is same as "
@@ -1523,8 +1518,7 @@ subgroup_announce_check (struct bgp_node *rn, struct bgp_info *ri,
set the originator id */
if (reflect && (!(attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))))
{
- attr->extra = bgp_attr_extra_get(attr);
- IPV4_ADDR_COPY(&(attr->extra->originator_id), &(from->remote_id));
+ IPV4_ADDR_COPY(&(attr->originator_id), &(from->remote_id));
SET_FLAG(attr->flag, BGP_ATTR_ORIGINATOR_ID);
}
@@ -1555,7 +1549,7 @@ subgroup_announce_check (struct bgp_node *rn, struct bgp_info *ri,
(safi != SAFI_ENCAP && safi != SAFI_MPLS_VPN &&\
(p->family == AF_INET6 || peer_cap_enhe(peer, afi, safi))) || \
((safi == SAFI_ENCAP || safi == SAFI_MPLS_VPN) &&\
- attr->extra->mp_nexthop_len >= IPV6_MAX_BYTELEN))
+ attr->mp_nexthop_len >= IPV6_MAX_BYTELEN))
/* IPv6/MP starts with 1 nexthop. The link-local address is passed only if
* the peer (group) is configured to receive link-local nexthop unchanged
@@ -1565,14 +1559,14 @@ subgroup_announce_check (struct bgp_node *rn, struct bgp_info *ri,
*/
if (NEXTHOP_IS_V6)
{
- attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
+ attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
if ((CHECK_FLAG (peer->af_flags[afi][safi],
PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED) &&
- IN6_IS_ADDR_LINKLOCAL (&attr->extra->mp_nexthop_local)) ||
+ IN6_IS_ADDR_LINKLOCAL (&attr->mp_nexthop_local)) ||
(!reflect && peer->shared_network &&
(from == bgp->peer_self || peer->sort == BGP_PEER_EBGP)))
{
- attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
+ attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
}
/* Clear off link-local nexthop in source, whenever it is not needed to
@@ -1580,7 +1574,7 @@ subgroup_announce_check (struct bgp_node *rn, struct bgp_info *ri,
*/
if (!(CHECK_FLAG (peer->af_flags[afi][safi],
PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED)))
- memset (&attr->extra->mp_nexthop_local, 0, IPV6_MAX_BYTELEN);
+ memset (&attr->mp_nexthop_local, 0, IPV6_MAX_BYTELEN);
}
bgp_peer_remove_private_as(bgp, afi, safi, peer, attr);
@@ -1592,9 +1586,6 @@ subgroup_announce_check (struct bgp_node *rn, struct bgp_info *ri,
{
struct bgp_info info;
struct attr dummy_attr;
- struct attr_extra dummy_extra;
-
- dummy_attr.extra = &dummy_extra;
info.peer = peer;
info.attr = attr;
@@ -1679,7 +1670,7 @@ subgroup_announce_check (struct bgp_node *rn, struct bgp_info *ri,
*/
if (p->family == AF_INET6 || peer_cap_enhe(peer, afi, safi))
{
- if (IN6_IS_ADDR_LINKLOCAL (&attr->extra->mp_nexthop_global))
+ if (IN6_IS_ADDR_LINKLOCAL (&attr->mp_nexthop_global))
subgroup_announce_reset_nhop (AF_INET6, attr);
}
}
@@ -1899,7 +1890,6 @@ subgroup_process_announce_selected (struct update_subgroup *subgrp,
struct prefix *p;
struct peer *onlypeer;
struct attr attr;
- struct attr_extra extra;
afi_t afi;
safi_t safi;
@@ -1914,9 +1904,8 @@ subgroup_process_announce_selected (struct update_subgroup *subgrp,
PEER_STATUS_ORF_WAIT_REFRESH))
return 0;
- memset(&extra, 0, sizeof(struct attr_extra));
+ memset(&attr, 0, sizeof(struct attr));
/* It's initialized in bgp_announce_check() */
- attr.extra = &extra;
/* Announcement to the subgroup. If the route is filtered withdraw it. */
if (selected)
@@ -2047,7 +2036,7 @@ bgp_process_main (struct work_queue *wq, void *data)
{
if (new_select->sub_type == BGP_ROUTE_STATIC &&
new_select->attr->flag & ATTR_FLAG_BIT (BGP_ATTR_PREFIX_SID) &&
- new_select->attr->extra->label_index != BGP_INVALID_LABEL_INDEX)
+ new_select->attr->label_index != BGP_INVALID_LABEL_INDEX)
{
if (CHECK_FLAG (rn->flags, BGP_NODE_REGISTERED_FOR_LABEL))
bgp_unregister_for_label (rn);
@@ -2459,27 +2448,24 @@ info_make (int type, int sub_type, u_short instance, struct peer *peer,
static void
overlay_index_update(struct attr *attr, struct eth_segment_id *eth_s_id, union gw_addr *gw_ip)
{
- struct attr_extra *extra;
-
if(!attr)
return;
- extra = bgp_attr_extra_get(attr);
if(eth_s_id == NULL)
{
- memset(&(extra->evpn_overlay.eth_s_id),0, sizeof(struct eth_segment_id));
+ memset(&(attr->evpn_overlay.eth_s_id),0, sizeof(struct eth_segment_id));
}
else
{
- memcpy(&(extra->evpn_overlay.eth_s_id), eth_s_id, sizeof(struct eth_segment_id));
+ memcpy(&(attr->evpn_overlay.eth_s_id), eth_s_id, sizeof(struct eth_segment_id));
}
if(gw_ip == NULL)
{
- memset(&(extra->evpn_overlay.gw_ip), 0, sizeof(union gw_addr));
+ memset(&(attr->evpn_overlay.gw_ip), 0, sizeof(union gw_addr));
}
else
{
- memcpy(&(extra->evpn_overlay.gw_ip),gw_ip, sizeof(union gw_addr));
+ memcpy(&(attr->evpn_overlay.gw_ip),gw_ip, sizeof(union gw_addr));
}
}
@@ -2492,7 +2478,7 @@ overlay_index_equal(afi_t afi, struct bgp_info *info, struct eth_segment_id *eth
if(afi != AFI_L2VPN)
return true;
- if (!info->attr || !info->attr->extra)
+ if (!info->attr)
{
memset(&temp, 0, 16);
info_eth_s_id = (struct eth_segment_id *)&temp;
@@ -2502,8 +2488,8 @@ overlay_index_equal(afi_t afi, struct bgp_info *info, struct eth_segment_id *eth
}
else
{
- info_eth_s_id = &(info->attr->extra->evpn_overlay.eth_s_id);
- info_gw_ip = &(info->attr->extra->evpn_overlay.gw_ip);
+ info_eth_s_id = &(info->attr->evpn_overlay.eth_s_id);
+ info_gw_ip = &(info->attr->evpn_overlay.gw_ip);
}
if(gw_ip == NULL)
info_gw_ip_remote = (union gw_addr *)&temp;
@@ -2522,7 +2508,6 @@ overlay_index_equal(afi_t afi, struct bgp_info *info, struct eth_segment_id *eth
static int
bgp_update_martian_nexthop (struct bgp *bgp, afi_t afi, safi_t safi, struct attr *attr)
{
- struct attr_extra *attre = attr->extra;
int ret = 0;
/* Only validated for unicast and multicast currently. */
@@ -2544,23 +2529,23 @@ bgp_update_martian_nexthop (struct bgp *bgp, afi_t afi, safi_t safi, struct attr
* there is code in bgp_attr.c to ignore the link-local (2nd) nexthop if
* it is not an IPv6 link-local address.
*/
- if (attre && attre->mp_nexthop_len)
+ if (attr->mp_nexthop_len)
{
- switch (attre->mp_nexthop_len)
+ switch (attr->mp_nexthop_len)
{
case BGP_ATTR_NHLEN_IPV4:
case BGP_ATTR_NHLEN_VPNV4:
- ret = (attre->mp_nexthop_global_in.s_addr == 0 ||
- IPV4_CLASS_DE (ntohl (attre->mp_nexthop_global_in.s_addr)) ||
- bgp_nexthop_self (bgp, attre->mp_nexthop_global_in));
+ ret = (attr->mp_nexthop_global_in.s_addr == 0 ||
+ IPV4_CLASS_DE (ntohl (attr->mp_nexthop_global_in.s_addr)) ||
+ bgp_nexthop_self (bgp, attr->mp_nexthop_global_in));
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL:
case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL:
case BGP_ATTR_NHLEN_VPNV6_GLOBAL:
- ret = (IN6_IS_ADDR_UNSPECIFIED(&attre->mp_nexthop_global) ||
- IN6_IS_ADDR_LOOPBACK(&attre->mp_nexthop_global) ||
- IN6_IS_ADDR_MULTICAST(&attre->mp_nexthop_global));
+ ret = (IN6_IS_ADDR_UNSPECIFIED(&attr->mp_nexthop_global) ||
+ IN6_IS_ADDR_LOOPBACK(&attr->mp_nexthop_global) ||
+ IN6_IS_ADDR_MULTICAST(&attr->mp_nexthop_global));
break;
default:
@@ -2583,7 +2568,6 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
struct bgp_node *rn;
struct bgp *bgp;
struct attr new_attr;
- struct attr_extra new_extra;
struct attr *attr_new;
struct bgp_info *ri;
struct bgp_info *new;
@@ -2599,9 +2583,8 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
int same_attr=0;
memset (&new_attr, 0, sizeof(struct attr));
- memset (&new_extra, 0, sizeof(struct attr_extra));
- new_extra.label_index = BGP_INVALID_LABEL_INDEX;
- new_extra.label = MPLS_INVALID_LABEL;
+ new_attr.label_index = BGP_INVALID_LABEL_INDEX;
+ new_attr.label = MPLS_INVALID_LABEL;
bgp = peer->bgp;
rn = bgp_afi_node_get (bgp->rib[afi][safi], afi, safi, p, prd);
@@ -2656,7 +2639,7 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
/* Route reflector originator ID check. */
if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID)
- && IPV4_ADDR_SAME (&bgp->router_id, &attr->extra->originator_id))
+ && IPV4_ADDR_SAME (&bgp->router_id, &attr->originator_id))
{
reason = "originator is us;";
goto filtered;
@@ -2676,7 +2659,6 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
goto filtered;
}
- new_attr.extra = &new_extra;
bgp_attr_dup (&new_attr, attr);
/* Apply incoming route-map.
@@ -2850,14 +2832,14 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
{
int cmp;
- cmp = ecommunity_cmp (ri->attr->extra->ecommunity,
- attr_new->extra->ecommunity);
+ cmp = ecommunity_cmp (ri->attr->ecommunity,
+ attr_new->ecommunity);
if (!cmp)
{
if (bgp_debug_update(peer, p, NULL, 1))
zlog_debug ("Change in EXT-COMM, existing %s new %s",
- ecommunity_str (ri->attr->extra->ecommunity),
- ecommunity_str (attr_new->extra->ecommunity));
+ ecommunity_str (ri->attr->ecommunity),
+ ecommunity_str (attr_new->ecommunity));
bgp_evpn_unimport_route (bgp, afi, safi, p, ri);
}
}
@@ -4000,7 +3982,7 @@ bgp_static_update (struct bgp *bgp, struct prefix *p,
/* Store label index, if required. */
if (bgp_static->label_index != BGP_INVALID_LABEL_INDEX)
{
- (bgp_attr_extra_get (&attr))->label_index = bgp_static->label_index;
+ attr.label_index = bgp_static->label_index;
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_PREFIX_SID);
}
@@ -4024,7 +4006,6 @@ bgp_static_update (struct bgp *bgp, struct prefix *p,
/* Unintern original. */
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
bgp_static_withdraw (bgp, p, afi, safi);
return;
}
@@ -4047,7 +4028,6 @@ bgp_static_update (struct bgp *bgp, struct prefix *p,
bgp_unlock_node (rn);
bgp_attr_unintern (&attr_new);
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
return;
}
else
@@ -4122,7 +4102,6 @@ bgp_static_update (struct bgp *bgp, struct prefix *p,
bgp_process (bgp, rn, afi, safi);
bgp_unlock_node (rn);
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
return;
}
}
@@ -4174,7 +4153,6 @@ bgp_static_update (struct bgp *bgp, struct prefix *p,
/* Unintern original. */
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
}
void
@@ -4277,8 +4255,8 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p,
{
if (afi == AFI_IP)
{
- bgp_attr_extra_get (&attr)->mp_nexthop_global_in = bgp_static->igpnexthop;
- bgp_attr_extra_get (&attr)->mp_nexthop_len = IPV4_MAX_BYTELEN;
+ attr.mp_nexthop_global_in = bgp_static->igpnexthop;
+ attr.mp_nexthop_len = IPV4_MAX_BYTELEN;
}
}
if(afi == AFI_L2VPN)
@@ -4323,7 +4301,6 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p,
/* Unintern original. */
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
bgp_static_withdraw_safi (bgp, p, afi, safi, &bgp_static->prd);
return;
}
@@ -4351,7 +4328,6 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p,
bgp_unlock_node (rn);
bgp_attr_unintern (&attr_new);
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
return;
}
else
@@ -4382,7 +4358,6 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p,
#endif
bgp_unlock_node (rn);
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
return;
}
}
@@ -4417,7 +4392,6 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p,
/* Unintern original. */
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
}
/* Configure static BGP network. When user don't run zebra, static
@@ -6156,14 +6130,13 @@ bgp_redistribute_add (struct bgp *bgp, struct prefix *p, const struct in_addr *n
if (nexthop6)
{
- struct attr_extra *extra = bgp_attr_extra_get(&attr);
- extra->mp_nexthop_global = *nexthop6;
- extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
+ attr.mp_nexthop_global = *nexthop6;
+ attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
}
attr.med = metric;
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC);
- attr.extra->tag = tag;
+ attr.tag = tag;
afi = family2afi (p->family);
@@ -6171,10 +6144,8 @@ bgp_redistribute_add (struct bgp *bgp, struct prefix *p, const struct in_addr *n
if (red)
{
struct attr attr_new;
- struct attr_extra extra_new;
/* Copy attribute for modification. */
- attr_new.extra = &extra_new;
bgp_attr_dup (&attr_new, &attr);
if (red->redist_metric_flag)
@@ -6199,7 +6170,6 @@ bgp_redistribute_add (struct bgp *bgp, struct prefix *p, const struct in_addr *n
/* Unintern original. */
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
bgp_redistribute_delete (bgp, p, type, instance);
return;
}
@@ -6224,7 +6194,6 @@ bgp_redistribute_add (struct bgp *bgp, struct prefix *p, const struct in_addr *n
{
bgp_attr_unintern (&new_attr);
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
bgp_unlock_node (bn);
return;
}
@@ -6247,7 +6216,6 @@ bgp_redistribute_add (struct bgp *bgp, struct prefix *p, const struct in_addr *n
bgp_process (bgp, bn, afi, SAFI_UNICAST);
bgp_unlock_node (bn);
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
return;
}
}
@@ -6264,7 +6232,6 @@ bgp_redistribute_add (struct bgp *bgp, struct prefix *p, const struct in_addr *n
/* Unintern original. */
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
}
void
@@ -6479,7 +6446,7 @@ route_vty_out (struct vty *vty, struct prefix *p,
/* Print attribute */
attr = binfo->attr;
- if (attr)
+ if (attr)
{
/*
* For ENCAP and EVPN routes, nexthop address family is not
@@ -6487,32 +6454,25 @@ route_vty_out (struct vty *vty, struct prefix *p,
* Both SAFI_MPLS_VPN and SAFI_ENCAP use the MP nexthop field
* EVPN routes are also exchanged with a MP nexthop. Currently, this
* is only IPv4, the value will be present in either attr->nexthop or
- * attr->extra->mp_nexthop_global_in
+ * attr->mp_nexthop_global_in
*/
if ((safi == SAFI_ENCAP) || (safi == SAFI_MPLS_VPN))
{
- if (attr->extra)
- {
- char buf[BUFSIZ];
- int af = NEXTHOP_FAMILY(attr->extra->mp_nexthop_len);
+ char buf[BUFSIZ];
+ int af = NEXTHOP_FAMILY(attr->mp_nexthop_len);
- switch (af)
- {
- case AF_INET:
- vty_out (vty, "%s", inet_ntop(af,
- &attr->extra->mp_nexthop_global_in, buf, BUFSIZ));
- break;
- case AF_INET6:
- vty_out (vty, "%s", inet_ntop(af,
- &attr->extra->mp_nexthop_global, buf, BUFSIZ));
- break;
- default:
- vty_out(vty, "?");
- break;
- }
+ switch (af)
+ {
+ case AF_INET:
+ vty_out (vty, "%s", inet_ntop(af, &attr->mp_nexthop_global_in, buf, BUFSIZ));
+ break;
+ case AF_INET6:
+ vty_out (vty, "%s", inet_ntop(af, &attr->mp_nexthop_global, buf, BUFSIZ));
+ break;
+ default:
+ vty_out(vty, "?");
+ break;
}
- else
- vty_out(vty, "?");
}
else if (safi == SAFI_EVPN)
{
@@ -6535,7 +6495,7 @@ route_vty_out (struct vty *vty, struct prefix *p,
json_nexthop_global = json_object_new_object();
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_EVPN))
- json_object_string_add(json_nexthop_global, "ip", inet_ntoa (attr->extra->mp_nexthop_global_in));
+ json_object_string_add(json_nexthop_global, "ip", inet_ntoa (attr->mp_nexthop_global_in));
else
json_object_string_add(json_nexthop_global, "ip", inet_ntoa (attr->nexthop));
@@ -6546,7 +6506,7 @@ route_vty_out (struct vty *vty, struct prefix *p,
{
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_EVPN))
vty_out (vty, "%-16s",
- inet_ntoa (attr->extra->mp_nexthop_global_in));
+ inet_ntoa (attr->mp_nexthop_global_in));
else
vty_out (vty, "%-16s", inet_ntoa (attr->nexthop));
}
@@ -6563,25 +6523,25 @@ route_vty_out (struct vty *vty, struct prefix *p,
json_nexthop_global = json_object_new_object();
json_object_string_add(json_nexthop_global, "ip",
inet_ntop (AF_INET6,
- &attr->extra->mp_nexthop_global,
+ &attr->mp_nexthop_global,
buf, BUFSIZ));
json_object_string_add(json_nexthop_global, "afi", "ipv6");
json_object_string_add(json_nexthop_global, "scope", "global");
/* We display both LL & GL if both have been received */
- if ((attr->extra->mp_nexthop_len == 32) || (binfo->peer->conf_if))
+ if ((attr->mp_nexthop_len == 32) || (binfo->peer->conf_if))
{
json_nexthop_ll = json_object_new_object();
json_object_string_add(json_nexthop_ll, "ip",
inet_ntop (AF_INET6,
- &attr->extra->mp_nexthop_local,
+ &attr->mp_nexthop_local,
buf, BUFSIZ));
json_object_string_add(json_nexthop_ll, "afi", "ipv6");
json_object_string_add(json_nexthop_ll, "scope", "link-local");
- if ((IPV6_ADDR_CMP (&attr->extra->mp_nexthop_global,
- &attr->extra->mp_nexthop_local) != 0) &&
- !attr->extra->mp_nexthop_prefer_global)
+ if ((IPV6_ADDR_CMP (&attr->mp_nexthop_global,
+ &attr->mp_nexthop_local) != 0) &&
+ !attr->mp_nexthop_prefer_global)
json_object_boolean_true_add(json_nexthop_ll, "used");
else
json_object_boolean_true_add(json_nexthop_global, "used");
@@ -6592,8 +6552,8 @@ route_vty_out (struct vty *vty, struct prefix *p,
else
{
/* Display LL if LL/Global both in table unless prefer-global is set */
- if (((attr->extra->mp_nexthop_len == 32) &&
- !attr->extra->mp_nexthop_prefer_global) ||
+ if (((attr->mp_nexthop_len == 32) &&
+ !attr->mp_nexthop_prefer_global) ||
(binfo->peer->conf_if))
{
if (binfo->peer->conf_if)
@@ -6611,7 +6571,7 @@ route_vty_out (struct vty *vty, struct prefix *p,
{
len = vty_out (vty, "%s",
inet_ntop (AF_INET6,
- &attr->extra->mp_nexthop_local,
+ &attr->mp_nexthop_local,
buf, BUFSIZ));
len = 16 - len;
@@ -6625,7 +6585,7 @@ route_vty_out (struct vty *vty, struct prefix *p,
{
len = vty_out (vty, "%s",
inet_ntop (AF_INET6,
- &attr->extra->mp_nexthop_global,
+ &attr->mp_nexthop_global,
buf, BUFSIZ));
len = 16 - len;
@@ -6658,14 +6618,9 @@ route_vty_out (struct vty *vty, struct prefix *p,
vty_out (vty, " ");
if (json_paths)
- {
- if (attr->extra)
- json_object_int_add(json_path, "weight", attr->extra->weight);
- else
- json_object_int_add(json_path, "weight", 0);
- }
+ json_object_int_add(json_path, "weight", attr->weight);
else
- vty_out (vty, "%7u ", (attr->extra ? attr->extra->weight : 0));
+ vty_out (vty, "%7u ", attr->weight);
if (json_paths) {
char buf[BUFSIZ];
@@ -6762,7 +6717,7 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
!BGP_ATTR_NEXTHOP_AFI_IP6(attr)))
{
if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP || safi == SAFI_EVPN)
- json_object_string_add(json_net, "nextHop", inet_ntoa (attr->extra->mp_nexthop_global_in));
+ json_object_string_add(json_net, "nextHop", inet_ntoa (attr->mp_nexthop_global_in));
else
json_object_string_add(json_net, "nextHop", inet_ntoa (attr->nexthop));
}
@@ -6770,7 +6725,7 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
{
char buf[BUFSIZ];
- json_object_string_add(json_net, "netHopGloabal", inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
+ json_object_string_add(json_net, "netHopGloabal", inet_ntop (AF_INET6, &attr->mp_nexthop_global,
buf, BUFSIZ));
}
@@ -6780,10 +6735,7 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))
json_object_int_add(json_net, "localPref", attr->local_pref);
- if (attr->extra)
- json_object_int_add(json_net, "weight", attr->extra->weight);
- else
- json_object_int_add(json_net, "weight", 0);
+ json_object_int_add(json_net, "weight", attr->weight);
/* Print aspath */
if (attr->aspath)
@@ -6802,7 +6754,7 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
{
if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP || safi == SAFI_EVPN)
vty_out (vty, "%-16s",
- inet_ntoa (attr->extra->mp_nexthop_global_in));
+ inet_ntoa (attr->mp_nexthop_global_in));
else
vty_out (vty, "%-16s", inet_ntoa (attr->nexthop));
}
@@ -6811,10 +6763,8 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
int len;
char buf[BUFSIZ];
- assert (attr->extra);
-
len = vty_out (vty, "%s",
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_global,
buf, BUFSIZ));
len = 16 - len;
if (len < 1)
@@ -6832,7 +6782,7 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
else
vty_out (vty, " ");
- vty_out (vty, "%7u ", (attr->extra ? attr->extra->weight : 0));
+ vty_out (vty, "%7u ", attr->weight);
/* Print aspath */
if (attr->aspath)
@@ -6891,9 +6841,9 @@ route_vty_out_tag (struct vty *vty, struct prefix *p,
if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP || safi == SAFI_EVPN)
{
if (json)
- json_object_string_add(json_out, "mpNexthopGlobalIn", inet_ntoa (attr->extra->mp_nexthop_global_in));
+ json_object_string_add(json_out, "mpNexthopGlobalIn", inet_ntoa (attr->mp_nexthop_global_in));
else
- vty_out (vty, "%-16s", inet_ntoa (attr->extra->mp_nexthop_global_in));
+ vty_out (vty, "%-16s", inet_ntoa (attr->mp_nexthop_global_in));
}
else
{
@@ -6907,36 +6857,35 @@ route_vty_out_tag (struct vty *vty, struct prefix *p,
|| (safi == SAFI_EVPN && p->family == AF_ETHERNET && BGP_ATTR_NEXTHOP_AFI_IP6(attr))
|| (BGP_ATTR_NEXTHOP_AFI_IP6(attr)))
{
- assert (attr->extra);
char buf_a[BUFSIZ];
char buf_b[BUFSIZ];
char buf_c[BUFSIZ];
- if (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL)
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL)
{
if (json)
json_object_string_add(json_out, "mpNexthopGlobalIn",
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global, buf_a, BUFSIZ));
+ inet_ntop (AF_INET6, &attr->mp_nexthop_global, buf_a, BUFSIZ));
else
vty_out (vty, "%s",
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_global,
buf_a, BUFSIZ));
}
- else if (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ else if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
{
if (json)
{
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_global,
buf_a, BUFSIZ);
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_local,
buf_b, BUFSIZ);
sprintf(buf_c, "%s(%s)", buf_a, buf_b);
json_object_string_add(json_out, "mpNexthopGlobalLocal", buf_c);
}
else
vty_out (vty, "%s(%s)",
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_global,
buf_a, BUFSIZ),
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_local,
buf_b, BUFSIZ));
}
@@ -6987,60 +6936,52 @@ route_vty_out_overlay (struct vty *vty, struct prefix *p,
attr = binfo->attr;
if (attr)
{
- if (attr->extra)
- {
- char buf1[BUFSIZ];
- int af = NEXTHOP_FAMILY(attr->extra->mp_nexthop_len);
+ char buf1[BUFSIZ];
+ int af = NEXTHOP_FAMILY(attr->mp_nexthop_len);
- switch (af) {
- case AF_INET:
- vty_out (vty, "%-16s", inet_ntop(af,
- &attr->extra->mp_nexthop_global_in, buf, BUFSIZ));
- break;
- case AF_INET6:
- vty_out (vty, "%s(%s)",
- inet_ntop (af,
- &attr->extra->mp_nexthop_global, buf, BUFSIZ),
- inet_ntop (af,
- &attr->extra->mp_nexthop_local, buf1, BUFSIZ));
- break;
- default:
- vty_out(vty, "?");
- }
- } else {
+ switch (af) {
+ case AF_INET:
+ vty_out (vty, "%-16s", inet_ntop(af,
+ &attr->mp_nexthop_global_in, buf, BUFSIZ));
+ break;
+ case AF_INET6:
+ vty_out (vty, "%s(%s)",
+ inet_ntop (af,
+ &attr->mp_nexthop_global, buf, BUFSIZ),
+ inet_ntop (af,
+ &attr->mp_nexthop_local, buf1, BUFSIZ));
+ break;
+ default:
vty_out(vty, "?");
}
}
- if(attr->extra)
+ struct eth_segment_id *id = &(attr->evpn_overlay.eth_s_id);
+ char *str = esi2str(id);
+ vty_out (vty, "%s", str);
+ XFREE (MTYPE_TMP, str);
+ if (IS_EVPN_PREFIX_IPADDR_V4((struct prefix_evpn *)p))
{
- struct eth_segment_id *id = &(attr->extra->evpn_overlay.eth_s_id);
- char *str = esi2str(id);
- vty_out (vty, "%s", str);
- XFREE (MTYPE_TMP, str);
- if (IS_EVPN_PREFIX_IPADDR_V4((struct prefix_evpn *)p))
- {
- vty_out (vty, "/%s", inet_ntoa (attr->extra->evpn_overlay.gw_ip.ipv4));
- }
- else if (IS_EVPN_PREFIX_IPADDR_V6((struct prefix_evpn *)p))
- {
- vty_out (vty, "/%s",
- inet_ntop (AF_INET6, &(attr->extra->evpn_overlay.gw_ip.ipv6),
- buf, BUFSIZ));
- }
- if(attr->extra->ecommunity)
- {
- char *mac = NULL;
- struct ecommunity_val *routermac = ecommunity_lookup (attr->extra->ecommunity,
- ECOMMUNITY_ENCODE_EVPN,
- ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC);
- if(routermac)
- mac = ecom_mac2str((char *)routermac->val);
- if(mac)
- {
- vty_out (vty, "/%s",(char *)mac);
- XFREE(MTYPE_TMP, mac);
- }
+ vty_out (vty, "/%s", inet_ntoa (attr->evpn_overlay.gw_ip.ipv4));
+ }
+ else if (IS_EVPN_PREFIX_IPADDR_V6((struct prefix_evpn *)p))
+ {
+ vty_out (vty, "/%s",
+ inet_ntop (AF_INET6, &(attr->evpn_overlay.gw_ip.ipv6),
+ buf, BUFSIZ));
+ }
+ if(attr->ecommunity)
+ {
+ char *mac = NULL;
+ struct ecommunity_val *routermac = ecommunity_lookup (attr->ecommunity,
+ ECOMMUNITY_ENCODE_EVPN,
+ ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC);
+ if(routermac)
+ mac = ecom_mac2str((char *)routermac->val);
+ if(mac)
+ {
+ vty_out (vty, "/%s",(char *)mac);
+ XFREE(MTYPE_TMP, mac);
}
}
vty_out (vty, VTYNL);
@@ -7372,14 +7313,14 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
{
if (json_paths)
{
- json_object_int_add(json_path, "aggregatorAs", attr->extra->aggregator_as);
- json_object_string_add(json_path, "aggregatorId", inet_ntoa (attr->extra->aggregator_addr));
+ json_object_int_add(json_path, "aggregatorAs", attr->aggregator_as);
+ json_object_string_add(json_path, "aggregatorId", inet_ntoa (attr->aggregator_addr));
}
else
{
vty_out (vty, ", (aggregated by %u %s)",
- attr->extra->aggregator_as,
- inet_ntoa (attr->extra->aggregator_addr));
+ attr->aggregator_as,
+ inet_ntoa (attr->aggregator_addr));
}
}
@@ -7429,9 +7370,9 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP || safi == SAFI_EVPN)
{
if (json_paths)
- json_object_string_add(json_nexthop_global, "ip", inet_ntoa (attr->extra->mp_nexthop_global_in));
+ json_object_string_add(json_nexthop_global, "ip", inet_ntoa (attr->mp_nexthop_global_in));
else
- vty_out (vty, " %s", inet_ntoa (attr->extra->mp_nexthop_global_in));
+ vty_out (vty, " %s", inet_ntoa (attr->mp_nexthop_global_in));
}
else
{
@@ -7446,11 +7387,10 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
}
else
{
- assert (attr->extra);
if (json_paths)
{
json_object_string_add(json_nexthop_global, "ip",
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_global,
buf, INET6_ADDRSTRLEN));
json_object_string_add(json_nexthop_global, "afi", "ipv6");
json_object_string_add(json_nexthop_global, "scope", "global");
@@ -7458,7 +7398,7 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
else
{
vty_out (vty, " %s",
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_global,
buf, INET6_ADDRSTRLEN));
}
}
@@ -7559,7 +7499,7 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
}
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))
- vty_out (vty, " (%s)", inet_ntoa (attr->extra->originator_id));
+ vty_out (vty, " (%s)", inet_ntoa (attr->originator_id));
else
vty_out (vty, " (%s)", inet_ntop (AF_INET, &binfo->peer->remote_id, buf1, BUFSIZ));
}
@@ -7569,20 +7509,20 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out (vty, VTYNL);
/* display the link-local nexthop */
- if (attr->extra && attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
{
if (json_paths)
{
json_nexthop_ll = json_object_new_object();
json_object_string_add(json_nexthop_ll, "ip",
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_local,
buf, INET6_ADDRSTRLEN));
json_object_string_add(json_nexthop_ll, "afi", "ipv6");
json_object_string_add(json_nexthop_ll, "scope", "link-local");
json_object_boolean_true_add(json_nexthop_ll, "accessible");
- if (!attr->extra->mp_nexthop_prefer_global)
+ if (!attr->mp_nexthop_prefer_global)
json_object_boolean_true_add(json_nexthop_ll, "used");
else
json_object_boolean_true_add(json_nexthop_global, "used");
@@ -7590,9 +7530,9 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
else
{
vty_outln (vty, " (%s) %s",
- inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local,
+ inet_ntop (AF_INET6, &attr->mp_nexthop_local,
buf, INET6_ADDRSTRLEN),
- attr->extra->mp_nexthop_prefer_global ? "(prefer-global)" : "(used)");
+ attr->mp_nexthop_prefer_global ? "(prefer-global)" : "(used)");
}
}
/* If we do not have a link-local nexthop then we must flag the global as "used" */
@@ -7631,20 +7571,20 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out (vty, ", localpref %u", bgp->default_local_pref);
}
- if (attr->extra && attr->extra->weight != 0)
+ if (attr->weight != 0)
{
if (json_paths)
- json_object_int_add(json_path, "weight", attr->extra->weight);
+ json_object_int_add(json_path, "weight", attr->weight);
else
- vty_out (vty, ", weight %u", attr->extra->weight);
+ vty_out (vty, ", weight %u", attr->weight);
}
- if (attr->extra && attr->extra->tag != 0)
+ if (attr->tag != 0)
{
if (json_paths)
- json_object_int_add(json_path, "tag", attr->extra->tag);
+ json_object_int_add(json_path, "tag", attr->tag);
else
- vty_out (vty, ", tag %"ROUTE_TAG_PRI, attr->extra->tag);
+ vty_out (vty, ", tag %"ROUTE_TAG_PRI, attr->tag);
}
if (! CHECK_FLAG (binfo->flags, BGP_INFO_VALID))
@@ -7807,33 +7747,32 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
if (json_paths)
{
json_ext_community = json_object_new_object();
- json_object_string_add(json_ext_community, "string", attr->extra->ecommunity->str);
+ json_object_string_add(json_ext_community, "string", attr->ecommunity->str);
json_object_object_add(json_path, "extendedCommunity", json_ext_community);
}
else
{
vty_outln (vty, " Extended Community: %s",
- attr->extra->ecommunity->str);
+ attr->ecommunity->str);
}
}
/* Line 6 display Large community */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES))
vty_outln (vty, " Large Community: %s",
- attr->extra->lcommunity->str);
+ attr->lcommunity->str);
/* Line 7 display Originator, Cluster-id */
if ((attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)) ||
(attr->flag & ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST)))
{
- assert (attr->extra);
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))
{
if (json_paths)
- json_object_string_add(json_path, "originatorId", inet_ntoa (attr->extra->originator_id));
+ json_object_string_add(json_path, "originatorId", inet_ntoa (attr->originator_id));
else
vty_out (vty, " Originator: %s",
- inet_ntoa (attr->extra->originator_id));
+ inet_ntoa (attr->originator_id));
}
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST))
@@ -7845,16 +7784,16 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
json_cluster_list = json_object_new_object();
json_cluster_list_list = json_object_new_array();
- for (i = 0; i < attr->extra->cluster->length / 4; i++)
+ for (i = 0; i < attr->cluster->length / 4; i++)
{
- json_string = json_object_new_string(inet_ntoa (attr->extra->cluster->list[i]));
+ json_string = json_object_new_string(inet_ntoa (attr->cluster->list[i]));
json_object_array_add(json_cluster_list_list, json_string);
}
/* struct cluster_list does not have "str" variable like
* aspath and community do. Add this someday if someone
* asks for it.
- json_object_string_add(json_cluster_list, "string", attr->extra->cluster->str);
+ json_object_string_add(json_cluster_list, "string", attr->cluster->str);
*/
json_object_object_add(json_cluster_list, "list", json_cluster_list_list);
json_object_object_add(json_path, "clusterList", json_cluster_list);
@@ -7863,10 +7802,10 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
{
vty_out (vty, ", Cluster list: ");
- for (i = 0; i < attr->extra->cluster->length / 4; i++)
+ for (i = 0; i < attr->cluster->length / 4; i++)
{
vty_out (vty, "%s ",
- inet_ntoa (attr->extra->cluster->list[i]));
+ inet_ntoa (attr->cluster->list[i]));
}
}
}
@@ -7893,13 +7832,13 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
}
/* Label Index */
- if (attr->extra->label_index != BGP_INVALID_LABEL_INDEX)
+ if (attr->label_index != BGP_INVALID_LABEL_INDEX)
{
if (json_paths)
- json_object_int_add(json_path, "labelIndex", attr->extra->label_index);
+ json_object_int_add(json_path, "labelIndex", attr->label_index);
else
vty_outln (vty, " Label Index: %d",
- attr->extra->label_index);
+ attr->label_index);
}
/* Line 8 display Addpath IDs */
@@ -8105,10 +8044,8 @@ bgp_show_table (struct vty *vty, struct bgp *bgp, struct bgp_table *table,
struct route_map *rmap = output_arg;
struct bgp_info binfo;
struct attr dummy_attr;
- struct attr_extra dummy_extra;
int ret;
- dummy_attr.extra = &dummy_extra;
bgp_attr_dup (&dummy_attr, ri->attr);
binfo.peer = ri->peer;
@@ -8186,21 +8123,20 @@ bgp_show_table (struct vty *vty, struct bgp *bgp, struct bgp_table *table,
{
struct lcommunity *lcom = output_arg;
- if (! ri->attr->extra || ! ri->attr->extra->lcommunity ||
- ! lcommunity_match (ri->attr->extra->lcommunity, lcom))
+ if (! ri->attr->lcommunity ||
+ ! lcommunity_match (ri->attr->lcommunity, lcom))
continue;
}
if (type == bgp_show_type_lcommunity_list)
{
struct community_list *list = output_arg;
- if (! ri->attr->extra ||
- ! lcommunity_list_match (ri->attr->extra->lcommunity, list))
+ if (! lcommunity_list_match (ri->attr->lcommunity, list))
continue;
}
if (type == bgp_show_type_lcommunity_all)
{
- if (! ri->attr->extra || ! ri->attr->extra->lcommunity)
+ if (! ri->attr->lcommunity)
continue;
}
if (type == bgp_show_type_dampend_paths
@@ -9831,7 +9767,6 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
struct bgp *bgp;
int header2 = 1;
struct attr attr;
- struct attr_extra extra;
int ret;
struct update_subgroup *subgrp;
json_object *json_scode = NULL;
@@ -9904,7 +9839,6 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
header1 = 0;
}
- attr.extra = &extra;
for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn))
{
if (in)
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index cb918718fe..4b82717569 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -232,8 +232,8 @@ struct bgp_static
#define BGP_ATTR_NEXTHOP_AFI_IP6(attr) \
(! CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP)) && \
- (attr)->extra && ((attr)->extra->mp_nexthop_len == 16 || \
- (attr)->extra->mp_nexthop_len == 32))
+ ((attr)->mp_nexthop_len == 16 || \
+ (attr)->mp_nexthop_len == 32))
#define BGP_INFO_COUNTABLE(BI) \
(! CHECK_FLAG ((BI)->flags, BGP_INFO_HISTORY) \
&& ! CHECK_FLAG ((BI)->flags, BGP_INFO_REMOVED))
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index b0a3cc677d..7ce144f729 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -868,8 +868,7 @@ route_match_lcommunity (void *rule, struct prefix *prefix,
if (! list)
return RMAP_NOMATCH;
- if (bgp_info->attr->extra &&
- lcommunity_list_match (bgp_info->attr->extra->lcommunity, list))
+ if (lcommunity_list_match (bgp_info->attr->lcommunity, list))
return RMAP_MATCH;
}
@@ -933,15 +932,12 @@ route_match_ecommunity (void *rule, struct prefix *prefix,
{
bgp_info = object;
- if (!bgp_info->attr->extra)
- return RMAP_NOMATCH;
-
list = community_list_lookup (bgp_clist, (char *) rule,
EXTCOMMUNITY_LIST_MASTER);
if (! list)
return RMAP_NOMATCH;
- if (ecommunity_list_match (bgp_info->attr->extra->ecommunity, list))
+ if (ecommunity_list_match (bgp_info->attr->ecommunity, list))
return RMAP_MATCH;
}
return RMAP_NOMATCH;
@@ -1149,10 +1145,7 @@ route_match_tag (void *rule, struct prefix *prefix,
tag = rule;
bgp_info = object;
- if (!bgp_info->attr->extra)
- return RMAP_NOMATCH;
-
- return ((bgp_info->attr->extra->tag == *tag)? RMAP_MATCH : RMAP_NOMATCH);
+ return ((bgp_info->attr->tag == *tag)? RMAP_MATCH : RMAP_NOMATCH);
}
return RMAP_NOMATCH;
@@ -1332,7 +1325,6 @@ route_set_weight (void *rule, struct prefix *prefix, route_map_object_t type,
{
struct rmap_value *rv;
struct bgp_info *bgp_info;
- u_int32_t weight;
if (type == RMAP_BGP)
{
@@ -1341,11 +1333,7 @@ route_set_weight (void *rule, struct prefix *prefix, route_map_object_t type,
bgp_info = object;
/* Set weight value. */
- weight = route_value_adjust(rv, 0, bgp_info->peer);
- if (weight)
- (bgp_attr_extra_get (bgp_info->attr))->weight = weight;
- else if (bgp_info->attr->extra)
- bgp_info->attr->extra->weight = 0;
+ bgp_info->attr->weight = route_value_adjust(rv, 0, bgp_info->peer);
}
return RMAP_OKAY;
@@ -1644,14 +1632,13 @@ route_set_lcommunity (void *rule, struct prefix *prefix,
rcs = rule;
binfo = object;
attr = binfo->attr;
- old = (attr->extra) ? attr->extra->lcommunity : NULL;
+ old = attr->lcommunity;
/* "none" case. */
if (rcs->none)
{
attr->flag &= ~(ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES));
- if (attr->extra)
- attr->extra->lcommunity = NULL;
+ attr->lcommunity = NULL;
/* See the longer comment down below. */
if (old && old->refcnt == 0)
@@ -1676,7 +1663,7 @@ route_set_lcommunity (void *rule, struct prefix *prefix,
new = lcommunity_dup (rcs->lcom);
/* will be intern()'d or attr_flush()'d by bgp_update_main() */
- (bgp_attr_extra_get (attr))->lcommunity = new;
+ attr->lcommunity = new;
attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES);
}
@@ -1766,7 +1753,7 @@ route_set_lcommunity_delete (void *rule, struct prefix *prefix,
binfo = object;
list = community_list_lookup (bgp_clist, rule,
LARGE_COMMUNITY_LIST_MASTER);
- old = ((binfo->attr->extra) ? binfo->attr->extra->lcommunity : NULL);
+ old = binfo->attr->lcommunity;
if (list && old)
{
@@ -1783,13 +1770,13 @@ route_set_lcommunity_delete (void *rule, struct prefix *prefix,
if (new->size == 0)
{
- binfo->attr->extra->lcommunity = NULL;
+ binfo->attr->lcommunity = NULL;
binfo->attr->flag &= ~ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES);
lcommunity_free (&new);
}
else
{
- binfo->attr->extra->lcommunity = new;
+ binfo->attr->lcommunity = new;
binfo->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES);
}
}
@@ -1946,7 +1933,7 @@ route_set_ecommunity (void *rule, struct prefix *prefix,
return RMAP_OKAY;
/* We assume additive for Extended Community. */
- old_ecom = (bgp_attr_extra_get (bgp_info->attr))->ecommunity;
+ old_ecom = bgp_info->attr->ecommunity;
if (old_ecom)
{
@@ -1961,7 +1948,7 @@ route_set_ecommunity (void *rule, struct prefix *prefix,
new_ecom = ecommunity_dup (ecom);
/* will be intern()'d or attr_flush()'d by bgp_update_main() */
- bgp_info->attr->extra->ecommunity = new_ecom;
+ bgp_info->attr->ecommunity = new_ecom;
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES);
}
@@ -2129,16 +2116,14 @@ route_set_aggregator_as (void *rule, struct prefix *prefix,
{
struct bgp_info *bgp_info;
struct aggregator *aggregator;
- struct attr_extra *ae;
if (type == RMAP_BGP)
{
bgp_info = object;
aggregator = rule;
- ae = bgp_attr_extra_get (bgp_info->attr);
- ae->aggregator_as = aggregator->as;
- ae->aggregator_addr = aggregator->address;
+ bgp_info->attr->aggregator_as = aggregator->as;
+ bgp_info->attr->aggregator_addr = aggregator->address;
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR);
}
@@ -2187,16 +2172,14 @@ route_set_tag (void *rule, struct prefix *prefix,
{
route_tag_t *tag;
struct bgp_info *bgp_info;
- struct attr_extra *ae;
if (type == RMAP_BGP)
{
tag = rule;
bgp_info = object;
- ae = bgp_attr_extra_get (bgp_info->attr);
/* Set tag value */
- ae->tag=*tag;
+ bgp_info->attr->tag=*tag;
}
@@ -2231,7 +2214,7 @@ route_set_label_index (void *rule, struct prefix *prefix,
label_index = rv->value;
if (label_index)
{
- (bgp_attr_extra_get (bgp_info->attr))->label_index = label_index;
+ bgp_info->attr->label_index = label_index;
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_PREFIX_SID);
}
}
@@ -2302,14 +2285,11 @@ route_match_ipv6_next_hop (void *rule, struct prefix *prefix,
{
bgp_info = object;
- if (!bgp_info->attr->extra)
- return RMAP_NOMATCH;
-
- if (IPV6_ADDR_SAME (&bgp_info->attr->extra->mp_nexthop_global, addr))
+ if (IPV6_ADDR_SAME (&bgp_info->attr->mp_nexthop_global, addr))
return RMAP_MATCH;
- if (bgp_info->attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL &&
- IPV6_ADDR_SAME (&bgp_info->attr->extra->mp_nexthop_local, rule))
+ if (bgp_info->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL &&
+ IPV6_ADDR_SAME (&bgp_info->attr->mp_nexthop_local, rule))
return RMAP_MATCH;
return RMAP_NOMATCH;
@@ -2407,11 +2387,11 @@ route_set_ipv6_nexthop_global (void *rule, struct prefix *prefix,
bgp_info = object;
/* Set next hop value. */
- (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global = *address;
+ bgp_info->attr->mp_nexthop_global = *address;
/* Set nexthop length. */
- if (bgp_info->attr->extra->mp_nexthop_len == 0)
- bgp_info->attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
+ if (bgp_info->attr->mp_nexthop_len == 0)
+ bgp_info->attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
SET_FLAG(bgp_info->attr->rmap_change_flags,
BATTR_RMAP_IPV6_GLOBAL_NHOP_CHANGED);
@@ -2477,13 +2457,13 @@ route_set_ipv6_nexthop_prefer_global (void *rule, struct prefix *prefix,
&& sockunion_family (peer->su_remote) == AF_INET6)
{
/* Set next hop preference to global */
- bgp_info->attr->extra->mp_nexthop_prefer_global = TRUE;
+ bgp_info->attr->mp_nexthop_prefer_global = TRUE;
SET_FLAG(bgp_info->attr->rmap_change_flags,
BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED);
}
else
{
- bgp_info->attr->extra->mp_nexthop_prefer_global = FALSE;
+ bgp_info->attr->mp_nexthop_prefer_global = FALSE;
SET_FLAG(bgp_info->attr->rmap_change_flags,
BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED);
}
@@ -2535,11 +2515,11 @@ route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix,
bgp_info = object;
/* Set next hop value. */
- (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_local = *address;
+ bgp_info->attr->mp_nexthop_local = *address;
/* Set nexthop length. */
- if (bgp_info->attr->extra->mp_nexthop_len != BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
- bgp_info->attr->extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
+ if (bgp_info->attr->mp_nexthop_len != BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ bgp_info->attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
SET_FLAG(bgp_info->attr->rmap_change_flags,
BATTR_RMAP_IPV6_LL_NHOP_CHANGED);
@@ -2611,15 +2591,15 @@ route_set_ipv6_nexthop_peer (void *rule, struct prefix *prefix,
/* Set next hop value and length in attribute. */
if (IN6_IS_ADDR_LINKLOCAL(&peer_address))
{
- (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_local = peer_address;
- if (bgp_info->attr->extra->mp_nexthop_len != 32)
- bgp_info->attr->extra->mp_nexthop_len = 32;
+ bgp_info->attr->mp_nexthop_local = peer_address;
+ if (bgp_info->attr->mp_nexthop_len != 32)
+ bgp_info->attr->mp_nexthop_len = 32;
}
else
{
- (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global = peer_address;
- if (bgp_info->attr->extra->mp_nexthop_len == 0)
- bgp_info->attr->extra->mp_nexthop_len = 16;
+ bgp_info->attr->mp_nexthop_global = peer_address;
+ if (bgp_info->attr->mp_nexthop_len == 0)
+ bgp_info->attr->mp_nexthop_len = 16;
}
}
@@ -2633,9 +2613,9 @@ route_set_ipv6_nexthop_peer (void *rule, struct prefix *prefix,
SET_FLAG(bgp_info->attr->rmap_change_flags,
BATTR_RMAP_NEXTHOP_PEER_ADDRESS);
/* clear next hop value. */
- memset (&((bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global),
+ memset (&(bgp_info->attr->mp_nexthop_global),
0, sizeof (struct in6_addr));
- memset (&((bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_local),
+ memset (&(bgp_info->attr->mp_nexthop_local),
0, sizeof (struct in6_addr));
}
}
@@ -2688,8 +2668,8 @@ route_set_vpnv4_nexthop (void *rule, struct prefix *prefix,
bgp_info = object;
/* Set next hop value. */
- (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global_in = *address;
- (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_len = 4;
+ bgp_info->attr->mp_nexthop_global_in = *address;
+ bgp_info->attr->mp_nexthop_len = 4;
}
return RMAP_OKAY;
@@ -2730,8 +2710,8 @@ route_set_vpnv6_nexthop (void *rule, struct prefix *prefix,
bgp_info = object;
/* Set next hop value. */
- memcpy (&(bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global, address, sizeof(struct in6_addr));
- (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_len = BGP_ATTR_NHLEN_VPNV6_GLOBAL;
+ memcpy (&bgp_info->attr->mp_nexthop_global, address, sizeof(struct in6_addr));
+ bgp_info->attr->mp_nexthop_len = BGP_ATTR_NHLEN_VPNV6_GLOBAL;
}
return RMAP_OKAY;
@@ -2794,7 +2774,7 @@ route_set_originator_id (void *rule, struct prefix *prefix, route_map_object_t t
bgp_info = object;
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID);
- (bgp_attr_extra_get (bgp_info->attr))->originator_id = *address;
+ bgp_info->attr->originator_id = *address;
}
return RMAP_OKAY;
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index db69400a67..c1a6ad589d 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -802,16 +802,10 @@ bgp4PathAttrTable (struct variable *v, oid name[], size_t *length,
return SNMP_INTEGER (1);
break;
case BGP4PATHATTRAGGREGATORAS: /* 10 */
- if (binfo->attr->extra)
- return SNMP_INTEGER (binfo->attr->extra->aggregator_as);
- else
- return SNMP_INTEGER (0);
+ return SNMP_INTEGER (binfo->attr->aggregator_as);
break;
case BGP4PATHATTRAGGREGATORADDR: /* 11 */
- if (binfo->attr->extra)
- return SNMP_IPADDRESS (binfo->attr->extra->aggregator_addr);
- else
- return SNMP_INTEGER (0);
+ return SNMP_IPADDRESS (binfo->attr->aggregator_addr);
break;
case BGP4PATHATTRCALCLOCALPREF: /* 12 */
return SNMP_INTEGER (-1);
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index c4cb8ae1b3..f81568976f 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -587,7 +587,6 @@ subgroup_announce_table (struct update_subgroup *subgrp,
struct bgp_node *rn;
struct bgp_info *ri;
struct attr attr;
- struct attr_extra extra;
struct peer *peer;
afi_t afi;
safi_t safi;
@@ -610,9 +609,6 @@ subgroup_announce_table (struct update_subgroup *subgrp,
&& CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
subgroup_default_originate (subgrp, 0);
- /* It's initialized in bgp_announce_check() */
- attr.extra = &extra;
-
for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn))
for (ri = rn->info; ri; ri = ri->next)
@@ -716,18 +712,16 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw)
str2prefix ("0.0.0.0/0", &p);
else if (afi == AFI_IP6)
{
- struct attr_extra *ae = attr.extra;
-
str2prefix ("::/0", &p);
/* IPv6 global nexthop must be included. */
- ae->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
+ attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
/* If the peer is on shared nextwork and we have link-local
nexthop set it. */
if (peer->shared_network
&& !IN6_IS_ADDR_UNSPECIFIED (&peer->nexthop.v6_local))
- ae->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
+ attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
}
if (peer->default_rmap[afi][safi].name)
@@ -739,11 +733,9 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw)
for (ri = rn->info; ri; ri = ri->next)
{
struct attr dummy_attr;
- struct attr_extra dummy_extra;
struct bgp_info info;
/* Provide dummy so the route-map can't modify the attributes */
- dummy_attr.extra = &dummy_extra;
bgp_attr_dup (&dummy_attr, ri->attr);
info.peer = ri->peer;
info.attr = &dummy_attr;
@@ -794,7 +786,6 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw)
}
}
- bgp_attr_extra_free (&attr);
aspath_unintern (&aspath);
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index b877d982c8..b58a3266a0 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -6724,11 +6724,6 @@ DEFUN (show_bgp_memory,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof(struct attr)),
VTYNL);
- if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
- vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof(struct attr_extra)),
- VTYNL);
if ((count = attr_unknown_count()))
vty_out (vty, "%ld unknown attributes%s", count, VTYNL);
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 91c155b3fd..3a215dc476 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -73,14 +73,12 @@ struct stream *bgp_label_buf = NULL;
2. use an array to avoid number of mallocs.
Number of supported next-hops are finite, use of arrays should be ok. */
struct attr attr_cp[MULTIPATH_NUM];
-struct attr_extra attr_extra_cp[MULTIPATH_NUM];
unsigned int attr_index = 0;
/* Once per address-family initialization of the attribute array */
#define BGP_INFO_ATTR_BUF_INIT()\
do {\
memset(attr_cp, 0, MULTIPATH_NUM * sizeof(struct attr));\
- memset(attr_extra_cp, 0, MULTIPATH_NUM * sizeof(struct attr_extra));\
attr_index = 0;\
} while (0)
@@ -88,7 +86,6 @@ do {\
do { \
*info_dst = *info_src; \
assert(attr_index != multipath_num);\
- attr_cp[attr_index].extra = &attr_extra_cp[attr_index]; \
bgp_attr_dup (&attr_cp[attr_index], info_src->attr); \
bgp_attr_deep_dup (&attr_cp[attr_index], info_src->attr); \
info_dst->attr = &attr_cp[attr_index]; \
@@ -1162,23 +1159,23 @@ bgp_info_to_ipv6_nexthop (struct bgp_info *info)
struct in6_addr *nexthop = NULL;
/* Only global address nexthop exists. */
- if (info->attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL)
- nexthop = &info->attr->extra->mp_nexthop_global;
+ if (info->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL)
+ nexthop = &info->attr->mp_nexthop_global;
/* If both global and link-local address present. */
- if (info->attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ if (info->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
{
/* Check if route-map is set to prefer global over link-local */
- if (info->attr->extra->mp_nexthop_prefer_global)
- nexthop = &info->attr->extra->mp_nexthop_global;
+ if (info->attr->mp_nexthop_prefer_global)
+ nexthop = &info->attr->mp_nexthop_global;
else
{
/* Workaround for Cisco's nexthop bug. */
- if (IN6_IS_ADDR_UNSPECIFIED (&info->attr->extra->mp_nexthop_global)
+ if (IN6_IS_ADDR_UNSPECIFIED (&info->attr->mp_nexthop_global)
&& info->peer->su_remote->sa.sa_family == AF_INET6)
nexthop = &info->peer->su_remote->sin6.sin6_addr;
else
- nexthop = &info->attr->extra->mp_nexthop_local;
+ nexthop = &info->attr->mp_nexthop_local;
}
}
@@ -1248,10 +1245,7 @@ bgp_zebra_announce (struct bgp_node *rn, struct prefix *p, struct bgp_info *info
flags = 0;
peer = info->peer;
- if ((info->attr->extra) && (info->attr->extra->tag != 0))
- tag = info->attr->extra->tag;
- else
- tag = 0;
+ tag = info->attr->tag;
/* When we create an aggregate route we must also install a Null0 route in
* the RIB */
@@ -1305,7 +1299,7 @@ bgp_zebra_announce (struct bgp_node *rn, struct prefix *p, struct bgp_info *info
{
/* Metric is currently based on the best-path only */
metric = info_cp->attr->med;
- tag = info_cp->attr->extra->tag;
+ tag = info_cp->attr->tag;
}
nexthop = &info_cp->attr->nexthop;
}
@@ -1420,8 +1414,6 @@ bgp_zebra_announce (struct bgp_node *rn, struct prefix *p, struct bgp_info *info
ifindex = 0;
nexthop = NULL;
- assert (info->attr->extra);
-
if (bgp->table_map[afi][safi].name)
BGP_INFO_ATTR_BUF_INIT();
@@ -1441,7 +1433,7 @@ bgp_zebra_announce (struct bgp_node *rn, struct prefix *p, struct bgp_info *info
if (mpinfo == info)
{
metric = info_cp->attr->med;
- tag = info_cp->attr->extra->tag;
+ tag = info_cp->attr->tag;
}
nexthop = bgp_info_to_ipv6_nexthop(info_cp);
}
@@ -1454,7 +1446,7 @@ bgp_zebra_announce (struct bgp_node *rn, struct prefix *p, struct bgp_info *info
continue;
if ((mpinfo == info) &&
- mpinfo->attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ mpinfo->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
if (mpinfo->peer->nexthop.ifp)
ifindex = mpinfo->peer->nexthop.ifp->ifindex;
@@ -1674,10 +1666,10 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi)
api.metric = info->attr->med;
api.tag = 0;
- if ((info->attr->extra) && (info->attr->extra->tag != 0))
+ if (info->attr->tag != 0)
{
SET_FLAG(api.message, ZAPI_MESSAGE_TAG);
- api.tag = info->attr->extra->tag;
+ api.tag = info->attr->tag;
}
if (bgp_debug_zebra(p))
@@ -1696,8 +1688,6 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi)
if (p->family == AF_INET6)
{
struct zapi_ipv6 api;
-
- assert (info->attr->extra);
api.vrf_id = peer->bgp->vrf_id;
api.flags = flags;
@@ -1714,10 +1704,10 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi)
api.metric = info->attr->med;
api.tag = 0;
- if ((info->attr->extra) && (info->attr->extra->tag != 0))
+ if (info->attr->tag != 0)
{
SET_FLAG(api.message, ZAPI_MESSAGE_TAG);
- api.tag = info->attr->extra->tag;
+ api.tag = info->attr->tag;
}
if (bgp_debug_zebra(p))
@@ -1903,9 +1893,7 @@ bgp_redistribute_metric_set (struct bgp *bgp, struct bgp_redist *red, afi_t afi,
{
struct attr *old_attr;
struct attr new_attr;
- struct attr_extra new_extra;
- new_attr.extra = &new_extra;
bgp_attr_dup (&new_attr, ri->attr);
new_attr.med = red->redist_metric;
old_attr = ri->attr;
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index ffd4e3e323..5a9544247c 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -715,7 +715,6 @@ add_vnc_route (
/* Cripes, the memory management of attributes is byzantine */
bgp_attr_default_set (&attr, BGP_ORIGIN_INCOMPLETE);
- assert (attr.extra);
/*
* At this point:
@@ -772,7 +771,6 @@ add_vnc_route (
/* Encap SAFI not used with MPLS */
vnc_zlog_debug_verbose ("%s: mpls tunnel type, encap safi omitted", __func__);
aspath_unintern (&attr.aspath); /* Unintern original. */
- bgp_attr_extra_free (&attr);
return;
}
}
@@ -790,7 +788,7 @@ add_vnc_route (
}
/* override default weight assigned by bgp_attr_default_set() */
- attr.extra->weight = rfd->peer ? rfd->peer->weight[afi][safi] : 0;
+ attr.weight = rfd->peer ? rfd->peer->weight[afi][safi] : 0;
/*
* NB: ticket 81: do not reset attr.aspath here because it would
@@ -808,7 +806,7 @@ add_vnc_route (
if (type == ZEBRA_ROUTE_BGP_DIRECT || type == ZEBRA_ROUTE_BGP_DIRECT_EXT)
{
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID);
- attr.extra->originator_id = bgp->router_id;
+ attr.originator_id = bgp->router_id;
}
@@ -825,7 +823,7 @@ add_vnc_route (
encaptlv->length = 4;
lt = htonl (*lifetime);
memcpy (encaptlv->value, &lt, 4);
- attr.extra->vnc_subtlvs = encaptlv;
+ attr.vnc_subtlvs = encaptlv;
vnc_zlog_debug_verbose ("%s: set Encap Attr Prefix Lifetime to %d",
__func__, *lifetime);
}
@@ -845,13 +843,13 @@ add_vnc_route (
*/
encaptlv =
encap_tlv_dup ((struct bgp_attr_encap_subtlv *) rfp_options);
- if (attr.extra->vnc_subtlvs)
+ if (attr.vnc_subtlvs)
{
- attr.extra->vnc_subtlvs->next = encaptlv;
+ attr.vnc_subtlvs->next = encaptlv;
}
else
{
- attr.extra->vnc_subtlvs = encaptlv;
+ attr.vnc_subtlvs = encaptlv;
}
}
@@ -859,7 +857,7 @@ add_vnc_route (
{
struct bgp_tea_options *hop;
/* XXX max of one tlv present so far from above code */
- struct bgp_attr_encap_subtlv *tail = attr.extra->vnc_subtlvs;
+ struct bgp_attr_encap_subtlv *tail = attr.vnc_subtlvs;
for (hop = rfp_options; hop; hop = hop->next)
{
@@ -887,7 +885,7 @@ add_vnc_route (
}
else
{
- attr.extra->vnc_subtlvs = encaptlv;
+ attr.vnc_subtlvs = encaptlv;
}
tail = encaptlv;
}
@@ -903,8 +901,8 @@ add_vnc_route (
*/
- attr.extra->ecommunity = ecommunity_new ();
- assert (attr.extra->ecommunity);
+ attr.ecommunity = ecommunity_new ();
+ assert (attr.ecommunity);
if (TunnelType != BGP_ENCAP_TYPE_MPLS &&
TunnelType != BGP_ENCAP_TYPE_RESERVED)
@@ -921,7 +919,7 @@ add_vnc_route (
beec.val[1] = ECOMMUNITY_OPAQUE_SUBTYPE_ENCAP;
beec.val[6] = ((TunnelType) >> 8) & 0xff;
beec.val[7] = (TunnelType) & 0xff;
- ecommunity_add_val (attr.extra->ecommunity, &beec);
+ ecommunity_add_val (attr.ecommunity, &beec);
}
/*
@@ -929,21 +927,21 @@ add_vnc_route (
*/
if (rt_export_list)
{
- attr.extra->ecommunity =
- ecommunity_merge (attr.extra->ecommunity, rt_export_list);
+ attr.ecommunity =
+ ecommunity_merge (attr.ecommunity, rt_export_list);
}
- if (attr.extra->ecommunity->size)
+ if (attr.ecommunity->size)
{
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES);
}
else
{
- ecommunity_free (&attr.extra->ecommunity);
- attr.extra->ecommunity = NULL;
+ ecommunity_free (&attr.ecommunity);
+ attr.ecommunity = NULL;
}
- vnc_zlog_debug_verbose ("%s: attr.extra->ecommunity=%p", __func__,
- attr.extra->ecommunity);
+ vnc_zlog_debug_verbose ("%s: attr.ecommunity=%p", __func__,
+ attr.ecommunity);
/*
@@ -965,13 +963,13 @@ add_vnc_route (
*/
attr.nexthop.s_addr = nexthop->addr.v4.s_addr;
- attr.extra->mp_nexthop_global_in = nexthop->addr.v4;
- attr.extra->mp_nexthop_len = 4;
+ attr.mp_nexthop_global_in = nexthop->addr.v4;
+ attr.mp_nexthop_len = 4;
break;
case AF_INET6:
- attr.extra->mp_nexthop_global = nexthop->addr.v6;
- attr.extra->mp_nexthop_len = 16;
+ attr.mp_nexthop_global = nexthop->addr.v6;
+ attr.mp_nexthop_len = 16;
break;
default:
@@ -1016,7 +1014,6 @@ add_vnc_route (
new_attr = bgp_attr_intern (&attr);
aspath_unintern (&attr.aspath); /* Unintern original. */
- bgp_attr_extra_free (&attr);
/*
* At this point:
diff --git a/bgpd/rfapi/rfapi_encap_tlv.c b/bgpd/rfapi/rfapi_encap_tlv.c
index 04f8b249f7..24bfb41bfa 100644
--- a/bgpd/rfapi/rfapi_encap_tlv.c
+++ b/bgpd/rfapi/rfapi_encap_tlv.c
@@ -162,28 +162,24 @@ rfapi_tunneltype_option_to_tlv (
struct rfapi_un_option *
rfapi_encap_tlv_to_un_option (struct attr *attr)
{
- struct attr_extra *attre = attr->extra;
struct rfapi_un_option *uo = NULL;
struct rfapi_tunneltype_option *tto;
int rc;
struct bgp_attr_encap_subtlv *stlv;
- if (!attre)
- return NULL;
-
/* no tunnel encap attr stored */
- if (!attre->encap_tunneltype)
+ if (!attr->encap_tunneltype)
return NULL;
- stlv = attre->encap_subtlvs;
+ stlv = attr->encap_subtlvs;
uo = XCALLOC (MTYPE_RFAPI_UN_OPTION, sizeof (struct rfapi_un_option));
assert (uo);
uo->type = RFAPI_UN_OPTION_TYPE_TUNNELTYPE;
- uo->v.tunnel.type = attre->encap_tunneltype;
+ uo->v.tunnel.type = attr->encap_tunneltype;
tto = &uo->v.tunnel;
- switch (attre->encap_tunneltype)
+ switch (attr->encap_tunneltype)
{
case BGP_ENCAP_TYPE_L2TPV3_OVER_IP:
rc = tlv_to_bgp_encap_type_l2tpv3overip (stlv, &tto->bgpinfo.l2tpv3_ip);
@@ -249,7 +245,7 @@ rfapi_encap_tlv_to_un_option (struct attr *attr)
default:
vnc_zlog_debug_verbose ("%s: unknown tunnel type %d",
- __func__, attre->encap_tunneltype);
+ __func__, attr->encap_tunneltype);
rc = -1;
break;
}
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index ec52b5742b..7b0ca0cbb9 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -1,4 +1,4 @@
-/*
+ /*
*
* Copyright 2009-2016, LabN Consulting, L.L.C.
*
@@ -308,12 +308,12 @@ rfapi_deferred_close_workfunc (struct work_queue *q, void *data)
int
rfapiGetL2o (struct attr *attr, struct rfapi_l2address_option *l2o)
{
- if (attr && attr->extra)
+ if (attr)
{
struct bgp_attr_encap_subtlv *pEncap;
- for (pEncap = attr->extra->vnc_subtlvs; pEncap; pEncap = pEncap->next)
+ for (pEncap = attr->vnc_subtlvs; pEncap; pEncap = pEncap->next)
{
if (pEncap->type == BGP_VNC_SUBTLV_TYPE_RFPOPTION)
@@ -358,10 +358,10 @@ rfapiGetVncLifetime (struct attr *attr, uint32_t * lifetime)
*lifetime = RFAPI_INFINITE_LIFETIME; /* default to infinite */
- if (attr && attr->extra)
+ if (attr)
{
- for (pEncap = attr->extra->vnc_subtlvs; pEncap; pEncap = pEncap->next)
+ for (pEncap = attr->vnc_subtlvs; pEncap; pEncap = pEncap->next)
{
if (pEncap->type == BGP_VNC_SUBTLV_TYPE_LIFETIME)
@@ -387,9 +387,9 @@ rfapiGetTunnelType (struct attr *attr,
bgp_encap_types *type)
{
*type = BGP_ENCAP_TYPE_MPLS; /* default to MPLS */
- if (attr && attr->extra && attr->extra->ecommunity)
+ if (attr && attr->ecommunity)
{
- struct ecommunity *ecom = attr->extra->ecommunity;
+ struct ecommunity *ecom = attr->ecommunity;
int i;
for (i = 0; i < (ecom->size * ECOMMUNITY_SIZE); i += ECOMMUNITY_SIZE)
@@ -431,9 +431,9 @@ rfapiGetVncTunnelUnAddr (struct attr *attr, struct prefix *p)
return ENOENT;
}
- if (attr && attr->extra)
+ if (attr)
{
- for (pEncap = attr->extra->encap_subtlvs; pEncap; pEncap = pEncap->next)
+ for (pEncap = attr->encap_subtlvs; pEncap; pEncap = pEncap->next)
{
if (pEncap->type == BGP_ENCAP_SUBTLV_TYPE_REMOTE_ENDPOINT)
@@ -1184,7 +1184,7 @@ rfapiVpnBiNhEqualsPt (struct bgp_info *bi, struct rfapi_ip_addr *hpt)
if (!hpt || !bi)
return 0;
- family = BGP_MP_NEXTHOP_FAMILY (bi->attr->extra->mp_nexthop_len);
+ family = BGP_MP_NEXTHOP_FAMILY (bi->attr->mp_nexthop_len);
if (hpt->addr_family != family)
return 0;
@@ -1192,12 +1192,12 @@ rfapiVpnBiNhEqualsPt (struct bgp_info *bi, struct rfapi_ip_addr *hpt)
switch (family)
{
case AF_INET:
- if (bi->attr->extra->mp_nexthop_global_in.s_addr != hpt->addr.v4.s_addr)
+ if (bi->attr->mp_nexthop_global_in.s_addr != hpt->addr.v4.s_addr)
return 0;
break;
case AF_INET6:
- if (IPV6_ADDR_CMP (&bi->attr->extra->mp_nexthop_global, &hpt->addr.v6))
+ if (IPV6_ADDR_CMP (&bi->attr->mp_nexthop_global, &hpt->addr.v6))
return 0;
break;
@@ -1225,31 +1225,27 @@ rfapiVpnBiSamePtUn (struct bgp_info *bi1, struct bgp_info *bi2)
if (!bi1->attr || !bi2->attr)
return 0;
- if (!bi1->attr->extra || !bi2->attr->extra)
- return 0;
-
/*
* VN address comparisons
*/
- if (BGP_MP_NEXTHOP_FAMILY (bi1->attr->extra->mp_nexthop_len) !=
- BGP_MP_NEXTHOP_FAMILY (bi2->attr->extra->mp_nexthop_len))
+ if (BGP_MP_NEXTHOP_FAMILY (bi1->attr->mp_nexthop_len) !=
+ BGP_MP_NEXTHOP_FAMILY (bi2->attr->mp_nexthop_len))
{
return 0;
}
- switch (BGP_MP_NEXTHOP_FAMILY (bi1->attr->extra->mp_nexthop_len))
+ switch (BGP_MP_NEXTHOP_FAMILY (bi1->attr->mp_nexthop_len))
{
-
case AF_INET:
- if (bi1->attr->extra->mp_nexthop_global_in.s_addr !=
- bi2->attr->extra->mp_nexthop_global_in.s_addr)
+ if (bi1->attr->mp_nexthop_global_in.s_addr !=
+ bi2->attr->mp_nexthop_global_in.s_addr)
return 0;
break;
case AF_INET6:
- if (IPV6_ADDR_CMP (&bi1->attr->extra->mp_nexthop_global,
- &bi2->attr->extra->mp_nexthop_global))
+ if (IPV6_ADDR_CMP (&bi1->attr->mp_nexthop_global,
+ &bi2->attr->mp_nexthop_global))
return 0;
break;
@@ -1419,11 +1415,11 @@ rfapiRouteInfo2NextHopEntry (
memcpy (&vo->v.l2addr.macaddr, &rn->p.u.prefix_eth.octet,
ETHER_ADDR_LEN);
/* only low 3 bytes of this are significant */
- if (bi->attr && bi->attr->extra)
+ if (bi->attr)
{
- (void) rfapiEcommunityGetLNI (bi->attr->extra->ecommunity,
+ (void) rfapiEcommunityGetLNI (bi->attr->ecommunity,
&vo->v.l2addr.logical_net_id);
- (void) rfapiEcommunityGetEthernetTag (bi->attr->extra->ecommunity,
+ (void) rfapiEcommunityGetEthernetTag (bi->attr->ecommunity,
&vo->v.l2addr.tag_id);
}
@@ -1451,132 +1447,129 @@ rfapiRouteInfo2NextHopEntry (
bgp_encap_types tun_type;
new->prefix.cost = rfapiRfpCost (bi->attr);
- if (bi->attr->extra)
+ struct bgp_attr_encap_subtlv *pEncap;
+
+ switch (BGP_MP_NEXTHOP_FAMILY (bi->attr->mp_nexthop_len))
{
+ case AF_INET:
+ new->vn_address.addr_family = AF_INET;
+ new->vn_address.addr.v4 = bi->attr->mp_nexthop_global_in;
+ break;
- struct bgp_attr_encap_subtlv *pEncap;
+ case AF_INET6:
+ new->vn_address.addr_family = AF_INET6;
+ new->vn_address.addr.v6 = bi->attr->mp_nexthop_global;
+ break;
- switch (BGP_MP_NEXTHOP_FAMILY (bi->attr->extra->mp_nexthop_len))
- {
- case AF_INET:
- new->vn_address.addr_family = AF_INET;
- new->vn_address.addr.v4 = bi->attr->extra->mp_nexthop_global_in;
- break;
+ default:
+ zlog_warn ("%s: invalid vpn nexthop length: %d",
+ __func__, bi->attr->mp_nexthop_len);
+ rfapi_free_next_hop_list (new);
+ return NULL;
+ }
- case AF_INET6:
- new->vn_address.addr_family = AF_INET6;
- new->vn_address.addr.v6 = bi->attr->extra->mp_nexthop_global;
+ for (pEncap = bi->attr->vnc_subtlvs; pEncap;
+ pEncap = pEncap->next)
+ {
+ switch (pEncap->type)
+ {
+ case BGP_VNC_SUBTLV_TYPE_LIFETIME:
+ /* use configured lifetime, not attr lifetime */
break;
default:
- zlog_warn ("%s: invalid vpn nexthop length: %d",
- __func__, bi->attr->extra->mp_nexthop_len);
- rfapi_free_next_hop_list (new);
- return NULL;
- }
+ zlog_warn ("%s: unknown VNC option type %d",
+ __func__, pEncap->type);
- for (pEncap = bi->attr->extra->vnc_subtlvs; pEncap;
- pEncap = pEncap->next)
- {
- switch (pEncap->type)
- {
- case BGP_VNC_SUBTLV_TYPE_LIFETIME:
- /* use configured lifetime, not attr lifetime */
- break;
-
- default:
- zlog_warn ("%s: unknown VNC option type %d",
- __func__, pEncap->type);
-
- break;
- }
+ break;
}
+ }
- rfapiGetTunnelType (bi->attr, &tun_type);
- if (tun_type == BGP_ENCAP_TYPE_MPLS)
+ rfapiGetTunnelType (bi->attr, &tun_type);
+ if (tun_type == BGP_ENCAP_TYPE_MPLS)
+ {
+ struct prefix p;
+ /* MPLS carries UN address in next hop */
+ rfapiNexthop2Prefix (bi->attr, &p);
+ if (p.family != 0)
{
- struct prefix p;
- /* MPLS carries UN address in next hop */
- rfapiNexthop2Prefix (bi->attr, &p);
- if (p.family != 0)
- {
- rfapiQprefix2Raddr(&p, &new->un_address);
- have_vnc_tunnel_un = 1;
- }
+ rfapiQprefix2Raddr(&p, &new->un_address);
+ have_vnc_tunnel_un = 1;
}
+ }
- for (pEncap = bi->attr->extra->encap_subtlvs; pEncap;
- pEncap = pEncap->next)
+ for (pEncap = bi->attr->encap_subtlvs; pEncap;
+ pEncap = pEncap->next)
+ {
+ switch (pEncap->type)
{
- switch (pEncap->type)
+ case BGP_ENCAP_SUBTLV_TYPE_REMOTE_ENDPOINT:
+ /*
+ * Overrides ENCAP UN address, if any
+ */
+ switch (pEncap->length)
{
- case BGP_ENCAP_SUBTLV_TYPE_REMOTE_ENDPOINT:
- /*
- * Overrides ENCAP UN address, if any
- */
- switch (pEncap->length)
- {
- case 8:
- new->un_address.addr_family = AF_INET;
- memcpy (&new->un_address.addr.v4, pEncap->value, 4);
- have_vnc_tunnel_un = 1;
- break;
-
- case 20:
- new->un_address.addr_family = AF_INET6;
- memcpy (&new->un_address.addr.v6, pEncap->value, 16);
- have_vnc_tunnel_un = 1;
- break;
-
- default:
- zlog_warn
- ("%s: invalid tunnel subtlv UN addr length (%d) for bi %p",
- __func__, pEncap->length, bi);
- }
+ case 8:
+ new->un_address.addr_family = AF_INET;
+ memcpy (&new->un_address.addr.v4, pEncap->value, 4);
+ have_vnc_tunnel_un = 1;
+ break;
+
+ case 20:
+ new->un_address.addr_family = AF_INET6;
+ memcpy (&new->un_address.addr.v6, pEncap->value, 16);
+ have_vnc_tunnel_un = 1;
break;
default:
- zlog_warn ("%s: unknown Encap Attribute option type %d",
- __func__, pEncap->type);
+ zlog_warn
+ ("%s: invalid tunnel subtlv UN addr length (%d) for bi %p",
+ __func__, pEncap->length, bi);
+ }
+ break;
+ default:
+ zlog_warn ("%s: unknown Encap Attribute option type %d",
+ __func__, pEncap->type);
- break;
- }
+
+ break;
}
+ }
- new->un_options = rfapi_encap_tlv_to_un_option (bi->attr);
+ new->un_options = rfapi_encap_tlv_to_un_option (bi->attr);
#if DEBUG_ENCAP_MONITOR
- vnc_zlog_debug_verbose ("%s: line %d: have_vnc_tunnel_un=%d",
- __func__, __LINE__, have_vnc_tunnel_un);
+ vnc_zlog_debug_verbose ("%s: line %d: have_vnc_tunnel_un=%d",
+ __func__, __LINE__, have_vnc_tunnel_un);
#endif
- if (!have_vnc_tunnel_un && bi && bi->extra)
+ if (!have_vnc_tunnel_un && bi && bi->extra)
+ {
+ /*
+ * use cached UN address from ENCAP route
+ */
+ new->un_address.addr_family = bi->extra->vnc.import.un_family;
+ switch (new->un_address.addr_family)
{
- /*
- * use cached UN address from ENCAP route
- */
- new->un_address.addr_family = bi->extra->vnc.import.un_family;
- switch (new->un_address.addr_family)
- {
- case AF_INET:
- new->un_address.addr.v4 = bi->extra->vnc.import.un.addr4;
- break;
- case AF_INET6:
- new->un_address.addr.v6 = bi->extra->vnc.import.un.addr6;
- break;
- default:
- zlog_warn ("%s: invalid UN addr family (%d) for bi %p",
- __func__, new->un_address.addr_family, bi);
- rfapi_free_next_hop_list (new);
- return NULL;
- break;
- }
+ case AF_INET:
+ new->un_address.addr.v4 = bi->extra->vnc.import.un.addr4;
+ break;
+ case AF_INET6:
+ new->un_address.addr.v6 = bi->extra->vnc.import.un.addr6;
+ break;
+ default:
+ zlog_warn ("%s: invalid UN addr family (%d) for bi %p",
+ __func__, new->un_address.addr_family, bi);
+ rfapi_free_next_hop_list (new);
+ return NULL;
+ break;
}
}
}
+
new->lifetime = lifetime;
return new;
}
@@ -2702,19 +2695,18 @@ rfapiNexthop2Prefix (struct attr *attr, struct prefix *p)
{
assert (p);
assert (attr);
- assert (attr->extra);
memset (p, 0, sizeof (struct prefix));
- switch (p->family = BGP_MP_NEXTHOP_FAMILY (attr->extra->mp_nexthop_len))
+ switch (p->family = BGP_MP_NEXTHOP_FAMILY (attr->mp_nexthop_len))
{
case AF_INET:
- p->u.prefix4 = attr->extra->mp_nexthop_global_in;
+ p->u.prefix4 = attr->mp_nexthop_global_in;
p->prefixlen = 32;
break;
case AF_INET6:
- p->u.prefix6 = attr->extra->mp_nexthop_global;
+ p->u.prefix6 = attr->mp_nexthop_global;
p->prefixlen = 128;
break;
@@ -2779,9 +2771,7 @@ rfapiAttrNexthopAddrDifferent (struct prefix *p1, struct prefix *p2)
static void
rfapiCopyUnEncap2VPN (struct bgp_info *encap_bi, struct bgp_info *vpn_bi)
{
- struct attr_extra *attre;
-
- if (!encap_bi->attr || !encap_bi->attr->extra)
+ if (!encap_bi->attr)
{
zlog_warn ("%s: no encap bi attr/extra, can't copy UN address",
__func__);
@@ -2795,9 +2785,7 @@ rfapiCopyUnEncap2VPN (struct bgp_info *encap_bi, struct bgp_info *vpn_bi)
return;
}
- attre = encap_bi->attr->extra;
-
- switch (BGP_MP_NEXTHOP_FAMILY (attre->mp_nexthop_len))
+ switch (BGP_MP_NEXTHOP_FAMILY (encap_bi->attr->mp_nexthop_len))
{
case AF_INET:
@@ -2811,17 +2799,17 @@ rfapiCopyUnEncap2VPN (struct bgp_info *encap_bi, struct bgp_info *vpn_bi)
}
vpn_bi->extra->vnc.import.un_family = AF_INET;
- vpn_bi->extra->vnc.import.un.addr4 = attre->mp_nexthop_global_in;
+ vpn_bi->extra->vnc.import.un.addr4 = encap_bi->attr->mp_nexthop_global_in;
break;
case AF_INET6:
vpn_bi->extra->vnc.import.un_family = AF_INET6;
- vpn_bi->extra->vnc.import.un.addr6 = attre->mp_nexthop_global;
+ vpn_bi->extra->vnc.import.un.addr6 = encap_bi->attr->mp_nexthop_global;
break;
default:
zlog_warn ("%s: invalid encap nexthop length: %d",
- __func__, attre->mp_nexthop_len);
+ __func__, encap_bi->attr->mp_nexthop_len);
vpn_bi->extra->vnc.import.un_family = 0;
break;
}
@@ -3102,21 +3090,21 @@ rfapiExpireEncapNow (
static int
rfapiGetNexthop (struct attr *attr, struct prefix *prefix)
{
- switch (BGP_MP_NEXTHOP_FAMILY (attr->extra->mp_nexthop_len))
+ switch (BGP_MP_NEXTHOP_FAMILY (attr->mp_nexthop_len))
{
case AF_INET:
prefix->family = AF_INET;
prefix->prefixlen = 32;
- prefix->u.prefix4 = attr->extra->mp_nexthop_global_in;
+ prefix->u.prefix4 = attr->mp_nexthop_global_in;
break;
case AF_INET6:
prefix->family = AF_INET6;
prefix->prefixlen = 128;
- prefix->u.prefix6 = attr->extra->mp_nexthop_global;
+ prefix->u.prefix6 = attr->mp_nexthop_global;
break;
default:
- vnc_zlog_debug_verbose ("%s: unknown attr->extra->mp_nexthop_len %d", __func__,
- attr->extra->mp_nexthop_len);
+ vnc_zlog_debug_verbose ("%s: unknown attr->mp_nexthop_len %d", __func__,
+ attr->mp_nexthop_len);
return EINVAL;
}
return 0;
@@ -3187,7 +3175,7 @@ rfapiBgpInfoFilteredImportEncap (
* On a withdraw, peer and RD are sufficient to determine if
* we should act.
*/
- if (!attr || !attr->extra || !attr->extra->ecommunity)
+ if (!attr || !attr->ecommunity)
{
vnc_zlog_debug_verbose ("%s: attr, extra, or ecommunity missing, not importing",
@@ -3195,7 +3183,7 @@ rfapiBgpInfoFilteredImportEncap (
return;
}
#if RFAPI_REQUIRE_ENCAP_BEEC
- if (!rfapiEcommunitiesMatchBeec (attr->extra->ecommunity))
+ if (!rfapiEcommunitiesMatchBeec (attr->ecommunity))
{
vnc_zlog_debug_verbose ("%s: it=%p: no match for BGP Encapsulation ecommunity",
__func__, import_table);
@@ -3203,7 +3191,7 @@ rfapiBgpInfoFilteredImportEncap (
}
#endif
if (!rfapiEcommunitiesIntersect (import_table->rt_import_list,
- attr->extra->ecommunity))
+ attr->ecommunity))
{
vnc_zlog_debug_verbose ("%s: it=%p: no ecommunity intersection",
@@ -3669,7 +3657,7 @@ rfapiBgpInfoFilteredImportVPN (
*/
if (action == FIF_ACTION_UPDATE)
{
- if (!attr || !attr->extra || !attr->extra->ecommunity)
+ if (!attr || !attr->ecommunity)
{
vnc_zlog_debug_verbose ("%s: attr, extra, or ecommunity missing, not importing",
@@ -3678,7 +3666,7 @@ rfapiBgpInfoFilteredImportVPN (
}
if ((import_table != bgp->rfapi->it_ce) &&
!rfapiEcommunitiesIntersect (import_table->rt_import_list,
- attr->extra->ecommunity))
+ attr->ecommunity))
{
vnc_zlog_debug_verbose ("%s: it=%p: no ecommunity intersection",
@@ -4162,12 +4150,12 @@ rfapiProcessUpdate (
* Find rt containing LNI (Logical Network ID), which
* _should_ always be present when mac address is present
*/
- rc = rfapiEcommunityGetLNI (attr->extra->ecommunity, &lni);
+ rc = rfapiEcommunityGetLNI (attr->ecommunity, &lni);
vnc_zlog_debug_verbose
- ("%s: rfapiEcommunityGetLNI returned %d, lni=%d, attr=%p, attr->extra=%p",
- __func__, rc, lni, attr, attr->extra);
- if (attr && attr->extra && !rc)
+ ("%s: rfapiEcommunityGetLNI returned %d, lni=%d, attr=%p",
+ __func__, rc, lni, attr);
+ if (attr && !rc)
{
it = rfapiMacImportTableGet (bgp, lni);
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index 5c3976a0c1..563c862381 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -664,7 +664,7 @@ rfapiRibBi2Ri(
ri->lifetime = lifetime;
/* This loop based on rfapiRouteInfo2NextHopEntry() */
- for (pEncap = bi->attr->extra->vnc_subtlvs; pEncap; pEncap = pEncap->next)
+ for (pEncap = bi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next)
{
struct bgp_tea_options *hop;
@@ -723,11 +723,11 @@ rfapiRibBi2Ri(
memcpy (&vo->v.l2addr.macaddr, bi->extra->vnc.import.rd.val+2,
ETHER_ADDR_LEN);
- if (bi->attr && bi->attr->extra)
+ if (bi->attr)
{
- (void) rfapiEcommunityGetLNI (bi->attr->extra->ecommunity,
+ (void) rfapiEcommunityGetLNI (bi->attr->ecommunity,
&vo->v.l2addr.logical_net_id);
- (void) rfapiEcommunityGetEthernetTag (bi->attr->extra->ecommunity,
+ (void) rfapiEcommunityGetEthernetTag (bi->attr->ecommunity,
&vo->v.l2addr.tag_id);
}
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index d12958a600..81e307d86f 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -469,9 +469,9 @@ rfapi_vty_out_vncinfo (
}
}
- if (bi->attr && bi->attr->extra && bi->attr->extra->ecommunity)
+ if (bi->attr && bi->attr->ecommunity)
{
- s = ecommunity_ecom2str (bi->attr->extra->ecommunity,
+ s = ecommunity_ecom2str (bi->attr->ecommunity,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
vty_out (vty, " EC{%s}", s);
XFREE (MTYPE_ECOMMUNITY_STR, s);
@@ -499,7 +499,6 @@ rfapiPrintAttrPtrs (void *stream, struct attr *attr)
void *out;
const char *vty_newline;
- struct attr_extra *ae;
char buf[BUFSIZ];
if (rfapiStream2Vty (stream, &fp, &vty, &out, &vty_newline) == 0)
@@ -518,15 +517,12 @@ rfapiPrintAttrPtrs (void *stream, struct attr *attr)
fp (out, " community=%p, refcnt=%d%s", attr->community,
(attr->community ? attr->community->refcnt : 0), HVTYNL);
- if ((ae = attr->extra))
- {
- fp (out, " ecommunity=%p, refcnt=%d%s", ae->ecommunity,
- (ae->ecommunity ? ae->ecommunity->refcnt : 0), HVTYNL);
- fp (out, " cluster=%p, refcnt=%d%s", ae->cluster,
- (ae->cluster ? ae->cluster->refcnt : 0), HVTYNL);
- fp (out, " transit=%p, refcnt=%d%s", ae->transit,
- (ae->transit ? ae->transit->refcnt : 0), HVTYNL);
- }
+ fp (out, " ecommunity=%p, refcnt=%d%s", attr->ecommunity,
+ (attr->ecommunity ? attr->ecommunity->refcnt : 0), HVTYNL);
+ fp (out, " cluster=%p, refcnt=%d%s", attr->cluster,
+ (attr->cluster ? attr->cluster->refcnt : 0), HVTYNL);
+ fp (out, " transit=%p, refcnt=%d%s", attr->transit,
+ (attr->transit ? attr->transit->refcnt : 0), HVTYNL);
}
/*
@@ -593,26 +589,26 @@ rfapiPrintBi (void *stream, struct bgp_info *bi)
* RFP option sizes (they are opaque values)
* extended communities (RTs)
*/
- if (bi->attr && bi->attr->extra)
+ if (bi->attr)
{
uint32_t lifetime;
int printed_1st_gol = 0;
struct bgp_attr_encap_subtlv *pEncap;
struct prefix pfx_un;
- int af = BGP_MP_NEXTHOP_FAMILY (bi->attr->extra->mp_nexthop_len);
+ int af = BGP_MP_NEXTHOP_FAMILY (bi->attr->mp_nexthop_len);
/* Nexthop */
if (af == AF_INET)
{
r = snprintf (p, REMAIN, "%s", inet_ntop (AF_INET,
- &bi->attr->extra->mp_nexthop_global_in,
+ &bi->attr->mp_nexthop_global_in,
buf, BUFSIZ));
INCP;
}
else if (af == AF_INET6)
{
r = snprintf (p, REMAIN, "%s", inet_ntop (AF_INET6,
- &bi->attr->extra->mp_nexthop_global,
+ &bi->attr->mp_nexthop_global,
buf, BUFSIZ));
INCP;
}
@@ -650,7 +646,7 @@ rfapiPrintBi (void *stream, struct bgp_info *bi)
}
/* RFP option lengths */
- for (pEncap = bi->attr->extra->vnc_subtlvs; pEncap;
+ for (pEncap = bi->attr->vnc_subtlvs; pEncap;
pEncap = pEncap->next)
{
@@ -673,9 +669,9 @@ rfapiPrintBi (void *stream, struct bgp_info *bi)
}
/* RT list */
- if (bi->attr->extra->ecommunity)
+ if (bi->attr->ecommunity)
{
- s = ecommunity_ecom2str (bi->attr->extra->ecommunity,
+ s = ecommunity_ecom2str (bi->attr->ecommunity,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
r = snprintf (p, REMAIN, " %s", s);
INCP;
@@ -704,9 +700,9 @@ rfapiPrintBi (void *stream, struct bgp_info *bi)
if (bi->attr)
{
- if (bi->attr->extra)
+ if (bi->attr->weight)
{
- r = snprintf (p, REMAIN, " W=%d", bi->attr->extra->weight);
+ r = snprintf (p, REMAIN, " W=%d", bi->attr->weight);
INCP;
}
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index bca95e47c0..342dc6a193 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -74,7 +74,6 @@ encap_attr_export_ce (
*/
memset (new, 0, sizeof (struct attr));
bgp_attr_dup (new, orig);
- bgp_attr_extra_get (new);
/*
* Set nexthop
@@ -83,17 +82,13 @@ encap_attr_export_ce (
{
case AF_INET:
new->nexthop = use_nexthop->u.prefix4;
- new->extra->mp_nexthop_len = 4; /* bytes */
+ new->mp_nexthop_len = 4; /* bytes */
new->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
break;
case AF_INET6:
- if (!new->extra)
- {
- new->extra = XCALLOC (MTYPE_ATTR_EXTRA, sizeof (struct attr_extra));
- }
- new->extra->mp_nexthop_global = use_nexthop->u.prefix6;
- new->extra->mp_nexthop_len = 16; /* bytes */
+ new->mp_nexthop_global = use_nexthop->u.prefix6;
+ new->mp_nexthop_len = 16; /* bytes */
break;
default:
@@ -133,7 +128,6 @@ encap_attr_export_ce (
*
* Caller should, after using the attr, call:
* - bgp_attr_flush() to free non-interned parts
- * - call bgp_attr_extra_free() to free extra
*/
}
@@ -144,8 +138,8 @@ getce (struct bgp *bgp, struct attr *attr, struct prefix *pfx_ce)
int i;
uint16_t localadmin = bgp->rfapi_cfg->resolve_nve_roo_local_admin;
- for (ecp = attr->extra->ecommunity->val, i = 0;
- i < attr->extra->ecommunity->size; ++i, ecp += ECOMMUNITY_SIZE)
+ for (ecp = attr->ecommunity->val, i = 0;
+ i < attr->ecommunity->size; ++i, ecp += ECOMMUNITY_SIZE)
{
if (VNC_DEBUG(EXPORT_BGP_GETCE))
@@ -309,14 +303,12 @@ vnc_direct_bgp_add_route_ce (
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
return;
}
}
iattr = bgp_attr_intern (&hattr);
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
/*
* Rule: disallow route-map alteration of next-hop, because it
@@ -563,14 +555,14 @@ vnc_route_origin_ecom (struct route_node *rn)
struct ecommunity_val roec;
- switch (BGP_MP_NEXTHOP_FAMILY (bi->attr->extra->mp_nexthop_len))
+ switch (BGP_MP_NEXTHOP_FAMILY (bi->attr->mp_nexthop_len))
{
case AF_INET:
memset (&roec, 0, sizeof (roec));
roec.val[0] = 0x01;
roec.val[1] = 0x03;
memcpy (roec.val + 2,
- &bi->attr->extra->mp_nexthop_global_in.s_addr, 4);
+ &bi->attr->mp_nexthop_global_in.s_addr, 4);
roec.val[6] = 0;
roec.val[7] = 0;
ecommunity_add_val (new, &roec);
@@ -642,16 +634,16 @@ encap_attr_export (
{
use_nexthop = &orig_nexthop;
orig_nexthop.family =
- BGP_MP_NEXTHOP_FAMILY (orig->extra->mp_nexthop_len);
+ BGP_MP_NEXTHOP_FAMILY (orig->mp_nexthop_len);
if (orig_nexthop.family == AF_INET)
{
orig_nexthop.prefixlen = 32;
- orig_nexthop.u.prefix4 = orig->extra->mp_nexthop_global_in;
+ orig_nexthop.u.prefix4 = orig->mp_nexthop_global_in;
}
else if (orig_nexthop.family == AF_INET6)
{
orig_nexthop.prefixlen = 128;
- orig_nexthop.u.prefix6 = orig->extra->mp_nexthop_global;
+ orig_nexthop.u.prefix6 = orig->mp_nexthop_global;
}
else
{
@@ -673,17 +665,13 @@ encap_attr_export (
{
case AF_INET:
new->nexthop = use_nexthop->u.prefix4;
- new->extra->mp_nexthop_len = 4; /* bytes */
+ new->mp_nexthop_len = 4; /* bytes */
new->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
break;
case AF_INET6:
- if (!new->extra)
- {
- new->extra = XCALLOC (MTYPE_ATTR_EXTRA, sizeof (struct attr_extra));
- }
- new->extra->mp_nexthop_global = use_nexthop->u.prefix6;
- new->extra->mp_nexthop_len = 16; /* bytes */
+ new->mp_nexthop_global = use_nexthop->u.prefix6;
+ new->mp_nexthop_len = 16; /* bytes */
break;
default:
@@ -691,7 +679,6 @@ encap_attr_export (
break;
}
- bgp_attr_extra_get (new);
if (rn)
{
ecom_ro = vnc_route_origin_ecom (rn);
@@ -701,17 +688,14 @@ encap_attr_export (
/* TBD test/assert for IPv6 */
ecom_ro = vnc_route_origin_ecom_single (&use_nexthop->u.prefix4);
}
- if (new->extra->ecommunity)
+ if (new->ecommunity)
{
if (ecom_ro)
- {
- new->extra->ecommunity =
- ecommunity_merge (ecom_ro, new->extra->ecommunity);
- }
+ new->ecommunity = ecommunity_merge (ecom_ro, new->ecommunity);
}
else
{
- new->extra->ecommunity = ecom_ro;
+ new->ecommunity = ecom_ro;
}
if (ecom_ro)
{
@@ -750,7 +734,6 @@ encap_attr_export (
*
* Caller should, after using the attr, call:
* - bgp_attr_flush() to free non-interned parts
- * - call bgp_attr_extra_free() to free extra
*/
return 0;
@@ -887,7 +870,6 @@ vnc_direct_bgp_add_prefix (
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
vnc_zlog_debug_verbose
("%s: route map says DENY, so not calling bgp_update",
__func__);
@@ -903,7 +885,6 @@ vnc_direct_bgp_add_prefix (
iattr = bgp_attr_intern (&hattr);
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
bgp_update (irfd->peer, &rn->p, /* prefix */
0, /* addpath_id */
@@ -917,7 +898,6 @@ vnc_direct_bgp_add_prefix (
}
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
}
/*
@@ -1134,7 +1114,6 @@ vnc_direct_bgp_add_nve (struct bgp *bgp, struct rfapi_descriptor *rfd)
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
continue;
}
@@ -1142,7 +1121,6 @@ vnc_direct_bgp_add_nve (struct bgp *bgp, struct rfapi_descriptor *rfd)
iattr = bgp_attr_intern (&hattr);
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
bgp_update (irfd->peer, &rn->p, /* prefix */
0, /* addpath_id */
@@ -1157,7 +1135,6 @@ vnc_direct_bgp_add_nve (struct bgp *bgp, struct rfapi_descriptor *rfd)
}
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
}
}
}
@@ -1361,7 +1338,6 @@ vnc_direct_bgp_add_group_afi (
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
continue;
}
@@ -1369,7 +1345,6 @@ vnc_direct_bgp_add_group_afi (
iattr = bgp_attr_intern (&hattr);
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
bgp_update (irfd->peer, &rn->p, /* prefix */
0, /* addpath_id */
@@ -1384,7 +1359,6 @@ vnc_direct_bgp_add_group_afi (
}
aspath_unintern (&attr.aspath);
- bgp_attr_extra_free (&attr);
}
@@ -1744,14 +1718,12 @@ vnc_direct_bgp_rh_add_route (
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
return;
}
}
iattr = bgp_attr_intern (&hattr);
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
/*
* record route information that we will need to expire
@@ -1983,7 +1955,6 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi)
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
vnc_zlog_debug_verbose ("%s: route map says DENY", __func__);
continue;
}
@@ -1991,7 +1962,6 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi)
iattr = bgp_attr_intern (&hattr);
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
/*
* record route information that we will need to expire
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 47203cd238..1daf02a6bf 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -393,7 +393,6 @@ process_unicast_route (
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
vnc_zlog_debug_verbose ("%s: route map \"%s\" says DENY, returning", __func__,
rmap->name);
return -1;
@@ -406,8 +405,8 @@ process_unicast_route (
*/
rfapiUnicastNexthop2Prefix (afi, &hattr, unicast_nexthop);
- if (hattr.extra && hattr.extra->ecommunity)
- *ecom = ecommunity_dup (hattr.extra->ecommunity);
+ if (hattr.ecommunity)
+ *ecom = ecommunity_dup (hattr.ecommunity);
else
*ecom = ecommunity_new ();
@@ -415,7 +414,6 @@ process_unicast_route (
* Done with hattr, clean up
*/
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
/*
* Add EC that carries original NH of iBGP route (2 bytes = magic
@@ -510,18 +508,18 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi (
plifetime = &lifetime;
}
- if (bi->attr && bi->attr->extra)
+ if (bi->attr)
{
- encaptlvs = bi->attr->extra->vnc_subtlvs;
- if (bi->attr->extra->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED &&
- bi->attr->extra->encap_tunneltype != BGP_ENCAP_TYPE_MPLS)
+ encaptlvs = bi->attr->vnc_subtlvs;
+ if (bi->attr->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED &&
+ bi->attr->encap_tunneltype != BGP_ENCAP_TYPE_MPLS)
{
if (opt != NULL)
opt->next = &optary[cur_opt];
opt = &optary[cur_opt++];
memset (opt, 0, sizeof (struct rfapi_un_option));
opt->type = RFAPI_UN_OPTION_TYPE_TUNNELTYPE;
- opt->v.tunnel.type = bi->attr->extra->encap_tunneltype;
+ opt->v.tunnel.type = bi->attr->encap_tunneltype;
/* TBD parse bi->attr->extra->encap_subtlvs */
}
}
@@ -532,8 +530,8 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi (
struct ecommunity *new_ecom = ecommunity_dup (ecom);
- if (bi->attr && bi->attr->extra && bi->attr->extra->ecommunity)
- ecommunity_merge (new_ecom, bi->attr->extra->ecommunity);
+ if (bi->attr && bi->attr->ecommunity)
+ ecommunity_merge (new_ecom, bi->attr->ecommunity);
if (bi->extra)
label = decode_label (&bi->extra->label);
@@ -891,7 +889,6 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp,
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
vnc_zlog_debug_verbose ("%s: route map \"%s\" says DENY, returning", __func__,
rmap->name);
return;
@@ -900,7 +897,6 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp,
iattr = bgp_attr_intern (&hattr);
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
/* Now iattr is an allocated interned attr */
@@ -925,8 +921,8 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp,
memset (&prd, 0, sizeof (prd));
rfapi_set_autord_from_vn (&prd, &vnaddr);
- if (iattr && iattr->extra && iattr->extra->ecommunity)
- ecom = ecommunity_dup (iattr->extra->ecommunity);
+ if (iattr && iattr->ecommunity)
+ ecom = ecommunity_dup (iattr->ecommunity);
}
@@ -1103,7 +1099,6 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp,
if (ret == RMAP_DENYMATCH)
{
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
vnc_zlog_debug_verbose ("%s: route map \"%s\" says DENY, returning", __func__,
rmap->name);
return;
@@ -1112,7 +1107,6 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp,
iattr = bgp_attr_intern (&hattr);
bgp_attr_flush (&hattr);
- bgp_attr_extra_free (&hattr);
/* Now iattr is an allocated interned attr */
@@ -1139,8 +1133,8 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp,
else
ecom = ecommunity_new ();
- if (iattr && iattr->extra && iattr->extra->ecommunity)
- ecom = ecommunity_merge (ecom, iattr->extra->ecommunity);
+ if (iattr && iattr->ecommunity)
+ ecom = ecommunity_merge (ecom, iattr->ecommunity);
}
local_pref = calc_local_pref (iattr, peer);
@@ -1942,7 +1936,6 @@ vnc_import_bgp_exterior_add_route_it (
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
- bgp_attr_extra_free (&new_attr);
}
if (have_usable_route)
@@ -2273,7 +2266,6 @@ vnc_import_bgp_exterior_add_route_interior (
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
- bgp_attr_extra_free (&new_attr);
}
vnc_zlog_debug_verbose
("%s: finished constructing exteriors based on existing monitors",
@@ -2412,7 +2404,6 @@ vnc_import_bgp_exterior_add_route_interior (
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
- bgp_attr_extra_free (&new_attr);
}
}
@@ -2536,7 +2527,6 @@ vnc_import_bgp_exterior_add_route_interior (
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
- bgp_attr_extra_free (&new_attr);
}
}
if (list_adopted)
@@ -2740,7 +2730,6 @@ vnc_import_bgp_exterior_del_route_interior (
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
- bgp_attr_extra_free (&new_attr);
}
}