]> git.ipfire.org Git - thirdparty/bird.git/log
thirdparty/bird.git
2 years agoReplaced custom linpools in tests for the common tmp_linpool
Maria Matejka [Wed, 2 Mar 2022 09:59:52 +0000 (10:59 +0100)] 
Replaced custom linpools in tests for the common tmp_linpool

2 years agoIntroducing an universal temporary linpool flushed after every task
Maria Matejka [Wed, 2 Mar 2022 09:35:21 +0000 (10:35 +0100)] 
Introducing an universal temporary linpool flushed after every task

2 years agoStatic list initializer
Maria Matejka [Wed, 2 Mar 2022 10:22:01 +0000 (11:22 +0100)] 
Static list initializer

2 years agoMerge commit '2c13759136951ef0e70a3e3c2b2d3c9a387f7ed9' into haugesund
Maria Matejka [Wed, 2 Mar 2022 09:01:44 +0000 (10:01 +0100)] 
Merge commit '2c13759136951ef0e70a3e3c2b2d3c9a387f7ed9' into haugesund

2 years agoBabel: Fix bug in iface reconfiguration
Ondrej Zajicek (work) [Sun, 27 Feb 2022 02:10:38 +0000 (03:10 +0100)] 
Babel: Fix bug in iface reconfiguration

A recent change in Babel causes ifaces to disappear after
reconfiguration. The patch fixes that.

Thanks to Johannes Kimmel for an insightful bugreport.

2 years agoSmall change to fix doc building on Debian v2.0.9
Ondrej Filip [Sun, 20 Feb 2022 14:30:47 +0000 (15:30 +0100)] 
Small change to fix doc building on Debian

2 years agoSmall changes related to the new release
Ondrej Filip [Sun, 20 Feb 2022 13:28:06 +0000 (14:28 +0100)] 
Small changes related to the new release

2 years agoNEWS: Fix formatting and add some notes
Ondrej Zajicek (work) [Sun, 13 Feb 2022 15:45:49 +0000 (16:45 +0100)] 
NEWS: Fix formatting and add some notes

2 years agoNEWS and version update
Ondrej Zajicek (work) [Wed, 9 Feb 2022 02:47:49 +0000 (03:47 +0100)] 
NEWS and version update

2 years agoAlloc: Use posix_memalign() instead of aligned_alloc()
Ondrej Zajicek (work) [Tue, 8 Feb 2022 21:42:00 +0000 (22:42 +0100)] 
Alloc: Use posix_memalign() instead of aligned_alloc()

For compatibility with older systems use posix_memalign(). We can
switch to aligned_alloc() when we commit to C11 for multithreading.

2 years agoNetlink: Minor cleanup
Ondrej Zajicek (work) [Tue, 8 Feb 2022 21:21:08 +0000 (22:21 +0100)] 
Netlink: Minor cleanup

2 years agoLib: Update alignment of slabs
Ondrej Zajicek (work) [Mon, 7 Feb 2022 03:39:49 +0000 (04:39 +0100)] 
Lib: Update alignment of slabs

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.

2 years agoMerge branch 'oz-trie-table'
Ondrej Zajicek (work) [Sun, 6 Feb 2022 22:32:15 +0000 (23:32 +0100)] 
Merge branch 'oz-trie-table'

2 years agoTrie: Fix trie format
Ondrej Zajicek (work) [Sun, 6 Feb 2022 21:53:55 +0000 (22:53 +0100)] 
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.

2 years agoNest: Implement locking of prefix tries during walks
Ondrej Zajicek (work) [Fri, 4 Feb 2022 04:34:02 +0000 (05:34 +0100)] 
Nest: Implement locking of prefix tries during walks

The prune loop may may rebuild the prefix trie and therefore invalidate
walk state for asynchronous walks (used in 'show route in' cmd). Fix it
by adding locking that keeps the old trie in memory until current walks
are done.

In future this could be improved by rebuilding trie walk states (by
lookup for last found prefix) after the prefix trie rebuild.

