summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2022-03-16Lib: Allow use of 240.0.0.0/4 as a private rangeOndrej Zajicek (work)
There were several requests to allow use of 240.0.0.0/4 as a private range, and Linux kernel already allows such routes, so perhaps we can allow that too. Thanks to Vincent Bernat and others for suggestion and patches.
2022-02-07Lib: Update alignment of slabsOndrej Zajicek (work)
Alignment of slabs should be at least sizeof(ptr) to avoid unaligned pointers in slab structures. Fixme: Use proper way to choose alignment for internal allocators.
2022-02-06Merge branch 'oz-trie-table'Ondrej Zajicek (work)
2022-02-06Nest: Attach prefix trie to rtable for faster LPM and interval queriesOndrej Zajicek (work)
Attach a prefix trie to IP/VPN/ROA tables. Use it for net_route() and net_roa_check(). This leads to 3-5x speedups for IPv4 and 5-10x speedup for IPv6 of these calls. TODO: - Rebuild the trie during rt_prune_table() - Better way to avoid trie_add_prefix() in net_get() for existing tables - Make it configurable (?)
2022-01-08IO: Support nonlocal bind in socket interfaceAlexander Zubkov
Add option to socket interface for nonlocal binding, i.e. binding to an IP address that is not present on interfaces. This behaviour is enabled when SKF_FREEBIND socket flag is set. For Linux systems, it is implemented by IP_FREEBIND socket flag. Minor changes done by commiter.
2021-11-27Memory statistics split into Effective and OverheadMaria Matejka
This feature is intended mostly for checking that BIRD's allocation strategies don't consume much memory space. There are some cases where withdrawing routes in a specific order lead to memory fragmentation and this output should give the user at least a notion of how much memory is actually used for data storage and how much memory is "just allocated" or used for overhead. Also raising the "system allocator overhead estimation" from 8 to 16 bytes; it is probably even more. I've found 16 as a local minimum in best scenarios among reachable machines. I couldn't find any reasonable method to estimate this value when BIRD starts up. This commit also fixes the inaccurate computation of memory overhead for slabs where the "system allocater overhead estimation" was improperly added to the size of mmap-ed memory.
2021-11-24Directly mapped pages are kept for future use if temporarily not neededMaria Matejka
2021-11-13Trie: Simplify network matching codeOndrej Zajicek (work)
Introduce ipX_prefix_equal() and use it to simplify network matching code.
2021-09-25Filter: Faster prefix setsOndrej Zajicek (work)
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-06-06Lib: Fix static assert macroOndrej Zajicek (work)
2021-06-06Nest: Allow MAC algorithms to specify min/max key lengthToke Høiland-Jørgensen
Add min/max key length fields to the MAC algorithm description and validate configured keys before they are used.
2021-06-06Nest: Allow specifying security keys as hex bytes as well as stringsToke Høiland-Jørgensen
Add support for specifying a password in hexadecimal format, The result is the same whether a password is specified as a quoted string or a hex-encoded byte string, this just makes it more convenient to input high-entropy byte strings as MAC keys.
2021-06-06Lib: Add tests for blake2s and blake2bToke Høiland-Jørgensen
Import the blake2-kat.h header with test vector output from the blake reference implementation, and add tests to mac_test.c to compare the output of the Bird MAC algorithm implementations with that reference output. Since the reference implementation only has test vectors for the full output size, there are no tests for the smaller-sized output variants.
2021-06-06Lib: Add Blake2s and Blake2b hash functionsToke Høiland-Jørgensen
The Babel MAC authentication RFC recommends implementing Blake2s as one of the supported algorithms. In order to achieve do this, add the blake2b and blake2s hash functions for MAC authentication. The hashing function implementations are the reference implementations from blake2.net. The Blake2 algorithms allow specifying an arbitrary output size, and the Babel MAC spec says to implement Blake2s with 128-bit output. To satisfy this, we add two different variants of each of the algorithms, one using the default size (256 bits for Blake2s, 512 bits for Blake2b), and one using half the default output size. Update to BIRD coding style done by committer.
2021-06-06sysdep: Add wrapper to get random bytes - updateOndrej Zajicek (work)
Simplify the code and fix an issue with getentropy() return value.
2021-06-06sysdep: Add wrapper to get random bytesToke Høiland-Jørgensen
Add a wrapper function in sysdep to get random bytes, and required checks in configure.ac to select how to do it. The configure script tries, in order, getrandom(), getentropy() and reading from /dev/urandom.
2021-05-30Babel: Seqno requests are properly decoupled from neighbors when the ↵Maria Matejka
underlying interface disappears When an interface disappears, all the neighbors are freed as well. Seqno requests were anyway not decoupled from them, leading to strange segfaults. This fix adds a proper seqno request list inside neighbors to make sure that no pointer to neighbor is kept after free.
2021-05-18Flowspec: Documentation updateOndrej Zajicek (work)
2021-05-18Flowspec: Label field should use numeric operator and not bitmask operatorOndrej Zajicek (work)
2021-05-18Flowspec: Do not use comma for bitmask operatorsOndrej Zajicek (work)
For numeric operators, comma is used for disjunction in expressions like "10, 20, 30..40". But for bitmask operators, comma is used for conjunction in a way that does not really make much sense. Use always explicit logical operators (&& and ||) to connect bitmask operators. Thanks to Matt Corallo for the bugreport.
2021-05-17Filter: Add MPLS label route attributeTrisha Biswas
Add support to set or read outgoing MPLS labels using filters. Currently this supports the addition of one label per route for the first next hop. Minor changes by committer.
2021-05-14Flowspec: Fix values for true/false operatorsOndrej Zajicek (work)
RFC 8955 is pretty clear that 000 is false and 111 is true.
2021-05-14Flowspec: Add code for conversion of flowspec parts to interval listsOndrej Zajicek (work)
Implement function flow_explicate_part() to convert flowspec numeric expressions to a simple list of (disjoint, sorted) intervals. That could be used in filters to build f_tree-based int-sets from them.
2021-04-12Lib: Fix handling of buffers in timestamp formattingOndrej Zajicek (work)
The code in tm_format_real_time() mixed up two buffers and their sizes, which may cause crash in MRT dumping code. Thanks to Piotr Wydrych for the bugreport.
2021-03-30Resources: added mb_move() to complement rmove() for memory blocksMaria Matejka
2021-03-25Slab: head now uses bitmask for used/free nodes info instead of listsMaria Matejka
From now, there are no auxiliary pointers stored in the free slab nodes. This led to strange debugging problems if use-after-free happened in slab-allocated structures, especially if the structure's first member is a next pointer. This also reduces the memory needed by 1 pointer per allocated object. OTOH, we now rely on pages being aligned to their size's multiple, which is quite common anyway.
2021-03-12Rate-limit scheduling of work-eventsOndrej Zajicek (work)
In general, events are code handling some some condition, which is scheduled when such condition happened and executed independently from I/O loop. Work-events are a subgroup of events that are scheduled repeatedly until some (often significant) work is done (e.g. feeding routes to protocol). All scheduled events are executed during each I/O loop iteration. Separate work-events from regular events to a separate queue and rate limit their execution to a fixed number per I/O loop iteration. That should prevent excess latency when many work-events are scheduled at one time (e.g. simultaneous reload of many BGP sessions).
2021-02-07Filter: Recursive filter iteration codeOndrej Zajicek (work)
Add macros for recursive filter iteration that allows to examine all instructions reachable from a filter.
2020-11-24lib/slab: introduce sl_allocz() function and use it in BabelToke Høiland-Jørgensen
The babel protocol code was initialising objects returned from the slab allocator by assigning to each of the struct members individually, but wasn't touching the NODE member while doing so. This leads to warnings on debug builds since commit: baac7009063d ("List expensive check.") To fix this, introduce an sl_allocz() variant of the slab allocator which will zero out the memory before returning it, and switch all the babel call sites to use this version. The overhead for doing this should be negligible for small objects, and in the case of babel, the largest object being allocated was being zeroed anyway, so we can drop the memset in babel_read_tlv().
2020-05-01Slab: Init node in slab head to NULLs.Maria Matejka
2020-05-01Timer: Adding missing initializer.Maria Matejka
2020-05-01Lists: Replaced replace_node() by update_node() which is the only use of ↵Maria Matejka
that function.
2020-05-01Lists: fix a stupid sanitizer bugMaria Matejka
2020-05-01Uninitialized list nodes fixesMaria Matejka
2020-05-01List expensive check.Maria Matejka
2020-05-01Expensive check declarationMaria Matejka
Intended to be run at every operation with complex data structures to check their consistency and validity.
2020-05-01IPv6 address parser: fail on incomplete addressesMaria Matejka
2020-05-01Non-null function argument declarationMaria Matejka
2020-04-28More assertion categoriesMaria Matejka
2020-04-28Not calling memcpy with n=0.Maria Matejka
2020-04-09Configuration strings are constant.Maria Matejka
This is merely a const propagation. There was no problem in there.
2020-04-05Fletcher16 test fixed to work at bigendian architectures.Maria Matejka
To be honest, it was wrong in concept, anyway it accidentally worked.
2020-03-03Flowspec: Fix testsOndrej Zajicek (work)
Missing dst no longer generates error.
2020-03-03BGP: Handle flowspec rules without dst partOndrej Zajicek (work)
The RFC 5575 does not explicitly reject flowspec rules without dst part, it just requires dst part in validation procedure for feasibility, which we do not implement anyway. Thus flow without dst prefix is syntactically valid, but unfeasible (if feasibilty testing is done). Thanks to Alex D. for the bugreport.
2020-02-27BGP: Support for MD5SIG together with remote rangeOndrej Zajicek (work)
When dynamic BGP with remote range is configured, MD5SIG needs to use newer socket option (TCP_MD5SIG_EXT) to specify remote addres range for listening socket. Thanks to Adam Kułagowski for the suggestion.
2019-12-09Filter: Add support for src/dst accessors for Flowspec and SADROndrej Zajicek (work)
2019-11-26Nest: Use bitmaps to keep track of exported routesOndrej Zajicek (work)
Use a hierarchical bitmap in a routing table to assign ids to routes, and then use bitmaps (indexed by route id) in channels to keep track whether routes were exported. This avoids unreliable and inefficient re-evaluation of filters for old routes in order to determine whether they were exported.
2019-11-26Lib: Basic and hierarchical bitmapsOndrej Zajicek (work)
Basic bitmap is obvious. Hierarchical bitmap is structure of several bitmaps, where higher levels are conjunctions of intervals on level below, allowing for efficient lookup of first unset bit.
2019-11-18BGP: Fix processing of IPv6 FlowspecOndrej Zajicek (work)
During NLRI parsing of IPv6 Flowspec, dst prefix was not properly extracted from NLRI, therefore a received flow was stored in a different position in flowspec routing table, and was not reachable by command 'show route <flow>'. Add proper prefix part accessors to flowspec code and use them from BGP NLRI parsing code. Thanks to Alex D. for the bugreport.
2019-11-03Support for address family constantsOndrej Zajicek (work)
We already had them defined on BGP level, but they are more general.