]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Dumping route sources along with protocols and routes
authorMaria Matejka <mq@ucw.cz>
Wed, 1 Nov 2023 17:25:40 +0000 (18:25 +0100)
committerMaria Matejka <mq@ucw.cz>
Wed, 1 Nov 2023 17:25:40 +0000 (18:25 +0100)
lib/route.h
nest/proto.c
nest/rt-attr.c
nest/rt-table.c

index 0fc0d0b3fa73ad2b9703732bd404c45903b47e80..067725771c53cea60e961f65c76cb0fba899d965 100644 (file)
@@ -173,6 +173,8 @@ static inline void rt_unlock_source(struct rte_src *src)
 void rt_init_sources(struct rte_owner *, const char *name, event_list *list);
 void rt_destroy_sources(struct rte_owner *, event *);
 
+void rt_dump_sources(struct rte_owner *);
+
 /*
  *     Route Attributes
  *
index 414ce704dc935cb3fbee916a0432ea4c76be3e59..8b949c9cdb17c9bcb3c683816c5a24e5697298f3 100644 (file)
@@ -2034,6 +2034,9 @@ protos_dump_all(void)
          c->out_req.hook ? rt_export_state_name(rt_export_get_state(c->out_req.hook)) : "-");
     }
 
+    debug("\tSOURCES\n");
+    rt_dump_sources(&p->sources);
+
     if (p->proto->dump && (p->proto_state != PS_DOWN))
       p->proto->dump(p);
   }
index 2e703a0b1641a22b2be1bcebf3a3c4636ab390d1..53111696ddbf6f660ff04d9ece054e54245f1620 100644 (file)
@@ -366,6 +366,30 @@ rt_prune_sources(void *data)
     RTA_UNLOCK;
 }
 
+void
+rt_dump_sources(struct rte_owner *o)
+{
+  debug("\t%s: hord=%u, uc=%u, cnt=%u prune=%p, stop=%p\n",
+      o->name, o->hash.order, o->uc, o->hash.count, o->prune, o->stop);
+  debug("\tget_route_info=%p, better=%p, mergable=%p, igp_metric=%p, recalculate=%p",
+      o->class->get_route_info, o->class->rte_better, o->class->rte_mergable,
+      o->class->rte_igp_metric, o->rte_recalculate);
+
+  int splitting = 0;
+  HASH_WALK(o->hash, next, src)
+  {
+    debug("%c%c%uL %uG %luU",
+       (splitting % 8) ? ',' : '\n',
+       (splitting % 8) ? ' ' : '\t',
+       src->private_id, src->global_id,
+       atomic_load_explicit(&src->uc, memory_order_relaxed));
+
+    splitting++;
+  }
+  HASH_WALK_END;
+  debug("\n");
+}
+
 void
 rt_init_sources(struct rte_owner *o, const char *name, event_list *list)
 {
index e86397e49ba4c05ca2bf4876367e97cd53346afc..0075bb7fda9fab3af290e78701de1fd98915263e 100644 (file)
@@ -2502,6 +2502,7 @@ rte_dump(struct rte_storage *e)
 {
   debug("%-1N ", e->rte.net);
   debug("PF=%02x ", e->rte.pflags);
+  debug("SRC=%uG ", e->rte.src->global_id);
   ea_dump(e->rte.attrs);
   debug("\n");
 }