0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-26 02:40:03 +00:00

5340 Commits

Author SHA1 Message Date
Maria Matejka
d13c9d378f BGP: fix shutdown crash when dynamic peer is just connected
In some edge cases, the dynamic BGP starts but doesn't yet pick up
the socket from the peer, when it gets shut down, typically on
a complete shutdown. Fixing this to just close the socket, not assert
it being already picked up.
2025-01-13 22:15:52 +01:00
Maria Matejka
77582da162 NEWS and version update v3.0.1 2025-01-09 21:54:53 +01:00
Maria Matejka
bd3ba2af92 Merge remote-tracking branch 'origin/stable-v2.16' into HEAD 2025-01-09 21:54:15 +01:00
Maria Matejka
11913f58cb NEWS and version update v2.16.1 2025-01-09 21:51:15 +01:00
Maria Matejka
000ba7e960 Merge commit 'abecb5bb408f253cd24345ba94940ea0f7b59f4f' into HEAD 2025-01-09 18:55:26 +01:00
Maria Matejka
4074112992 Merge commit '85aa283071ed75059fd8c889bc4ee33be1f901af' into HEAD 2025-01-09 18:46:04 +01:00
Maria Matejka
d0a328bfa9 Merge commit 'd221f39731be40ed3821f8db09d590edb849cb0c' into HEAD 2025-01-09 18:45:50 +01:00
Maria Matejka
5c3eff5645 Merge commit 'e063365590b9b857a5bd0acfa519783eba639bbf' into stable-v3.0 2025-01-09 18:40:29 +01:00
Ondrej Zajicek
abecb5bb40 lib: Unify alignment of allocators
Different internal allocators (memory blocks, linpools, and slabs) used
different way to compute alignment. Unify it to use alignment based on
standard max_align_t type.

On x86_64, this does not change alignment of memory blocks and linpools
(both old and new is 16), but it increases alignment of slabs from 8 to
16.

Minor changes by commiter.
2025-01-09 17:42:55 +01:00
Maria Matejka
b2de140d1a Table: Fixed table debug settings reconfiguration 2025-01-09 10:35:00 +01:00
Maria Matejka
a24ec59d24 Table: more best route refeed fixes
Best route refeed is tricky. The journal may include repeatedly the same
route in the old and/or in the new position in case of flaps. We don't
like checking that fully in the RCU critical section which is already
way too long, thus we filter out the repeated occurence of the current
best route while keeping possibly more old routes.

We also don't want to send spurious withdraws, and we need to check that
only one notification per net is sent for RA_OPTIMAL.

There was also missing a rejected map update in case of idempotent
squashed update, and last but not least, the best route journal should
not include invalid routes (import keep filtered).
2025-01-09 10:35:00 +01:00
Maria Matejka
9381f8f2d8 Table: old best route refeed fix
When refeeding with RA_OPTIMAL, the old best routes weren't announced,
leading to weird behavior of protocols, mostly kernel. Fixed.
2025-01-09 10:34:49 +01:00
Maria Matejka
d43538acbd BGP: fixed deterministic med crashes
There were several places of forgotten NULL checks.

Thanks to Alarig Le Lay <alarig@swordarmor.fr> for reporting:
https://trubka.network.cz/pipermail/bird-users/2024-December/017990.html
2025-01-09 10:08:27 +01:00
Maria Matejka
c2bd489bbc BGP: fix display name of bgp_otc attribute 2025-01-09 10:08:27 +01:00
Maria Matejka
ffa57a4303 Allocate the normalization buckets on stack
Even though allocating from tmp_linpool is quite cheap,
it isn't cheap when the block is larger than a page, which is the case here.
Instead, we now allocate just the result which typically fits in a page,
avoiding a necessity of a malloc().
2025-01-09 10:08:27 +01:00
Maria Matejka
4f7899e3cb BGP: TX bucket storage moved to Stonehenge 2025-01-09 10:08:27 +01:00
Maria Matejka
240dd41f06 Route attribute storage moved to Stonehenge 2025-01-09 10:08:27 +01:00
Maria Matejka
29df992f7f Stonehenge: multi-slab allocator
To mid-term allocate and free lots of small blocks in a fast pace,
mb_alloc is too slow and causes heap bloating. We can already allocate
blocks from slabs, and if we allow for a little bit of inefficiency,
we can just use multiple slabs with stepped sizes.

