]> git.ipfire.org Git - thirdparty/bird.git/log
thirdparty/bird.git
2 years 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).

2 years agoInterface subsystem locking
Maria Matejka [Tue, 4 Apr 2023 14:41:55 +0000 (16:41 +0200)] 
Interface subsystem locking

2 years agoProto: published protocol-loop connections
Maria Matejka [Sun, 2 Apr 2023 17:34:22 +0000 (19:34 +0200)] 
Proto: published protocol-loop connections

2 years agoProtocol shutdown/restart from limits is respecting the loops
Maria Matejka [Mon, 6 Feb 2023 14:06:12 +0000 (15:06 +0100)] 
Protocol shutdown/restart from limits is respecting the loops

2 years agoMerge commit '0bb04d5390f21b0c96fc4894ba5d5510c541f0ef' into HEAD
Maria Matejka [Tue, 7 Feb 2023 13:27:23 +0000 (14:27 +0100)] 
Merge commit '0bb04d5390f21b0c96fc4894ba5d5510c541f0ef' into HEAD

2 years agoBGP: opening and closing listening socket asynchronously
Maria Matejka [Sun, 5 Feb 2023 18:54:06 +0000 (19:54 +0100)] 
BGP: opening and closing listening socket asynchronously

2 years agoMacro: stringify
Maria Matejka [Thu, 2 Feb 2023 12:27:10 +0000 (13:27 +0100)] 
Macro: stringify

2 years agoLists: fixed bugs in expensive checks in quirky usecases
Maria Matejka [Thu, 2 Feb 2023 12:26:49 +0000 (13:26 +0100)] 
Lists: fixed bugs in expensive checks in quirky usecases

2 years agoInterface updates are asynchronous
Maria Matejka [Tue, 31 Jan 2023 12:07:46 +0000 (13:07 +0100)] 
Interface updates are asynchronous

Instead of propagating interface updates as they are loaded from kernel,
they are enqueued and all the notifications are called from a
protocol-specific event. This change allows to break the locking loop
between protocols and interfaces.

Anyway, this change is based on v2 branch to keep the changes between v2
and v3 smaller.

2 years agoProto: Adding a list of associated neighbors
Maria Matejka [Wed, 1 Feb 2023 11:10:34 +0000 (12:10 +0100)] 
Proto: Adding a list of associated neighbors

This makes for safer and faster pruning and notifying as protocol now on
its shutdown prunes only its neighbors and nothing else.

2 years agoTyped lists: shortcut for simple nodes
Maria Matejka [Tue, 31 Jan 2023 13:30:35 +0000 (14:30 +0100)] 
Typed lists: shortcut for simple nodes

2 years agoMoved interface list flush to device protocol cleanup hook.
Maria Matejka [Tue, 31 Jan 2023 12:11:55 +0000 (13:11 +0100)] 
Moved interface list flush to device protocol cleanup hook.

The interface list must be flushed when device protocol is stopped. This
was done in a hardcoded specific hook inside generic protocol routines.
The cleanup hook was originally used for table reference counting late
cleanup, yet it can be also simply used for prettier interface list flush.

2 years agoObject locks use events
Maria Matejka [Tue, 24 Jan 2023 10:01:34 +0000 (11:01 +0100)] 
Object locks use events

Instead of calling custom hooks from object locks, we use standard event
sending mechanism to inform protocols about object lock changes. This is
a backport from version 3 where these events are passed across threads.

This implementation of object locks doesn't use mutexes to lock the
whole data structure. In version 3, this data structure may get accessed
from multiple threads and must be protected by mutex.

2 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

2 years agoObject locks use events
Maria Matejka [Tue, 24 Jan 2023 10:01:34 +0000 (11:01 +0100)] 
Object locks use events

Instead of calling custom hooks from object locks, we use standard event
sending mechanism to inform protocols about object lock changes. As
event sending is lockless, the unlocking protocol simply enqueues the
appropriate event to the given loop when the locking is done.

2 years agoMerge v2.0.12 into thread-next
Maria Matejka [Tue, 24 Jan 2023 08:45:50 +0000 (09:45 +0100)] 
Merge v2.0.12 into thread-next