2 years agoNest: Implement prefix trie pruning
Ondrej Zajicek (work) [Thu, 3 Feb 2022 05:08:51 +0000 (06:08 +0100)] 
Nest: Implement prefix trie pruning

When rtable is pruned and network fib nodes are removed, we also need to
prune prefix trie. Unfortunately, rebuilding prefix trie takes long time
(got about 400 ms for 1M networks), so must not be atomic, we have to
rebuild a new trie while current one is still active. That may require
some considerable amount of temporary memory, so we do that only if
we expect significant trie size reduction.

2 years agoTrie: Add prefix counter
Ondrej Zajicek (work) [Wed, 2 Feb 2022 04:06:49 +0000 (05:06 +0100)] 
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.

2 years agoDoc: Describe routing table options
Ondrej Zajicek (work) [Fri, 31 Dec 2021 17:42:50 +0000 (18:42 +0100)] 
Doc: Describe routing table options

2 years agoBGP: Implement flowspec validation procedure
Ondrej Zajicek (work) [Mon, 20 Dec 2021 19:25:35 +0000 (20:25 +0100)] 
BGP: Implement flowspec validation procedure

Implement flowspec validation procedure as described in RFC 8955 sec. 6
and RFC 9117. The Validation procedure enforces that only routers in the
forwarding path for a network can originate flowspec rules for that
network.

The patch adds new mechanism for tracking inter-table dependencies, which
is necessary as the flowspec validation depends on IP routes, and flowspec
rules must be revalidated when best IP routes change.

The validation procedure is disabled by default and requires that
relevant IP table uses trie, as it uses interval queries for subnets.

2 years agoNest: Add routing table configuration blocks
Ondrej Zajicek (work) [Wed, 22 Dec 2021 03:32:26 +0000 (04:32 +0100)] 
Nest: Add routing table configuration blocks

Allow to specify sorted flag, trie fla, and min/max settle time.

Also do not enable trie by default, it must be explicitly enabled.

2 years agoNest: Add convenience functions to check rtable net type
Ondrej Zajicek (work) [Mon, 20 Dec 2021 19:44:36 +0000 (20:44 +0100)] 
Nest: Add convenience functions to check rtable net type

2 years agoNest: Avoid unnecessary net_format() in 'show route' command
Ondrej Zajicek (work) [Thu, 2 Dec 2021 03:05:17 +0000 (04:05 +0100)] 
Nest: Avoid unnecessary net_format() in 'show route' command

When output of 'show route' command was generated, the net_format() was
called for each network prematurely, even if the result was not needed.

Fix the code to call net_format() only when needed. This makes queries
that process many networks but show only few (e.g. 'show route where ..',
or 'show route count') much faster (like 5x - 10x faster).

2 years agoNest: Add trie iteration code to 'show route'
Ondrej Zajicek (work) [Thu, 2 Dec 2021 02:30:39 +0000 (03:30 +0100)] 
Nest: Add trie iteration code to 'show route'

Add trie iteration code to rt_show_cont() CLI hook and use it to
accelerate 'show route in <addr>' commands using interval queries.

2 years agoNest: Implement 'show route in <addr>' command
Ondrej Zajicek (work) [Thu, 2 Dec 2021 01:22:30 +0000 (02:22 +0100)] 
Nest: Implement 'show route in <addr>' command

Implement 'show route in <addr>' command, which shows all routes in
networks that are subnets of given network. Currently limited to IP
network types.

2 years agoNest: Attach prefix trie to rtable for faster LPM and interval queries
Ondrej Zajicek (work) [Mon, 29 Nov 2021 18:23:42 +0000 (19:23 +0100)] 
Nest: Attach prefix trie to rtable for faster LPM and interval queries

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 (?)

2 years agoBGP: Make routing loops silent
Ondrej Zajicek (work) [Fri, 28 Jan 2022 17:13:18 +0000 (18:13 +0100)] 
BGP: Make routing loops silent

One of previous commits added error logging of invalid routes. This
also inadvertently caused error logging of route loops, which should
be ignored silently. Fix that.

