Hi,

The new intra area db entry has to be saved into the tree before
orig_intra_area_prefix_lsas() is called.  If not, the ospf6d will not
announce the new intra area db for a newly learned link from another
ospf router of the broadcast domain.

This bug is triggered, if you add new addresses an ospf interface while
the ospf6d is already running as a backup designated router.  The
opposite designated ospf6d will get your new link announcement and
return an old intra area db without the new address.

Beside of the fix, the diff removes redundant code.  I made the same
diff for the ospfd to keep code in sync and remove redundant code there,
too.  ospfd does not have the bug explained above, as far as I know.

Both regression tests passes with this diff.

OK?

Bye,
Jan

Index: ospf6d/rde_lsdb.c
===================================================================
RCS file: /cvs//src/usr.sbin/ospf6d/rde_lsdb.c,v
retrieving revision 1.45
diff -u -p -r1.45 rde_lsdb.c
--- ospf6d/rde_lsdb.c   21 Aug 2020 10:17:35 -0000      1.45
+++ ospf6d/rde_lsdb.c   1 Oct 2020 23:09:38 -0000
@@ -467,6 +467,7 @@ lsa_add(struct rde_nbr *nbr, struct lsa 
        struct lsa_tree *tree;
        struct vertex   *new, *old;
        struct timeval   tv, now, res;
+       int update = 1;
 
        if (LSA_IS_SCOPE_AS(ntohs(lsa->hdr.type)))
                tree = &asext_tree;
@@ -495,16 +496,13 @@ lsa_add(struct rde_nbr *nbr, struct lsa 
                                fatal("lsa_add");
                        return (1);
                }
-               if (!lsa_equal(new->lsa, old->lsa)) {
-                       if (ntohs(lsa->hdr.type) == LSA_TYPE_LINK)
-                               orig_intra_area_prefix_lsas(nbr->area);
-                       if (ntohs(lsa->hdr.type) != LSA_TYPE_EXTERNAL)
-                               nbr->area->dirty = 1;
-                       start_spf_timer();
-               }
+               if (lsa_equal(new->lsa, old->lsa))
+                       update = 0;
                vertex_free(old);
                RB_INSERT(lsa_tree, tree, new);
-       } else {
+       }
+
+       if (update) {
                if (ntohs(lsa->hdr.type) == LSA_TYPE_LINK)
                        orig_intra_area_prefix_lsas(nbr->area);
                if (ntohs(lsa->hdr.type) != LSA_TYPE_EXTERNAL)
Index: ospfd/rde_lsdb.c
===================================================================
RCS file: /cvs//src/usr.sbin/ospfd/rde_lsdb.c,v
retrieving revision 1.50
diff -u -p -r1.50 rde_lsdb.c
--- ospfd/rde_lsdb.c    22 Nov 2015 13:09:10 -0000      1.50
+++ ospfd/rde_lsdb.c    1 Oct 2020 23:06:57 -0000
@@ -383,6 +383,7 @@ lsa_add(struct rde_nbr *nbr, struct lsa 
        struct lsa_tree *tree;
        struct vertex   *new, *old;
        struct timeval   tv, now, res;
+       int update = 1;
 
        if (lsa->hdr.type == LSA_TYPE_EXTERNAL ||
            lsa->hdr.type == LSA_TYPE_AS_OPAQ)
@@ -410,15 +411,13 @@ lsa_add(struct rde_nbr *nbr, struct lsa 
                                fatal("lsa_add");
                        return (1);
                }
-               if (!lsa_equal(new->lsa, old->lsa)) {
-                       if (lsa->hdr.type != LSA_TYPE_EXTERNAL &&
-                           lsa->hdr.type != LSA_TYPE_AS_OPAQ)
-                               nbr->area->dirty = 1;
-                       start_spf_timer();
-               }
+               if (lsa_equal(new->lsa, old->lsa))
+                       update = 0;
                vertex_free(old);
                RB_INSERT(lsa_tree, tree, new);
-       } else {
+       }
+
+       if (update) {
                if (lsa->hdr.type != LSA_TYPE_EXTERNAL &&
                    lsa->hdr.type != LSA_TYPE_AS_OPAQ)
                        nbr->area->dirty = 1;

Reply via email to