]> git.ipfire.org Git - thirdparty/bird.git/log
thirdparty/bird.git
3 years agoGDB pretty printer for resource pools
Maria Matejka [Tue, 23 Nov 2021 18:04:16 +0000 (18:04 +0000)] 
GDB pretty printer for resource pools

3 years agoFixed pipe reload/refeed
Maria Matejka [Tue, 23 Nov 2021 12:06:27 +0000 (12:06 +0000)] 
Fixed pipe reload/refeed

3 years agoStored pages release routine
Maria Matejka [Tue, 23 Nov 2021 11:13:11 +0000 (11:13 +0000)] 
Stored pages release routine

3 years agoFixed channel export map confusion
Maria Matejka [Tue, 23 Nov 2021 11:12:32 +0000 (11:12 +0000)] 
Fixed channel export map confusion

3 years agoBGP: End route refresh before another starts
Maria Matejka [Sun, 21 Nov 2021 11:06:19 +0000 (12:06 +0100)] 
BGP: End route refresh before another starts

3 years agoRPKI has its own loop
Maria Matejka [Wed, 17 Nov 2021 20:34:54 +0000 (21:34 +0100)] 
RPKI has its own loop

3 years agoRPKI: Use the route refresh mechanism also for the first load
Maria Matejka [Tue, 16 Nov 2021 21:14:24 +0000 (21:14 +0000)] 
RPKI: Use the route refresh mechanism also for the first load

3 years agoMore information on RPKI errors
Maria Matejka [Tue, 16 Nov 2021 21:13:32 +0000 (21:13 +0000)] 
More information on RPKI errors

3 years agoHigher settle times when route refresh in the source table is running
Maria Matejka [Tue, 16 Nov 2021 11:23:24 +0000 (12:23 +0100)] 
Higher settle times when route refresh in the source table is running

3 years agoCorking also feed start to keep BIRD running when refeeds would easily cause congestion
Maria Matejka [Mon, 15 Nov 2021 21:48:24 +0000 (22:48 +0100)] 
Corking also feed start to keep BIRD running when refeeds would easily cause congestion

3 years agoRoute attribute cache is now lockless on read / clone.
Maria Matejka [Sat, 13 Nov 2021 21:13:51 +0000 (22:13 +0100)] 
Route attribute cache is now lockless on read / clone.

Lots of time was spent locking when accessing route attribute cache.
This overhead should be now reduced to a minimum.

3 years agoRoute sources have their separate global lock
Maria Matejka [Sat, 13 Nov 2021 16:52:34 +0000 (17:52 +0100)] 
Route sources have their separate global lock

3 years agoIntroducing basic RCU primitives for lock-less shared data structures
Maria Matejka [Fri, 12 Nov 2021 21:58:40 +0000 (22:58 +0100)] 
Introducing basic RCU primitives for lock-less shared data structures

3 years agoVRF setting reduced to one argument, using default dummy iface for default vrf
Maria Matejka [Mon, 15 Nov 2021 09:53:58 +0000 (10:53 +0100)] 
VRF setting reduced to one argument, using default dummy iface for default vrf

3 years agoRoute table import-to-export announcement indirection to reduce pipe traffic
Maria Matejka [Fri, 12 Nov 2021 15:53:33 +0000 (15:53 +0000)] 
Route table import-to-export announcement indirection to reduce pipe traffic

3 years agoKeeping un-unmmappable pages until they can be reused
Maria Matejka [Thu, 11 Nov 2021 15:25:59 +0000 (16:25 +0100)] 
Keeping un-unmmappable pages until they can be reused

On Linux, munmap() may fail with ENOMEM when virtual memory is too
fragmented. Working this around by just keeping such blocks for future
use.

3 years agoPipe runs in parallel.
Maria Matejka [Mon, 18 Oct 2021 19:22:58 +0000 (21:22 +0200)] 
Pipe runs in parallel.

3 years agoRouting tables now have their own loops.
Maria Matejka [Wed, 29 Sep 2021 14:15:13 +0000 (16:15 +0200)] 
Routing tables now have their own loops.