2 years agoMerge commit '3186ffe79714a48542d5ad61a94c81216b522fd0' into thread-next
Maria Matejka [Tue, 24 Jan 2023 08:45:40 +0000 (09:45 +0100)] 
Merge commit '3186ffe79714a48542d5ad61a94c81216b522fd0' into thread-next

2 years agoMerge commit '6bb992cb04926895be57dc97e7d569ea15a07db1' into thread-next
Maria Matejka [Tue, 24 Jan 2023 08:44:43 +0000 (09:44 +0100)] 
Merge commit '6bb992cb04926895be57dc97e7d569ea15a07db1' into thread-next

2 years agoMerge commit '9dc9124c' into thread-next
Maria Matejka [Tue, 24 Jan 2023 08:21:34 +0000 (09:21 +0100)] 
Merge commit '9dc9124c' into thread-next

2 years agoRevert "Filter: Allow setting the 'onlink' route attribute in filters"
Maria Matejka [Tue, 24 Jan 2023 08:20:36 +0000 (09:20 +0100)] 
Revert "Filter: Allow setting the 'onlink' route attribute in filters"

This reverts commit 7144c9ca46f092da33a4e051bbce8f973a3bd8c4.

The onlink attribute implementation collides with the nexthop attribute
behavior in v3; keeping it aside until finding out how to reimplement it
correctly.

2 years agoMerge commit '928a1cb034e6f9e8edcdd1dc07264cd703e00827' into thread-next
Maria Matejka [Mon, 23 Jan 2023 18:51:24 +0000 (19:51 +0100)] 
Merge commit '928a1cb034e6f9e8edcdd1dc07264cd703e00827' into thread-next

2 years agoMerge commit '7fb23041a52d01754c53ba963e2282e524813364' into thread-next
Maria Matejka [Mon, 23 Jan 2023 18:46:26 +0000 (19:46 +0100)] 
Merge commit '7fb23041a52d01754c53ba963e2282e524813364' into thread-next

2 years agoMerge commit 'd1cd5e5a63b2256eb71661f7438537e4ded7b01a' into thread-next
Maria Matejka [Mon, 23 Jan 2023 18:42:12 +0000 (19:42 +0100)] 
Merge commit 'd1cd5e5a63b2256eb71661f7438537e4ded7b01a' into thread-next

2 years agoMerge commit 'b28431e557c4f63923476094a919a0630001275e' into thread-next
Maria Matejka [Mon, 23 Jan 2023 18:36:22 +0000 (19:36 +0100)] 
Merge commit 'b28431e557c4f63923476094a919a0630001275e' into thread-next

2 years agoMerge commit 'd3f50ede127df338f575e188566035b2a46cf6c6' into thread-next
Maria Matejka [Mon, 23 Jan 2023 18:05:41 +0000 (19:05 +0100)] 
Merge commit 'd3f50ede127df338f575e188566035b2a46cf6c6' into thread-next

2 years agoMerge commit '6d1ae197d189d50e60279796441c6e74272ddc54' into thread-next
Maria Matejka [Mon, 23 Jan 2023 18:03:16 +0000 (19:03 +0100)] 
Merge commit '6d1ae197d189d50e60279796441c6e74272ddc54' into thread-next

2 years agoMerge commit '8b06a4d8af46511f0f8dbb8905afa88590a831b6' into thread-next
Maria Matejka [Mon, 23 Jan 2023 17:57:13 +0000 (18:57 +0100)] 
Merge commit '8b06a4d8af46511f0f8dbb8905afa88590a831b6' into thread-next

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

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

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

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

2 years agoMerge commit '2b7643e1f8ecb0bd4cf9af4183b4fd53b655d19c' into thread-next
Maria Matejka [Sun, 22 Jan 2023 12:19:22 +0000 (13:19 +0100)] 
Merge commit '2b7643e1f8ecb0bd4cf9af4183b4fd53b655d19c' into thread-next

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

2 years agoMerge commit '1e47b9f203aaaad0fb658d40a1670f1d0437f1f8' into thread-next
Maria Matejka [Sat, 21 Jan 2023 22:49:52 +0000 (23:49 +0100)] 
Merge commit '1e47b9f203aaaad0fb658d40a1670f1d0437f1f8' into thread-next

2 years agoMerge commit 'e48f898fdaf06b61754ae520410729a9984ab65b' into thread-next
Maria Matejka [Sat, 21 Jan 2023 22:46:45 +0000 (23:46 +0100)] 
Merge commit 'e48f898fdaf06b61754ae520410729a9984ab65b' into thread-next

