]> git.ipfire.org Git - thirdparty/bird.git/log
thirdparty/bird.git
8 months agoNest: Treat VRF interfaces as inside respective VRFs
Ondrej Zajicek [Wed, 23 Aug 2023 13:55:31 +0000 (15:55 +0200)] 
Nest: Treat VRF interfaces as inside respective VRFs

Despite not having defined 'master interface', VRF interfaces should be
treated as being inside respective VRFs. They behave as a loopback for
respective VRFs. Treating the VRF interface as inside the VRF allows
e.g. OSPF to pick up IP addresses defined on the VRF interface.

For this, we also need to tell apart VRF interfaces and regular interfaces.
Extend Netlink code to parse interface type and mark VRF interfaces with
IF_VRF flag.

Based on the patch from Erin Shepherd, thanks!

8 months agoMerge branch 'bmp'
Ondrej Zajicek [Tue, 22 Aug 2023 13:28:05 +0000 (15:28 +0200)] 
Merge branch 'bmp'

8 months agoRPM: Sync bird.spec from Fedora dist-git
Jakub Ružička [Tue, 22 Aug 2023 12:13:55 +0000 (14:13 +0200)] 
RPM: Sync bird.spec from Fedora dist-git

It seems all Fedora packages are built from epel7 branch.

8 months agoDistro: Add apkg packaging test
Jakub Ružička [Wed, 26 Apr 2023 15:26:30 +0000 (17:26 +0200)] 
Distro: Add apkg packaging test

The test was written by Maria Matejka, thanks!

Run this using

    apkg test

8 months agoDistro: Add apkg compat level
Jakub Ružička [Fri, 21 May 2021 02:48:27 +0000 (04:48 +0200)] 
Distro: Add apkg compat level

This will allow compatibility on future apkg config updates.

8 months agoDebian: Fix for arm64 cross build
Jakub Ružička [Wed, 3 May 2023 12:13:21 +0000 (14:13 +0200)] 
Debian: Fix for arm64 cross build

Mirrors debian patch.

8 months agoDebian: Use {{ now }} in changelog
Jakub Ružička [Thu, 20 Oct 2022 16:47:09 +0000 (18:47 +0200)] 
Debian: Use {{ now }} in changelog

8 months agoDebian: Bump compat level to 11
Jakub Ružička [Wed, 22 Feb 2023 18:01:31 +0000 (19:01 +0100)] 
Debian: Bump compat level to 11

Current is 13, remaining blockers:

- Debian 9 @ 11 (EOL)
- Ubuntu 18.04 @ 12 (EOL 2023-04-02)

8 months agoDebian: Sync packaging with Debian
Jakub Ružička [Tue, 7 Feb 2023 18:20:52 +0000 (19:20 +0100)] 
Debian: Sync packaging with Debian

8 months agoDebian: Add birdcl manpage
Jakub Ružička [Tue, 7 Feb 2023 18:19:57 +0000 (19:19 +0100)] 
Debian: Add birdcl manpage

Mirrors Debian package change.

8 months agoRPM: Add missing BuildRequires: autoconf
Jakub Ružička [Thu, 20 May 2021 16:07:46 +0000 (18:07 +0200)] 
RPM: Add missing BuildRequires: autoconf

8 months agoUse more proper pointers to constant bytestrings
Alexander Zubkov [Tue, 22 Aug 2023 12:44:18 +0000 (14:44 +0200)] 
Use more proper pointers to constant bytestrings

8 months agoBGP: Update RFC reference
Ondrej Zajicek [Tue, 22 Aug 2023 12:20:59 +0000 (14:20 +0200)] 
BGP: Update RFC reference

RFC 5549 was obsoleted by RFC 8950.

8 months agoBMP: Improve peer_down handling
Ondrej Zajicek [Mon, 21 Aug 2023 23:24:21 +0000 (01:24 +0200)] 
BMP: Improve peer_down handling

Move all bmp_peer_down() calls to one place and make it synchronous with
BGP session down, ensuring that BMP receives peer_down before route
withdraws from flushing.

Also refactor bmp_peer_down_() message generating code.

8 months agoBMP: Use generic channel feed instead of direct walk over rtable
Ondrej Zajicek [Mon, 21 Aug 2023 02:20:32 +0000 (04:20 +0200)] 
BMP: Use generic channel feed instead of direct walk over rtable

Now we use rt_notify() and channels for both feed and notifications,
in both import tables (pre-policy) and regular tables (post-policy).

Remove direct walk in bmp_route_monitor_snapshot().

8 months agoNest: Use generic rte_announce() also for import tables
Ondrej Zajicek [Mon, 21 Aug 2023 02:17:21 +0000 (04:17 +0200)] 
Nest: Use generic rte_announce() also for import tables

Remove special rte_announce_in(), so we can use generic rte_announce()
for bot feed and notifications.

