summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_attr.c9
-rw-r--r--bgpd/bgp_attr.h1
-rw-r--r--bgpd/bgp_evpn.c4
-rw-r--r--bgpd/bgp_mpath.c2
-rw-r--r--bgpd/bgp_mplsvpn.c6
-rw-r--r--bgpd/bgp_route.c14
-rw-r--r--bgpd/bgp_updgrp_adv.c2
-rw-r--r--bgpd/bgp_zebra.c2
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c4
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c19
10 files changed, 29 insertions, 34 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index bfa578085d..ab80aff81b 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -464,15 +464,6 @@ static void transit_finish(void)
/* 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;
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h
index 375a2272e1..13ed3e1ee3 100644
--- a/bgpd/bgp_attr.h
+++ b/bgpd/bgp_attr.h
@@ -272,7 +272,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 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 *);
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 48b714c7df..155658e93f 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -1571,7 +1571,7 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp,
* 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);
@@ -2661,7 +2661,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
* 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
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index d37bf54734..77448ec15d 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -720,7 +720,7 @@ void bgp_path_info_mpath_aggregate_update(struct bgp_path_info *new_best,
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)) {
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 1d15361416..59ed433e58 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -699,7 +699,8 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
return;
}
- bgp_attr_dup(&static_attr, path_vrf->attr); /* shallow copy */
+ /* shallow copy */
+ static_attr = *path_vrf->attr;
/*
* route map handling
@@ -1082,7 +1083,8 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
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
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index ae70ea0690..3ef1ac39a5 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1695,7 +1695,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi,
}
/* 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)
@@ -1815,7 +1815,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi,
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;
}
@@ -3178,7 +3178,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
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
@@ -6829,7 +6829,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
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;
@@ -9218,7 +9218,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
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;
@@ -11361,7 +11361,7 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
header2 = 0;
}
- bgp_attr_dup(&attr, ain->attr);
+ attr = *ain->attr;
route_filtered = false;
/* Filter prefix using distribute list,
@@ -11463,7 +11463,7 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
header2 = 0;
}
- bgp_attr_dup(&attr, adj->attr);
+ attr = *adj->attr;
ret = bgp_output_modifier(
peer, &rn->p, &attr, afi, safi,
rmap_name);
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index 5c1483a768..49e87adc3c 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -764,7 +764,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
/* 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;
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index e886733ced..033e081e87 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -1693,7 +1693,7 @@ int bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red,
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);
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index b97c8c3030..352f5e8328 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -78,7 +78,7 @@ static void encap_attr_export_ce(struct attr *new, struct attr *orig,
* Make "new" a ghost attr copy of "orig"
*/
memset(new, 0, sizeof(struct attr));
- bgp_attr_dup(new, orig);
+ *new = *orig;
/*
* Set nexthop
@@ -616,7 +616,7 @@ encap_attr_export(struct attr *new, struct attr *orig,
* Make "new" a ghost attr copy of "orig"
*/
memset(new, 0, sizeof(struct attr));
- bgp_attr_dup(new, orig);
+ *new = *orig;
/*
* Set nexthop
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 6e8969ad18..ba6ef14257 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -356,7 +356,8 @@ static int process_unicast_route(struct bgp *bgp, /* in */
* 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;
@@ -798,7 +799,8 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
* 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;
@@ -1000,7 +1002,8 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
* 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;
@@ -1779,7 +1782,7 @@ static void vnc_import_bgp_exterior_add_route_it(
/* 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 =
@@ -2104,7 +2107,7 @@ void vnc_import_bgp_exterior_add_route_interior(
/* 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))) {
@@ -2240,7 +2243,7 @@ void vnc_import_bgp_exterior_add_route_interior(
/* 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))) {
@@ -2360,7 +2363,7 @@ void vnc_import_bgp_exterior_add_route_interior(
/* 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))) {
@@ -2550,7 +2553,7 @@ void vnc_import_bgp_exterior_del_route_interior(
/* 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))) {