This basically means that:
* there are some more levels of indirection and asynchronicity, mostly
  in cleanup procedures, requiring correct lock ordering
* all the internal table operations (prune, next hop update) are done
  without blocking the other parts of BIRD
* the protocols may get their own loops very soon

3 years agoRoute subscription uses events
Maria Matejka [Wed, 27 Oct 2021 12:42:05 +0000 (12:42 +0000)] 
Route subscription uses events

3 years agoGlobal table update pool removed
Maria Matejka [Wed, 29 Sep 2021 15:59:50 +0000 (17:59 +0200)] 
Global table update pool removed

3 years agoLocking route attributes cache
Maria Matejka [Mon, 27 Sep 2021 15:44:19 +0000 (17:44 +0200)] 
Locking route attributes cache

To access route attribute cache from multiple threads at once, we have
to lock the cache on writing. The route attributes data structures are
safe to read unless somebody tries to tamper with the cache itself.

3 years agoRoute sources have an explicit owner
Maria Matejka [Mon, 27 Sep 2021 14:40:28 +0000 (16:40 +0200)] 
Route sources have an explicit owner

This commit prevents use-after-free of routes belonging to protocols
which have been already destroyed, delaying also all the protocols'
shutdown until all of their routes have been finally propagated through
all the pipes down to the appropriate exports.

The use-after-free was somehow hypothetic yet theoretically possible in
rare conditions, when one BGP protocol authors a lot of routes and the
user deletes that protocol by reconfiguring in the same time as next hop
update is requested, causing rte_better() to be called on a
not-yet-pruned network prefix while the owner protocol has been already
freed.

In parallel execution environments, this would happen an inter-thread
use-after-free, causing possible heisenbugs or other nasty problems.

3 years agoTable cork: Stop creating updates when there are too many pending.
Maria Matejka [Mon, 27 Sep 2021 12:08:03 +0000 (14:08 +0200)] 
Table cork: Stop creating updates when there are too many pending.

The corked procedure gets a callback when uncorked. Supported by table
maintenance routines and also BGP.

3 years agoSplit route table event into separate events
Maria Matejka [Fri, 22 Oct 2021 19:03:25 +0000 (21:03 +0200)] 
Split route table event into separate events

The former rt_event is dropped in favour of separate table events.
This allows for selective corking of NHU and prune.

3 years agoAdding a generic cork mechanism for events
Maria Matejka [Wed, 20 Oct 2021 21:08:58 +0000 (23:08 +0200)] 
Adding a generic cork mechanism for events

3 years agoConverting the former BFD loop to a universal IO loop and protocol loop.
Maria Matejka [Sat, 19 Jun 2021 18:50:18 +0000 (20:50 +0200)] 
Converting the former BFD loop to a universal IO loop and protocol loop.

There is a simple universal IO loop, taking care of events, timers and
sockets. Primarily, one instance of a protocol should use exactly one IO
loop to do all its work, as is now done in BFD.

Contrary to previous versions, the loop is now launched and cleaned by
the nest/proto.c code, allowing for a protocol to just request its own
loop by setting the loop's lock order in config higher than the_bird.

It is not supported nor checked if any protocol changed the requested
lock order in reconfigure. No protocol should do it at all.

3 years agoMoved BFD IO loop out of BFD as we want to use it as socket-io coroutine
Maria Matejka [Fri, 18 Jun 2021 16:23:41 +0000 (18:23 +0200)] 
Moved BFD IO loop out of BFD as we want to use it as socket-io coroutine

3 years agoUnified time for whole BIRD
Maria Matejka [Wed, 4 Aug 2021 20:48:51 +0000 (22:48 +0200)] 
Unified time for whole BIRD

In previous versions, every thread used its own time structures,
effectively leading to different time in every thread and strange
logging messages.

The time processing code now uses global atomic variables to keep
current time available for fast concurrent reading and safe updates.

3 years agoDebug messages with timestamps.
Maria Matejka [Mon, 28 Jun 2021 13:43:45 +0000 (15:43 +0200)] 
Debug messages with timestamps.