2 years agoBGP: Use proper class in attribute error messages
Ondrej Zajicek (work) [Fri, 28 Jan 2022 04:35:22 +0000 (05:35 +0100)] 
BGP: Use proper class in attribute error messages

Most error messages in attribute processing are in rx/decode step and
these use L_REMOTE log class. But there are few that are in tx/export
step and these should use L_ERR log class.

Use tx-specific macro (REJECT()) in tx/export code and rename field
err_withdraw to err_reject in struct bgp_export_state to ensure that
appropriate error reporting macros are called in proper contexts.

2 years agoBGP: Improve 'invalid next hop' error reporting
Ondrej Zajicek (work) [Fri, 28 Jan 2022 04:03:03 +0000 (05:03 +0100)] 
BGP: Improve 'invalid next hop' error reporting

Distinguish multiple causes of 'invalid next hop' message and report
the relevant next hop address.

Thanks to Simon Ruderich for the original patch.

2 years agoBGP: Log route updates that were changed to withdraws
Ondrej Zajicek (work) [Mon, 24 Jan 2022 02:44:21 +0000 (03:44 +0100)] 
BGP: Log route updates that were changed to withdraws

Typical BGP error handling is treat-as-withdraw, where an invalid route
is replaced with a withdraw. Log route network when it happens.

2 years ago.gitlab-ci.yml: minor changes inside the .yml file.
Matous Holinka [Thu, 6 Jan 2022 08:53:23 +0000 (09:53 +0100)] 
.gitlab-ci.yml: minor changes inside the .yml file.

+ ubuntu:21.10 added into the pipeline,
- ubuntu:20.10 removed from the pipeline,

+ misc/docker/ubuntu-21.10-amd64/Dockerfile added,
- misc/docker/ubuntu-20.10-amd64/Dockerfile removed.

2 years agoNetlink: Add option to specify netlink socket receive buffer size
Ondrej Zajicek (work) [Mon, 17 Jan 2022 04:11:29 +0000 (05:11 +0100)] 
Netlink: Add option to specify netlink socket receive buffer size

Add option 'netlink rx buffer' to specify netlink socket receive buffer
size. Uses SO_RCVBUFFORCE, so it can override rmem_max limit.

Thanks to Trisha Biswas and Michal for the original patches.

2 years agoNetlink: Add another workaround for older kernel headers
Ondrej Zajicek (work) [Sat, 15 Jan 2022 21:39:40 +0000 (22:39 +0100)] 
Netlink: Add another workaround for older kernel headers

Unfortunately, SOL_NETLINK is both recently added and arch-dependent,
so we cannot just define it.

2 years agoNetlink: Add workaround for older kernel headers
Ondrej Zajicek (work) [Fri, 14 Jan 2022 22:15:05 +0000 (23:15 +0100)] 
Netlink: Add workaround for older kernel headers

2 years agoNetlink: Enable strict checking for KRT dumps
Ondrej Zajicek (work) [Fri, 14 Jan 2022 20:53:40 +0000 (21:53 +0100)] 
Netlink: Enable strict checking for KRT dumps

Add strict checking for netlink KRT dumps to avoid PMTU cache records
from FNHE table dump along with KRT.

Linux Kernel added FNHE table dump to the netlink API in patch:

https://patchwork.ozlabs.org/project/netdev/patch/8d3b68cd37fb5fddc470904cdd6793fcf480c6c1.1561131177.git.sbrivio@redhat.com/

Therefore, since Linux 5.3 these route cache entries are dumped together
with regular routes during periodic KRT scans, which in some cases may be
huge amount of useless data. This can be avoided by using strict checking
for netlink dumps:

https://lore.kernel.org/netdev/20181008031644.15989-1-dsahern@kernel.org/

The patch mitigates the risk of receiving unknown and potentially large
number of FNHE records that would block BIRD I/O in each sync. There is a
known issue caused by the GRE tunnels on Linux that seems to be creating
one FNHE record for each destination IP address that is routed through
the tunnel, even when the PMTU equals to GRE interface MTU.