9 months agoBMP: Fix route timestamps
Ondrej Zajicek [Fri, 18 Aug 2023 13:39:08 +0000 (15:39 +0200)] 
BMP: Fix route timestamps

9 months agoBMP: Refactor route monitoring
Ondrej Zajicek [Fri, 18 Aug 2023 01:53:58 +0000 (03:53 +0200)] 
BMP: Refactor route monitoring

 - Manage BMP state through bmp_peer, bmp_stream, bmp_table structures
 - Use channels and rt_notify() hook for route announcements
 - Add support for post-policy monitoring
 - Send End-of-RIB even when there is no routes
 - Remove rte_update_in_notify() hook from import tables
 - Update import tables to support channels
 - Add bmp_hack (no feed / no flush) flag to channels

9 months agoBMP: Remove useless buffer
Ondrej Zajicek [Tue, 1 Aug 2023 16:39:38 +0000 (18:39 +0200)] 
BMP: Remove useless buffer

9 months agoBMP: Simplify route monitoring hooks
Ondrej Zajicek [Tue, 1 Aug 2023 15:56:56 +0000 (17:56 +0200)] 
BMP: Simplify route monitoring hooks

No need for *_begin(), *_commit(), and *_end() hooks. The hook *_notify()
is sufficient for everything.

10 months agoFixed a typo in documentation
Alexander Zubkov [Fri, 30 Jun 2023 11:16:09 +0000 (13:16 +0200)] 
Fixed a typo in documentation

The problem was the "/" symbol in the prefix mask that finished the formatting definition prematurely.

10 months agoRAdv: Use new syntax for custom options
Alexander Zubkov [Mon, 26 Jun 2023 13:35:22 +0000 (15:35 +0200)] 
RAdv: Use new syntax for custom options

And use WALK_LIST macro

10 months agoRAdv: Add custom options
Alexander Zubkov [Fri, 23 Jun 2023 15:21:05 +0000 (17:21 +0200)] 
RAdv: Add custom options

Currently one can use only a predefined set of advertised options in RAdv
protocol, which are supported by BIRD configuration. It would be convenient
to be able to specify other possible options at least manually as a blob
so one should not wait until it is supported in the code, released, etc.

This idea is inspired by presentation by Ondřej Caletka at CSNOG, in which
he noticed the lack of either PREF64 option or possibility to add custom
options in various software.

The patch makes it possible to define such options with the syntax:

  other type <num> <bytestring>

10 months agoAdd hex:XYZ syntax for short hex strings
Alexander Zubkov [Fri, 23 Jun 2023 14:47:37 +0000 (16:47 +0200)] 
Add hex:XYZ syntax for short hex strings

Hexadecimal bytestring literals have minimal length to not collide
with IP addresses or regular (hexadecimal) number literals.

Allow to use shorter literals with explicit hex: prefix.

10 months agoMerge tag 'v2.13.1'
Maria Matejka [Thu, 22 Jun 2023 15:25:18 +0000 (17:25 +0200)] 
Merge tag 'v2.13.1'

10 months agoNEWS and version update stable-2.13 v2.13.1
Maria Matejka [Thu, 22 Jun 2023 14:14:12 +0000 (16:14 +0200)] 
NEWS and version update

10 months agoFilter: Fixed segfault when a case option had an empty block
Maria Matejka [Thu, 22 Jun 2023 14:07:28 +0000 (16:07 +0200)] 
Filter: Fixed segfault when a case option had an empty block

Thanks to Kobayashi_Bairuo <noc@tohunet.com> for reporting.

10 months agoBGP: Fix role check when no capability option is present
Ondrej Zajicek [Thu, 18 May 2023 23:02:57 +0000 (01:02 +0200)] 
BGP: Fix role check when no capability option is present

When an OPEN message without capability options was parsed, the remote
role field was not initialized with the proper (non-zero) default value,
so it was interpreted as if 'provider' was announced.

Thanks to Mikhail Grishin for the bugreport.

11 months agoNetlink: Allow RTA_VIA even without MPLS support
Luiz Amaral [Thu, 15 Jun 2023 13:01:50 +0000 (15:01 +0200)] 
Netlink: Allow RTA_VIA even without MPLS support

It is necessary for IPv4 over IPv6 nexthop support on FreeBSD,
and RTA_VIA is not really related to MPLS.

It breaks build for some very old systems like Debian 8 and CentOS 7,
but we generally do not support older kernels than 4.14 LTS anyway.

11 months agoCI: Remove obsolete CI targets
Ondrej Zajicek [Thu, 15 Jun 2023 13:50:18 +0000 (15:50 +0200)] 
CI: Remove obsolete CI targets

Remove build-debian-8, build-ubuntu-14_04, build-centos-7, pkg-debian-9,
and pkg-centos-7 targets.