On most of current hardware, getting monotonic clock is fast enough to
get it and write for each debug message.

3 years agoLock position checking allows for safe lock unions
Maria Matejka [Mon, 24 May 2021 11:41:23 +0000 (13:41 +0200)] 
Lock position checking allows for safe lock unions

3 years agoCoroutines: A simple and lightweight parallel execution framework.
Maria Matejka [Mon, 8 Feb 2021 08:51:59 +0000 (09:51 +0100)] 
Coroutines: A simple and lightweight parallel execution framework.

3 years agoLocking subsystem: Just a global BIRD lock to begin with.
Maria Matejka [Thu, 4 Feb 2021 14:52:42 +0000 (15:52 +0100)] 
Locking subsystem: Just a global BIRD lock to begin with.

3 years agoDropping the POSIX thread-local variables in favor of much easier-to-use C11 thread...
Maria Matejka [Fri, 18 Jun 2021 16:10:42 +0000 (18:10 +0200)] 
Dropping the POSIX thread-local variables in favor of much easier-to-use C11 thread-local variables

3 years agoPOSIX threads and thread-local storage is needed for concurrent execution
Maria Matejka [Thu, 4 Feb 2021 14:08:52 +0000 (15:08 +0100)] 
POSIX threads and thread-local storage is needed for concurrent execution

3 years agoMultithreaded BIRD needs reasonably new software to compile
Maria Matejka [Mon, 15 Feb 2021 17:23:15 +0000 (18:23 +0100)] 
Multithreaded BIRD needs reasonably new software to compile

3 years agoFixing expensive list checks. Debug only commit.
Maria Matejka [Mon, 9 Aug 2021 09:51:19 +0000 (11:51 +0200)] 
Fixing expensive list checks. Debug only commit.

3 years agoGDB: SKIP_BACK and linked list tools
Maria Matejka [Wed, 13 Oct 2021 12:50:02 +0000 (14:50 +0200)] 
GDB: SKIP_BACK and linked list tools

3 years agoType checking in SKIP_BACK macro
Maria Matejka [Wed, 13 Oct 2021 09:33:48 +0000 (11:33 +0200)] 
Type checking in SKIP_BACK macro

3 years agoRoute export is now asynchronous.
Maria Matejka [Mon, 27 Sep 2021 11:04:16 +0000 (13:04 +0200)] 
Route export is now asynchronous.

To allow for multithreaded execution, we need to break the import-export
chain and buffer the exports before actually processing them.

3 years agoBetter profylaction recursive route loops
Maria Matejka [Fri, 22 Oct 2021 17:43:55 +0000 (19:43 +0200)] 
Better profylaction recursive route loops

In some specific configurations, it was possible to send BIRD into an
infinite loop of recursive next hop resolution. This was caused by route
priority inversion.

To prevent priority inversions affecting other next hops, we simply
refuse to resolve any next hop if the best route for the matching prefix
is recursive or any other route with the same preference is recursive.

Next hop resolution doesn't change route priority, therefore it is
perfectly OK to resolve BGP next hops e.g. by an OSPF route, yet if the
same (or covering) prefix is also announced by iBGP, by retraction of
the OSPF route we would get a possible priority inversion.

3 years agoSpecial table hooks rectified.
Maria Matejka [Wed, 6 Oct 2021 13:10:33 +0000 (15:10 +0200)] 
Special table hooks rectified.

* internal tables are now more standalone, having their own import and
  export hooks
* route refresh/reload uses stale counter instead of stale flag,
  allowing to drop walking the table at the beginning
* route modify (by BGP LLGR) is now done by a special refeed hook,
  reimporting the modified routes directly without filters

3 years agoTable import and export are now explicit hooks.
Maria Matejka [Mon, 21 Jun 2021 15:07:31 +0000 (17:07 +0200)] 
Table import and export are now explicit hooks.

Channels have now included rt_import_req and rt_export_req to hook into
the table instead of just one list node. This will (in future) allow for:

* channel import and export bound to different tables
* more efficient pipe code (dropping most of the channel code)
* conversion of 'show route' to a special kind of export
* temporary static routes from CLI

