ospf6d: fix various bugs in installing and flooding LSAs

Signed-off-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com>
Reviewed-by: Scott Feldman <sfeldma at cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 64f929d..db14731 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -636,12 +636,12 @@
   if (CHECK_FLAG (lsa->flag, OSPF6_LSA_HEADERONLY))
     return 0;    /* dbexchange will do something ... */
 
-  /* reflood lsa */
-  ospf6_flood (NULL, lsa);
-
   /* reinstall lsa */
   ospf6_install_lsa (lsa);
 
+  /* reflood lsa */
+  ospf6_flood (NULL, lsa);
+
   /* schedule maxage remover */
   ospf6_maxage_remove (ospf6);
 
@@ -692,9 +692,8 @@
       ospf6_lsa_header_print (new);
     }
 
-  ospf6_flood_clear (old);
-  ospf6_flood (NULL, new);
   ospf6_install_lsa (new);
+  ospf6_flood (NULL, new);
 
   return 0;
 }