Debian 8, Ubuntu 14.04, and CentOS 7 have unsupported kernels, Debian 9
has okay kernel, but is EOL.

11 months agoBMP: Ensure that bmp_fire_tx() does nothing when not up
Ondrej Zajicek [Thu, 8 Jun 2023 03:10:05 +0000 (05:10 +0200)] 
BMP: Ensure that bmp_fire_tx() does nothing when not up

11 months agoBMP: Support multiple instances of BMP protocol
Ondrej Zajicek [Thu, 8 Jun 2023 02:56:41 +0000 (04:56 +0200)] 
BMP: Support multiple instances of BMP protocol

Add internal BMP functions with plicit bmp_proto *p as first argument,
which allows using TRACE() macro. Keep list of BMP instances and call
internal functions. Old BMP functions are wrappers that call internal
functions for all enabled BMP instances.

Extract End-of-RIB mark into separate function.

Based on patch from Michal Zagorski <mzagorsk@akamai.com>. Thanks!

11 months agoBabel: Minor changes to RTT formatting
Ondrej Zajicek [Fri, 2 Jun 2023 00:34:05 +0000 (02:34 +0200)] 
Babel: Minor changes to RTT formatting

Use existing %t printf code and move 'ms' in CLI output to table header.

11 months agoBabel: Add support for the RTT extension
Toke Høiland-Jørgensen [Thu, 1 Jun 2023 22:31:53 +0000 (00:31 +0200)] 
Babel: Add support for the RTT extension

This adds support to the Babel protocol for the RTT extension specified
in draft-ietf-babel-rtt-extension. While this extension is not yet at the
RFC stage, it is one of the more useful extensions to Babel[0], so it
seems worth having in Bird as well.

The extension adds timestamps to Hello and IHU TLVs and uses these to
compute an RTT to each neighbour. An extra per-neighbour cost is then
computed from the RTT based on a minimum and maximum interval and cost
value specified in the configuration. The primary use case for this is
improving routing in a geographically distributed tunnel-based overlay
network.

The implementation follows the babeld implementation when picking
constants and default configuration values. It also uses the same RTT
smoothing algorithm as babeld, and follows it in adding a new 'tunnel'
interface type which enables RTT by default.

[0] https://alioth-lists.debian.net/pipermail/babel-users/2022-April/003932.html

11 months agoIO: Add current_time_now() function for immediate timestamp
Toke Høiland-Jørgensen [Thu, 1 Jun 2023 22:26:41 +0000 (00:26 +0200)] 
IO: Add current_time_now() function for immediate timestamp

Add a current_time_now() function which gets an immediate monotonic
timestamp instead of using the cached value from the event loop. This is
useful for callers that need precise times, such as the Babel RTT
measurement code.

Minor changes by committer.

11 months agoBMP: Fix bug in buffer resize
Ondrej Zajicek [Wed, 31 May 2023 16:32:53 +0000 (18:32 +0200)] 
BMP: Fix bug in buffer resize

The buffer code in bmp_buffer_grow(), reuse the MRT buffer handling code.

Based on comments by Michal Zagorski <mzagorsk@akamai.com>, Thanks!

11 months agoBMP: Proper reconfiguration and protocol status
Ondrej Zajicek [Wed, 31 May 2023 15:41:53 +0000 (17:41 +0200)] 
BMP: Proper reconfiguration and protocol status

Based on patches from Michal Zagorski <mzagorsk@akamai.com> co-authored
with Pawel Maslanka <pmaslank@akamai.com>. Thanks!

11 months agoBMP: Add station address check
Ondrej Zajicek [Tue, 30 May 2023 15:23:56 +0000 (17:23 +0200)] 
BMP: Add station address check

Also, do not initialize it to IPA_NONE4, use regular IPA_NONE.

11 months agoBMP: Add local address option
Michal Zagorski [Tue, 30 May 2023 15:09:25 +0000 (17:09 +0200)] 
BMP: Add local address option

Also remove unused local and ip_post_policy options.

Co-authored with Pawel Maslanka <pmaslank@akamai.com>.

Minor changes by committer.

11 months agoBMP: Minor formatting cleanups
Ondrej Zajicek [Tue, 30 May 2023 13:52:01 +0000 (15:52 +0200)] 
BMP: Minor formatting cleanups

Based on patches from Michal Zagorski <mzagorsk@akamai.com> co-authored
with Pawel Maslanka <pmaslank@akamai.com>. Thanks!

11 months agoBGP: Improve bgp_create_update_bmp()
Ondrej Zajicek [Tue, 30 May 2023 13:37:52 +0000 (15:37 +0200)] 
BGP: Improve bgp_create_update_bmp()

Fix issue with missing AF cap (e.g. IPv4 unicast when no capabilities
are announced).

Add Linpool save/restore action similar to bgp_create_update().