This technique is already used in ea_list allocation which is gonna be
converted to Stonehenge.
2025-01-09 10:08:27 +01:00
Maria Matejka
5edac7403e Graceful recovery: converted to obstacles
Yet another refcounting mechanism had a locking collision.
2025-01-09 10:08:27 +01:00
Maria Matejka
91c98efe57 Kernel: feed only once during startup
There was an inefficiency in the initial scan state machine,
causing routes to be fed several times instead of just once.
Now the export startup is postponed until first krt_scan()
finishes and we actually can do the pruning with full information.
2025-01-09 10:08:27 +01:00
Maria Matejka
56be89911a CLI: Flushing tmp_linpool after every shown net.
There is no reason to keep the allocated objects through multiple nets.
2025-01-09 10:08:27 +01:00
Maria Matejka
ccff887e50 CLI: allocate TX buffers as pages, not by malloc
Every malloc risks heap bloating and these blocks are already
the same size as pages.
2025-01-09 10:08:27 +01:00
Maria Matejka
85aa283071 Static: fixed ASPA reconfiguration
Due to an oversight, the provider lists weren't compared on reconfiguration.

Reported-By: Ralph Covelli <rcovelli@he.net>
2025-01-07 20:40:37 +01:00
Ondrej Zajicek
d221f39731 Nest: Fix handling of 64-bit rte_src.private_id
The commit 21213be523baa7f2cbf0feaa617f265c55e9b17a expanded private_id
in route source to u64, but forgot to modify function arguments, so it
was still cropped at 32-bit, which may cause some collisions for L3VPN.
This patch fixes that.
2025-01-07 20:40:17 +01:00
Ondrej Zajicek
e063365590 Lib: Ensure that all net_addr structures have the same alignment
Also weaken the explicit alignment of net_addr to be u32, as VPN
is already u32-aligned.
2025-01-07 20:40:17 +01:00
Ondrej Zajicek
fe5ca3fa7d Doc: Fix protocol outline in RPKI
Protocol outlines should not contain specific values.

Also fix some space intendation in code sections.
2025-01-07 20:40:17 +01:00
Ondrej Zajicek
cf659a05a4 Lib: Data type for VPN route distinguishers
Use a distinct data structure for VPN route distinguishers instead
of just u64.
2025-01-07 20:40:17 +01:00
Ondrej Zajicek
f9c7861e11 Netlink: Handle onlink flag on BSD-Netlink
On BSD, the onlink flag is not tracked or reported by kernel. We are
using an heuristic that assigns the onlink flag to routes scanned from
the kernel. We should use the same heuristic even in BSD-Netlink
case, as the onlink flag is not reported here too.

Thanks to Björn König for the original patch.
2025-01-07 20:38:49 +01:00
Fabian Bläse
de7ded6ef6 Babel: fix seqno wrapping on seqno request
The Babel seqno wraps around when reaching its maximum value (UINT16_MAX).
When comparing seqnos, this has to be taken into account. Therefore,
plain number comparisons do not work.
2025-01-07 20:38:28 +01:00
Maria Matejka
8349536278 BFD: Fix session reconfiguration locking order
The sessions have to be updated asynchronously to avoid
cross-locking between protocols.

Testsuite: cf-ibgp-bfd-switch, cf-ibgp-multi-bfd-auth
Fixes: #139

Thanks to Daniel Suchy <danny@danysek.cz> for reporting:
https://trubka.network.cz/pipermail/bird-users/2024-December/017984.html
2024-12-21 19:12:54 +01:00
Maria Matejka
6779e5da69 BGP: fix locking order error on dynamic protocol spawn
We missed that the protocol spawner violates the prescribed
locking order. When the rtable level is locked, no new protocol can be
started, thus we need to:

* create the protocol from a clean mainloop context
* in protocol start hook, take the socket

Testsuite: cf-bgp-autopeer
Fixes: #136