Thanks to Tomas Hlavacek for the original patch.

2 years agoNetlink: Explicitly skip received cloned routes
Ondrej Zajicek (work) [Fri, 14 Jan 2022 18:07:57 +0000 (19:07 +0100)] 
Netlink: Explicitly skip received cloned routes

Kernel uses cloned routes to keep route cache entries, but reports them
together with regular routes. They were skipped implicitly as they
do not have rtm_protocol filled. Add explicit check for cloned flag
and skip such routes explicitly.

Also, improve debug logs of skipped routes.

2 years agoBGP: Add option 'free bind'
Ondrej Zajicek (work) [Sun, 9 Jan 2022 01:40:58 +0000 (02:40 +0100)] 
BGP: Add option 'free bind'

The BGP 'free bind' option applies the IP_FREEBIND/IPV6_FREEBIND
socket option for the BGP listening socket.

Thanks to Alexander Zubkov for the idea.

2 years agoIO: Support nonlocal bind in socket interface
Alexander Zubkov [Sat, 8 Jan 2022 17:31:56 +0000 (18:31 +0100)] 
IO: Support nonlocal bind in socket interface

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.

2 years agoTest: Activate some remaining build tests
Ondrej Zajicek (work) [Wed, 5 Jan 2022 19:07:27 +0000 (20:07 +0100)] 
Test: Activate some remaining build tests

2 years agoNetlink: Do not ignore dead routes from BIRD
Ondrej Zajicek (work) [Wed, 5 Jan 2022 18:25:42 +0000 (19:25 +0100)] 
Netlink: Do not ignore dead routes from BIRD

Currently, BIRD ignores dead routes to consider them absent. But it also
ignores its own routes and thus it can not correctly manage such routes
in some cases. This patch makes an exception for routes with proto bird
when ignoring dead routes, so they can be properly updated or removed.

Thanks to Alexander Zubkov for the original patch.

2 years agoNetlink: Improve multipath parsing errors
Ondrej Zajicek (work) [Wed, 5 Jan 2022 17:46:41 +0000 (18:46 +0100)] 
Netlink: Improve multipath parsing errors

Function nl_parse_multipath() should handle errors internally.

2 years agoConf: Fix parsing full-length IPv6 addresses
Ondrej Zajicek (work) [Wed, 5 Jan 2022 15:38:49 +0000 (16:38 +0100)] 
Conf: Fix parsing full-length IPv6 addresses

Lexer expression for bytestring was too loose, accepting also
full-length IPv6 addresses. It should be restricted such that
colon is used between every byte or never.

Fix the regex and also add some test cases for it.

Thanks to Alexander Zubkov for the bugreport

2 years agogitlab-ci.yml: failing gitlab runner fixed.
Matous [Thu, 14 Oct 2021 10:16:46 +0000 (12:16 +0200)] 
gitlab-ci.yml: failing gitlab runner fixed.

'registry.labs.nic.cz' -> 'registry.nic.cz' changed

2 years agoDoc: Document min/max operators for lists
Alexander Zubkov [Tue, 28 Dec 2021 03:09:36 +0000 (04:09 +0100)] 
Doc: Document min/max operators for lists

2 years agoFilter: Add operators to find minimum and maximum element of sets
Alexander Zubkov [Tue, 28 Dec 2021 03:05:05 +0000 (04:05 +0100)] 
Filter: Add operators to find minimum and maximum element of sets

Add operators .min and .max to find minumum or maximum element in sets
of types: clist, eclist, lclist. Example usage:

bgp_community.min
bgp_ext_community.max
filter(bgp_large_community, [(as1, as2, *)]).min

Signed-off-by: Alexander Zubkov <green@qrator.net>
2 years agoDoc: Document community components access operators
Alexander Zubkov [Tue, 28 Dec 2021 02:48:42 +0000 (03:48 +0100)] 
Doc: Document community components access operators

2 years agoFilter: Add operators to pick community components
Alexander Zubkov [Tue, 28 Dec 2021 02:46:13 +0000 (03:46 +0100)] 
Filter: Add operators to pick community components