Based on patch from Michal Zagorski <mzagorsk@akamai.com> co-authored
with Pawel Maslanka <pmaslank@akamai.com>. Thanks!

12 months agoBGP: Fix role check when no capability option is present
Ondrej Zajicek [Thu, 18 May 2023 23:02:57 +0000 (01:02 +0200)] 
BGP: Fix role check when no capability option is present

When an OPEN message without capability options was parsed, the remote
role field was not initialized with the proper (non-zero) default value,
so it was interpreted as if 'provider' was announced.

Thanks to Mikhail Grishin for the bugreport.

12 months agoLib: Improve IP/net hashing
Ondrej Zajicek [Thu, 18 May 2023 13:55:45 +0000 (15:55 +0200)] 
Lib: Improve IP/net hashing

Backport some changes from branch oz-parametric-hashes. Replace naive
hash function for IPv6 addresses, fix hashing of VPNx (where upper half
of RD was ignored), fix hashing of MPLS labels (where identity was used).

12 months agoNest: Add tests and benchmark for FIB
Ondrej Zajicek [Tue, 16 May 2023 11:25:48 +0000 (13:25 +0200)] 
Nest: Add tests and benchmark for FIB

Basic fib_get() / fib_find() test for random prefixes, FIB_WALK() test,
and benchmark for fib_find(). Also generalize and reuse some code from
trie tests.

12 months agoBMP: Use OPEN messages stored in BGP
Ondrej Zajicek [Mon, 1 May 2023 01:35:21 +0000 (03:35 +0200)] 
BMP: Use OPEN messages stored in BGP

The BMP protocol needs OPEN messages of established BGP sessions to
construct appropriate Peer Up messages. Instead of saving them internally
we use OPEN messages stored in BGP instances. This allows BMP instances
to be restarted or enabled later.

Because of this change, we can simplify BMP data structures. No need to
keep track of BGP sessions when we are not started. We have to iterate
over all (established) BGP sessions when the BMP session is established.
This is just a scaffolding now, but some kind of iteration would be
necessary anyway.

Also, the commit cleans up handling of msg/msg_length arguments to be
body/body_length consistently in both rx/tx and peer_up/peer_down calls.

12 months agoBGP: Save sent and received OPEN messages
Ondrej Zajicek [Fri, 28 Apr 2023 17:13:56 +0000 (19:13 +0200)] 
BGP: Save sent and received OPEN messages

These are necessary for BMP Peer UP message and it is better to keep them
in BGP than in BMP (so BMP could be restarted or added later).

12 months agoConf: Improve handling of keywords
Ondrej Zajicek [Thu, 27 Apr 2023 16:20:49 +0000 (18:20 +0200)] 
Conf: Improve handling of keywords

For whatever reason, parser allocated a symbol for every parsed keyword
in each scope. That wasted time and memory. The effect is worsened with
recent changes allowing local scopes, so keywords often promote soft
scopes (with no symbols) to real scopes.

Do not allocate a symbol for a keyword. Take care of keywords that could
be promoted to symbols (kw_sym) and do it explicitly.

12 months agoConf: Fix symbol lookup
Ondrej Zajicek [Thu, 27 Apr 2023 15:09:00 +0000 (17:09 +0200)] 
Conf: Fix symbol lookup

The symbol table used just symbol name as a key, and used a trick with
active flag to find symbols in active scopes with one hash table lookup.

The disadvantage is that it can degenerate to O(n) for negative queries
in situations where are many symbols with the same name in different
scopes.

Thanks to Yanko Kaneti for the bugreport.

12 months agoNEWS and version update v2.13
Ondrej Zajicek [Fri, 21 Apr 2023 18:24:43 +0000 (20:24 +0200)] 
NEWS and version update

12 months agoFilter: Disable some trie formatting tests
Ondrej Zajicek [Fri, 21 Apr 2023 17:29:17 +0000 (19:29 +0200)] 
Filter: Disable some trie formatting tests

Trie formatting works slightly different with 4-way tries than with
16-way ones, so these tests generated false error. Block them for now.

12 months agoMerge branch 'bmp'
Ondrej Zajicek [Fri, 21 Apr 2023 02:47:55 +0000 (04:47 +0200)] 
Merge branch 'bmp'

12 months agoBMP: Add some basic documentation
Ondrej Zajicek [Fri, 21 Apr 2023 02:42:13 +0000 (04:42 +0200)] 
BMP: Add some basic documentation

12 months agoBSD: IPv4 over IPv6 nexthop support on FreeBSD
Luiz Amaral [Thu, 20 Apr 2023 23:37:30 +0000 (01:37 +0200)] 
BSD: IPv4 over IPv6 nexthop support on FreeBSD

The support for IPv4 routes with IPv6 nexthops was implemented in FreeBSD
13.1, this patch allows to import and export such routes from/to kernel.

