From b5046a3c5056462721372b4ecf7508746d00c27e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 29 Jul 2019 11:36:03 -0400 Subject: [PATCH] zebra: Remove repeated enqueueing of system routes for rethinking The code as written before this code change point would enqueue every system route type to be refigured when we have an interface event. I believe this was to originally handle bugs in the way nexthop tracking was handled, mainly that if you keep asking the question you'll eventually get the right answer. Modify the code to not do this, we have fixed nexthop tracking to not be so brain dead and to know when it needs to refigure a route that it is tracking. Signed-off-by: Donald Sharp --- zebra/connected.c | 31 ------------------------------- zebra/interface.c | 19 ------------------- zebra/rib.h | 1 - zebra/zebra_rib.c | 44 -------------------------------------------- 4 files changed, 95 deletions(-) diff --git a/zebra/connected.c b/zebra/connected.c index bba221c2cf..4101a4bf24 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -260,16 +260,6 @@ void connected_up(struct interface *ifp, struct connected *ifc) rib_add(afi, SAFI_MULTICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT, 0, 0, &p, NULL, &nh, zvrf->table_id, metric, 0, 0, 0); - if (IS_ZEBRA_DEBUG_RIB_DETAILED) { - char buf[PREFIX_STRLEN]; - - zlog_debug( - "%u: IF %s address %s add/up, scheduling RIB processing", - ifp->vrf_id, ifp->name, - prefix2str(&p, buf, sizeof(buf))); - } - rib_update(zvrf->vrf->vrf_id, RIB_UPDATE_IF_CHANGE); - /* Schedule LSP forwarding entries for processing, if appropriate. */ if (zvrf->vrf->vrf_id == VRF_DEFAULT) { if (IS_ZEBRA_DEBUG_MPLS) { @@ -433,17 +423,6 @@ void connected_down(struct interface *ifp, struct connected *ifc) rib_delete(afi, SAFI_MULTICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT, 0, 0, &p, NULL, &nh, zvrf->table_id, 0, 0, false); - if (IS_ZEBRA_DEBUG_RIB_DETAILED) { - char buf[PREFIX_STRLEN]; - - zlog_debug( - "%u: IF %s IP %s address down, scheduling RIB processing", - zvrf->vrf->vrf_id, ifp->name, - prefix2str(&p, buf, sizeof(buf))); - } - - rib_update(zvrf->vrf->vrf_id, RIB_UPDATE_IF_CHANGE); - /* Schedule LSP forwarding entries for processing, if appropriate. */ if (zvrf->vrf->vrf_id == VRF_DEFAULT) { if (IS_ZEBRA_DEBUG_MPLS) { @@ -468,16 +447,6 @@ static void connected_delete_helper(struct connected *ifc, struct prefix *p) connected_withdraw(ifc); - if (IS_ZEBRA_DEBUG_RIB_DETAILED) { - char buf[PREFIX_STRLEN]; - - zlog_debug( - "%u: IF %s IP %s address del, scheduling RIB processing", - ifp->vrf_id, ifp->name, - prefix2str(p, buf, sizeof(buf))); - } - rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE); - /* Schedule LSP forwarding entries for processing, if appropriate. */ if (ifp->vrf_id == VRF_DEFAULT) { if (IS_ZEBRA_DEBUG_MPLS) { diff --git a/zebra/interface.c b/zebra/interface.c index 4eec435f1c..732e900bbd 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -799,15 +799,6 @@ void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id) /* Install connected routes (in new VRF). */ if (if_is_operative(ifp)) if_install_connected(ifp); - - /* Due to connected route change, schedule RIB processing for both old - * and new VRF. - */ - if (IS_ZEBRA_DEBUG_RIB_DETAILED) - zlog_debug("%u: IF %s VRF change, scheduling RIB processing", - ifp->vrf_id, ifp->name); - rib_update(old_vrf_id, RIB_UPDATE_IF_CHANGE); - rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE); } static void ipv6_ll_address_to_mac(struct in6_addr *address, uint8_t *mac) @@ -950,11 +941,6 @@ void if_up(struct interface *ifp) /* Install connected routes to the kernel. */ if_install_connected(ifp); - if (IS_ZEBRA_DEBUG_RIB_DETAILED) - zlog_debug("%u: IF %s up, scheduling RIB processing", - ifp->vrf_id, ifp->name); - rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE); - /* Handle interface up for specific types for EVPN. Non-VxLAN interfaces * are checked to see if (remote) neighbor entries need to be installed * on them for ARP suppression. @@ -1008,11 +994,6 @@ void if_down(struct interface *ifp) /* Uninstall connected routes from the kernel. */ if_uninstall_connected(ifp); - if (IS_ZEBRA_DEBUG_RIB_DETAILED) - zlog_debug("%u: IF %s down, scheduling RIB processing", - ifp->vrf_id, ifp->name); - rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE); - if_nbr_ipv6ll_to_ipv4ll_neigh_del_all(ifp); /* Delete all neighbor addresses learnt through IPv6 RA */ diff --git a/zebra/rib.h b/zebra/rib.h index 9d8cee8bf7..181286a904 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -303,7 +303,6 @@ typedef struct rib_tables_iter_t_ { /* Events/reasons triggering a RIB update. */ typedef enum { - RIB_UPDATE_IF_CHANGE, RIB_UPDATE_RMAP_CHANGE, RIB_UPDATE_OTHER } rib_update_event_t; diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index afe59b9593..5dcf21f561 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2967,50 +2967,6 @@ void rib_update_table(struct route_table *table, rib_update_event_t event) RIB_ROUTE_ANY_QUEUED)) continue; switch (event) { - case RIB_UPDATE_IF_CHANGE: - /* Examine all routes that won't get processed by the - * protocol or - * triggered by nexthop evaluation (NHT). This would be - * system, - * kernel and certain static routes. Note that NHT will - * get - * triggered upon an interface event as connected routes - * always - * get queued for processing. - */ - RNODE_FOREACH_RE_SAFE (rn, re, next) { - struct nexthop *nh; - - if (re->type != ZEBRA_ROUTE_SYSTEM - && re->type != ZEBRA_ROUTE_KERNEL - && re->type != ZEBRA_ROUTE_CONNECT - && re->type != ZEBRA_ROUTE_STATIC) - continue; - - if (re->type != ZEBRA_ROUTE_STATIC) { - SET_FLAG(re->status, - ROUTE_ENTRY_CHANGED); - rib_queue_add(rn); - continue; - } - - for (nh = re->ng.nexthop; nh; nh = nh->next) - if (!(nh->type == NEXTHOP_TYPE_IPV4 - || nh->type == NEXTHOP_TYPE_IPV6)) - break; - - /* If we only have nexthops to a - * gateway, NHT will - * take care. - */ - if (nh) { - SET_FLAG(re->status, - ROUTE_ENTRY_CHANGED); - rib_queue_add(rn); - } - } - break; - case RIB_UPDATE_RMAP_CHANGE: case RIB_UPDATE_OTHER: /* Right now, examine all routes. Can restrict to a -- 2.39.5