summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-08-11 18:54:26 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2017-08-11 19:02:08 +0200
commit6ac011aaadbf6ef1a3b64b6a2518da11ea62a2ab (patch)
tree4ce0da59b1b5dfee77062fd5facd62ca2d5b03c4
parentc47b10cae1e0a623589692d6bd8793c2a17ed29a (diff)
lib: fix prefix list trie corruption
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>
-rw-r--r--lib/plist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/plist.c b/lib/plist.c
index 2af13244ff..56684e8251 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -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;
}