Minor change from committer.

12 months agoLinpool: Fix lp_restore()
Maria Matejka [Thu, 20 Apr 2023 17:33:00 +0000 (19:33 +0200)] 
Linpool: Fix lp_restore()

When lp_save() is called on an empty linpool, then some allocation is
done, then lp_restore() is called, the linpool is restored but the used
chunks are inaccessible. Fix it.

12 months agoBMP: Silence some log messages
Ondrej Zajicek [Thu, 20 Apr 2023 15:14:45 +0000 (17:14 +0200)] 
BMP: Silence some log messages

Hooks called from BGP to BMP should not log warning when BMP is not
connected, that is not an error (and we do not want to flood logs with
a ton of messages).

Blocked sk_send() should not log warning, that is expected situation.
Error during sk_send() is handled in error hook anyway.

12 months agoBMP: Fix connection management
Ondrej Zajicek [Thu, 20 Apr 2023 14:13:58 +0000 (16:13 +0200)] 
BMP: Fix connection management

Replace broken TCP connection management with a simple state machine.
Handle failed attempts properly with a timeout, detect and handle TCP
connection close and try to reconnect after that. Remove useless
'station_connected' flag.

Keep open messages saved even after the BMP session establishment,
so they can be used after BMP session flaps.

Use proper log messages for session events.

13 months agoBMP: Fix reconfiguration
Ondrej Zajicek [Tue, 18 Apr 2023 16:57:54 +0000 (18:57 +0200)] 
BMP: Fix reconfiguration

It is not supported, but at least it must update internal config
pointer to not keep old one.

13 months agoBMP: Allow build without BMP and disable BMP build by default
Ondrej Zajicek [Tue, 18 Apr 2023 15:21:13 +0000 (17:21 +0200)] 
BMP: Allow build without BMP and disable BMP build by default

It has still several important issues to be enabled by default.

13 months agoBMP: Move initialization to bmp_start()
Ondrej Zajicek [Tue, 18 Apr 2023 13:13:24 +0000 (15:13 +0200)] 
BMP: Move initialization to bmp_start()

That fixes BMP socket allocation from an invalid pool.

13 months agoBMP: Fix missing template
Ondrej Zajicek [Tue, 18 Apr 2023 13:09:21 +0000 (15:09 +0200)] 
BMP: Fix missing template

It is mandatory for protocol.

13 months agoBMP: Add some missing bmp_buffer_free() calls
Ondrej Zajicek (work) [Thu, 15 Apr 2021 16:32:47 +0000 (18:32 +0200)] 
BMP: Add some missing bmp_buffer_free() calls

They were inadvertently removed during recent code refactoring.

Thanks to Dawid Macek for the bugreport and patch.

13 months agoBMP: Remove duplicate functions for update encoding
Ondrej Zajicek (work) [Mon, 29 Mar 2021 02:43:04 +0000 (04:43 +0200)] 
BMP: Remove duplicate functions for update encoding

Use existing BGP functions also for BMP update encoding.

13 months agoBMP: Integrate bmp_conn to bmp_proto
Ondrej Zajicek (work) [Sun, 28 Mar 2021 14:41:53 +0000 (16:41 +0200)] 
BMP: Integrate bmp_conn to bmp_proto

There is only one socket per BMP instance, no need to have separate
struct (like in BGP).

13 months agoBMP: Minor cleanups
Ondrej Zajicek (work) [Sun, 28 Mar 2021 13:36:59 +0000 (15:36 +0200)] 
BMP: Minor cleanups

Remove redundant 'disable' option, simplify IP address serialization,
and remove useless macros.

13 months agoBMP: Do not use global instance ptr internally
Ondrej Zajicek (work) [Sun, 28 Mar 2021 13:13:23 +0000 (15:13 +0200)] 
BMP: Do not use global instance ptr internally

Use local variable to refence relevant instance instead of using global
instance ptr. Also, use 'p' variable instead of 'bmp' so we can use
common macros like TRACE().

13 months agoBMP: Remove superfluous error handling
Ondrej Zajicek (work) [Sun, 28 Mar 2021 02:30:11 +0000 (04:30 +0200)] 
BMP: Remove superfluous error handling

Most error handling code was was for cases that cannot happen,
or they would be code bugs (and should use ASSERT()). Keep error
handling for just for I/O errors, like in rest of BIRD.

13 months agoBMP protocol support
Pawel Maslanka [Mon, 29 Mar 2021 20:45:21 +0000 (22:45 +0200)] 
BMP protocol support

Initial implementation of a basic subset of the BMP (BGP Monitoring
Protocol, RFC 7854) from Akamai team. Submitted for further review
and improvement.

13 months agoBGP: Add 'allow bgp_med' option for EBGP sessions
Trisha Biswas [Fri, 14 Apr 2023 02:28:37 +0000 (04:28 +0200)] 
BGP: Add 'allow bgp_med' option for EBGP sessions

