]> 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, 5 Dec 2019 16:05:32 +0000 (11:05 -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 bfa578085d7907e7960bfe403f201bd3d5d826f9..ab80aff81b3210a17e460b55f9153d996a92dc5d 100644 (file)
@@ -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;
index 375a2272e1d0f85adb61d3ae69c058c525e80d65..13ed3e1ee3fb0655ff68f44e3069461ec6e1decd 100644 (file)
@@ -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 *);
index 48b714c7df4cdab8294fc3329cd2089511c671b1..155658e93f190aea006b42456192c125da5e8f68 100644 (file)
@@ -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
index d37bf5473466b3e1fbcd923b15d3c3eda59f22b4..77448ec15d3477375149fbb5f717497b55f65701 100644 (file)
@@ -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)) {
index 1d153614161007298daead22171370cf30f26eda..59ed433e581a0a1e841746d7eb73b790786754d1 100644 (file)
@@ -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
index ae70ea0690f2f00e207de98b88349920c9685351..3ef1ac39a5db7b0711602579107da0e42d06912f 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)
@@ -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);
index 5c1483a768e512300f1eb60baad2956af4271586..49e87adc3cf2914e28394794d360093620ec62c1 100644 (file)
@@ -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;
 
index e886733ced51e3ab2edfe595b434d2635dc61155..033e081e87c563fa50ad0b4f6a311cf5cfa2c40e 100644 (file)
@@ -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);
index b97c8c3030f890374055c51f66ee0c05e112bf9e..352f5e8328c5b4ce6fc6b1416f5e7920bb5d9b3e 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 6e8969ad18c8b62de10c22e11ae27c610c1b8ece..ba6ef142579d450f3e67eb1d081c48c292928871 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;
@@ -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))) {