]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: prevent from crashing when processing external lsa
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 7 Nov 2022 10:03:41 +0000 (11:03 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 10 Nov 2022 14:11:53 +0000 (15:11 +0100)
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>
ospfd/ospf_lsa.c

index 4fb3a33568e218bd5d29a9b8ce37360a8fd3a5d5..a67b6c6c19586e352174f3686ea85513878df42b 100644 (file)
@@ -2205,7 +2205,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);
@@ -2214,7 +2214,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);