The import / export states are also updated to the new algorithms.

3 years agoLimit containment
Maria Matejka [Sat, 6 Nov 2021 19:34:16 +0000 (20:34 +0100)] 
Limit containment

3 years agoRPKI: Do nothing when protocol is stopping
Maria Matejka [Sat, 30 Oct 2021 15:50:16 +0000 (15:50 +0000)] 
RPKI: Do nothing when protocol is stopping

3 years agoRPKI shouldn't process more packets when being stopped
Maria Matejka [Sat, 30 Oct 2021 14:56:55 +0000 (14:56 +0000)] 
RPKI shouldn't process more packets when being stopped

3 years agoKernel routes are flushed on shutdown by kernel scan, not by table scan
Maria Matejka [Fri, 1 Oct 2021 12:11:13 +0000 (14:11 +0200)] 
Kernel routes are flushed on shutdown by kernel scan, not by table scan

3 years agoSecondary and merged exports get a whole feed instead of traversing the table structu...
Maria Matejka [Thu, 30 Sep 2021 11:50:54 +0000 (13:50 +0200)] 
Secondary and merged exports get a whole feed instead of traversing the table structures directly

3 years agoRoute export: rejected by filter bitmap
Maria Matejka [Mon, 9 Mar 2020 14:31:10 +0000 (15:31 +0100)] 
Route export: rejected by filter bitmap

If a route has been rejected by filter, store that information
to avoid repeated export filter runs on rejected routes.

3 years agoProtocol stats split to import and export
Maria Matejka [Mon, 21 Jun 2021 17:11:42 +0000 (19:11 +0200)] 
Protocol stats split to import and export

3 years agoNest: Route generations and explicit tracking route propagion through pipes
Maria Matejka [Fri, 1 May 2020 20:26:24 +0000 (22:26 +0200)] 
Nest: Route generations and explicit tracking route propagion through pipes

3 years agoRefeed is done from export table when appropriate
Maria Matejka [Fri, 14 May 2021 14:23:18 +0000 (16:23 +0200)] 
Refeed is done from export table when appropriate

3 years agoRecursive route nexthop updates now announced with valid new_best/old_best information
Maria Matejka [Thu, 25 Feb 2021 20:52:49 +0000 (21:52 +0100)] 
Recursive route nexthop updates now announced with valid new_best/old_best information

3 years agoSuppressed MRT unused static function warning
Maria Matejka [Thu, 30 Sep 2021 09:54:11 +0000 (11:54 +0200)] 
Suppressed MRT unused static function warning

3 years agoSplit route data structure to storage (ro) / manipulation (rw) structures.
Maria Matejka [Tue, 28 Jan 2020 10:42:46 +0000 (11:42 +0100)] 
Split route data structure to storage (ro) / manipulation (rw) structures.

Routes are now allocated only when they are just to be inserted to the
table. Updating a route needs a locally allocated route structure.
Ownership of the attributes is also now not transfered from protocols to
tables and vice versa but just borrowed which should be easier to handle
in a multithreaded environment.

3 years agoExtended route trace: logging Path Identifiers
Maria Matejka [Tue, 9 Nov 2021 16:42:36 +0000 (17:42 +0100)] 
Extended route trace: logging Path Identifiers

3 years agoDropping the unused rte_same hook
Maria Matejka [Tue, 14 Sep 2021 09:20:16 +0000 (11:20 +0200)] 
Dropping the unused rte_same hook

3 years agoDropping rte-local dumper entries
Maria Matejka [Mon, 17 Feb 2020 11:42:14 +0000 (12:42 +0100)] 
Dropping rte-local dumper entries

3 years agoRIP fixup + dropping the tmp_attrs mechanism as obsolete
Maria Matejka [Thu, 16 Sep 2021 09:00:19 +0000 (11:00 +0200)] 
RIP fixup + dropping the tmp_attrs mechanism as obsolete

3 years agoBGP: Moved the suppressed and stale flags to pflags
Maria Matejka [Mon, 10 Feb 2020 14:01:36 +0000 (15:01 +0100)] 
BGP: Moved the suppressed and stale flags to pflags

