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 <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2020-11-05 09:40:26 -03:00
parent 4f3e4669f0
commit e33b95b4bb
12 changed files with 7 additions and 172 deletions

View File

@ -263,9 +263,15 @@ 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;
api.type = PROTO_TYPE;

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",