]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Remove extra alloc function bgp_path_info_new
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 7 Apr 2019 00:08:34 +0000 (20:08 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 7 Apr 2019 00:10:52 +0000 (20:10 -0400)
The bgp_path_info_new function whenever it was called
pretty much duplicated the info_make function call.  So
convert over to using it and remove the bgp_path_info_new
function so people are not tempted.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_route.c
bgpd/bgp_route.h
bgpd/rfapi/rfapi.c
bgpd/rfapi/rfapi_import.c

index 555a08552227f030dcc8dc82bc08cfa0c54a6808..e8a8e561503596fc611cac3f69ee9db393bbe62c 100644 (file)
@@ -239,12 +239,6 @@ struct bgp_path_info_extra *bgp_path_info_extra_get(struct bgp_path_info *pi)
        return pi->extra;
 }
 
-/* Allocate new bgp info structure. */
-struct bgp_path_info *bgp_path_info_new(void)
-{
-       return XCALLOC(MTYPE_BGP_ROUTE, sizeof(struct bgp_path_info));
-}
-
 /* Free bgp route information. */
 static void bgp_path_info_free(struct bgp_path_info *path)
 {
index fc5bf0c7558a03ff1c74af0712d63aca3df4039c..a559a6b58cb4390acd6045f7d5c0adf8de509190 100644 (file)
@@ -564,7 +564,6 @@ extern void bgp_process_queues_drain_immediate(void);
 extern struct bgp_node *bgp_afi_node_lookup(struct bgp_table *table, afi_t afi,
                                            safi_t safi, struct prefix *p,
                                            struct prefix_rd *prd);
-extern struct bgp_path_info *bgp_path_info_new(void);
 extern void bgp_path_info_restore(struct bgp_node *rn,
                                  struct bgp_path_info *path);
 
index a41473fa4ff8a6691306f8c2a5c24b997bda2239..5525547454857273bac647576236225fa7669e07 100644 (file)
@@ -1059,14 +1059,8 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
                }
        }
 
-
-       new = bgp_path_info_new();
-       new->type = type;
-       new->sub_type = sub_type;
-       new->peer = rfd->peer;
+       new = info_make(type, sub_type, 0, rfd->peer, new_attr, NULL);
        SET_FLAG(new->flags, BGP_PATH_VALID);
-       new->attr = new_attr;
-       new->uptime = bgp_clock();
 
        /* save backref to rfapi handle */
        assert(bgp_path_info_extra_get(new));
index 93729c14763d831c0d419611452f896a6a7ffc09..568f8d68e863e72d0e106dbedfab07099c168051 100644 (file)
@@ -509,13 +509,11 @@ static struct bgp_path_info *rfapiBgpInfoCreate(struct attr *attr,
 {
        struct bgp_path_info *new;
 
-       new = bgp_path_info_new();
-       assert(new);
+       new = info_make(type, sub_type, 0, peer, attr, NULL);
+
+       if (attr)
+               new->attr = bgp_attr_intern(attr);
 
-       if (attr) {
-               if (!new->attr)
-                       new->attr = bgp_attr_intern(attr);
-       }
        bgp_path_info_extra_get(new);
        if (prd) {
                new->extra->vnc.import.rd = *prd;
@@ -523,9 +521,7 @@ static struct bgp_path_info *rfapiBgpInfoCreate(struct attr *attr,
        }
        if (label)
                encode_label(*label, &new->extra->label[0]);
-       new->type = type;
-       new->sub_type = sub_type;
-       new->peer = peer;
+
        peer_lock(peer);
 
        return new;