]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: return created bgp_path_info
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 16 Oct 2019 11:01:20 +0000 (07:01 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 16 Oct 2019 11:02:55 +0000 (07:02 -0400)
In bgp_create_evpn_bgp_path_info we create a bgp_path_info
that should be returned since we need it later.

Found by Coverity Scan.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_evpn.c

index f8cd3de68cfdbd1fc7ba41b6ada8c9dfd1491105..bc0b98517e7b4d9e9ea652cead15139e576af8d1 100644 (file)
@@ -2394,8 +2394,9 @@ static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn,
        return 0;
 }
 
-static void bgp_create_evpn_bgp_path_info(struct bgp_path_info *parent_pi,
-                                         struct bgp_node *rn)
+static struct bgp_path_info *
+bgp_create_evpn_bgp_path_info(struct bgp_path_info *parent_pi,
+                             struct bgp_node *rn)
 {
        struct attr *attr_new;
        struct bgp_path_info *pi;
@@ -2416,6 +2417,8 @@ static void bgp_create_evpn_bgp_path_info(struct bgp_path_info *parent_pi,
                pi->extra->num_labels = parent_pi->extra->num_labels;
        }
        bgp_path_info_add(rn, pi);
+
+       return pi;
 }
 
 /* Install EVPN route entry in ES */
@@ -2542,7 +2545,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
                        break;
 
        if (!pi)
-               bgp_create_evpn_bgp_path_info(parent_pi, rn);
+               pi = bgp_create_evpn_bgp_path_info(parent_pi, rn);
        else {
                if (attrhash_cmp(pi->attr, &attr)
                    && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
@@ -2606,7 +2609,7 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
                        break;
 
        if (!pi)
-               bgp_create_evpn_bgp_path_info(parent_pi, rn);
+               pi = bgp_create_evpn_bgp_path_info(parent_pi, rn);
        else {
                if (attrhash_cmp(pi->attr, parent_pi->attr)
                    && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {