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

4299 Commits

Author SHA1 Message Date
Maria Matejka
08a975926f Fixed several tests which needed static protocol
Now they need device protocol which is always built.
2024-12-17 09:01:26 +01:00
Maria Matejka
2a726e0559 Disabling filter test unless needed protocols are configured 2024-12-17 09:01:26 +01:00
Ondrej Zajicek
161aef353a 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.
2024-12-16 18:56:30 +01:00
Ondrej Zajicek
34b7d77e06 Lib: Data type for VPN route distinguishers
Use a distinct data structure for VPN route distinguishers instead
of just u64.
2024-12-16 18:27:42 +01:00
Ondrej Zajicek
e0ed978e75 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.
2024-12-12 04:04:07 +01:00
Ondrej Zajicek
38a422d489 Build: Fix newlines in build of proto-build.c
Add newlines to the body of proto-build.c . Use printf instead of echo
for portable handling of backslash sequences.

Thanks to CCX for the change.
2024-12-10 14:58:05 +01:00
Fabian Bläse
cfac0076fb 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.
2024-12-10 02:14:06 +01:00
Ondrej Zajicek
6a55359b1e BGP: Graceful restart timer overrides
Implement several options (min/max graceful restart time, min/max long
lived stale time) to override graceful restart and long-lived graceful
restart timer values, as suggested by RFC 9494.
2024-12-06 04:06:16 +01:00
Ondrej Zajicek
fc5d06c28d BGP: Update LLGR draft references to RFC 9494 2024-12-05 16:42:49 +01:00
Ondrej Zajicek
1dbee120d3 CI: Fix filter tests for ASPA
(broken by previous change)
2024-12-03 17:23:09 +01:00
Ondrej Zajicek
c926a6e105 Static: Fix ASPA static route argument
It seems that it should be 'providers' instead of 'provider'.

It matches keyword declaration and documentation. Mismatch beween keyword
declaration also breaks static-only builds.
2024-12-03 17:05:23 +01:00
Ondrej Zajicek
4fb8fe6f53 NEWS and version update 2024-12-03 15:12:50 +01:00
Maria Matejka
b8008791cd Documentation: Updating roadmap as of end of 2024 2024-12-03 15:10:14 +01:00
Maria Matejka
707cad6188 CLI: Dumping forces new file creation instead of truncating. 2024-12-03 10:57:10 +01:00
Maria Matejka
2ab3f22e4a CLI: show memory also displays cold pages
Minor changes by committer.
2024-12-03 04:07:53 +01:00
Ondrej Zajicek
ef45611850 RPKI: Fix several errors in handling of Error PDU
Fix several errors including:
 - Unaligned memory access to 'Length of Error Text' field
 - No validation of 'Length of Encapsulated PDU' field
 - No validation of 'Error Code' field
 - No validation of characters in diagnostic message
2024-12-03 01:19:44 +01:00
Ondrej Zajicek
89d548accb RPKI: Increase max PDU length to 64k
APSA records can be arbitrarily large, let's use 64k as
a reasonable limit.
2024-12-02 07:06:34 +01:00
Maria Matejka
d85fa48e3a Slab: Write out all block pointers when asked for dump 2024-12-02 06:54:54 +01:00
Maria Matejka
ceab028326 Linpool: Write out all block pointers when asked for dump 2024-12-02 06:54:54 +01:00
Maria Matejka
da8a23277e CLI: Dumping internal data structures to files, not to debug output
All the 'dump something' CLI commands now have a new mandatory
argument -- name of the file where to dump the data. This allows
for more flexible dumping even for production deployments where
the debug output is by default off.

