]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: prevent from crashing when processing external lsa 12304/head
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 7 Nov 2022 10:03:41 +0000 (11:03 +0100)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Thu, 10 Nov 2022 19:21:36 +0000 (19:21 +0000)
When using debug mode, the ei parameter may be NULL. In that
case, do not display the log trace, otherwise a crash will
happen.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit e5309c1a6e366f5dc95cbc3bbbe5c7ce1d46625c)

ospfd/ospf_lsa.c

index 14ab416c295660fdbc9e652eec22f87a78334882..52b36a449ae280457177b218ff88b3a1770e6d65 100644 (file)
@@ -2203,7 +2203,7 @@ struct ospf_lsa *ospf_external_lsa_originate(struct ospf *ospf,
           */
 
        if (ospf->router_id.s_addr == INADDR_ANY) {
-               if (IS_DEBUG_OSPF_EVENT)
+               if (ei && IS_DEBUG_OSPF_EVENT)
                        zlog_debug(
                                "LSA[Type5:%pI4]: deferring AS-external-LSA origination, router ID is zero",
                                &ei->p.prefix);
@@ -2212,7 +2212,7 @@ struct ospf_lsa *ospf_external_lsa_originate(struct ospf *ospf,
 
        /* Create new AS-external-LSA instance. */
        if ((new = ospf_external_lsa_new(ospf, ei, NULL)) == NULL) {
-               if (IS_DEBUG_OSPF_EVENT)
+               if (ei && IS_DEBUG_OSPF_EVENT)
                        zlog_debug(
                                "LSA[Type5:%pI4]: Could not originate AS-external-LSA",
                                &ei->p.prefix);