Add operators that can be used to pick components from
pair (standard community) or lc (large community) types.
For example:

(10, 20).asn --> 10
(10, 20).data --> 20

(10, 20, 30).asn --> 10
(10, 20, 30).data1 --> 20
(10, 20, 30).data2 --> 30

Signed-off-by: Alexander Zubkov <green@qrator.net>
2 years agoBSD: Assume onlink flag on ifaces with only host addresses
Ondrej Zajicek (work) [Mon, 27 Dec 2021 18:10:35 +0000 (19:10 +0100)] 
BSD: Assume onlink flag on ifaces with only host addresses

The BSD kernel does not support the onlink flag and BIRD does not use
direct routes for next hop validation, instead depends on interface
address ranges. We would like to handle PtMP cases with only host
addresses configured, like:

  ifconfig wg0 192.168.0.10/32
  route add 192.168.0.4 -iface wg0
  route add 192.168.0.8 -iface wg0

To accept BIRD routes with onlink next-hop, like:

  route 192.168.42.0/24 via 192.168.0.4%wg0 onlink

BIRD would dismiss the route when receiving from the kernel, as the
next-hop 192.168.0.4 is not part of any interface subnet and onlink
flag is not kept by the BSD kernel.

The commit fixes this by assuming that for routes received from the
kernel, any next-hop is onlink on ifaces with only host addresses.

Thanks to Stefan Haller for the original patch.

2 years agoRPKI: Add contextual out-of-bound checks in RTR Prefix PDU handler
Job Snijders [Sat, 18 Dec 2021 15:35:28 +0000 (16:35 +0100)] 
RPKI: Add contextual out-of-bound checks in RTR Prefix PDU handler

RFC 6810 and RFC 8210 specify that the "Max Length" value MUST NOT be
less than the Prefix Length element (underflow). On the other side,
overflow of the Max Length element also is possible, it being an 8-bit
unsigned integer allows for values larger than 32 or 128. This also
implicitly ensures there is no overflow of "Length" value.

When a PDU is received where the Max Length field is corrputed, the RTR
client (BIRD) should immediately terminate the session, flush all data
learned from that cache, and log an error for the operator.

Minor changes done by commiter.

2 years agoDoc: bgp: remove "advertise ipv4"
Simon Ruderich [Sat, 18 Dec 2021 02:17:48 +0000 (03:17 +0100)] 
Doc: bgp: remove "advertise ipv4"

The option was removed in d15b0b0a ("BGP redesign", 2016-12-07)
but the documentation wasn't updated.

2 years agoNest: Do not ignore secondary flag changes in ifa updates
Ondrej Zajicek (work) [Fri, 17 Dec 2021 23:58:47 +0000 (00:58 +0100)] 
Nest: Do not ignore secondary flag changes in ifa updates

Compare all IA_* flags that are set by sysdep iface code.

The old code ignores IA_SECONDARY flag when comparing whether iface
address updates from kernel changed anything. This is usually not an
issue as kernel removes all secondary addresses due to removal of the
primary one, but it breaks when sysctl 'promote_secondaries' is enabled
and kernel promotes secondary addresses to primary ones.

Thanks to 'Alexander' for the bugreport.

2 years agoTrie: Clarify handling of less-common net types
Ondrej Zajicek (work) [Mon, 29 Nov 2021 18:00:24 +0000 (19:00 +0100)] 
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.

2 years agoMemory statistics split into Effective and Overhead
Maria Matejka [Fri, 26 Nov 2021 23:21:12 +0000 (00:21 +0100)] 
Memory statistics split into Effective and Overhead

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.

2 years agoTrie: Implement longest-prefix-match queries and walks
Ondrej Zajicek (work) [Fri, 26 Nov 2021 02:26:36 +0000 (03:26 +0100)] 
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.

2 years agoDirectly mapped pages are kept for future use if temporarily not needed
Maria Matejka [Wed, 24 Nov 2021 16:30:13 +0000 (17:30 +0100)] 
Directly mapped pages are kept for future use if temporarily not needed