2 years agoMerge commit 'a80cd4707464cedb526eb72e7704b097af20beb7' into thread-next
Maria Matejka [Sat, 21 Jan 2023 22:46:33 +0000 (23:46 +0100)] 
Merge commit 'a80cd4707464cedb526eb72e7704b097af20beb7' into thread-next

2 years agoMerge commit '3859e4efc1597368df647323c5a3cc1771cb64ca' into thread-next
Maria Matejka [Sat, 21 Jan 2023 22:45:13 +0000 (23:45 +0100)] 
Merge commit '3859e4efc1597368df647323c5a3cc1771cb64ca' into thread-next

2 years agoMerge commit 'e80156d9363a594ff23524f56d59f0eee160859d' into thread-next
Maria Matejka [Sat, 21 Jan 2023 22:45:04 +0000 (23:45 +0100)] 
Merge commit 'e80156d9363a594ff23524f56d59f0eee160859d' into thread-next

2 years agoAdding forgotten pthread.h #include in io-loop.h (breaks at openbsd 7.1)
Maria Matejka [Sat, 21 Jan 2023 22:42:02 +0000 (23:42 +0100)] 
Adding forgotten pthread.h #include in io-loop.h (breaks at openbsd 7.1)

2 years agoMerge commit 'a50d2fa65f3350ee55f5106b87a884d1b98e7761' into thread-next
Maria Matejka [Sat, 21 Jan 2023 21:57:12 +0000 (22:57 +0100)] 
Merge commit 'a50d2fa65f3350ee55f5106b87a884d1b98e7761' into thread-next

2 years agoMerge commit '543c8ba0971e91da3fe507dbfc1e1f9b556642b1' into thread-next
Maria Matejka [Sat, 21 Jan 2023 21:32:29 +0000 (22:32 +0100)] 
Merge commit '543c8ba0971e91da3fe507dbfc1e1f9b556642b1' into thread-next

2 years agoFixed various build problems on FreeBSD and/or CLang
Maria Matejka [Fri, 20 Jan 2023 13:07:38 +0000 (14:07 +0100)] 
Fixed various build problems on FreeBSD and/or CLang

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

2 years agoMerge commit '140c534fb81d0e165b7d674e869c646455ed19d1' into thread-next
Maria Matejka [Thu, 19 Jan 2023 12:24:12 +0000 (13:24 +0100)] 
Merge commit '140c534fb81d0e165b7d674e869c646455ed19d1' into thread-next

2 years agoDecoupling loops from threads to allow fixed thread count
Maria Matejka [Thu, 19 Jan 2023 09:49:47 +0000 (10:49 +0100)] 
Decoupling loops from threads to allow fixed thread count

On large configurations, too many threads would spawn with one thread
per loop. Therefore, threads may now run multiple loops at once. The
thread count is configurable and may be changed during run. All threads
are spawned on startup.

This change helps with memory bloating. BIRD filters need large
temporary memory blocks to store their stack and also memory management
keeps its hot page storage per-thread.

Known bugs:
* Thread autobalancing is not yet implemented.
* Low latency loops are executed together with standard loops.

2 years agoTable prune routine doesn't walk over lists unless needed.
Maria Matejka [Thu, 19 Jan 2023 09:56:16 +0000 (10:56 +0100)] 
Table prune routine doesn't walk over lists unless needed.

If no channel is flushing, table prune doesn't walk over routes in nets
and also doesn't walk over importing channel lists. This helps to
alleviate the memory caching burdens a lot.

2 years agoCLI closing fix when its action is run asynchronously.
Maria Matejka [Thu, 19 Jan 2023 09:53:09 +0000 (10:53 +0100)] 
CLI closing fix when its action is run asynchronously.

Some CLI actions, notably "show route", are run by queuing an event
somewhere else. If the user closes the socket, in case such an action is
being executed, the CLI must free the socket immediately from the error
hook but the pool must remain until the asynchronous event finishes and
cleans everything up.

2 years agoRemoved config reparsing from unrelated tests
Maria Matejka [Wed, 18 Jan 2023 13:31:11 +0000 (14:31 +0100)] 
Removed config reparsing from unrelated tests

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

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

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

