]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: remove bgp_attr_dup
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 3 Dec 2019 21:01:19 +0000 (16:01 -0500)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 16 Jan 2020 19:36:52 +0000 (14:36 -0500)
yeah

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_attr.c
bgpd/bgp_attr.h
bgpd/bgp_evpn.c
bgpd/bgp_mpath.c
bgpd/bgp_mplsvpn.c
bgpd/bgp_route.c
bgpd/bgp_updgrp_adv.c
bgpd/bgp_zebra.c
bgpd/rfapi/vnc_export_bgp.c
bgpd/rfapi/vnc_import_bgp.c

index ec63a7178c2958986001b0fdd64a515437f2901c..c7bdab35d2abd9691518316290e0fc6b4041042d 100644 (file)
@@ -466,15 +466,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;
index 0f63c3af846558806cb86e2c2b75319ce3fca5cb..2dda2e37d76209b60be05fcb8452eeb41b37774c 100644 (file)
@@ -260,7 +260,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 *);
index 739f8e605f76241b7cce84853569ae16ae257759..e86379d1d422af40b0c4149859ea1b918cc15dc7 100644 (file)
@@ -1531,7 +1531,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);
@@ -2497,7 +2497,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
index 648c3be47e07c8426bb353f4de9dadace57bf7d3..90b37f0dd20773428b38c4afe7ef0433fefff55d 100644 (file)
@@ -722,7 +722,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)) {
index 3ad41ca620dc19adbb5eede21a48001ce7610de0..f99ffce1ad60c6ccdaebfe2a5263a50507414c41 100644 (file)
@@ -700,7 +700,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
@@ -1081,7 +1082,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
index 494ca4b00b8cfc356304fc07f05890a4ae5b95cc..2fe35d0b014813781137446a5e802e766bce798d 100644 (file)
@@ -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)
@@ -1814,7 +1814,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;
                }
 
@@ -3154,7 +3154,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
@@ -6744,7 +6744,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;
@@ -9255,7 +9255,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;
@@ -11330,7 +11330,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,
@@ -11431,7 +11431,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);
index 0cc2e354d5ae2f6e7809d6b9243ff9f8e399211b..6117d62ab57717779b0efaeca9817fa13d372796 100644 (file)
@@ -755,7 +755,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;
 
index 71f7f6d0e3fb9f0d176aefa8f3d218b35bef6045..e561832e2dbc92dc9b4cb5d618ae269713056a02 100644 (file)
@@ -1726,7 +1726,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);
index 3d8d5bccb0febfa42e6758985ce82c009d1faf7f..c85c78a77ad91ea608e839560914d21beb1c6417 100644 (file)
@@ -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
index eb2d0fd8894666f3a7732a6e135ce8dcf0a8dc59..f9bfe76d66b586719d4a20bf6254ce575f87a802 100644 (file)
@@ -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;
@@ -808,7 +809,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;
@@ -1010,7 +1012,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;
@@ -1797,7 +1800,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 =
@@ -2128,7 +2131,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))) {
@@ -2265,7 +2268,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))) {
@@ -2386,7 +2389,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))) {
@@ -2577,7 +2580,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))) {