2 years agoTrie: Implement trie walking code
Ondrej Zajicek (work) [Fri, 19 Nov 2021 17:04:32 +0000 (18:04 +0100)] 
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).

2 years agoTrie: Simplify network matching code
Ondrej Zajicek (work) [Sat, 13 Nov 2021 20:11:18 +0000 (21:11 +0100)] 
Trie: Simplify network matching code

Introduce ipX_prefix_equal() and use it to simplify network matching code.

2 years agoConf: Fix crash during shutdown
Ondrej Zajicek (work) [Tue, 19 Oct 2021 23:51:28 +0000 (01:51 +0200)] 
Conf: Fix crash during shutdown

BIRD implements shutdown by reconfiguring to fake empty configuration.
Such fake config structure is created from the last running config and
shares some data, including symbol table. This allows access to (removed)
routing tables and causes crash when 'show route' command is used during
shutdown.

Clean up symbol table, table list and links to default tables, so removed
routing tables cannot be accessed during shutdown.

2 years agoFilter: Add prefix trie benchmarks
Ondrej Zajicek (work) [Sat, 25 Sep 2021 14:00:30 +0000 (16:00 +0200)] 
Filter: Add prefix trie benchmarks

Add trie tests intended as benchmarks that use external datasets
instead of generated prefixes. As datasets are not included, they
are commented out by default.

2 years agoFilter: Improve prefix trie tests
Ondrej Zajicek (work) [Tue, 21 Apr 2020 11:49:29 +0000 (13:49 +0200)] 
Filter: Improve prefix trie tests

Add tests explicitly matching insides and outsides of trie and update
tests to do testing of both IPv4 and IPv6 tries.

2 years agoFilter: Update trie documentation
Ondrej Zajicek (work) [Mon, 6 Apr 2020 12:20:16 +0000 (14:20 +0200)] 
Filter: Update trie documentation

2 years agoFilter: Fix trie test
Ondrej Zajicek (work) [Sun, 5 Apr 2020 01:56:07 +0000 (03:56 +0200)] 
Filter: Fix trie test

Generated prefixes must be valid.

2 years agoFilter: Faster prefix sets
Ondrej Zajicek (work) [Sun, 5 Apr 2020 01:24:46 +0000 (03:24 +0200)] 
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).

2 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

2 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

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

2 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.

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

2 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.

2 years agoNest: Clean up main channel handling 1/merge 23/merge
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.

2 years agoNest: Fix export of tmpattrs through pipes
Ondrej Zajicek (work) [Mon, 14 Jun 2021 18:02:50 +0000 (20:02 +0200)] 
Nest: Fix export of tmpattrs through pipes

Pipes copy the original rte with old values, so they require rte to be
exported with stored tmpattrs. Other protocols access stored attributes
using eattr list, so they require rte to be exported with expanded
tmpattrs. This is temporary hack, we plan to remove whoe tmpattr mechanism.

Thanks to Paul Donohue for the bugreport.

2 years agoRevert "Nest: Fix export of tmpattrs through pipes"
Ondrej Zajicek (work) [Mon, 14 Jun 2021 15:58:37 +0000 (17:58 +0200)] 
Revert "Nest: Fix export of tmpattrs through pipes"

This reverts commit f8e273b5e7a3c721f4a30cf27a0b4fe54602e83f.

2 years agoNest: Fix export of tmpattrs through pipes
Ondrej Zajicek (work) [Mon, 14 Jun 2021 14:30:59 +0000 (16:30 +0200)] 
Nest: Fix export of tmpattrs through pipes

In most cases of export there is no need to store back temporary
attributes to rte, as receivers (protocols) access eattr list anyway.
But pipe copies the original rte with old values, so we should store
tmpattrs also during export.

Thanks to Paul Donohue for the bugreport.

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

2 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

2 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.

2 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.

2 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

2 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

2 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.

2 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.

2 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.

2 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.

2 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.