2 years 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;

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

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

2 years agoMinor cleanups
Ondrej Zajicek [Fri, 13 Jan 2023 12:32:29 +0000 (13:32 +0100)] 
Minor cleanups

2 years agoBSD: Add support for kernel route metric
Ondrej Zajicek [Fri, 13 Jan 2023 12:17:46 +0000 (13:17 +0100)] 
BSD: Add support for kernel route metric

Add support for kernel route metric/priority, exported as krt_metric
attribute, like in Linux. This should also fix issues with overwriting
or removing system routes.

2 years agoLog message before aborting
Mike Crute [Thu, 12 Jan 2023 16:40:53 +0000 (17:40 +0100)] 
Log message before aborting

Log message before aborting due to watchdog timeout. We have to use
async-safe write to debug log, as it is done in signal handler.

Minor changes from committer.

2 years agoFilter: Change linearization of branches in switch instruction
Ondrej Zajicek [Sat, 7 Jan 2023 19:18:44 +0000 (20:18 +0100)] 
Filter: Change linearization of branches in switch instruction

Most branching instructions (FI_CONDITION, FI_AND, FI_OR) linearize its
branches in a recursive way, while FI_SWITCH branches are linearized
from parser even before the switch instruction is allocated.

Change linearization of FI_SWITCH branches to make it similar to other
branching instructions. This also fixes an issue with constant
switch evaluation, where linearized branch is mistaken for
non-linearized during switch construction.

Thanks to Jiten Kumar Pathy for the bugreport.

2 years agoBGP: Allow role specific keywords to be used as symbols
Ondrej Zajicek [Tue, 3 Jan 2023 18:09:51 +0000 (19:09 +0100)] 
BGP: Allow role specific keywords to be used as symbols

Some of these new BGP role keywords use generic names that collides with
user-defined symbols. Allow them to be redefined. Also remove duplicit
keyword definition for 'prefer'.

2 years agoConfigure: Expensive check option was broken, never worked
Ondrej Zajicek [Tue, 3 Jan 2023 16:14:48 +0000 (17:14 +0100)] 
Configure: Expensive check option was broken, never worked

2 years agoNest: Fix leaking internal attributes in RIP and Babel
Ondrej Zajicek [Tue, 3 Jan 2023 16:01:54 +0000 (17:01 +0100)] 
Nest: Fix leaking internal attributes in RIP and Babel

During backporting attribute changes from 3.0-branch, some internal
attributes (RIP iface and Babel seqno) leaked to 'show route all' output.
Allow protocols to hide specific attributes with GA_HIDDEN value.

Thanks to Nigel Kukard for the bugreport.

2 years agoAdd compile-time option to enable 4-way tries instead of 16-way ones
Ondrej Zajicek [Mon, 2 Jan 2023 14:55:55 +0000 (15:55 +0100)] 
Add compile-time option to enable 4-way tries instead of 16-way ones

In some cases 16-way tries are too memory-heavy, while 4-way are
almost as efficient as the original 2-way ones.

2 years agoNest: Fix several issues with pflags
Ondrej Zajicek [Sun, 1 Jan 2023 19:10:23 +0000 (20:10 +0100)] 
Nest: Fix several issues with pflags

There were some confusion about validity and usage of pflags, which
caused incorrect usage after some flags from (now removed) protocol-
specific area were moved to pflags.

We state that pflags:

 - Are secondary data used by protocol-specific hooks
 - Can be changed on an existing route (in contrast to copy-on-write
   for primary data)
 - Are irrelevant for propagation (not propagated when changed)
 - Are specific to a routing table (not propagated by pipe)

The patch did these fixes:

 - Do not compare pflags in rte_same(), as they may keep cached values
   like BGP_REF_STALE, causing spurious propagation.

 - Initialize pflags to zero in rte_get_temp(), avoid initialization in
   protocol code, fixing at least two forgotten initializations (krt
   and one case in babel).

 - Improve documentation about pflags

2 years agoBabel: Rework seqno request handling
Toke Høiland-Jørgensen [Sat, 24 Dec 2022 14:47:11 +0000 (15:47 +0100)] 
Babel: Rework seqno request handling

