]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: fix prefix list trie corruption 963/head
authorDavid Lamparter <equinox@opensourcerouting.org>
Fri, 11 Aug 2017 16:54:26 +0000 (18:54 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 11 Aug 2017 17:02:22 +0000 (19:02 +0200)
The specific code here needs to establish an absolute order of more
specific to less specific possible matches in a prefix list.  This is
indirectly checked by an assert on insertion, because the "next best"
entry is required to be consistent even when joining multiple chains
of candidates.

Unfortunately, trie_install_fn() would insert entries too far ahead in
the chain if another entry with higher sequence number was seen.  This
breaks the trie and (rightfully) triggers the assertion failure on
insert.

Fixes: #937
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/plist.c

index d7a0db6807664a692c4362d18003c4720c69678b..b0cf42ca49980c38c58aa2103953707d863d8910 100644 (file)
@@ -538,7 +538,8 @@ static void trie_install_fn(struct prefix_list_entry *object,
                        return;
                if ((*updptr)->prefix.prefixlen < object->prefix.prefixlen)
                        break;
-               if ((*updptr)->seq > object->seq)
+               if ((*updptr)->prefix.prefixlen == object->prefix.prefixlen
+                   && (*updptr)->seq > object->seq)
                        break;
                updptr = &(*updptr)->next_best;
        }