3 years agoKernel: Convert the rte-local attributes to extended attributes and flags to pflags
Maria Matejka [Thu, 13 Feb 2020 15:59:53 +0000 (16:59 +0100)] 
Kernel: Convert the rte-local attributes to extended attributes and flags to pflags

3 years agoDropping the RTS_DUMMY temporary route storage.
Maria Matejka [Mon, 17 Feb 2020 10:18:32 +0000 (11:18 +0100)] 
Dropping the RTS_DUMMY temporary route storage.

Kernel route sync is done by other ways now and this code is not used
currently.

3 years agoBabel: Convert the rte-local attributes to extended attributes
Maria Matejka [Thu, 13 Feb 2020 12:22:15 +0000 (13:22 +0100)] 
Babel: Convert the rte-local attributes to extended attributes

3 years agoOSPF: Convert the rte-local attributes to extended attributes
Maria Matejka [Tue, 11 Feb 2020 20:24:15 +0000 (21:24 +0100)] 
OSPF: Convert the rte-local attributes to extended attributes

3 years agoRIP: convert the rte-local attributes to extended attributes
Maria Matejka [Tue, 14 Sep 2021 18:12:33 +0000 (20:12 +0200)] 
RIP: convert the rte-local attributes to extended attributes

3 years agoExtended route attributes may include also pointers
Maria Matejka [Tue, 14 Sep 2021 17:53:03 +0000 (19:53 +0200)] 
Extended route attributes may include also pointers

3 years agoIGP metric getter refactoring to protocol callback
Maria Matejka [Sat, 20 Mar 2021 22:18:34 +0000 (23:18 +0100)] 
IGP metric getter refactoring to protocol callback

Direct protocol hooks for IGP metric inside nest/rt-table.c make the
protocol API unnecessarily complex. Instead, we use a proper callback.

3 years agoRoute: moved rte_src pointer from rta to rte
Maria Matejka [Fri, 10 Apr 2020 15:08:29 +0000 (17:08 +0200)] 
Route: moved rte_src pointer from rta to rte

It is an auxiliary key in the routing table, not a route attribute.

3 years agoPreference moved to RTA and set explicitly in protocols
Maria Matejka [Mon, 10 Feb 2020 07:41:05 +0000 (08:41 +0100)] 
Preference moved to RTA and set explicitly in protocols

3 years agoPreexport: No route modification, no linpool needed
Maria Matejka [Sun, 12 Apr 2020 19:54:20 +0000 (21:54 +0200)] 
Preexport: No route modification, no linpool needed

3 years agoExport table: Delay freeing of old stored route.
Maria Matejka [Sat, 20 Mar 2021 20:16:12 +0000 (21:16 +0100)] 
Export table: Delay freeing of old stored route.

This is needed to provide the protocols the full old route after filters
when export table is enabled.

3 years agoThere may be a symbol with NULL protocol when reconfiguring
Maria Matejka [Wed, 8 Sep 2021 15:30:09 +0000 (15:30 +0000)] 
There may be a symbol with NULL protocol when reconfiguring

3 years agoShow route may be accidentally called on shutdown also when not all default tables...
Maria Matejka [Wed, 8 Sep 2021 08:33:25 +0000 (08:33 +0000)] 
Show route may be accidentally called on shutdown also when not all default tables are present

3 years agofixup! Multipage allocation
Maria Matejka [Wed, 13 Oct 2021 17:08:35 +0000 (19:08 +0200)] 
fixup! Multipage allocation

3 years agoMultipage allocation
Maria Matejka [Wed, 8 Sep 2021 09:29:49 +0000 (11:29 +0200)] 
Multipage allocation

We can also quite simply allocate bigger blocks. Anyway, we need these
blocks to be aligned to their size which needs one mmap() two times
bigger and then two munmap()s returning the unaligned parts.

