0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-20 04:15:19 +00:00
Commit Graph

1163 Commits

Author SHA1 Message Date
Maria Matejka
7d8e541057 Linpool state save and restore refactoring 2023-05-06 10:50:31 +02:00
Maria Matejka
91471531a1 Fixed race condition in hostentry allocation 2023-05-03 21:30:29 +02:00
Maria Matejka
ce7495b49a Refactoring of domains connected to pools 2023-04-25 09:52:28 +02:00
Maria Matejka
22f54eaee6 Resource pools are now bound with domains.
Memory allocation is a fragile part of BIRD and we need checking that
everybody is using the resource pools in an appropriate way. To assure
this, all the resource pools are associated with locking domains and
every resource manipulation is thoroughly checked whether the
appropriate locking domain is locked.

With transitive resource manipulation like resource dumping or mass free
operations, domains are locked and unlocked on the go, thus we require
pool domains to have higher order than their parent to allow for this
transitive operations.

Adding pool locking revealed some cases of insecure memory manipulation
and this commit fixes that as well.
2023-04-24 10:33:28 +02:00
Maria Matejka
6230d87c74 Protocols and tables now use the birdloop pools as primary 2023-04-22 21:20:19 +02:00
Maria Matejka
1141ce4e2d Resource pool closing has its dedicated function 2023-04-22 20:49:58 +02:00
Maria Matejka
b3f805ce29 Socket closing has its dedicated function 2023-04-22 20:48:42 +02:00
Maria Matejka
074739e0e9 Global protocol list is typed to avoid typecast confusion 2023-04-22 20:48:42 +02:00
Maria Matejka
787fb56da3 IO: added a specific loop pickup group for BFD; to be done better in future 2023-04-17 13:30:14 +02:00
Maria Matejka
dc75d3e305 Merge commit '231c6385' into thread-next-iface 2023-04-14 14:00:54 +02:00
Maria Matejka
eb978f3a83 Merge commit '0851fcde' into thread-next-iface 2023-04-14 11:37:23 +02:00
Maria Matejka
571c4f69bf More efficient IO loop event execution to avoid long loops
If there are lots of loops in a single thread and only some of the loops
are actually active, the other loops are now kept aside and not checked
until they actually get some timers, events or active sockets.

This should help with extreme loads like 100k tables and protocols.

Also ping and loop pickup mechanism was allowing subtle race
conditions. Now properly handling collisions between loop ping and pickup.
2023-04-04 17:00:59 +02:00
Maria Matejka
d9f0f4af7d Resource dumps also write out block addresses 2023-04-04 17:00:59 +02:00
Maria Matejka
0b7657a9dc Route feed marks only the relevant pending exports as done 2023-04-04 17:00:58 +02:00
Maria Matejka
98f69aa419 Propagated const through route feed routines 2023-04-04 17:00:58 +02:00
Maria Matejka
3a53a12af4 Moved channel export hooks to rt.h as the channel refactoring isn't going to take place soon 2023-04-04 17:00:58 +02:00
Maria Matejka
731ec00840 Allowing to restart a route refresh.
Repeated pipe refeed should not end route refresh as the prune routine
may start pruning otherwise valid routes.

The same applies for BGP repeated route refresh.
2023-04-04 17:00:58 +02:00
Maria Matejka
765bf99b69 Fixed default table configuration
When changing default table behavior, I missed that it enabled to
configure multiple master4 and master6 tables. Now BIRD recognizes it
and fails properly.
2023-04-04 17:00:58 +02:00
Maria Matejka
88fc87afe6 Fixed use-after-free of old protocol name pointer copied into rte_owner structure 2023-04-04 17:00:58 +02:00
Maria Matejka
90de93ca03 Fixed unwanted reloads while reconfiguring protocols with import table on 2023-04-04 17:00:58 +02:00
Maria Matejka
97d2875e99 Fixed bad filter re-evaluation with import table if filtered->accepted
The import table feed wasn't resetting the table-specific route values
like REF_FILTERED and thus made the route look like filtered even though
it should have been re-evaluated as accepted.
2023-04-04 17:00:58 +02:00
Maria Matejka
aa5fc3b99d Fixed channel stopping when reload is active 2023-04-04 17:00:58 +02:00
Maria Matejka
7d6fe6dfb1 Fix obvious mistake in protocol debug dump 2023-04-04 17:00:58 +02:00
Maria Matejka
c8507c1247 Fixed stopping of import request with no imports in idle table 2023-04-04 17:00:58 +02:00
Maria Matejka
03bfb8b59d Moved table hostcache updater to table service routines to not bother the mainloop 2023-04-04 17:00:58 +02:00
Maria Matejka
9073eda854 Reducing initial channel bitmap sizes to help extreme cases 2023-04-04 17:00:58 +02:00
Maria Matejka
e565e045b6 Flowspec links must have the destination table service loop locked 2023-04-04 17:00:58 +02:00
Maria Matejka
6543303ad4 BFD notifications respect protocol loop settings 2023-04-04 17:00:58 +02:00
Maria Matejka
b8a230e478 Interface subsystem locking 2023-04-04 17:00:58 +02:00
Maria Matejka
a26d307eab Proto: published protocol-loop connections 2023-04-04 16:44:54 +02:00
Johannes Moos
231c63851e 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.
2023-03-18 15:36:05 +01:00
Maria Matejka
9508cd85ce Protocol shutdown/restart from limits is respecting the loops 2023-02-07 14:28:25 +01:00
Maria Matejka
a2fd889a3b Merge commit '0bb04d5390f21b0c96fc4894ba5d5510c541f0ef' into HEAD 2023-02-07 14:27:23 +01:00
Maria Matejka
c354e8f4c1 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.
2023-02-02 15:57:21 +01:00
Maria Matejka
64e0877525 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.
2023-02-02 14:40:00 +01:00
Maria Matejka
e077d0e770 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.
2023-02-02 14:40:00 +01:00
Ondrej Zajicek
0ab62f2674 Build: Partial revert of one of previous changes
There are many compatibility issues with echo -e, scratch that.
2023-02-01 19:30:21 +01:00
Ondrej Zajicek
23f3dd5cfb 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
2023-02-01 17:31:18 +01:00
Maria Matejka
05d8c3699d 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.
2023-01-26 13:22:28 +01:00
Maria Matejka
4334f86251 VRF setting reduced to one argument, using default dummy iface for default vrf 2023-01-25 13:33:31 +01:00
Maria Matejka
f7c2a886c9 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.
2023-01-24 11:34:36 +01:00
Maria Matejka
7bb93efc27 Merge commit '6d1ae197d189d50e60279796441c6e74272ddc54' into thread-next 2023-01-23 19:03:16 +01:00
Maria Matejka
21c4c8eafb Merge commit '1e47b9f203aaaad0fb658d40a1670f1d0437f1f8' into thread-next 2023-01-21 23:49:52 +01:00
Maria Matejka
343628d8c0 Fixed various build problems on FreeBSD and/or CLang 2023-01-20 18:31:57 +01:00
Maria Matejka
4d8d81f144 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.
2023-01-19 11:10:25 +01:00
Maria Matejka
59a5bf18f9 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.
2023-01-19 11:03:31 +01:00
Ondrej Zajicek
b28431e557 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.
2023-01-03 17:01:54 +01:00
Ondrej Zajicek
6d1ae197d1 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
2023-01-01 20:10:23 +01:00
Ondrej Zajicek
4c19a8a984 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.
2022-12-10 17:32:42 +01:00
Ondrej Zajicek
e80156d936 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.
2022-12-06 19:51:50 +01:00