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]>
  • Loading branch information
pguibert6WIND committed Nov 10, 2022
1 parent ac8aa2f commit e5309c1
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 @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit e5309c1

Please sign in to comment.