Default table selection with 'show route' in bird 2.13

Alexander Shikov a.shikov at dtel-ix.net
Wed Jun 14 11:58:22 CEST 2023


Hello!

While testing bird 2.13 with a bunch of non-default tables, including separate
tables for flow specifications, I've found the output of 'show route' without 
additional parameters a bit annoying:

# birdc show route
BIRD 2.13 ready.
Table FLOW4:
flow4 { dst 109.68.40.15/32; proto 17; dport 123; }  [FLOWSPEC 2023-06-08] * (200)



So I had to add additional "table all" parameter to get route from non-default IPv4 table:
# birdc show route table all
BIRD 2.13 ready.
Table master4:

Table master6:

Table IP4:
109.68.40.15/32      unicast [RS0 2023-06-07 from 193.25.180.255] * (100) [AS25372i]
        via 193.25.180.17 on bxe0

[...]
Table FLOW4:
flow4 { dst 109.68.40.15/32; proto 17; dport 123; }  [FLOWSPEC 2023-06-08] * (200)



Second example:
-- default behavior:
# birdc show route 109.68.40.15/32
BIRD 2.13 ready.
Network not found

# birdc show route 109.68.40.15/32 table all
BIRD 2.13 ready.
Table IP4:
109.68.40.15/32      unicast [RS0 2023-06-07 from 193.25.180.255] * (100) [AS25372i]
        via 193.25.180.17 on bxe0
^^ have to always add 'table all'


-- changed behavior looks more logical to me:
# birdc show route 109.68.40.15/32
BIRD 2.13 ready.
Table IP4:
109.68.40.15/32      unicast [RS0 12:31:26.621 from 193.25.180.255] * (100) [AS25372i]
        via 193.25.180.17 on bge1



Thus in my opinion, when no tables specified, it's reasonable to select not just default
tables but all tables with routes. Such behavior should be closer to other vendors, at 
least JunOS. Attached patch changes default table selection.

Have a nice day!

-- 
Alexander Shikov
Technical Staff, Digital Telecom IX
http://dtel-ix.net/
-------------- next part --------------
diff -u --recursive nest.o/rt-show.c nest/rt-show.c
--- nest.o/rt-show.c	2023-06-14 12:28:18.309345000 +0300
+++ nest/rt-show.c	2023-06-14 12:29:20.227958000 +0300
@@ -362,6 +362,7 @@
 {
   struct channel *c;
   struct rt_show_data_rtable *tab;
+  struct rtable_config *t;
 
   if (d->export_channel)
   {
@@ -391,9 +392,9 @@
     return;
   }
 
-  for (int i=1; i<NET_MAX; i++)
-    if (config->def_tables[i] && config->def_tables[i]->table)
-      rt_show_add_table(d, config->def_tables[i]->table);
+  WALK_LIST(t, config->tables)
+    if (t->table->rt_count > 0)
+      rt_show_add_table(d, t->table);
 }
 
 static inline void


More information about the Bird-users mailing list