diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-06-11 09:11:12 -0700 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-06-11 09:11:12 -0700 |
| commit | 94ad353dfd9916eabc8fe075a441dde9416a9d36 (patch) | |
| tree | 5b6cbe38abbfd6ed8c9803d92797de29528fee3d | |
| parent | 18ff3eddccd3b024677bb9b2f9c5aac8df8ecc35 (diff) | |
Zebra: Optimize static route path deletion.
When a path of a static route is deleted, there is no need to reschedule and
run the RIB selection again, it is sufficient to just delete this path.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Satish Ashok <sashok@cumulusnetworks.com>
| -rw-r--r-- | zebra/zebra_rib.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 99db3a264e..6c61985155 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2816,16 +2816,30 @@ static_uninstall_ipv4 (struct prefix *p, struct static_ipv4 *si) rib_delnode (rn, rib); else { + /* Mark this nexthop as inactive and reinstall the route. Then, delete + * the nexthop. There is no need to re-evaluate the route for this + * scenario. + */ + UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) - rib_uninstall (rn, rib); + { + redistribute_delete (&rn->p, rib); + rib_uninstall_kernel (rn, rib); + /* Are there other active nexthops? */ + if (rib->nexthop_active_num > 1) + { + rib_install_kernel (rn, rib); + redistribute_add (&rn->p, rib); + } + } + /* Delete the nexthop and dereg from NHT */ nh_p.family = AF_INET; nh_p.prefixlen = IPV4_MAX_BITLEN; nh_p.u.prefix4 = nexthop->gate.ipv4; nexthop_delete (rib, nexthop); zebra_deregister_rnh_static_nh(&nh_p, rn); nexthop_free (nexthop, rn); - rib_queue_add (&zebrad, rn); } /* Unlock node. */ route_unlock_node (rn); @@ -3543,16 +3557,30 @@ static_uninstall_ipv6 (struct prefix *p, struct static_ipv6 *si) } else { + /* Mark this nexthop as inactive and reinstall the route. Then, delete + * the nexthop. There is no need to re-evaluate the route for this + * scenario. + */ + UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) - rib_uninstall (rn, rib); + { + redistribute_delete (&rn->p, rib); + rib_uninstall_kernel (rn, rib); + /* Are there other active nexthops? */ + if (rib->nexthop_active_num > 1) + { + rib_install_kernel (rn, rib); + redistribute_add (&rn->p, rib); + } + } + /* Delete the nexthop and dereg from NHT */ nh_p.family = AF_INET6; nh_p.prefixlen = IPV6_MAX_BITLEN; nh_p.u.prefix6 = nexthop->gate.ipv6; nexthop_delete (rib, nexthop); zebra_deregister_rnh_static_nh(&nh_p, rn); nexthop_free (nexthop, rn); - rib_queue_add (&zebrad, rn); } /* Unlock node. */ route_unlock_node (rn); |