Also the dump commands are now restricted (they weren't before)
to assure that only the appropriate users can run these time consuming
commands.
2024-12-02 06:54:54 +01:00
Maria Matejka
4dd5b3d90e Logging: exposing vlog() to log va_lists 2024-12-02 04:27:30 +01:00
Maria Matejka
145830bdc8 CLI: adding cli_vprintf() 2024-12-02 04:27:30 +01:00
Maria Matejka
946386f2dd MRT: instead of crashing, ignore non-BGP attributes 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
Ondrej Zajicek
a47704a53d BMP: Refactor route monitor message serialization
Instead of several levels of functions, just have two functions
(one for routes, the other for end-of-rib), this allows to create
messages in a simple linear fashion.

Also reduce three duplicite functions to construct BGP header for
BMP messages to just one.
2024-12-02 03:38:17 +01:00
Ondrej Zajicek
73e7d3f5ce BMP: Refactor computation of message length
Fill message length after the message is created instead of computing
it beforehand. Also rename some functions to fit common pattern.
2024-12-02 03:38:17 +01:00
Ondrej Zajicek
5205ff9744 BMP: Refactor per-peer header arguments
Put all arguments for per-peer header into one structure instead of
passing them around as a lump of arguments. Also simplify code for
peer flags.
2024-12-02 03:38:17 +01:00
Maria Matejka
e6a100b31a BMP: simplified update queuing and better memory performance
This commit is quite a substantial rework of the underlying layers in
BMP TX:

- several unnecessary layers of indirection dropped, including most of
  the original BMP's buffer machinery
- all messages are now written directly into one protocol's buffer
  allocated for the whole time big enough to fit every possible message
- output blocks are allocated by pages and immediately returned when
  used, improving the overall memory footprint
- no intermediary allocation is done from the heap altogether
- there is a documented and configurable limit on the TX queue size
2024-12-02 03:38:17 +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
c48a7ac0cc BMP: drop an unused mempool 2024-11-29 16:06:07 +01:00
Maria Matejka
3ca6e03db7 RPKI: refactored pdu to host byte order conversion
We shouldn't convert bytes 2 and 3 of the PDU blindly, there are several
cases where these are used by bytes. Instead, the conversion is done
only where needed.

This fixes misinterpretation bug of ASPA PDU flags on little endian
architectures.
2024-11-28 14:19:47 +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
Ondrej Zajicek
fc2b4b26a6 Fixed crash if logging happened in unit tests
The patch initializes logging in unit tests. Previously, unit tests did
not initialize logging and other subsystems, just resources. But
resource_init() could under certain circumstances trigger logging and
cause crash.

The bug was Found by Jakub Ruzicka, dissected by David Petera and Maria
Matejka, disguised as failing build for Debian arm64 in pbuilder
emulation which did not like disabling THP.

Fixes #42.
2024-11-27 04:15:16 +01:00
Maria Matejka
997d2f578e ASPA: Unified the ASPA_INVALID into one result
The _EMPTY and _CONFED variants are easy to spot bare-eyed from the AS path.
2024-11-26 20:33:28 +01:00
Maria Matejka
01377599da RPKI: Polishing of ASPA syntax and documentation 2024-11-26 18:11:39 +01:00
Ondrej Zajicek
fb919ac2a2 RPKI: Fix PDU length check
The END_OF_DATA PDU was extended in version 1, so it has different length
in different versions. We should do the PDU length check according to its
version.
2024-11-26 17:52:51 +01:00
Maria Matejka
e330fb1614 RPKI: added documentation and RTR version config options 2024-11-26 04:47:33 +01:00
Katerina Kubecova
fa65e06372 RPKI: protocol version 2, loading ASPA
Implemented draft-ietf-sidrops-8210bis-16, interoperable with StayRTR
development branches.
2024-11-26 04:14:36 +01:00
Katerina Kubecova
224fbe5980 ASPA: Automatic channel reload 2024-11-09 16:51:06 +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
Piotr Wydrych
82d57fb7ad CLI: Add timeformat command
Adds ability to override time format of show commands for current CLI session
so that it does not depend on configuration and may ease parsing when CLI is
called from tools.

Minor changes by committer.
2024-11-07 15:08:51 +01:00
Ondrej Zajicek
9eca3e1a2e Nest: Cleanup timeformat grammar 2024-11-07 15:08:51 +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
Ondrej Zajicek
c7e843c1a7 BGP: Add RFC 9687 to list of supported RFCs 2024-11-07 15:07:22 +01:00
Maria Matejka
b4196b70c4 BGP: SendHoldTimer became an RFC, updating docs 2024-11-06 13:05:32 +01:00
Ondrej Zajicek
294d363da0 Filter: Remove T_ENUM_RTC
It is not used for a long time.
2024-10-18 16:53:12 +02:00
Ondrej Zajicek
1002c35bf9 Filter: Replace T_ENUM_NETTYPE with T_ENUM_NET_TYPE
To be consistent with other enum type names.
2024-10-18 16:49:19 +02:00
Ondrej Zajicek
80ca0ed279 Filter: Add enum types to filter grammar
Enum types existed on semantic level, but not on syntactic level,
so they could not be used in filter code.

Generate filter grammar for enum types based on CF_ENUM() declarations.

Thanks to lbz for the bugreport.
2024-10-18 16:39:42 +02: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