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