]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Showing the nexthop resolution target in import tables
authorMaria Matejka <mq@ucw.cz>
Thu, 16 Jun 2022 10:39:08 +0000 (12:39 +0200)
committerMaria Matejka <mq@ucw.cz>
Thu, 16 Jun 2022 10:39:08 +0000 (12:39 +0200)
nest/rt-show.c
proto/bgp/bgp.h

index f3852d170d5537a314d1564b3d2fd6ba6402657c..35036fe6a0e85c2cbb34f43e33ea7decf49c5bb7 100644 (file)
@@ -71,8 +71,13 @@ rt_show_rte(struct cli *c, byte *ia, rte *e, struct rt_show_data *d, int primary
   if (d->last_table != d->tab)
     rt_show_table(c, d);
 
-  cli_printf(c, -1007, "%-20s %s [%s %s%s]%s%s", ia, 
-      net_is_flow(e->net) ? flowspec_valid_name(flowspec_valid) : rta_dest_name(dest),
+  eattr *heea;
+  struct hostentry_adata *had = NULL;
+  if (!net_is_flow(e->net) && (dest == RTD_NONE) && (heea = ea_find(a, &ea_gen_hostentry)))
+    had = (struct hostentry_adata *) heea->u.ptr;
+
+  cli_printf(c, -1007, "%-20s %s [%s %s%s]%s%s", ia,
+      net_is_flow(e->net) ? flowspec_valid_name(flowspec_valid) : had ? "recursive" : rta_dest_name(dest),
       e->src->proto->name, tm, from, primary ? (sync_error ? " !" : " *") : "", info);
 
   if (dest == RTD_UNICAST)
@@ -100,6 +105,13 @@ rt_show_rte(struct cli *c, byte *ia, rte *e, struct rt_show_data *d, int primary
        cli_printf(c, -1007, "\tdev %s%s%s",
                   nh->iface->name, mpls,  onlink, weight);
     }
+  else if (had)
+    {
+      if (ipa_nonzero(had->he->link) && !ipa_equal(had->he->link, had->he->addr))
+       cli_printf(c, -1007, "\tvia %I %I table %s", had->he->addr, had->he->link, had->he->tab->name);
+      else
+       cli_printf(c, -1007, "\tvia %I table %s", had->he->addr, had->he->tab->name);
+    }
 
   if (d->verbose)
     ea_show_list(c, a);
index b3966bc3db9abaca690f9d6864d6fca82a9b3439..cca7873ac43c0f670190bc7299ecc94ae5c22b03 100644 (file)
@@ -520,6 +520,9 @@ static inline int
 rte_resolvable(const rte *rt)
 {
   eattr *nhea = ea_find(rt->attrs, &ea_gen_nexthop);
+  if (!nhea)
+    return 0;
+
   struct nexthop_adata *nhad = (void *) nhea->u.ptr;
   return NEXTHOP_IS_REACHABLE(nhad) || (nhad->dest != RTD_UNREACHABLE);
 }