Skip to content

Commit

Permalink
ospfd: prevent from crashing when processing external lsa
Browse files Browse the repository at this point in the history
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 <[email protected]>
(cherry picked from commit e5309c1)
  • Loading branch information
pguibert6WIND authored and mergify[bot] committed Nov 10, 2022
1 parent b87dfd9 commit 24da77c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ospfd/ospf_lsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 24da77c

Please sign in to comment.