On Thu, Aug 29, 2019 at 08:08:23PM +0200, aldem-bird.201...@nk7.net wrote:
> Hi,
> 
> Attempt to show ospf's lsadb using birdc produces segfault, with or without
> ospf routes:
> 
> 2019-08-29 20:04:39.203 <TRACE> device1: Initializing
> 2019-08-29 20:04:39.203 <TRACE> ospf1: Channel ipv4 connected to table
> master4
> 2019-08-29 20:04:39.203 <TRACE> ospf1: Initializing
> 2019-08-29 20:04:39.203 <TRACE> device1: Starting
> 2019-08-29 20:04:39.203 <TRACE> device1: State changed to up
> 2019-08-29 20:04:39.203 <INFO> Chosen router ID 192.168.255.4 according to
> interface failover
> 2019-08-29 20:04:39.203 <TRACE> ospf1: Starting
> 2019-08-29 20:04:39.203 <TRACE> ospf1: State changed to up
> 2019-08-29 20:04:39.203 <INFO> Started
> 
> # birdc
> BIRD 2.0.5 ready.
> bird> show ospf lsadb
> Connection closed by server

Hi

Thanks for the bugreport, patch is attached.

-- 
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."
commit 56d8b1e7f6252158caf0ecd3147376b858b16d97
Author: Ondrej Zajicek (work) <santi...@crfreenet.org>
Date:   Thu Aug 29 20:58:16 2019 +0200

    OSPF: Fix 'show ospf lsadb' cmd without proto arg
    
    It crashed when used without protocol argument.
    
    Thanks to Alexander for the bugreport.

diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y
index 2ec8c0b6..f631a649 100644
--- a/proto/ospf/config.Y
+++ b/proto/ospf/config.Y
@@ -537,7 +537,12 @@ CF_CLI(SHOW OSPF STATE ALL, optproto opttext, [<name>], [[Show information about
 
 CF_CLI_HELP(SHOW OSPF LSADB, ..., [[Show content of OSPF LSA database]]);
 CF_CLI(SHOW OSPF LSADB, lsadb_args, [global | area <id> | link] [type <num>] [lsid <id>] [self | router <id>] [<proto>], [[Show content of OSPF LSA database]])
-{ ospf_sh_lsadb($4); };
+{
+  if (!$4->proto)
+    $4->proto = (struct ospf_proto *) proto_get_named(NULL, &proto_ospf);
+
+  ospf_sh_lsadb($4);
+};
 
 lsadb_args:
    /* empty */ {

Reply via email to