On Mon, Nov 05, 2018 at 08:47:36AM +0700, Clemens Schrimpe wrote:
> Hello -
> 
> just wanted to report a little (easily reproducable) problem: I’m 
> experimenting with BIRD 2.0.2 on a lab-router (Ubiquiti Edgerouter, MIPS 
> platform) and RPKI. 
> 
> In my attempts to examine ROA tables more closely I entered „show route table 
> r4 all“ into birdc and bird immediately segfaulted and died.

Hello

Does it crash without 'all'? Works for me:

bird> show route table rtab4
Table rtab4:
212.1.128.0/19-19 AS9105  [rpki1 13:28:00.854] * (150)
213.129.152.0/21-21 AS47834  [rpki1 13:28:00.851] * (150)
202.3.160.0/20-24 AS17408  [rpki1 13:28:00.786] * (150)
88.132.72.0/21-21 AS35311  [rpki1 13:28:00.841] * (150)
157.100.182.0/24-24 AS27947  [rpki1 13:28:00.839] * (150)
...

Attached patch should fix the crash.


> Is there any „official“ way to examine the contents of ROA tables other than 
> „eval roa_check(r4, 186.255.72.0/24, 204777)“?

Currently ROA has to be specified as a whole, including maxlen and ASN,
not just its prefix. Confusingly, it uses slightly different syntax
to enter ROAs and to print ROAs:

bird> show route 212.1.128.0/19 max 19 as 9105 table rtab4
Table rtab4:
212.1.128.0/19-19 AS9105  [rpki1 13:28:00.854] * (150)

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santi...@crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
diff --git a/nest/route.h b/nest/route.h
index 2ec1dc7f..e19e11ca 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -421,6 +421,7 @@ typedef struct rta {
 #define RTS_PIPE 12			/* Inter-table wormhole */
 #define RTS_BABEL 13			/* Babel route */
 #define RTS_RPKI 14			/* Route Origin Authorization */
+#define RTS_MAX 15
 
 
 #define RTC_UNICAST 0
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index 73ca4748..7a91a4f6 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -58,6 +58,24 @@
 
 #include <stddef.h>
 
+const char * const rta_src_names[RTS_MAX] = {
+  [RTS_DUMMY]		= "",
+  [RTS_STATIC]		= "static",
+  [RTS_INHERIT]		= "inherit",
+  [RTS_DEVICE]		= "device",
+  [RTS_STATIC_DEVICE]	= "static-device",
+  [RTS_REDIRECT]	= "redirect",
+  [RTS_RIP]		= "RIP",
+  [RTS_OSPF]		= "OSPF",
+  [RTS_OSPF_IA]		= "OSPF-IA",
+  [RTS_OSPF_EXT1]	= "OSPF-E1",
+  [RTS_OSPF_EXT2]	= "OSPF-E2",
+  [RTS_BGP]		= "BGP",
+  [RTS_PIPE]		= "pipe",
+  [RTS_BABEL]		= "Babel",
+  [RTS_RPKI]		= "RPKI",
+};
+
 const char * rta_dest_names[RTD_MAX] = {
   [RTD_NONE]		= "",
   [RTD_UNICAST]		= "unicast",
@@ -1262,10 +1280,7 @@ rta_dump_all(void)
 void
 rta_show(struct cli *c, rta *a)
 {
-  static char *src_names[] = { "dummy", "static", "inherit", "device", "static-device", "redirect",
-			       "RIP", "OSPF", "OSPF-IA", "OSPF-E1", "OSPF-E2", "BGP", "pipe" };
-
-  cli_printf(c, -1008, "\tType: %s %s", src_names[a->source], ip_scope_text(a->scope));
+  cli_printf(c, -1008, "\tType: %s %s", rta_src_names[a->source], ip_scope_text(a->scope));
 
   for(ea_list *eal = a->eattrs; eal; eal=eal->next)
     for(int i=0; i<eal->count; i++)

Reply via email to