This option allows to treat bgp_med as regular transitive attribute
on EBGP sessions (without hacks in filters).

Minor changes from committer.

13 months agoIncrease tests timeout
Jakub Ružička [Thu, 13 Apr 2023 18:06:55 +0000 (20:06 +0200)] 
Increase tests timeout

Tests may take longer than 5 s to complete on slow/virtual machines.

13 months agoBGP: Fix bgp_med handling
Ondrej Zajicek [Tue, 4 Apr 2023 03:20:49 +0000 (05:20 +0200)] 
BGP: Fix bgp_med handling

Missing translation from BGP attribute ID to eattr ID in bgp_unset_attr()
broke automatic removal of bgp_med during export to EBGP peers.

Thanks to Edward Sun for the bugreport.

14 months agoAdd missing references to "show route in" in the cli-help and doc.
Johannes Moos [Sat, 18 Mar 2023 14:33:48 +0000 (15:33 +0100)] 
Add missing references to "show route in" in the cli-help and doc.

The feature of showing all prefixes inside the given one has been added
in v2.0.9 but not well documented. Fixing it by this update.

Text in doc and commit message added by commiter.

14 months agoBGP: Free bind applies also to outbound connections
Maria Matejka [Thu, 16 Mar 2023 18:23:19 +0000 (19:23 +0100)] 
BGP: Free bind applies also to outbound connections

Even though the free bind option is primarily meant to alleviate problems
with addresses assigned too late, it's also possible to use BIRD with AnyIP
configuration, assigning whole ranges to the machine. Therefore free bind
allows also to create an outbound connection from specific address even though
such address is not assigned.

14 months agoNet: Replace runtime checks with STATIC_ASSERT()
Ondrej Zajicek [Mon, 6 Mar 2023 10:57:40 +0000 (11:57 +0100)] 
Net: Replace runtime checks with STATIC_ASSERT()

14 months agoPrintf test suite fails on systems with musl libc because tests for "%m"
Petr Vaněk [Mon, 6 Mar 2023 10:19:30 +0000 (11:19 +0100)] 
Printf test suite fails on systems with musl libc because tests for "%m"
and "%M" formats expect "Input/output error" message but musl returns
"I/O error". Proposed change compares the printf output with string
returned from strerror function for EIO constant.

See-also: https://bugs.gentoo.org/836713

Minor change from committer.

14 months agoConfig: Dropping filter instruction trees after linearization
Maria Matejka [Thu, 16 Feb 2023 13:22:23 +0000 (14:22 +0100)] 
Config: Dropping filter instruction trees after linearization

14 months agoLinpool flush drops all the allocated pages but one
Maria Matejka [Wed, 22 Feb 2023 13:45:20 +0000 (14:45 +0100)] 
Linpool flush drops all the allocated pages but one

When a linpool is used to allocate a one-off big load of memory, it
makes no sense to keep that amount of memory for future use inside the
linpool. Contrary to previous implementations where the memory was
directly free()d, we now use the page allocator which has an internal
cache which keeps the released pages for us and subsequent allocations
simply get these released pages back.

And even if the page cleanup routine kicks in inbetween, the pages get
only madvise()d, not munmap()ed so performance aspects are negligible.

This may fix some memory usage peaks in extreme cases.

14 months agoBGP: Update RFC references
Ondrej Zajicek [Sun, 19 Feb 2023 14:35:07 +0000 (15:35 +0100)] 
BGP: Update RFC references

14 months agoBabel: Update RFC references
Ondrej Zajicek [Sun, 19 Feb 2023 14:34:43 +0000 (15:34 +0100)] 
Babel: Update RFC references

14 months agoConf: Fix too early free of old configuration
Ondrej Zajicek [Sun, 19 Feb 2023 02:59:10 +0000 (03:59 +0100)] 
Conf: Fix too early free of old configuration

The change 371eb49043d225d2bab8149187b813a14b4b86d2 introduced early free
of old_config. Unfortunately, it did not properly check whether it is not
still in use (blocked by obstacle during reconfiguration). Fix that.

It also means that we still could have a short peak when three configs
are in use (when a new reconfig is requeste while the previous one is
still active).

15 months agoBabel: Keep separate auth PC counters for unicast and multicast
Toke Høiland-Jørgensen [Tue, 14 Feb 2023 17:18:32 +0000 (18:18 +0100)] 
Babel: Keep separate auth PC counters for unicast and multicast

The babel protocol normally sends all its messages as multicast packets,
but the protocol specification allows most messages to be sent as either
unicast or multicast, and the two can be mixed freely. In particular, the
babeld implementation can be configured to unicast updates to all peers
instead of sending them as unicast.

