From: Renato Westphal Date: Thu, 5 Nov 2020 12:40:26 +0000 (-0300) Subject: isisd: uninstall local routes that don't have any valid nexthop X-Git-Tag: base_7.6~209^2~3 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e33b95b4bb0afa46b89c3335443a9c316436fc9c;p=mirror%2Ffrr.git isisd: uninstall local routes that don't have any valid nexthop Once the remote end of a connected link is shut down (or lose its address), isisd will remove the corresponding route from its RIB after SPF runs. A new route for the same destination should be computed based on the local LSP, and that route by definition doesn't have any nexthop. The problem is that, when isisd tries to replace the old route by the new one, it fails because routes without nexthops can't be installed. That causes the old invalid route to remain in the RIB when it shouldn't. To fix this problem, change the zebra interface code to uninstall a route whenever it can't be installed (because it lacks nexthops) instead of doing nothing in that case. This change should fix occasional failures of the test_isis_sr_topo1 topotest. Signed-off-by: Renato Westphal --- diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index b9958a6696..e33b8c628d 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -263,8 +263,14 @@ void isis_zebra_route_add_route(struct isis *isis, struct prefix *prefix, struct zapi_route api; int count = 0; - if (zclient->sock < 0 || list_isempty(route_info->nexthops)) + if (zclient->sock < 0) + return; + + /* Uninstall the route if it doesn't have any valid nexthop. */ + if (list_isempty(route_info->nexthops)) { + isis_zebra_route_del_route(isis, prefix, src_p, route_info); return; + } memset(&api, 0, sizeof(api)); api.vrf_id = isis->vrf_id; diff --git a/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref index 387d3b43d7..b7d52cecca 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref @@ -134,27 +134,6 @@ ] } ], - "10.0.2.0\/24":[ - { - "prefix":"10.0.2.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.2.4", - "afi":"ipv4", - "interfaceName":"eth-rt4-1" - }, - { - "ip":"10.0.3.4", - "afi":"ipv4", - "interfaceName":"eth-rt4-2", - "active":true - } - ] - } - ], "10.0.3.0\/24":[ { "prefix":"10.0.3.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref index 4dc0dd7cac..f2a54bf958 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref @@ -278,21 +278,6 @@ ] } ], - "10.0.7.0\/24":[ - { - "prefix":"10.0.7.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.7.6", - "afi":"ipv4", - "interfaceName":"eth-rt6" - } - ] - } - ], "10.0.8.0\/24":[ { "prefix":"10.0.8.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref index 620f5eac67..29f4782482 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref @@ -274,21 +274,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref index 19cdf9d896..dc61b86410 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref @@ -281,21 +281,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref index 48b5e6491e..2d983c43b6 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref @@ -254,21 +254,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref index 156beef0f1..0a64db60f6 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref @@ -281,21 +281,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref index dba5e8d8a2..88485477e3 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref @@ -275,21 +275,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref index 156beef0f1..0a64db60f6 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref @@ -281,21 +281,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref index ece747bdac..769bc4d31e 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref @@ -275,21 +275,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref index 156beef0f1..0a64db60f6 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref @@ -281,21 +281,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref index 90588c6708..34cbf68b21 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref @@ -281,21 +281,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24",