2 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.

2 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.

2 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.

2 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.

2 years agoBabel: Seqno requests are properly decoupled from neighbors when the underlying inter... mh-bird-apkg
Maria Matejka [Sun, 30 May 2021 11:07:16 +0000 (13:07 +0200)] 
Babel: Seqno requests are properly decoupled from neighbors when the 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.

2 years agoOSPF: Fix OSPFv3 in IPv4 mode with multiple areas
Ondrej Zajicek (work) [Wed, 26 May 2021 16:57:32 +0000 (18:57 +0200)] 
OSPF: Fix OSPFv3 in IPv4 mode with multiple areas

Some area handling code got confused by IPv4 setup in OSPFv3 mode.

3 years agoCI: Try different locale for Centos 7 bird-apkg
Ondrej Zajicek (work) [Thu, 20 May 2021 13:02:48 +0000 (15:02 +0200)] 
CI: Try different locale for Centos 7

3 years agoCI: Package build for more platforms 25/merge
Matous Holinka [Wed, 19 May 2021 17:10:09 +0000 (19:10 +0200)] 
CI: Package build for more platforms

.gitlab-ci.yml:
+ pkg targets for some distros added
+ artifacts added
- some distros were commented out (due to errors).

misc/docker/*:
+ Dockerfiles updated with the necessary packages.

3 years agoCI: Try utf-8 locale to workaround apkg issue
Ondrej Zajicek (work) [Sun, 25 Apr 2021 17:52:19 +0000 (19:52 +0200)] 
CI: Try utf-8 locale to workaround apkg issue

3 years agoCI: Build documentation where tools are available
Ondrej Zajicek (work) [Sun, 25 Apr 2021 09:24:46 +0000 (11:24 +0200)] 
CI: Build documentation where tools are available

3 years agoCI: Update docker images for building of documentation
Ondrej Zajicek (work) [Sun, 25 Apr 2021 01:37:54 +0000 (03:37 +0200)] 
CI: Update docker images for building of documentation

3 years agoPkg: Enable docs subpackage for Debian
Ondrej Zajicek (work) [Sun, 25 Apr 2021 01:07:25 +0000 (03:07 +0200)] 
Pkg: Enable docs subpackage for Debian

3 years agoCI: Test of apkg build
Ondrej Zajicek (work) [Thu, 22 Apr 2021 22:20:36 +0000 (00:20 +0200)] 
CI: Test of apkg build

Also temporarily disable cf-ospf-auth, as there is some problem with it.

3 years agoTools: Improve make-dev-archive
Ondrej Zajicek (work) [Thu, 22 Apr 2021 17:23:18 +0000 (19:23 +0200)] 
Tools: Improve make-dev-archive

Use git-archive to avoid unrelated and temporary files and fix some
minor issues (e.g. dependency on bash as system shell).

3 years agoubuntu: use any init-system-helpers
Jakub Ružička [Tue, 13 Apr 2021 18:29:11 +0000 (20:29 +0200)] 
ubuntu: use any init-system-helpers

init-system-helpers (>= 1.56~) can't be satisfied on:

* Ubuntu 18.04 (1.51)
* Ubuntu 16.04 (1.29)
* Debian 9 (1.48)

Remove the specific version requirement in order to enable build on
older platforms.

3 years agosuse: fix bird.spec to work on SUSE
Jakub Ružička [Fri, 9 Apr 2021 16:36:25 +0000 (18:36 +0200)] 
suse: fix bird.spec to work on SUSE

SUSE is more strict about .spec.

* use SPDX license id
* add missing %ghost file directive

3 years agodocs: disable docs subpackage to fix FTBFS
Jakub Ružička [Fri, 9 Apr 2021 14:35:10 +0000 (16:35 +0200)] 
docs: disable docs subpackage to fix FTBFS

Adressing following FTBFS on all older debian/ubuntu distros:

    Can't locate LinuxDocTools/Data/Latin1ToSgml.pm in @INC (you may need to install the LinuxDocTools::Data::Latin1ToSgml module)