Commit graph

29 commits

Author SHA1 Message Date
Ondrej Zajicek (work) 24600c642a Trie: Fix trie format
After switching to 16-way tries, trie format ignored unaligned / internal
prefixes and only reported the primary prefix of a trie node.

Fix trie format by showing internal prefixes based on the 'local' bitmask
of a node. Also do basic (intra-node) reconstruction of prefix patterns
by finding common subtrees in 'local' bitmask.

In future, we could improve that by doing inter-node reconstruction, so
prefixes entered as one pattern for a subtree (e.g. 192.168.0.0/18+)
would be reported as such, like with aligned prefixes.
2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work) ba5aec94cd Trie: Add prefix counter
Add counter of prefixes stored in trie. Works only for 'restricted' tries
composed of explicit prefixes (pxlen == l == h), like ones used in rtables.
2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work) 78ddfd2600 Trie: Clarify handling of less-common net types
For convenience, Trie functions generally accept as input values not only
NET_IPx types of nets, but also NET_VPNx and NET_ROAx types. But returned
values are always NET_IPx types.
2021-12-02 03:35:29 +01:00
Ondrej Zajicek (work) 14fc24f3a5 Trie: Implement longest-prefix-match queries and walks
The prefix trie now supports longest-prefix-match query by function
trie_match_longest_ipX() and it can be extended to iteration over all
covering prefixes for a given prefix (from longest to shortest) using
TRIE_WALK_TO_ROOT_IPx() macro.
2021-11-26 03:26:36 +01:00
Ondrej Zajicek (work) 062e69bf52 Trie: Implement trie walking code
Trie walking allows enumeration of prefixes in a trie in the usual
lexicographic order. Optionally, trie enumeration can be restricted
to a chosen subnet (and its descendants).
2021-11-19 18:04:32 +01:00
Ondrej Zajicek (work) 71c18d9f53 Trie: Simplify network matching code
Introduce ipX_prefix_equal() and use it to simplify network matching code.
2021-11-13 21:11:18 +01:00
Ondrej Zajicek (work) dd61278c9d Filter: Update trie documentation 2021-09-25 16:06:43 +02:00
Ondrej Zajicek (work) 13225f1dbf Filter: Faster prefix sets
Use 16-way (4bit) branching in prefix trie instead of basic binary
branching. The change makes IPv4 prefix sets almost 3x faster, but
with more memory consumption and much more complicated algorithm.

Together with a previous filter change, it makes IPv4 prefix sets
about ~4.3x faster and slightly smaller (on my test data).
2021-09-25 16:06:43 +02:00
Ondrej Zajicek (work) c9d11e6230 Filter: Remove mixed address tests and fix formatting 2020-03-26 04:59:15 +01:00
Ondrej Zajicek (work) 2755002890 Filter: Optimize IPv4 prefix sets
Use separate IPv4 and IPv6 implementation of prefix sets. Just this
change makes IPv4 prefix sets 60% smaller and 50% faster.
2020-03-26 03:57:48 +01:00
Maria Matejka 4f082dfa89 Filter: merged filter instruction constructors, counting line size on instruction construct 2019-02-20 22:30:54 +01:00
Maria Matejka 8bdb05edb2 Filters: split the large filter.h file to smaller files.
This should be revised, there are still ugly things in the filter API.
2019-02-20 22:30:54 +01:00
Maria Matejka 4c553c5a5b Filter refactoring: dropped the recursion from the interpreter
This is a major change of how the filters are interpreted. If everything
works how it should, it should not affect you unless you are hacking the
filters themselves.

Anyway, this change should make a huge improvement in the filter performance
as previous benchmarks showed that our major problem lies in the
recursion itself.

There are also some changes in nest and protocols, related mostly to
spreading const declarations throughout the whole BIRD and also to
refactored dynamic attribute definitions. The need of these came up
during the whole work and it is too difficult to split out these
not-so-related changes.
2019-02-20 22:30:54 +01:00
Ondrej Zajicek (work) 8860e991f6 Merge branch 'master' into int-new 2016-11-08 19:27:58 +01:00
Pavel Tvrdik c2564d34af Tree/Trie: Check the end of buffer
We set buffer->pos to buffer->end in function buffer_print() when
bvsnprintf() failed, so there would be uninitialized memory between
the old buffer->pos and the current buffer->pos.
2016-10-11 21:25:21 +02:00
Ondrej Zajicek (work) a998836d4b Filter: fix missing separator 2016-10-04 23:19:35 +02:00
Pavel Tvrdík de9b87f558 Add NET ROA4/6 structures 2016-01-07 18:21:31 +01:00
Ondrej Zajicek (work) 0bf95f99e6 Follow-up work on integration
Contains some patches from Jan Moskyto Matejka
2015-12-21 17:17:21 +01:00
Jan Moskyto Matejka 5e173e9f63 Stop perusing f_prefix for non-prefix-set uses
Multiple changes by Ondrej Santiago Zajicek
2015-12-19 23:49:47 +01:00
Ondrej Zajicek 51762a45b3 Allows user data attached to f_trie_node structure.
Thanks to Alexander Chernikov for the patch.
2015-02-21 14:05:20 +01:00
Ondrej Zajicek 0aeac9cb7f Merge commit 'origin/bfd' 2013-11-22 02:48:44 +01:00
Ondrej Zajicek 0e175f9f0f Fixes some BFD bugs and makes logging thread-safe. 2013-10-05 20:12:28 +02:00
Ondrej Zajicek 28a10f84cb Some fixes in filter code.
Thanks to Sergey Popovich for original patches.
2013-10-02 14:41:37 +02:00
Ondrej Zajicek 0d1b3c4c0e Changes print-like filter commands to use a log instead of a stderr.
And extends the log subsystem to better handle that.
2010-09-20 13:01:01 +02:00
Ondrej Zajicek c477f48916 Hostcache should use trie to filter relevant route changes. 2010-07-27 18:20:12 +02:00
Ondrej Zajicek 7f0d245a5e Minor changes in prefix trie. 2010-07-27 17:17:11 +02:00
Ondrej Zajicek 05198c12f4 Some cleanups. 2009-08-27 19:01:04 +02:00
Ondrej Zajicek c60cdd8c39 Cleanup changes 2009-03-31 21:17:00 +02:00
Ondrej Zajicek b1a597e0c3 Reimplementation of prefix sets.
Prefix sets were broken beyond any repair and have to be reimplemented.
They are reimplemented using a trie with bitmasks in nodes.
There is also change in the interpretation of minus prefix pattern,
but the old interpretation was already inconsistent with
the documentation and broken.

There is also some bugfixes in filter code related to set variables.
2009-03-31 12:55:57 +02:00