]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: uninstall local routes that don't have any valid nexthop
authorRenato Westphal <renato@opensourcerouting.org>
Thu, 5 Nov 2020 12:40:26 +0000 (09:40 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Mon, 23 Nov 2020 17:50:32 +0000 (14:50 -0300)
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>
12 files changed:
isisd/isis_zebra.c
tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref
tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref
tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref
tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref
tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref
tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref
tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref
tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref
tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref
tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref
tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref

index b9958a669635bb7ce802de33aca82faccaafa46b..e33b8c628d0d5e4ce8d15d4474cfd15adc51fd9a 100644 (file)
@@ -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;
index 387d3b43d76a844da421eafbaa57d07add143846..b7d52cecca7a56517b708c519f8a90817175c9ba 100644 (file)
       ]
     }
   ],
-  "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",
index 4dc0dd7cacac06df5a195be8f02e8b0fe1cae8cc..f2a54bf9586970c20724f263dcdce2886328f70b 100644 (file)
       ]
     }
   ],
-  "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",
index 620f5eac67adf3c27d8d3eeb6d7763712c47cf67..29f47824826fb7ead774946e4f6470fb29d57ef0 100644 (file)
       ]
     }
   ],
-  "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",
index 19cdf9d89672ac58494688daa45d82b9ebc5e170..dc61b8641033b1f748955a6276334902b2b96c4a 100644 (file)
       ]
     }
   ],
-  "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",
index 48b5e6491eadafeb92f5164e6e45bfb3e90bc320..2d983c43b62dbbd2c4603e26b39d2c5746d5294f 100644 (file)
       ]
     }
   ],
-  "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",
index 156beef0f1017d0a773d5d718f2817764aac7ccf..0a64db60f648365e6191d7a0d3c21158160a374b 100644 (file)
       ]
     }
   ],
-  "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",
index dba5e8d8a2d79cac9646b869ca921fa8dc56da14..88485477e3b499820358145ca4f4021bded62477 100644 (file)
       ]
     }
   ],
-  "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",
index 156beef0f1017d0a773d5d718f2817764aac7ccf..0a64db60f648365e6191d7a0d3c21158160a374b 100644 (file)
       ]
     }
   ],
-  "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",
index ece747bdac0fa4aa1a2d452d9880e2e952fd1812..769bc4d31e00f0f7a9fa50932449a64532eceb66 100644 (file)
       ]
     }
   ],
-  "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",
index 156beef0f1017d0a773d5d718f2817764aac7ccf..0a64db60f648365e6191d7a0d3c21158160a374b 100644 (file)
       ]
     }
   ],
-  "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",
index 90588c6708d533a122b40a70eebf9d68d1f43e20..34cbf68b214eb00dba2bea1251199fb002632641 100644 (file)
       ]
     }
   ],
-  "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",