/* Attribute hash routines. */
static struct hash *attrhash;
-/* Shallow copy of an attribute
- * Though, not so shallow that it doesn't copy the contents
- * of the attr_extra pointed to by 'extra'
- */
-void bgp_attr_dup(struct attr *new, struct attr *orig)
-{
- *new = *orig;
-}
-
unsigned long int attr_count(void)
{
return attrhash->count;
extern bgp_attr_parse_ret_t bgp_attr_parse(struct peer *, struct attr *,
bgp_size_t, struct bgp_nlri *,
struct bgp_nlri *);
-extern void bgp_attr_dup(struct attr *, struct attr *);
extern void bgp_attr_undup(struct attr *new, struct attr *old);
extern struct attr *bgp_attr_intern(struct attr *attr);
extern void bgp_attr_unintern_sub(struct attr *);
* present, else treat as locally originated.
*/
if (src_attr)
- bgp_attr_dup(&attr, src_attr);
+ attr = *src_attr;
else {
memset(&attr, 0, sizeof(struct attr));
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP);
* address for the rest of the code to flow through. In the case of IPv4,
* make sure to set the flag for next hop attribute.
*/
- bgp_attr_dup(&attr, parent_pi->attr);
+ attr = *parent_pi->attr;
if (afi == AFI_IP6)
evpn_convert_nexthop_to_ipv6(&attr);
else
return;
}
- bgp_attr_dup(&attr, new_best->attr);
+ attr = *new_best->attr;
if (new_best->peer && bgp_flag_check(new_best->peer->bgp,
BGP_FLAG_MULTIPATH_RELAX_AS_SET)) {
return;
}
- bgp_attr_dup(&static_attr, path_vrf->attr); /* shallow copy */
+ /* shallow copy */
+ static_attr = *path_vrf->attr;
/*
* route map handling
buf_prefix, bgp_vrf->name_pretty);
}
- bgp_attr_dup(&static_attr, path_vpn->attr); /* shallow copy */
+ /* shallow copy */
+ static_attr = *path_vpn->attr;
/*
* Nexthop: stash and clear
}
/* For modify attribute, copy it to temporary structure. */
- bgp_attr_dup(attr, piattr);
+ *attr = *piattr;
/* If local-preference is not set. */
if ((peer->sort == BGP_PEER_IBGP || peer->sort == BGP_PEER_CONFED)
if ((from->sort == BGP_PEER_IBGP && peer->sort == BGP_PEER_IBGP)
&& !bgp_flag_check(bgp,
BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
- bgp_attr_dup(&dummy_attr, attr);
+ dummy_attr = *attr;
rmap_path.attr = &dummy_attr;
}
goto filtered;
}
- bgp_attr_dup(&new_attr, attr);
+ new_attr = *attr;
/* Apply incoming route-map.
* NB: new_attr may now contain newly allocated values from route-map
struct attr attr_new;
/* Copy attribute for modification. */
- bgp_attr_dup(&attr_new, &attr);
+ attr_new = attr;
if (red->redist_metric_flag)
attr_new.med = red->redist_metric;
struct attr dummy_attr;
route_map_result_t ret;
- bgp_attr_dup(&dummy_attr, pi->attr);
+ dummy_attr = *pi->attr;
path.peer = pi->peer;
path.attr = &dummy_attr;
header2 = 0;
}
- bgp_attr_dup(&attr, ain->attr);
+ attr = *ain->attr;
route_filtered = false;
/* Filter prefix using distribute list,
header2 = 0;
}
- bgp_attr_dup(&attr, adj->attr);
+ attr = *adj->attr;
ret = bgp_output_modifier(
peer, &rn->p, &attr, afi, safi,
rmap_name);
/* Provide dummy so the route-map can't modify
* the attributes */
- bgp_attr_dup(&dummy_attr, ri->attr);
+ dummy_attr = *ri->attr;
tmp_info.peer = ri->peer;
tmp_info.attr = &dummy_attr;
struct attr *old_attr;
struct attr new_attr;
- bgp_attr_dup(&new_attr, pi->attr);
+ new_attr = *pi->attr;
new_attr.med = red->redist_metric;
old_attr = pi->attr;
pi->attr = bgp_attr_intern(&new_attr);
* Make "new" a ghost attr copy of "orig"
*/
memset(new, 0, sizeof(struct attr));
- bgp_attr_dup(new, orig);
+ *new = *orig;
/*
* Set nexthop
* Make "new" a ghost attr copy of "orig"
*/
memset(new, 0, sizeof(struct attr));
- bgp_attr_dup(new, orig);
+ *new = *orig;
/*
* Set nexthop
* all of the possible returns above.
*/
memset(&hattr, 0, sizeof(struct attr));
- bgp_attr_dup(&hattr, attr); /* hattr becomes a ghost attr */
+ /* hattr becomes a ghost attr */
+ hattr = *attr;
if (rmap) {
struct bgp_path_info info;
* all of the possible returns above.
*/
memset(&hattr, 0, sizeof(struct attr));
- bgp_attr_dup(&hattr, attr); /* hattr becomes a ghost attr */
+ /* hattr becomes a ghost attr */
+ hattr = *attr;
if (rmap) {
struct bgp_path_info info;
* all of the possible returns above.
*/
memset(&hattr, 0, sizeof(struct attr));
- bgp_attr_dup(&hattr, attr); /* hattr becomes a ghost attr */
+ /* hattr becomes a ghost attr */
+ hattr = *attr;
if (rmap) {
struct bgp_path_info path;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bpi_interior->attr);
+ new_attr = *bpi_interior->attr;
if (info->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
new_attr.local_pref =
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bpi_interior->attr);
+ new_attr = *bpi_interior->attr;
if (bpi_exterior
&& (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bpi_interior->attr);
+ new_attr = *bpi_interior->attr;
if (bpi_exterior
&& (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bpi_interior->attr);
+ new_attr = *bpi_interior->attr;
if (bpi_exterior
&& (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bpi->attr);
+ new_attr = *bpi->attr;
if (bpi_exterior
&& (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {