zebra: handle blackholes encountered in recursive resolution

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index e39976e..301e0cc 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -472,6 +472,12 @@
 	}
       else
 	{
+	  /* If the longest prefix match for the nexthop yields
+	   * a blackhole, mark it as inactive. */
+	  if (CHECK_FLAG (match->flags, ZEBRA_FLAG_BLACKHOLE)
+	      || CHECK_FLAG (match->flags, ZEBRA_FLAG_REJECT))
+	    return 0;
+
 	  if (match->type == ZEBRA_ROUTE_CONNECT)
 	    {
 	      /* Directly point connected route. */
@@ -587,6 +593,12 @@
 	}
       else
 	{
+	  /* If the longest prefix match for the nexthop yields
+	   * a blackhole, mark it as inactive. */
+	  if (CHECK_FLAG (match->flags, ZEBRA_FLAG_BLACKHOLE)
+	      || CHECK_FLAG (match->flags, ZEBRA_FLAG_REJECT))
+	    return 0;
+
 	  if (match->type == ZEBRA_ROUTE_CONNECT)
 	    {
 	      /* Directly point connected route. */