The seqno request retransmission handling was tracking the destination
that a forwarded request was being sent to and always retransmitting to
that same destination. This is unnecessary because we only need to
retransmit requests we originate ourselves, not those we forward on
behalf of others; in fact retransmitting on behalf of others can lead to
exponential multiplication of requests, which would be bad.

So rework the seqno request tracking so that instead of storing the
destination of a request, we just track whether it was a request that we
forwarded on behalf of another node, or if it was a request we originated
ourselves. Forwarded requests are not retransmitted, they are only used
for duplicate suppression, and for triggering an update when satisfied.
If we end up originating a request that we previously forwarded, we
"upgrade" the old request and restart the retransmit counter.

One complication with this is that requests sent in response to unfeasible
updates (section 3.8.2.2 of the RFC) have to be sent as unicast to a
particular peer. However, we don't really need to retransmit those as
there's no starvation when sending such a request; so we just change
such requests to be one-off unicast requests that are not subject to
retransmission or duplicate suppression. This is the same behaviour as
babeld has for such requests.

Minor changes from committer.

2 years agoBSD: Use ip_mreqn on FreeBSD 12.1+ and OpenBSD 6.9+
Ondrej Zajicek [Sun, 18 Dec 2022 19:10:14 +0000 (20:10 +0100)] 
BSD: Use ip_mreqn on FreeBSD 12.1+ and OpenBSD 6.9+

2 years agoFreeBSD: use interface index instead of IP address when specifying multicast interface
Alexander Chernikov [Fri, 16 Dec 2022 18:35:02 +0000 (19:35 +0100)] 
FreeBSD: use interface index instead of IP address when specifying multicast interface

Minor changes from committer.

2 years agoNetlink: move OS-specific headers and defines to sysdep
Alexander Chernikov [Fri, 16 Dec 2022 18:20:05 +0000 (19:20 +0100)] 
Netlink: move OS-specific headers and defines to sysdep

Minor changes from committer.

2 years agoBSD: Add missing makefile for bsd-netlink target
Ondrej Zajicek [Fri, 16 Dec 2022 18:03:41 +0000 (19:03 +0100)] 
BSD: Add missing makefile for bsd-netlink target

Use symlinks to linux/netlink* to avoid limitations of our buildsystem.

2 years agoNEWS and version update v2.0.11
Ondrej Zajicek [Sun, 11 Dec 2022 16:28:14 +0000 (17:28 +0100)] 
NEWS and version update

2 years agoBSD: Workaround for direct routes on FreeBSD 13.0
Ondrej Zajicek [Sun, 11 Dec 2022 15:28:28 +0000 (16:28 +0100)] 
BSD: Workaround for direct routes on FreeBSD 13.0

FreeBSD 13.0 added some safechecks for syscalls, rejecting sockaddrs that
are too small, later versions loosen up the check.

2 years agoBGP: Log unacceptable hold time as decimal number
Ondrej Zajicek [Sat, 10 Dec 2022 17:03:41 +0000 (18:03 +0100)] 
BGP: Log unacceptable hold time as decimal number

Thanks Johannes Moos for the suggestion.

2 years agoCLI: Fix for long-lived sessions during high loads
Ondrej Zajicek [Sat, 10 Dec 2022 16:32:42 +0000 (17:32 +0100)] 
CLI: Fix for long-lived sessions during high loads

When there is a continuos stream of CLI commands, cli_get_command()
always returns 1 (there is a new command). Anyway, the socket receive
buffer was reset only when there was no command at all, leading to a
strange behavior: after a while, the CLI receive buffer came to its end,
then read() was called with zero size buffer, it returned 0 which was
interpreted as EOF.

The patch fixes that by resetting the buffer position after each command
and moving remaining data at the beginning of buffer.

Thanks to Maria Matejka for examining the bug and for the original bugfix.

2 years agoClient: Unknown command should return nonzero errorcode
Ondrej Zajicek [Sat, 10 Dec 2022 02:02:26 +0000 (03:02 +0100)] 
Client: Unknown command should return nonzero errorcode

2 years agoDoc: Document issue with import tables
Ondrej Zajicek [Fri, 9 Dec 2022 21:43:27 +0000 (22:43 +0100)] 
Doc: Document issue with import tables

The import table does not work reliably together with re-evaluation of
routes due to recursive next hops or flowspec validation. We will at
least document that here, as import tables are completely redesigned and
this issue is fixed in BIRD 3.x branch.

