diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 817e5372ead1..91455b19f46a 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -2356,7 +2356,22 @@ static void ospf6_send_lsupdate(struct ospf6_neighbor *on, } if (oi) { ospf6_packet_add(oi, op); - OSPF6_MESSAGE_WRITE_ON(oi); + /* If ospf instance is being deleted, send the packet + * immediately + */ + if ((oi->area == NULL) || (oi->area->ospf6 == NULL)) + return; + if (oi->area->ospf6->inst_shutdown) { + struct thread os_packet_thd; + + os_packet_thd.arg = (void *)oi->area->ospf6; + if (oi->on_write_q == 0) { + listnode_add(oi->area->ospf6->oi_write_q, oi); + oi->on_write_q = 1; + } + ospf6_write(&os_packet_thd); + } else + OSPF6_MESSAGE_WRITE_ON(oi); } }