diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-11-05 13:56:59 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-11-05 13:56:59 +0100 |
commit | 69b2f63d9a477ab5d083773e16ca15ed2e570144 (patch) | |
tree | c8a23de08a1cf6e7619d7c56d909d9f86270dcf4 /nest/rt-attr.c | |
parent | e19d08055a4614f03e51ee72617be10946ce7919 (diff) |
Nest: Fix crash in rta_show() for RPKI and Babel routes
Some new route source values did not have associated string
in rta_show(), which might caused crash in some cases.
Diffstat (limited to 'nest/rt-attr.c')
-rw-r--r-- | nest/rt-attr.c | 23 |
1 files changed, 19 insertions, 4 deletions
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++) |