2 years agoNetlink on FreeBSD support
Alexander V. Chernikov [Fri, 9 Dec 2022 14:59:06 +0000 (15:59 +0100)] 
Netlink on FreeBSD support

Netlink support was added to FreeBSD recently. It is not as full-featured
as its Linux counterpart yet, however the added subset is enough to make
a routing daemon work. Specifically, it supports multiple tables,
multipath, nexthops and nexthops groups. No MPLS support yet.

The attached change adds 'bsd-netlink’ sysconf target, allowing to build
both netlink & rtsock versions on FreeBSD.

2 years agoBGP: Improve handling of hold and keepalive timers
Ondrej Zajicek [Fri, 9 Dec 2022 04:51:30 +0000 (05:51 +0100)] 
BGP: Improve handling of hold and keepalive timers

The effective keepalive time now scales relative to the negotiated
hold time, to maintain proportion between the keepalive time and the
hold time. This avoids issues when both keepalive and hold times
were configured, the hold time was negotiated to a smaller value,
but the keepalive time stayed the same.

Add new options 'min hold time' and 'min keepalive time', which reject
session attempts with too small hold time.

Improve validation of config options an their documentation.

Thanks to Alexander Zubkov and Sergei Goriunov for suggestions.

2 years agoNest: Avoid spurious announcements triggered by filtered routes
Ondrej Zajicek [Tue, 6 Dec 2022 18:40:02 +0000 (19:40 +0100)] 
Nest: Avoid spurious announcements triggered by filtered routes

When filtered routes (enabled by 'import keep filtered' option) are
updated, they trigger announcements by rte_announce(). For regular
channels (e.g. type RA_OPTIMAL or RA_ANY) such announcement is just
ignored, but in case of RA_ACCEPTED (BGP peer with 'secondary' option)
it just reannounces the old (and still valid) best route.

The patch ensures that such no-change is ignored even for these channels.

2 years agoCI: Remove docker rebuild phase
Ondrej Zajicek [Wed, 30 Nov 2022 01:45:07 +0000 (02:45 +0100)] 
CI: Remove docker rebuild phase

It is unnnecessary and takes too much time

2 years agoCI: Try new workers
Ondrej Zajicek [Tue, 29 Nov 2022 17:30:16 +0000 (18:30 +0100)] 
CI: Try new workers

2 years agoBSD: Fix krt socket code w.r.t. rte/rta changes
Ondrej Zajicek [Tue, 29 Nov 2022 18:43:38 +0000 (19:43 +0100)] 
BSD: Fix krt socket code w.r.t. rte/rta changes

2 years agoFix build variables for OpenBSD
Ondrej Zajicek [Tue, 29 Nov 2022 02:50:33 +0000 (03:50 +0100)] 
Fix build variables for OpenBSD

2 years agoConf: Make 'configure check' command restricted
Ondrej Zajicek [Wed, 9 Nov 2022 21:02:46 +0000 (22:02 +0100)] 
Conf: Make 'configure check' command restricted

While it does not directly change BIRD state, it can trigger reading
arbitrary files and eating significant memory.

2 years agoConf: Free stored old config before parsing new one
Ondrej Zajicek [Wed, 9 Nov 2022 20:09:16 +0000 (21:09 +0100)] 
Conf: Free stored old config before parsing new one

BIRD keeps a previous (old) configuration for the purpose of undo. The
existing code frees it after a new configuration is successfully parsed
during reconfiguration. That causes memory usage spikes as there are
temporarily three configurations (old, current, and new). The patch
changes it to free the old one before parsing the new one (as user
already requested a new config). The disadvantage is that undo is
not available after failed reconfiguration.

2 years agoAdded more netlab tests for automatic run.
Maria Matejka [Tue, 8 Nov 2022 09:20:55 +0000 (10:20 +0100)] 
Added more netlab tests for automatic run.

This commit uses bird-tools in version
f35e8bce829f4bff61ec7eb07ec9c67aa867bc9a

2 years agoMerge remote-tracking branch 'origin/master' into thread-next
Maria Matejka [Mon, 7 Nov 2022 15:52:27 +0000 (16:52 +0100)] 
Merge remote-tracking branch 'origin/master' into thread-next