Daniel discovered that this can cause problems with the packet counter
checks in the MAC extension due to packet reordering. This happens on WiFi
networks where clients have power save enabled (which is quite common in
infrastructure networks): in this case, the access point will buffer all
multicast traffic and only send it out along with its beacons, leading to a
maximum buffering in default Linux-based access point configuration of up
to 200 ms.

This means that a Babel sender that mixes unicast and multicast messages
can have the unicast messages overtake the multicast messages because of
this buffering; when authentication is enabled, this causes the receiver to
discard the multicast message when it does arrive because it now has a
packet counter value less than the unicast message that arrived before it.
Daniel observed that this happens frequently enough that Babel ceases to
work entirely when runner over a WiFi network.

The issue has been described in draft-ietf-babel-mac-relaxed, which is
currently pending RFC publication. That also describes two mitigation
mechanisms: Keeping separate PC counters for unicast and multicast, and
using a reorder window for PC values. This patch implements the former as
that is the simplest, and resolves the particular issue seen on WiFi.

Thanks to Daniel Gröber for the bugreport.

Minor changes from committer.

15 months agoBabel: Implement IPv4 via IPv6 extension (RFC 9229)
Andreas Rammhold [Tue, 14 Feb 2023 15:17:03 +0000 (16:17 +0100)] 
Babel: Implement IPv4 via IPv6 extension (RFC 9229)

The patch implements an IPv4 via IPv6 extension (RFC 9229) to the Babel
routing protocol (RFC 8966) that allows annoncing routes to an IPv4
prefix with an IPv6 next hop, which makes it possible for IPv4 traffic
to flow through interfaces that have not been assigned an IPv4 address.

The implementation is compatible with the current Babeld version.

Thanks to Toke Høiland-Jørgensen for early review on this work.

Minor changes from committer.

15 months agoDocumentation: Adding roadmap as decided in January 2023
Maria Matejka [Fri, 3 Feb 2023 08:12:34 +0000 (09:12 +0100)] 
Documentation: Adding roadmap as decided in January 2023

15 months agoBuild: Partial revert of one of previous changes
Ondrej Zajicek [Wed, 1 Feb 2023 18:30:21 +0000 (19:30 +0100)] 
Build: Partial revert of one of previous changes

There are many compatibility issues with echo -e, scratch that.

15 months agoBuild: Minor improvement to build output
Ondrej Zajicek [Wed, 1 Feb 2023 16:46:48 +0000 (17:46 +0100)] 
Build: Minor improvement to build output

15 months agoNest: Minor cleanup in buildsystem
Ondrej Zajicek [Wed, 1 Feb 2023 15:15:13 +0000 (16:15 +0100)] 
Nest: Minor cleanup in buildsystem

There ware missing dependencies for proto-build.c generation, which
sometimes lead to failed builds, and ignores changes in the set of
built protocols. Fix that, and also improve formatting of proto-build.c

15 months agoBabel: Initialise source seqno from incoming message
Toke Høiland-Jørgensen [Tue, 31 Jan 2023 14:52:14 +0000 (15:52 +0100)] 
Babel: Initialise source seqno from incoming message

When creating a new babel_source object we initialise the seqno to 0. The
caller will update the source object with the right metric and seqno value,
for both newly created and old source objects. However if we initialise the
source object seqno to 0 that may actually turn out to be a valid (higher)
seqno than the one in the routing table, because of seqno wrapping. In this
case the source metric will not be set properly, which breaks feasibility
tracking for subsequent updates.

To fix this, add a new initial_seqno argument to babel_get_source() which
is used when allocating a new object, and set that to the seqno value of
the update we're sending.

Thanks to Juliusz Chroboczek for the bugreport.

15 months agoBabel: Improve clarity of unfeasible update handling.
Ondrej Zajicek [Mon, 30 Jan 2023 22:49:20 +0000 (23:49 +0100)] 
Babel: Improve clarity of unfeasible update handling.

Add a comment and (unnecessary) check to make correctness obvious.

15 months agoBabel: Fix missing modulo comparison of seqnos
Toke Høiland-Jørgensen [Mon, 30 Jan 2023 22:36:39 +0000 (23:36 +0100)] 
Babel: Fix missing modulo comparison of seqnos

Juliusz noticed there were a couple of places we were doing straight
inequality comparisons of seqnos in Babel. This is wrong because seqnos can
wrap: so we need to use the modulo-64k comparison function for these cases
as well.

Introduce a strict-inequality version of the modulo-comparison for this
purpose.

15 months agoSmall fix of indenting
Alexander Zubkov [Mon, 23 Jan 2023 13:23:00 +0000 (14:23 +0100)] 
Small fix of indenting

15 months agoNEWS and version update v2.0.12
Ondrej Zajicek [Mon, 23 Jan 2023 01:23:19 +0000 (02:23 +0100)] 
NEWS and version update