The user can specify -B <N> on startup when <N> is the exponent of 2,
setting the block size to 2^N. On most systems, N is 12, anyway if you
know that your configuration is going to eat gigabytes of RAM, you are
almost forced to raise your block size as you may easily get into memory
fragmentation issues or you have to raise your maximum mapping count,
e.g. "sysctl vm.max_map_count=(number)".

3 years agoCLI socket accept() may also fail and should produce some message, not a coredump.
Maria Matejka [Tue, 7 Sep 2021 16:22:32 +0000 (16:22 +0000)] 
CLI socket accept() may also fail and should produce some message, not a coredump.

3 years agoOSPF: explicitly stop the periodic tick on shutdown to avoid recalculation races
Maria Matejka [Sun, 5 Sep 2021 11:00:08 +0000 (13:00 +0200)] 
OSPF: explicitly stop the periodic tick on shutdown to avoid recalculation races

3 years agoLinpools may use pages instead of xmalloc
Maria Matejka [Fri, 3 Sep 2021 17:48:38 +0000 (19:48 +0200)] 
Linpools may use pages instead of xmalloc

3 years agofixup! Bound allocated pages to resource pools with page caches to avoid unnecessary...
Maria Matejka [Wed, 13 Oct 2021 16:59:45 +0000 (18:59 +0200)] 
fixup! Bound allocated pages to resource pools with page caches to avoid unnecessary syscalls

3 years agoBound allocated pages to resource pools with page caches to avoid unnecessary syscalls
Maria Matejka [Tue, 31 Aug 2021 22:46:46 +0000 (00:46 +0200)] 
Bound allocated pages to resource pools with page caches to avoid unnecessary syscalls

3 years agoReducing filter stack size to allow for lesser thread stack size
Maria Matejka [Wed, 25 Aug 2021 20:20:48 +0000 (22:20 +0200)] 
Reducing filter stack size to allow for lesser thread stack size

3 years agoOSPF: Setting a list node NULL before use
Maria Matejka [Thu, 27 May 2021 08:35:38 +0000 (10:35 +0200)] 
OSPF: Setting a list node NULL before use

3 years agoFixed memory poisoning in slab
Maria Matejka [Thu, 27 May 2021 08:35:33 +0000 (10:35 +0200)] 
Fixed memory poisoning in slab

3 years agoDebug output uses local buffer to avoid clashes between threads.
Maria Matejka [Wed, 26 May 2021 14:42:02 +0000 (16:42 +0200)] 
Debug output uses local buffer to avoid clashes between threads.

3 years agoFilter: Additional consistency checks
Maria Matejka [Mon, 27 Apr 2020 20:33:10 +0000 (22:33 +0200)] 
Filter: Additional consistency checks

3 years agoNest: Clean up main channel handling
Ondrej Zajicek (work) [Thu, 17 Jun 2021 14:56:51 +0000 (16:56 +0200)] 
Nest: Clean up main channel handling

Remove assumption that main channel is the only channel.

4 years agoCI: Allow Babel tests
Ondrej Zajicek (work) [Thu, 10 Jun 2021 23:31:10 +0000 (01:31 +0200)] 
CI: Allow Babel tests

4 years agoNest: Allow both 'password' and 'key' keywords for authentication keys
Ondrej Zajicek (work) [Wed, 9 Jun 2021 17:54:01 +0000 (19:54 +0200)] 
Nest: Allow both 'password' and 'key' keywords for authentication keys

4 years agoBabel: Simplify auth expiration
Ondrej Zajicek (work) [Wed, 9 Jun 2021 17:31:55 +0000 (19:31 +0200)] 
Babel: Simplify auth expiration

Just use hello_expiry for that, keep init_expiry for initial
unauthentized neighbors.

4 years agoNest: Fix password list parsing code
Ondrej Zajicek (work) [Sun, 6 Jun 2021 17:10:33 +0000 (19:10 +0200)] 
Nest: Fix password list parsing code

One of previous patches broke password list parsing code, fix that.

4 years agoLib: Fix static assert macro
Ondrej Zajicek (work) [Sun, 6 Jun 2021 15:23:45 +0000 (17:23 +0200)] 
Lib: Fix static assert macro