2 years agoMerge commit '37b64441' into thread-next
Maria Matejka [Mon, 7 Nov 2022 09:28:01 +0000 (10:28 +0100)] 
Merge commit '37b64441' into thread-next

2 years agoMerge commit '32425297' into thread-next
Maria Matejka [Mon, 7 Nov 2022 09:25:52 +0000 (10:25 +0100)] 
Merge commit '32425297' into thread-next

2 years agoMerge commit '8f79e6b9' into thread-next
Maria Matejka [Mon, 7 Nov 2022 09:24:56 +0000 (10:24 +0100)] 
Merge commit '8f79e6b9' into thread-next

2 years agoMerge commit '8478de88' into thread-next
Maria Matejka [Mon, 7 Nov 2022 09:09:40 +0000 (10:09 +0100)] 
Merge commit '8478de88' into thread-next

2 years agoMerge commit '54430df9' into thread-next
Maria Matejka [Mon, 7 Nov 2022 09:09:01 +0000 (10:09 +0100)] 
Merge commit '54430df9' into thread-next

2 years agoMerge commit '0f2be469' into thread-next
Maria Matejka [Mon, 7 Nov 2022 08:51:21 +0000 (09:51 +0100)] 
Merge commit '0f2be469' into thread-next

2 years agoPage allocator: Fixed minor bugs and added commentary
Maria Matejka [Thu, 3 Nov 2022 11:38:57 +0000 (12:38 +0100)] 
Page allocator: Fixed minor bugs and added commentary

2 years agoMemory pages are not munmapped, instead we just madvise()
Maria Matejka [Tue, 1 Nov 2022 17:40:56 +0000 (18:40 +0100)] 
Memory pages are not munmapped, instead we just madvise()

Memory unmapping causes slow address space fragmentation, leading in
extreme cases to failing to allocate pages at all. Removing this problem
by keeping all the pages allocated to us, yet calling madvise() to let
kernel dispose of them.

This adds a little complexity and overhead as we have to keep the
pointers to the free pages, therefore to hold e.g. 1 GB of 4K pages with
8B pointers, we have to store 2 MB of data.

2 years agoMoved config-related allocations to config_pool and showing its size in memory usage
Maria Matejka [Tue, 1 Nov 2022 07:56:26 +0000 (08:56 +0100)] 
Moved config-related allocations to config_pool and showing its size in memory usage

2 years agoDoc: Add documentation for "show route (import|export) table"
Alexander Zubkov [Tue, 18 Oct 2022 02:25:29 +0000 (04:25 +0200)] 
Doc: Add documentation for "show route (import|export) table"

2 years agoFilter: Fix handling of variables in anonymous filters
Ondrej Zajicek [Tue, 18 Oct 2022 01:58:19 +0000 (03:58 +0200)] 
Filter: Fix handling of variables in anonymous filters

Define scope for anonymous filters, and also explicitly distinguish block
scopes and function/filter scopes instead of using anonymous / named
distinction.

Anonymous filters forgot to push scope, so variables for them were in
fact defined in the top scope and therefore they shared a frame. This got
broken after rework of variables, which assumed that there is a named
scope for every function/filter.

2 years agoAttribute blocks are now allocated from slabs instead of malloc()
Maria Matejka [Wed, 12 Oct 2022 16:04:39 +0000 (18:04 +0200)] 
Attribute blocks are now allocated from slabs instead of malloc()

2 years agoRemoved an accidentally merged debug call introduced in 5395880908fdb264b5b78ccc455dc...
Maria Matejka [Wed, 12 Oct 2022 16:02:34 +0000 (18:02 +0200)] 
Removed an accidentally merged debug call introduced in 5395880908fdb264b5b78ccc455dced49eb29915

2 years agoNetlink: Parse onlink flag even on direct routes
Ondrej Zajicek [Wed, 12 Oct 2022 15:57:26 +0000 (17:57 +0200)] 
Netlink: Parse onlink flag even on direct routes

While onlink flag is meaningful only with explicit next hops, it can be
defined also on direct routes. Parse it also in this case to avoid
periodic updates of the same route.

Thanks to Marcin Saklak for the bugreport.

2 years agoGDB connection: resource pools don't keep free pages
Maria Matejka [Wed, 12 Oct 2022 12:23:50 +0000 (14:23 +0200)] 
GDB connection: resource pools don't keep free pages