summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2019-07-17 01:50:23 +0200
committerGitHub <noreply@github.com>2019-07-17 01:50:23 +0200
commita04686849fdf2f8bc81049d51c40a45c492b1f7f (patch)
tree3034d3f1abe677981e110851b5b60398464752bc
parentMerge pull request #4669 from opensourcerouting/bfd-isis-northbound (diff)
parentospfd: no router ospf crash fix (diff)
downloadfrr-a04686849fdf2f8bc81049d51c40a45c492b1f7f.tar.xz
frr-a04686849fdf2f8bc81049d51c40a45c492b1f7f.zip
Merge pull request #4685 from chiragshah6/ospf_vrf_dev
ospfd: no router ospf crash fix
-rw-r--r--ospfd/ospf_packet.c8
-rw-r--r--ospfd/ospfd.c17
2 files changed, 17 insertions, 8 deletions
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 6bc8c2515..50c30a6fa 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -660,6 +660,14 @@ static int ospf_write(struct thread *thread)
struct in_pktinfo *pi;
#endif
+ if (ospf->fd < 0 || ospf->oi_running == 0) {
+ if (IS_DEBUG_OSPF_EVENT)
+ zlog_debug(
+ "ospf_write failed to send, fd %d, instance %u"
+ ,ospf->fd, ospf->oi_running);
+ return -1;
+ }
+
ospf->t_write = NULL;
node = listhead(ospf->oi_write_q);
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index aa38a4271..a64ddbc3b 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -656,6 +656,7 @@ static void ospf_finish_final(struct ospf *ospf)
for (ALL_LIST_ELEMENTS(ospf->oiflist, node, nnode, oi))
ospf_if_free(oi);
list_delete(&ospf->oiflist);
+ ospf->oi_running = 0;
/* De-Register VRF */
ospf_zebra_vrf_deregister(ospf);
@@ -699,6 +700,8 @@ static void ospf_finish_final(struct ospf *ospf)
}
/* Cancel all timers. */
+ OSPF_TIMER_OFF(ospf->t_read);
+ OSPF_TIMER_OFF(ospf->t_write);
OSPF_TIMER_OFF(ospf->t_external_lsa);
OSPF_TIMER_OFF(ospf->t_spf_calc);
OSPF_TIMER_OFF(ospf->t_ase_calc);
@@ -708,14 +711,9 @@ static void ospf_finish_final(struct ospf *ospf)
OSPF_TIMER_OFF(ospf->t_asbr_check);
OSPF_TIMER_OFF(ospf->t_distribute_update);
OSPF_TIMER_OFF(ospf->t_lsa_refresher);
- OSPF_TIMER_OFF(ospf->t_read);
- OSPF_TIMER_OFF(ospf->t_write);
OSPF_TIMER_OFF(ospf->t_opaque_lsa_self);
OSPF_TIMER_OFF(ospf->t_sr_update);
- close(ospf->fd);
- stream_free(ospf->ibuf);
-
LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa)
ospf_discard_from_db(ospf, ospf->lsdb, lsa);
LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa)
@@ -755,9 +753,6 @@ static void ospf_finish_final(struct ospf *ospf)
ospf_ase_external_lsas_finish(ospf->external_lsas);
}
- list_delete(&ospf->areas);
- list_delete(&ospf->oi_write_q);
-
for (i = ZEBRA_ROUTE_SYSTEM; i <= ZEBRA_ROUTE_MAX; i++) {
struct list *ext_list;
struct ospf_external *ext;
@@ -789,6 +784,12 @@ static void ospf_finish_final(struct ospf *ospf)
if (!CHECK_FLAG(om->options, OSPF_MASTER_SHUTDOWN))
instance = ospf->instance;
+ list_delete(&ospf->areas);
+ list_delete(&ospf->oi_write_q);
+
+ close(ospf->fd);
+ stream_free(ospf->ibuf);
+ ospf->fd = -1;
ospf_delete(ospf);
if (ospf->name) {