diff options
author | Iqra Siddiqui <imujeebsiddi@vmware.com> | 2021-09-17 17:50:03 +0200 |
---|---|---|
committer | Kuldeep Kashyap <kashyapk@vmware.com> | 2021-11-19 03:03:22 +0100 |
commit | ad1844f7bd580e73f7088e79493481a20b5f872d (patch) | |
tree | e27170e03b7a4938f91d74e4a7a19c9d7d01dcf5 /bgpd/bgp_zebra.c | |
parent | bgpd: VRF-Lite fix best path selection (diff) | |
download | frr-ad1844f7bd580e73f7088e79493481a20b5f872d.tar.xz frr-ad1844f7bd580e73f7088e79493481a20b5f872d.zip |
bgpd: Few code optimisations
Description:
Added a macro which optimises some part of the code.
Co-authored-by: Santosh P K <sapk@vmware.com>
Co-authored-by: Kantesh Mundaragi <kmundaragi@vmware.com>
Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
Diffstat (limited to 'bgpd/bgp_zebra.c')
-rw-r--r-- | bgpd/bgp_zebra.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index a98168d46..5b4f31f66 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1249,6 +1249,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, uint8_t distance; struct peer *peer; struct bgp_path_info *mpinfo; + struct bgp *bgp_orig; uint32_t metric; struct attr local_attr; struct bgp_path_info local_info; @@ -1412,13 +1413,13 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, } } + BGP_ORIGINAL_UPDATE(bgp_orig, mpinfo, bgp); + if (nh_family == AF_INET) { nh_updated = update_ipv4nh_for_route_install( - nh_othervrf, - nh_othervrf ? - info->extra->bgp_orig : bgp, - &mpinfo_cp->attr->nexthop, - mpinfo_cp->attr, is_evpn, api_nh); + nh_othervrf, bgp_orig, + &mpinfo_cp->attr->nexthop, mpinfo_cp->attr, + is_evpn, api_nh); } else { ifindex_t ifindex = IFINDEX_INTERNAL; struct in6_addr *nexthop; @@ -1428,18 +1429,13 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, if (!nexthop) nh_updated = update_ipv4nh_for_route_install( - nh_othervrf, - nh_othervrf ? info->extra->bgp_orig - : bgp, + nh_othervrf, bgp_orig, &mpinfo_cp->attr->nexthop, mpinfo_cp->attr, is_evpn, api_nh); else nh_updated = update_ipv6nh_for_route_install( - nh_othervrf, - nh_othervrf ? info->extra->bgp_orig - : bgp, - nexthop, ifindex, mpinfo, info, is_evpn, - api_nh); + nh_othervrf, bgp_orig, nexthop, ifindex, + mpinfo, info, is_evpn, api_nh); } /* Did we get proper nexthop info to update zebra? */ |