Thanks to Job Snijders <job@fastly.com> for reporting:
https://trubka.network.cz/pipermail/bird-users/2024-December/017980.html
2024-12-20 11:40:10 +01:00
Maria Matejka
ab74652f96 Kernel: when channel traces, we have to trace the final result
Otherwise it looks like we are sending too much traffic to netlink
every other while, which is not true. Now we can disambiguate between
in-kernel updates and ignored routes.
2024-12-19 12:28:27 +01:00
Maria Matejka
0a2f92ad20 Table: not feeding twice, once is enough
If there is no feed pending, the requested one should be
activated immediately, otherwise it is activated only after
the full run, effectively running first a full feed and
then the requested one.
2024-12-19 11:54:05 +01:00
Maria Matejka
b6caccfd45 Kernel: Fix crash for merge paths on if no route is in BIRD
There was a missing check for a NULL return value.
Also fixed an indenting error.

Thanks to Radu Anghel for reporting it:
https://bird.network.cz/pipermail/bird-users/2024-December/017977.html
2024-12-19 11:38:27 +01:00
Maria Matejka
e7bd976178 NEWS and version update v3.0.0 2024-12-17 09:42:16 +01:00
Jakub Ružička
733baa1dbd Debian: Depend on libssh's default flavor
This mirrors Debian bird2 change, gcrypt flavor is deprecated.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1074257
2024-12-16 16:36:31 +01:00
Katerina Kubecova
1f6ecd7e19 BGP: Print warnings when the allocated memory is larger than given acceptable maximum. 2024-12-16 12:33:07 +01:00
Maria Matejka
c6b778794e Table exporter journal dumping and memsize
The show-memory command wasn't showing the consumed memory
properly because it ignored the journal size. Now it does.
2024-12-16 12:31:26 +01:00
Maria Matejka
b67db7c97d Fix mallopt configure checks
Some systems do have malloc.h but don't have mallopt.
2024-12-16 09:50:20 +01:00
Maria Matejka
d373d48377 Table cork compromise
The original values were way too low but what was set
later was too high and caused memory buildup upon startup.
2024-12-16 09:34:08 +01:00
Maria Matejka
d69d804679 Table prune inhibited during reconfiguration
When many changes are done during reconfiguration, the table may
start pruning old routes before everything is settled down, slowing
down not only the reconfiguration, but also the shutdown process.
2024-12-15 22:21:34 +01:00
Maria Matejka
792189e807 Disable multiple malloc arenas
In our usecase, these are impossibly greedy because we often
free memory in a different thread than where we allocate, forcing
the default allocator to scatter the used memory all over the place.
2024-12-15 22:21:34 +01:00
Maria Matejka
2d7c8f4d5c More accurate allocator internal log 2024-12-14 21:33:47 +01:00
Maria Matejka
c82f7ed4aa Drop forgotten debug logs 2024-12-14 19:49:56 +01:00
Katerina Kubecova
4c3ac54ee3 ROA: Extended and more thorough test
There was a suspicion that maybe the BIRD 3 version of ROA gets the
digesting wrong. This test covers the nastiest cornercases we could
think about, so now we can expect it to be right.
2024-12-13 21:42:09 +01:00
Maria Matejka
f2925d15fc Merge commit '1dbee120' into thread-next 2024-12-13 20:56:30 +01:00
Maria Matejka
060654066e Merge tag 'v2.16' into thread-next
v2.16
2024-12-13 20:56:08 +01:00
Katerina Kubecova
ef63946d2e Allow allocating cold pages inside RCU critical section
We have quite large critical sections and we need to allocate inside
them. This is something to revise properly later on, yet for now,
instead of slowly but surely growing the virtual memory address space,
it's better to optimize the cold page cache pickup and count situations
where this happened inside the critical section.
2024-12-13 20:15:37 +01:00
Maria Matejka
af89c43413 Fixed a subtle memory leak in protocol restart routine 2024-12-13 19:10:55 +01:00
Maria Matejka
93621ed9f4 Merge commit '707cad61' into thread-next 2024-12-13 19:10:28 +01:00