From b5046a3c5056462721372b4ecf7508746d00c27e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 29 Jul 2019 11:36:03 -0400 Subject: 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/zebra_rib.c | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'zebra/zebra_rib.c') 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 -- cgit v1.2.3 From 42fc558ee36561c3a024d21e89aacf68b88d25a0 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 29 Jul 2019 14:53:58 -0400 Subject: zebra, tests: Remove ROUTE_ENTRY_NEXTHOPS_CHANGED The flag ROUTE_ENTRY_NEXTHOPS_CHANGED is only ever set or unset. Since this flag is not used for anything useful, remove from system. By changing this flag we have re-ordered `internalStatus' of json output of zebra rib routes. Go through and fix up tetsts to use the new values. Signed-off-by: Donald Sharp --- tests/topotests/bfd-topo2/r1/ipv4_routes.json | 6 +++--- tests/topotests/bfd-topo2/r1/ipv6_routes.json | 6 +++--- tests/topotests/bfd-topo2/r2/ipv4_routes.json | 10 +++++----- tests/topotests/bfd-topo2/r2/ipv6_routes.json | 6 +++--- tests/topotests/bfd-topo2/r3/ipv4_routes.json | 8 ++++---- tests/topotests/bfd-topo2/r4/ipv4_routes.json | 2 +- tests/topotests/bfd-topo2/r4/ipv6_routes.json | 6 +++--- tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/ipv4_routes.json | 4 ++-- tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/ipv6_routes.json | 4 ++-- tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/ipv4_routes.json | 4 ++-- tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/ipv6_routes.json | 2 +- zebra/rib.h | 12 +++++------- zebra/zebra_nhg.c | 6 +----- zebra/zebra_rib.c | 2 -- zebra/zebra_rnh.c | 4 +--- 15 files changed, 36 insertions(+), 46 deletions(-) (limited to 'zebra/zebra_rib.c') diff --git a/tests/topotests/bfd-topo2/r1/ipv4_routes.json b/tests/topotests/bfd-topo2/r1/ipv4_routes.json index 8a2ec25baa..b0333de410 100644 --- a/tests/topotests/bfd-topo2/r1/ipv4_routes.json +++ b/tests/topotests/bfd-topo2/r1/ipv4_routes.json @@ -8,7 +8,7 @@ "selected": true, "installed": true, "prefix": "10.0.3.0/24", - "internalStatus": 34, + "internalStatus": 16, "nexthops": [ { "interfaceName": "r1-eth0", @@ -30,7 +30,7 @@ "selected": true, "installed": true, "prefix": "10.254.254.2/32", - "internalStatus": 34, + "internalStatus": 16, "nexthops": [ { "interfaceName": "r1-eth0", @@ -52,7 +52,7 @@ "selected": true, "installed": true, "prefix": "10.254.254.1/32", - "internalStatus": 32, + "internalStatus": 16, "nexthops": [ { "directlyConnected": true, diff --git a/tests/topotests/bfd-topo2/r1/ipv6_routes.json b/tests/topotests/bfd-topo2/r1/ipv6_routes.json index 618853bd42..d09439a8a6 100644 --- a/tests/topotests/bfd-topo2/r1/ipv6_routes.json +++ b/tests/topotests/bfd-topo2/r1/ipv6_routes.json @@ -8,7 +8,7 @@ "selected": true, "installed": true, "prefix": "2001:db8:4::/64", - "internalStatus": 34, + "internalStatus": 16, "nexthops": [ { "interfaceName": "r1-eth0", @@ -27,7 +27,7 @@ "protocol": "bgp", "internalFlags": 0, "metric": 0, - "internalStatus": 2, + "internalStatus": 0, "prefix": "2001:db8:1::/64", "nexthops": [ { @@ -47,7 +47,7 @@ "selected": true, "installed": true, "prefix": "2001:db8:1::/64", - "internalStatus": 32, + "internalStatus": 16, "nexthops": [ { "directlyConnected": true, diff --git a/tests/topotests/bfd-topo2/r2/ipv4_routes.json b/tests/topotests/bfd-topo2/r2/ipv4_routes.json index b9d8afb430..3c41e13434 100644 --- a/tests/topotests/bfd-topo2/r2/ipv4_routes.json +++ b/tests/topotests/bfd-topo2/r2/ipv4_routes.json @@ -5,7 +5,7 @@ "protocol": "ospf", "internalFlags": 0, "metric": 10, - "internalStatus": 2, + "internalStatus": 0, "prefix": "10.0.3.0/24", "nexthops": [ { @@ -25,7 +25,7 @@ "selected": true, "installed": true, "prefix": "10.0.3.0/24", - "internalStatus": 32, + "internalStatus": 16, "nexthops": [ { "directlyConnected": true, @@ -47,7 +47,7 @@ "selected": true, "installed": true, "prefix": "10.254.254.3/32", - "internalStatus": 34, + "internalStatus": 16, "nexthops": [ { "interfaceName": "r2-eth1", @@ -70,7 +70,7 @@ "selected": true, "installed": true, "prefix": "10.254.254.2/32", - "internalStatus": 32, + "internalStatus": 16, "nexthops": [ { "directlyConnected": true, @@ -92,7 +92,7 @@ "selected": true, "installed": true, "prefix": "10.254.254.1/32", - "internalStatus": 34, + "internalStatus": 16, "nexthops": [ { "interfaceName": "r2-eth0", diff --git a/tests/topotests/bfd-topo2/r2/ipv6_routes.json b/tests/topotests/bfd-topo2/r2/ipv6_routes.json index 004e7588aa..bb45bbae52 100644 --- a/tests/topotests/bfd-topo2/r2/ipv6_routes.json +++ b/tests/topotests/bfd-topo2/r2/ipv6_routes.json @@ -5,7 +5,7 @@ "protocol": "ospf6", "internalFlags": 0, "metric": 10, - "internalStatus": 2, + "internalStatus": 0, "prefix": "2001:db8:4::/64", "nexthops": [ { @@ -25,7 +25,7 @@ "selected": true, "installed": true, "prefix": "2001:db8:4::/64", - "internalStatus": 32, + "internalStatus": 16, "nexthops": [ { "directlyConnected": true, @@ -47,7 +47,7 @@ "selected": true, "installed": true, "prefix": "2001:db8:1::/64", - "internalStatus": 32, + "internalStatus": 16, "nexthops": [ { "directlyConnected": true, diff --git a/tests/topotests/bfd-topo2/r3/ipv4_routes.json b/tests/topotests/bfd-topo2/r3/ipv4_routes.json index 14dfc692fe..cbf116e687 100644 --- a/tests/topotests/bfd-topo2/r3/ipv4_routes.json +++ b/tests/topotests/bfd-topo2/r3/ipv4_routes.json @@ -25,7 +25,7 @@ "selected": true, "installed": true, "prefix": "10.0.3.0/24", - "internalStatus": 32, + "internalStatus": 16, "nexthops": [ { "directlyConnected": true, @@ -47,7 +47,7 @@ "selected": true, "installed": true, "prefix": "10.254.254.3/32", - "internalStatus": 32, + "internalStatus": 16, "nexthops": [ { "directlyConnected": true, @@ -69,7 +69,7 @@ "selected": true, "installed": true, "prefix": "10.254.254.2/32", - "internalStatus": 34, + "internalStatus": 16, "nexthops": [ { "interfaceName": "r3-eth0", @@ -92,7 +92,7 @@ "selected": true, "installed": true, "prefix": "10.254.254.1/32", - "internalStatus": 34, + "internalStatus": 16, "nexthops": [ { "interfaceName": "r3-eth0", diff --git a/tests/topotests/bfd-topo2/r4/ipv4_routes.json b/tests/topotests/bfd-topo2/r4/ipv4_routes.json index ae1e97b017..b06184a44d 100644 --- a/tests/topotests/bfd-topo2/r4/ipv4_routes.json +++ b/tests/topotests/bfd-topo2/r4/ipv4_routes.json @@ -8,7 +8,7 @@ "selected": true, "installed": true, "prefix": "10.254.254.4/32", - "internalStatus": 32, + "internalStatus": 16, "nexthops": [ { "directlyConnected": true, diff --git a/tests/topotests/bfd-topo2/r4/ipv6_routes.json b/tests/topotests/bfd-topo2/r4/ipv6_routes.json index 33608b45aa..a22c90cbba 100644 --- a/tests/topotests/bfd-topo2/r4/ipv6_routes.json +++ b/tests/topotests/bfd-topo2/r4/ipv6_routes.json @@ -5,7 +5,7 @@ "protocol": "ospf6", "internalFlags": 0, "metric": 10, - "internalStatus": 2, + "internalStatus": 0, "prefix": "2001:db8:4::/64", "nexthops": [ { @@ -25,7 +25,7 @@ "selected": true, "installed": true, "prefix": "2001:db8:4::/64", - "internalStatus": 32, + "internalStatus": 16, "nexthops": [ { "directlyConnected": true, @@ -47,7 +47,7 @@ "selected": true, "installed": true, "prefix": "2001:db8:1::/64", - "internalStatus": 34, + "internalStatus": 16, "nexthops": [ { "interfaceName": "r4-eth0", diff --git a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/ipv4_routes.json b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/ipv4_routes.json index e32c84b7d5..1649ade96d 100644 --- a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/ipv4_routes.json +++ b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/ipv4_routes.json @@ -9,7 +9,7 @@ "distance": 20, "metric": 0, "installed": true, - "internalStatus": 34, + "internalStatus": 16, "internalFlags": 8, "nexthops": [ { @@ -33,7 +33,7 @@ "distance": 0, "metric": 0, "installed": true, - "internalStatus": 32, + "internalStatus": 16, "internalFlags": 8, "nexthops": [ { diff --git a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/ipv6_routes.json b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/ipv6_routes.json index 88e8c5cd83..1ca62094bd 100644 --- a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/ipv6_routes.json +++ b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/ipv6_routes.json @@ -6,7 +6,7 @@ "vrfId":3, "distance": 20, "metric": 0, - "internalStatus": 2, + "internalStatus": 0, "internalFlags": 0, "nexthops": [ { @@ -27,7 +27,7 @@ "distance": 0, "metric": 0, "installed": true, - "internalStatus": 32, + "internalStatus": 16, "internalFlags": 8, "nexthops": [ { diff --git a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/ipv4_routes.json b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/ipv4_routes.json index 9d7c0e6e4f..eda4bed035 100644 --- a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/ipv4_routes.json +++ b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/ipv4_routes.json @@ -9,7 +9,7 @@ "distance": 0, "metric": 0, "installed": true, - "internalStatus": 32, + "internalStatus": 16, "internalFlags": 8, "nexthops": [ { @@ -33,7 +33,7 @@ "distance": 20, "metric": 0, "installed": true, - "internalStatus": 34, + "internalStatus": 16, "internalFlags": 8, "nexthops": [ { diff --git a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/ipv6_routes.json b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/ipv6_routes.json index 230fe38748..45c1b76017 100644 --- a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/ipv6_routes.json +++ b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/ipv6_routes.json @@ -9,7 +9,7 @@ "distance": 0, "metric": 0, "installed": true, - "internalStatus": 32, + "internalStatus": 16, "internalFlags": 8, "nexthops": [ { diff --git a/zebra/rib.h b/zebra/rib.h index 181286a904..b82428e54c 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -124,18 +124,16 @@ struct route_entry { /* RIB internal status */ uint32_t status; #define ROUTE_ENTRY_REMOVED 0x1 -/* to simplify NHT logic when NHs change, instead of doing a NH by NH cmp */ -#define ROUTE_ENTRY_NEXTHOPS_CHANGED 0x2 /* The Route Entry has changed */ -#define ROUTE_ENTRY_CHANGED 0x4 +#define ROUTE_ENTRY_CHANGED 0x2 /* The Label has changed on the Route entry */ -#define ROUTE_ENTRY_LABELS_CHANGED 0x8 +#define ROUTE_ENTRY_LABELS_CHANGED 0x4 /* Route is queued for Installation into the Data Plane */ -#define ROUTE_ENTRY_QUEUED 0x10 +#define ROUTE_ENTRY_QUEUED 0x8 /* Route is installed into the Data Plane */ -#define ROUTE_ENTRY_INSTALLED 0x20 +#define ROUTE_ENTRY_INSTALLED 0x10 /* Route has Failed installation into the Data Plane in some manner */ -#define ROUTE_ENTRY_FAILED 0x40 +#define ROUTE_ENTRY_FAILED 0x20 /* Nexthop information. */ uint8_t nexthop_num; diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 4a88296051..d123602550 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -272,8 +272,6 @@ static int nexthop_active(afi_t afi, struct route_entry *re, SET_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE); - SET_FLAG(re->status, - ROUTE_ENTRY_NEXTHOPS_CHANGED); nexthop_set_resolved(afi, newhop, nexthop); resolved = 1; } @@ -501,10 +499,8 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re) && nexthop->type < NEXTHOP_TYPE_BLACKHOLE) && !(IPV6_ADDR_SAME(&prev_src.ipv6, &nexthop->rmap_src.ipv6))) - || CHECK_FLAG(re->status, ROUTE_ENTRY_LABELS_CHANGED)) { + || CHECK_FLAG(re->status, ROUTE_ENTRY_LABELS_CHANGED)) SET_FLAG(re->status, ROUTE_ENTRY_CHANGED); - SET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED); - } } return re->nexthop_active_num; diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 5dcf21f561..479e971685 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1128,8 +1128,6 @@ static void rib_process(struct route_node *rn) re->status, re->flags, re->distance, re->metric); - UNSET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED); - /* Currently selected re. */ if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED)) { assert(old_selected == NULL); diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 6f65f8ab7a..5a10892d9a 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -859,10 +859,8 @@ static void zebra_rnh_clear_nhc_flag(struct zebra_vrf *zvrf, afi_t afi, re = zebra_rnh_resolve_nexthop_entry(zvrf, afi, nrn, rnh, &prn); - if (re) { - UNSET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED); + if (re) UNSET_FLAG(re->status, ROUTE_ENTRY_LABELS_CHANGED); - } } /* Evaluate all tracked entries (nexthops or routes for import into BGP) -- cgit v1.2.3