]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Cleanup api_nh in bgpd a bit
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 1 Mar 2018 00:10:02 +0000 (19:10 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 1 Mar 2018 00:10:02 +0000 (19:10 -0500)
The api_nh was being figured 2 times, also refactor
the vrf_id placement as well.

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

index daa7ccbf42c70ac40a4acab58928241ddc68db6c..029b3d4d36b801baaef65879734636e57476756b 100644 (file)
@@ -1054,6 +1054,9 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
                else
                        continue;
 
+               api_nh = &api.nexthops[valid_nh_count];
+               api_nh->vrf_id = bgp->vrf_id;
+
                if (nh_family == AF_INET) {
                        struct in_addr *nexthop;
 
@@ -1078,9 +1081,7 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
 
                        nexthop = &mpinfo_cp->attr->nexthop;
 
-                       api_nh = &api.nexthops[valid_nh_count];
                        api_nh->gate.ipv4 = *nexthop;
-                       api_nh->vrf_id = bgp->vrf_id;
                        /* EVPN type-2 routes are
                           programmed as onlink on l3-vni SVI
                         */
@@ -1135,7 +1136,6 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
                        if (ifindex == 0)
                                continue;
 
-                       api_nh = &api.nexthops[valid_nh_count];
                        api_nh->gate.ipv6 = *nexthop;
                        api_nh->ifindex = ifindex;
                        api_nh->type = NEXTHOP_TYPE_IPV6_IFINDEX;