15 months agoBFD: Improve incoming packet matching
Ondrej Zajicek [Sun, 22 Jan 2023 22:42:08 +0000 (23:42 +0100)] 
BFD: Improve incoming packet matching

For active sessions, ignore received packets with zero local id and
mismatched remote id. That forces a session timeout instead of an
immediate session restart. It makes BFD sessions more resilient to
packet spoofing.

Thanks to André Grüneberg for the suggestion.

15 months agoVRF: Fix issues with reconfiguration
Ondrej Zajicek [Sun, 22 Jan 2023 17:12:04 +0000 (18:12 +0100)] 
VRF: Fix issues with reconfiguration

Protocols receive if_notify() announcements that are filtered according
to their VRF setting, but during reconfiguration, they access iface_list
directly and forgot to check VRF setting here, which leads to all
interfaces be addedd.

Fix this issue for Babel, OSPF, RAdv and RIP protocols.

Thanks to Marcel Menzel for the bugreport.

15 months agoAdded test case for switch bug fixed in e20bef69ccc4a85ef62359ee539c9db2dbe09127
Maria Matejka [Sun, 22 Jan 2023 11:55:31 +0000 (12:55 +0100)] 
Added test case for switch bug fixed in e20bef69ccc4a85ef62359ee539c9db2dbe09127

15 months agoBGP: Add received role value to role mismatch log message
Ondrej Zajicek [Fri, 20 Jan 2023 14:55:47 +0000 (15:55 +0100)] 
BGP: Add received role value to role mismatch log message

16 months agoAlloc: Minor cleanups
Ondrej Zajicek [Wed, 18 Jan 2023 12:40:21 +0000 (13:40 +0100)] 
Alloc: Minor cleanups

 - Fix THP disable on old systems
 - Failed syscalls should use die() instead of bug()
 - Our printf uses %ld for s64 instead of long

16 months agoMerge branch 'master' of https://gitlab.nic.cz/labs/bird
Maria Matejka [Wed, 18 Jan 2023 11:33:06 +0000 (12:33 +0100)] 
Merge branch 'master' of https://gitlab.nic.cz/labs/bird

16 months agoFix memory pre-allocation
Maria Matejka [Wed, 18 Jan 2023 08:39:45 +0000 (09:39 +0100)] 
Fix memory pre-allocation

When BIRD has no free memory mapped, it allocates several pages in
advance just to be sure that there is some memory available if needed.
This hysteresis tactics works quite well to reduce memory ping-ping with
kernel.

Yet it had a subtle bug: this pre-allocation didn't take a memory
coldlist into account, therefore requesting new pages from kernel even
in cases when there were other pages available. This led to slow memory
bloating.

To demonstrate this behavior fast enough to be seen well, you may:
  * temporarily set the values in sysdep/unix/alloc.c as follows to
    exacerbate the issue:
      #define KEEP_PAGES_MAIN_MAX    4096
      #define KEEP_PAGES_MAIN_MIN    1000
      #define CLEANUP_PAGES_BULK     4096
  * create a config file with several millions of static routes
  * periodically disable all static protocols and then reload config
  * log memory consumption

This should give you a steady growth rate of about 16kB per cycle. If
you don't set the values this high, the issue happens much more slowly,
yet after 14 days of running, you are going to see an OOM kill.

After this fix, pre-allocation uses the memory coldlist to get some hot
pages and the same test as described here gets you a perfectly stable
constant memory consumption (after some initial wobbling).

Thanks to NIX-CZ for reporting and helping to investigate this issue.
Thanks to Santiago for finding the cause in the code.

16 months agoFilter: Allow setting the 'onlink' route attribute in filters
Radu Carpa [Tue, 17 Jan 2023 17:13:37 +0000 (18:13 +0100)] 
Filter: Allow setting the 'onlink' route attribute in filters

Add static route attribute to set onlink flag for route next hop. Can be
used to build a dynamically routed IP-in-IP overlay network. Usage:

     ifname = "tunl0";
     onlink = true;
     gw = bgp_next_hop;

16 months agoAlloc: Disable transparent huge pages
Ondrej Zajicek [Tue, 17 Jan 2023 16:13:50 +0000 (17:13 +0100)] 
Alloc: Disable transparent huge pages

The usage pattern implemented in allocator seems to be incompatible with
transparent huge pages, as memory released using madvise(MADV_DONTNEED)
with regular page size and alignment does not seem to trigger demotion
of huge pages back to regular pages, even when significant number of
pages is released. Even if demotion is triggered when system memory
is low, it still breaks memory accounting.

16 months agoBuild: Fix cleanup of nest/proto-build.c
Ondrej Zajicek [Fri, 13 Jan 2023 15:44:42 +0000 (16:44 +0100)] 
Build: Fix cleanup of nest/proto-build.c