0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00
Commit Graph

721 Commits

Author SHA1 Message Date
Maria Matejka
28b0adc15f Fix alignment requirements to include atomic u64.
Not having this led to bus errors on unaligned atomic u64 access
on architectures with 4B pointers.
2024-12-11 17:51:46 +01:00
Maria Matejka
fa5923289e Merge commit '4dd5b3d9' into thread-next 2024-12-10 23:57:59 +01:00
Maria Matejka
1fc569e32b Merge commit '7ee27418' into thread-next 2024-12-10 23:50:13 +01:00
Maria Matejka
cde582977f BMP: Never touching the BGP directly
Dropped hopefully last remnants of BMP directly accessing BGP structures.
2024-12-10 23:41:48 +01:00
Katerina Kubecova
d503204aa0 Lockfree journal: Cleanup hook runs only when needed.
The function lfjour_cleanup_hook() was scheduled each time any of the
journal recipients reached end of a block of journal items or read all
of journal items. Because lfjour_cleanup_hook() can clean only journal
items every recipient has processed, it was often called uselessly.

This commit restricts most of the unuseful scheduling. Only some
recipients are given a token alowing them to try to schedule the
cleanup hook. When a recipient wants to schedule the cleanup hook, it
checks whether it has a token. If yes, it decrements number of tokens
the journal has given (issued_tokens) and discards its own token. If
issued_tokens reaches zero, the recipient is allowed to schedule the
cleanup hook.

There is a maximum number of tokens a journal can give to its recipients
(max_tokens). A new recipient is given a token in its init, unless the
maximum number of tokens is reached. The rest of tokens is given to
customers in lfjour_cleanup_hook().

In the cleanup hook, the issued_tokens number is increased in order to
avoid calling the hook before it finishes. Then, tokens are given to the
slowest recipients (but never to more than max_token recipients). Before
leaving lfjour_cleanup_hook(), the issued_tokens number is decreased back.
If no other tokens are given, we have to make sure the
lfjour_cleanup_hook will be called again. If every item in journal was
read by every recipient, tokens are given to random recipients. If all
recipients with tokens managed to finish until now, we give the token to
the first unfinished customer we find, or we just call the hook again.
2024-12-10 23:37:20 +01:00
Ondrej Zajicek
6aea356b2a Merge commit '460321cfe979459e3b78ba87694f29865d321612' into thread-next 2024-12-03 15:45:25 +01:00
Maria Matejka
4dd5b3d90e Logging: exposing vlog() to log va_lists 2024-12-02 04:27:30 +01:00
Maria Matejka
7ee27418a7 Printf: impossible buffer overflow fix
When printing near the end of the buffer, there was an overflow in two cases:

(1) %c and size is zero
(2) %1N, %1I, %1I4, %1I6 (auto-fill field_width for Net or IP), size is
    more than actual length of the net/ip but less than the auto-filled
    field width.

Manual code examination showed that nothing could have ever triggered
this behavior. All older versions of BIRD, including BIRD 3 development
versions, are totally safe. This exact overflow has been found while
implementing a new feature in later commits.
2024-12-02 04:27:30 +01:00
Maria Matejka
460321cfe9 Formatting numbers with order prefixes
Unit tests by Ondrej Zajicek.
2024-11-29 16:06:07 +01:00
Maria Matejka
2936e15b28 Merge commit '49be4a03' into thread-merge-2.16 2024-11-29 11:30:59 +01:00
Maria Matejka
c1ad3e58c0 Merge commit '38195ac6' into thread-merge-2.16 2024-11-29 10:49:53 +01:00
Maria Matejka
14bc1fc4c1 Merge commit '1002c35b' into thread-merge-2.16 2024-11-29 10:25:59 +01:00
Maria Matejka
e0b1826b7c Merge commit '072821e5' into thread-merge-2.16 2024-11-28 12:44:04 +01:00
Maria Matejka
b4bd406795 Merge commit 'acbdc29d' into thread-merge-2.16 2024-11-28 12:18:44 +01:00
Maria Matejka
ac0cdf3ad4 Merge commit '09f50f37' into thread-merge-2.16 2024-11-28 10:02:07 +01:00
Maria Matejka
e6242ef948 Merge commit '8a40bccf' into thread-merge-2.16 2024-11-28 09:36:33 +01:00
Maria Matejka
029e6c7e1e Merge commit 'a5b4c21d' into thread-merge-2.16 2024-11-28 09:08:32 +01:00
Maria Matejka
2af438a9bf Merge commit '2d6fb31c' into thread-merge-2.16 2024-11-28 09:07:23 +01:00
Maria Matejka
b8f7200ee9 Merge commit 'bc10975a' into thread-merge-2.16 2024-11-28 08:56:27 +01:00
Maria Matejka
d73d861f0c Merge commit '08571b20' into thread-merge-2.16 2024-11-28 08:22:06 +01:00
Maria Matejka
54499f8850 String tests: fixed too strict strcmp checks
The strcmp function is not guaranteed to return -1 or +1
but any negative or positive value if the input strings
are different. Fixed the false assumption which triggered
a build bug on emulated arm64.
2024-11-27 12:01:58 +01:00
Maria Matejka
1dd21f6024 Netlink: Fixed handling of undefined bitfields in filters
The default value is obviously false everywhere so we just return zero
if nothing is found, instead of undef.
2024-11-25 17:14:32 +01:00
Maria Matejka
53431ff679 Hash test spurious fail fixed
There was a race condition in the test itself,
causing the test reader access data after free.
2024-11-25 09:44:00 +01:00
Maria Matejka
2956faf5a6 Protocol and BGP state information cleanup and fixes
There were some nasty problems with deferred protocol state updates and
race conditions on BGP startup, shutdown, and also with referencing the
cached states.

