haproxy/include/import
Willy Tarreau 81f3b80e32 MINOR: ebtree: add ebmb_lookup_shorter() to pursue lookups
This function is designed to enlarge the scope of a lookup performed
by a caller via ebmb_lookup_longest() that was not satisfied with the
result. It will first visit next duplicates, and if none are found,
it will go up in the tree to visit similar keys with shorter prefixes
and will return them if they match. We only use the starting point's
value to perform the comparison since it was expected to be valid for
the looked up key, hence it has all bits in common with its own length.

The algorithm is a bit complex because when going up we may visit nodes
that are located beneath the level we just come from. However it is
guaranteed that keys having a shorter prefix will be present above the
current location, though they may be attached to the left branch of a
cover node, so we just visit all nodes as long as their prefix is too
large, possibly go down along the left branch on cover nodes, and stop
when either there's a match, or there's a non-matching prefix anymore.

The following tricky case now works fine and properly finds 10.0.0.0/7
when looking up 11.0.0.1 from tree version 1 though both belong to
different sub-trees:

  prepare map #1
    add map @1 #1 10.0.0.0/7 10.0.0.0/7
    add map @1 #1 10.0.0.0/7 10.0.0.0/7
  commit map @1 #1
  prepare map #1
    add map @2 #1 11.0.0.0/8 11.0.0.0/8
    add map @2 #1 11.0.0.0/8 11.0.0.0/8

  prepare map #1
    add map @1 #1 10.0.0.0/7 10.0.0.0/7
  commit map @1 #1
  prepare map #1
    add map @2 #1 10.0.0.0/7 10.0.0.0/7
    add map @2 #1 11.0.0.0/8 11.0.0.0/8
    add map @2 #1 11.0.0.0/8 11.0.0.0/8
2022-08-01 11:59:46 +02:00
..
atomic-ops.h
eb32sctree.h REORG: ebtree: split structures into their own file ebtree-t.h 2021-10-07 01:41:14 +02:00
eb32tree.h REORG: ebtree: split structures into their own file ebtree-t.h 2021-10-07 01:41:14 +02:00
eb64tree.h REORG: ebtree: split structures into their own file ebtree-t.h 2021-10-07 01:41:14 +02:00
ebimtree.h
ebistree.h
ebmbtree.h MINOR: ebtree: add ebmb_lookup_shorter() to pursue lookups 2022-08-01 11:59:46 +02:00
ebpttree.h REORG: ebtree: split structures into their own file ebtree-t.h 2021-10-07 01:41:14 +02:00
ebsttree.h
ebtree-t.h REORG: ebtree: split structures into their own file ebtree-t.h 2021-10-07 01:41:14 +02:00
ebtree.h REORG: ebtree: split structures into their own file ebtree-t.h 2021-10-07 01:41:14 +02:00
ist.h CLEANUP: tree-wide: remove a few rare non-ASCII chars 2022-03-04 08:58:32 +01:00
lru.h
mjson.h
plock.h MAJOR: threads/plock: update the embedded library 2022-07-30 10:15:44 +02:00
sha1.h
slz-tables.h IMPORT: slz: do not produce the crc32_fast table when CRC is natively supported 2021-05-12 09:29:33 +02:00
slz.h IMPORT: slz: use inttypes.h instead of stdint.h 2021-05-14 08:44:52 +02:00
xxhash.h CLEANUP: Add haproxy/xxhash.h to avoid modifying import/xxhash.h 2021-09-11 19:58:45 +02:00