4 years agoBabel: Add MAC authentication support - update
Ondrej Zajicek (work) [Sun, 6 Jun 2021 13:22:59 +0000 (15:22 +0200)] 
Babel: Add MAC authentication support - update

Some cleanups and bugfixes to the previous patch, including:

 - Fix rate limiting in index mismatch check

 - Fix missing BABEL_AUTH_INDEX_LEN in auth_tx_overhead computation

 - Fix missing auth_tx_overhead recalculation during reconfiguration

 - Fix pseudoheader construction in babel_auth_sign() (sport vs fport)

 - Fix typecasts for ptrdiffs in log messages

 - Make auth log messages similar to corresponding RIP/OSPF ones

 - Change auth log messages for events that happen during regular
   operation to debug messages

 - Switch meaning of babel_auth_check*() functions for consistency
   with corresponding RIP/OSPF ones

 - Remove requirement for min/max key length, only those required by
   given MAC code are enforced

4 years agoBabel: Add MAC authentication support
Toke Høiland-Jørgensen [Sat, 17 Apr 2021 13:04:16 +0000 (15:04 +0200)] 
Babel: Add MAC authentication support

This implements support for MAC authentication in the Babel protocol, as
specified by RFC 8967. The implementation seeks to follow the RFC as close
as possible, with the only deliberate deviation being the addition of
support for all the HMAC algorithms already supported by Bird, as well as
the Blake2b variant of the Blake algorithm.

For description of applicability, assumptions and security properties,
see RFC 8967 sections 1.1 and 1.2.

4 years agoBabel: Refactor TLV parsing code for easier reuse
Toke Høiland-Jørgensen [Thu, 15 Apr 2021 18:15:53 +0000 (20:15 +0200)] 
Babel: Refactor TLV parsing code for easier reuse

In preparation for adding authentication checks, refactor the TLV
walking code so it can be reused for a separate pass of the packet
for authentication checks.

4 years agoNest: Allow MAC algorithms to specify min/max key length
Toke Høiland-Jørgensen [Thu, 15 Apr 2021 02:38:49 +0000 (04:38 +0200)] 
Nest: Allow MAC algorithms to specify min/max key length

Add min/max key length fields to the MAC algorithm description and
validate configured keys before they are used.

4 years agoNest: Allow specifying security keys as hex bytes as well as strings
Toke Høiland-Jørgensen [Wed, 14 Apr 2021 19:39:43 +0000 (21:39 +0200)] 
Nest: Allow specifying security keys as hex bytes as well as strings

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.

4 years agoLib: Add tests for blake2s and blake2b
Toke Høiland-Jørgensen [Wed, 14 Apr 2021 18:00:03 +0000 (20:00 +0200)] 
Lib: Add tests for blake2s and blake2b

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.

4 years agoLib: Add Blake2s and Blake2b hash functions
Toke Høiland-Jørgensen [Sat, 10 Apr 2021 15:33:28 +0000 (17:33 +0200)] 
Lib: Add Blake2s and Blake2b hash functions

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.

4 years agosysdep: Add wrapper to get random bytes - update
Ondrej Zajicek (work) [Wed, 7 Apr 2021 23:15:17 +0000 (01:15 +0200)] 
sysdep: Add wrapper to get random bytes - update

Simplify the code and fix an issue with getentropy() return value.

4 years agosysdep: Add wrapper to get random bytes
Toke Høiland-Jørgensen [Thu, 1 Apr 2021 17:20:13 +0000 (19:20 +0200)] 
sysdep: Add wrapper to get random bytes

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.

4 years agoBGP: Ensure that freed neighbor entry is not accessed
Ondrej Zajicek (work) [Mon, 31 May 2021 23:59:20 +0000 (01:59 +0200)] 
BGP: Ensure that freed neighbor entry is not accessed

Routes from downed protocols stay in rtable (until next rtable prune
cycle ends) and may be even exported to another protocol. In BGP case,
source BGP protocol is examined, although dynamic parts (including
neighbor entries) are already freed. That may lead to crash under some
race conditions. Ensure that freed neighbor entry is not accessed to
avoid this issue.