Now it looks fixed.
2024-11-24 22:51:08 +01:00
Maria Matejka
e654efd354 Debug option for ea_free 2024-11-24 22:49:39 +01:00
Maria Matejka
6ba06dc4df Deferred call may need to be returned for future cleanups 2024-11-24 22:49:35 +01:00
Maria Matejka
03f51079c1 Defer: fixup missing include guards 2024-11-14 11:41:37 +01:00
Katerina Kubecova
330c71bd0a More attribute types: pointers, strings, btime
For the upcoming rework of protocol state information propagation,
we need some more eattr types to be defined.

These types are probably not defined completely and before using
them for route attributes, you should check that they don't lack
some crucial methods.
2024-11-09 09:55:40 +01:00
Ondrej Zajicek
49be4a0329 Lib: Optimized printing of numbers
One simple trick makes printing of numbers ~4x faster.
2024-11-08 18:54:13 +01:00
Ondrej Zajicek
5c6572c422 Lib: Optimized printing of IP addresses
Makes printing network prefixes ~15x faster.
2024-11-08 18:51:54 +01:00
Maria Matejka
38195ac628 ASPA: fixed the check algorithm to actually do what is in the RFC
The original algorithm assumed principles not consistent with the RFC
and could have lead to false invalids.

Also added filter tests showing also how the ASPA literals are used in
the static protocol.
2024-11-07 15:08:14 +01:00
Eric Long
072821e55e Flowspec: Fix IPv6 prefix when offset is not multiple of 8
Current implementation handles flowspec prefix length and offset only
in bytes, but RFC 8956 (Dissemination of Flow Specification Rules for
IPv6) Section 3.1 [1] and example in Section 3.8.2 [2] states the
pattern should begin right after offset *bits*.

For example, pattern "::1:1234:5678:9800:0/60-104" is currently
serialized as "02 68 3c 01 12 34 56 78 98", but it should shift its
pattern 4 more bits to the left: "02 68 3c 11 23 45 67 89 80".

This patch implements shifting left/right for IPv6 type and use it to
correct the behaviour. Test data are replaced with the correct ones.

Minor changes and test vectors done by committer.

[1]: https://www.rfc-editor.org/rfc/rfc8956.html#section-3.1
[2]: https://www.rfc-editor.org/rfc/rfc8956.html#section-3.8.2
2024-10-16 21:32:36 +02:00
Ondrej Zajicek
6f9ccfae9e Flowspec: Test improvements
Simplify Flowspec initialization macros.

Add examples from RFC 8955 4.3 and RFC 8956 3.8 to format tests.
2024-10-16 04:04:46 +02:00
Ondrej Zajicek
acbdc29d57 Lib: Expand timer recurrence to 64b
The period of recurent timers was stored in 32b field, despite it was
btime-compatible value in us. Therefore, it was limited to ~72 min,
which mas okay for most purposes, except configurable MRT dump periods.

Thanks to Felix Friedlander for the bugreport.
2024-08-27 14:28:41 +02:00
Maria Matejka
6eea722d3f Forbid locking altogether when RCU reader is active 2024-06-28 22:03:45 +02:00
Maria Matejka
1e77e6e1b2 Flush deferred calls directly after the loop finished its one run 2024-06-28 22:03:45 +02:00
Maria Matejka
09f50f3766 Typed lists: added forgotten #undef 2024-06-27 04:14:38 +02:00
Maria Matejka
f27004fb4d Backported typed list updates from v3
Source: dda37842dc
2024-06-27 04:14:38 +02:00
Maria Matejka
af73cc4215 Allocator now reports cold pages 2024-06-26 20:45:54 +02:00
Maria Matejka
be2ba84e50 Tame improper xmalloc warning 2024-06-26 17:21:26 +02:00
Maria Matejka
b797444e94 Merge commit 'b95dc8f29f18eb177f91fdc4bf0716fac9b15366' into mq-config-ref
Also converted all _Bool's to bool.
2024-06-26 17:19:24 +02:00
Alexander Zubkov
8a40bccffe BFD: Add option to accept zero checksum for IPv6 UDP packets
Some vendors do not fill the checksum for IPv6 UDP packets.
For interoperability with such implementations one can set
UDP_NO_CHECK6_RX socket option on Linux.

Thanks to Ville O for the suggestion.

Minor changes by committer.
2024-06-26 16:29:57 +02:00
Maria Matejka
7d455d64ca Remove spinlock debug structures in production build 2024-06-26 11:30:41 +02:00
Maria Matejka
8e67cba528 Linpool: allocation split to fast and slow 2024-06-26 11:30:41 +02:00
Maria Matejka
6f981969bb RCU read lock optimization 2024-06-26 11:29:43 +02:00
Maria Matejka
0b6e752bd9 Conflating multiple partial ROA reload requests together 2024-06-26 11:29:43 +02:00
Maria Matejka
bd44a13ce5 Spinhash main lock removed
Spinhash now uses RCU instead to guard cur-new exchanges to avoid
excessive synchronization and cache misses on the main spinlock.
2024-06-26 11:29:12 +02:00
Maria Matejka
83045e9a1f Configuration obstacles made a separate, explicit structure
With this, one can walk the obstacle list in a debugger and
easier see which specific object is holding the reference.
2024-06-14 23:16:07 +02:00
Maria Matejka
61dcbb1d83 Global runtime values separated from config 2024-06-14 23:16:07 +02:00
Maria Matejka
f5fd70c54a Callback: bundling event with its target 2024-06-14 23:16:07 +02:00