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

4979 Commits

Author SHA1 Message Date
Ondrej Zajicek
e338c4b63c Lib: Extend MPLS label allocator bitmap
Add function lmap_last_one_in_range() for finding the last active label
in a label range.
2023-10-04 13:07:33 +02:00
Ondrej Zajicek
bcff3ae79a L3VPN: BGP/MPLS VPNs using MPLS backbone
The L3VPN protocol implements RFC 4364 BGP/MPLS VPNs using MPLS backbone.
It works similarly to pipe. It connects IP table (one per VRF) with (global)
VPN table. Routes passed from VPN table to IP table are stripped of RD and
filtered by import targets, routes passed in the other direction are extended
with RD, MPLS labels and export targets in extended communities. A separate
MPLS channel is used to announce MPLS routes for the labels.
2023-10-04 13:07:28 +02:00
Ondrej Zajicek
9ca86ef69c MPLS: Add support for per-VRF labeling policy
The new labeling policy MPLS_POLICY_VRF assigns one label to all routes
(from the same FEC map associated with one VRF), while replaces their
next hops with a lookup to a VRF table. This is useful for L3VPN
protocol.
2023-10-04 13:01:21 +02:00
Ondrej Zajicek
9d456d5366 BGP: Add MPLS support
When MPLS is active, received routes on MPLS-aware SAFIs (ipvX-mpls,
vpnX-mpls) are automatically labeled according to active label policy and
corresponding MPLS routes are automatically generated. Also routes sent
on MPLS-aware SAFIs announce local labels when it should be done.
2023-10-04 13:01:21 +02:00
Ondrej Zajicek
15c86ed061 Static: Add MPLS support
When MPLS is active, static IP/VPN routes are automatically labeled
according to active label policy and corresponding MPLS routes are
automatically generated.
2023-10-04 13:01:21 +02:00
Ondrej Zajicek
333ddd4f98 MPLS subsystem
The MPLS subsystem manages MPLS labels and handles their allocation to
MPLS-aware routing protocols. These labels are then attached to IP or VPN
routes representing label switched paths -- LSPs.

There was already a preliminary MPLS support consisting of MPLS label
net_addr, MPLS routing tables with static MPLS routes, remote labels in
next hops, and kernel protocol support.

This patch adds the MPLS domain as a basic structure representing local
label space with dynamic label allocator and configurable label ranges.
To represent LSPs, allocated local labels can be attached as route
attributes to IP or VPN routes with local labels as attributes.

There are several steps for handling LSP routes in routing protocols --
deciding to which forwarding equivalence class (FEC) the LSP route
belongs, allocating labels for new FECs, announcing MPLS routes for new
FECs, attaching labels to LSP routes. The FEC map structure implements
basic code for managing FECs in routing protocols, therefore existing
protocols can be made MPLS-aware by adding FEC map and delegating
most work related to local label management to it.
2023-10-04 13:01:21 +02:00
Ondrej Zajicek (work)
e55696a4f8 Lib: Indirect bitmap for MPLS label allocator 2023-10-04 13:01:21 +02:00
Maria Matejka
198fb23a3a Merge commit '93509af4' into HEAD 2023-10-03 11:26:46 +02:00
katerina.kubecova
93509af4c1 Table preexport net-filter refactoring
Also added a possibility for filtering by trie.
2023-10-03 11:08:28 +02:00
katerina.kubecova
216abcb12e ROA notifications store the affected nets into trie 2023-10-03 11:07:46 +02:00
Maria Matejka
8d1215dba6 Channel: Refeeding by an auxiliary request if needed.
If the protocol supports route refresh on export, we keep the stop-start
method of route refeed. This applies for BGP with ERR or with export
table on, for OSPF, Babel, RIP or Pipe.

For BGP without ERR or for future selective ROA reloads, we're adding an
auxiliary export request, doing the refeed while the main export request
is running, somehow resembling the original method of BIRD 2 refeed.

There is also a refeed request queue to keep track of different refeed
requests.
2023-10-03 09:54:39 +02:00
Ondrej Zajicek
21213be523 Nest: Expand rte_src.private_id to u64
In general, private_id is sparse and protocols may want to map some
internal values directly into it. For example, L3VPN needs to
map VPN route discriminators to private_id.

OTOH, u32 is enough for global_id, as these identifiers are dense.
2023-10-02 15:09:30 +02:00
Maria Matejka
8ad9c4bb33 BGP config: Splitting Route Refresh and Enhanced Route Refresh
Both toggles are on by default but if some implementation needs one or
another to be switched off separately, then it's possible now.
2023-09-27 20:18:46 +02:00
Maria Matejka
b58ebc4ef1 Babel: Properly handle route refeed 2023-09-27 17:40:40 +02:00
Maria Matejka
bf84daca8c RIP: Properly handle route refeed 2023-09-27 17:40:40 +02:00
Maria Matejka
a4adb09f5a Aggregator: brief documentation 2023-09-26 15:46:24 +02:00
Maria Matejka
018a77fc0b Aggregator: Forbidden dangerous filter computations 2023-09-26 15:46:24 +02:00
Maria Matejka
8674d7ab4b Aggregator: Fixed hashing of adata 2023-09-26 15:46:24 +02:00
Igor Putovny
977b82fba4 Basic route aggregation
Add a new protocol offering route aggregation.

User can specify list of route attributes in the configuration file and
run route aggregation on the export side of the pipe protocol. Routes are
sorted and for every group of equivalent routes new route is created and
exported to the routing table. It is also possible to specify filter
which will run for every route before aggregation.

Furthermore, it will be possible to set attributes of new routes
according to attributes of the aggregated routes.

This is a work in progress.

Original work by Igor Putovny, subsequent cleanups and finalization by
Maria Matejka.
2023-09-26 15:46:24 +02:00
Maria Matejka
860fbf0d65 Babel: Remove interfaces on shutdown
This avoids calling interface timer between Babel going
PS_DOWN and finally cleaning up the resource pool.
2023-09-25 09:31:18 +02:00
Maria Matejka
5cdc1b679c Kernel: refeed routes and delete them from kernel before actual shutdown 2023-09-24 23:23:08 +02:00
Maria Matejka
e65a5257b2 Protocols have now assigned startup phases
For now, there are 4 phases: Necessary (device), Connector (kernel, pipe), Generator (static, rpki) and Regular.
Started and reconfigured are from Necessary to Regular, shutdown backwards.

This way, kernel can flush routes before actually being shutdown.
2023-09-24 23:23:08 +02:00
Maria Matejka
5ab182d8d1 Iface: trace log messages cleanup 2023-09-24 22:20:01 +02:00
Maria Matejka
c92b5ad218 Table: Added some journal and export tracing 2023-09-24 20:43:04 +02:00
Maria Matejka
32bb548c11 Table: Fixed feed race condition
The problem happened like this:

1. Single route for the given net in table
2. A feed is started
3. The route is deleted (from another thread)
4. The feed finds an empty net, exports nothing, ignores journal (here is bug)
5. The route is added
6. The export transitions from FEEDING to READY
7. While processing the journal, the route deletion and addition combines into noop.

This way routes mysteriously disappeared in specific cases of link instability.

Problem fixed by explicitly marking the empty-net journal entries as processed in step 4.
2023-09-24 20:43:04 +02:00
Maria Matejka
c262c728eb Export: More strict export state checking on change 2023-09-24 20:43:04 +02:00
Maria Matejka
a920b5111c Properly consted routes inside table 2023-09-24 20:43:04 +02:00
Maria Matejka
206b33fd0b Filter iterator accepts lines instead of filter 2023-09-24 20:43:04 +02:00
Vojtech Vilimek
b43580d77d Renamed channel class pointers
The channel class pointers were strangely named , not .
2023-09-24 20:43:04 +02:00
Maria Matejka
144ac4c1d3 Logging: fixed size logfiles behaving as mmapped ringbuffers
This variant of logging avoids calling write() for every log line,
allowing for waitless logging. This makes heavy logging less heavy
and more useful for race condition debugging.
2023-09-24 20:43:04 +02:00
Maria Matejka
75a5936924 Logging limit enforcement moved into the rfile structure 2023-09-24 20:43:04 +02:00
Maria Matejka
427177edb7 Logging now doesn't lock with each message
The original logging routines were locking a common mutex. This led to
massive underperformance and unwanted serialization when heavily logging
due to lock contention. Now the logging is lockless, though still
serializing on write() syscalls to the same filedescriptor.

This change also brings in a persistent logging channel structures and
thus avoids writing into active configuration data structures during
regular run.
2023-09-24 20:43:04 +02:00
Maria Matejka
3c9429a282 Threads: added a generic method to run in all threads 2023-09-24 20:40:07 +02:00
Maria Matejka
32009cb6eb Logging: Abolished stdio in favor of write() to make the logging faster. 2023-09-24 20:40:06 +02:00
Maria Matejka
0a729b509c Simple testing of reconfiguration to a slightly different one 2023-09-24 15:40:18 +02:00
katerina.kubecova
a0fb0eaa67 BGP: Setting and unsetting unknown attributes
All these must be declared as bytestring. Allows operators to delete
unwanted attributes breaking the Internet:

    https://blog.benjojo.co.uk/post/bgp-path-attributes-grave-error-handling
2023-09-20 14:15:18 +02:00
katerina.kubecova
cc122bf0c2 Attributes declared in config can be bytestrings 2023-09-20 14:03:41 +02:00
katerina.kubecova
8cc9d198c7 Filter: Function unset() accepts attributes declared in config 2023-09-20 14:03:18 +02:00
katerina.kubecova
bb8e28248b Structures bytestring and adata merged into adata. 2023-09-20 14:03:05 +02:00
Ondrej Zajicek
9ffea830b6 Conf: Move definition of struct keyword to conf.h 2023-09-14 17:24:09 +02:00
Maria Matejka
88307c31c5 CLI: Dropping the mechanism of echoing log messages
This is better done by running tail -f on a logfile.
2023-09-14 14:45:01 +02:00
Maria Matejka
8638c6f0b3 BGP: When debug { routes } is set, updates considered as loop are logged 2023-09-14 14:44:35 +02:00
Maria Matejka
0faf3bb630 Enhanced tracing of route refresh state 2023-09-14 14:40:33 +02:00
Ondrej Zajicek
a3dc26455d Filter: Use common initializer for undefined variables and eattrs.
Undefined paths and clists should use typed f_val with empty adata
instead of just void f_val. Use common initializer to handle both
variables and eattrs.
2023-09-13 06:21:26 +02:00
Ondrej Zajicek
7395b97daf Filter: Minor updates to methods
Remove warning when function-like syntax is used for calling
add/remove/... methods.

Fix argument offset in error messages for function-like syntax.
2023-09-12 18:44:20 +02:00
Ondrej Zajicek
132f1edaf4 Filter: Split clist add/delete operations to multiple methods 2023-09-12 16:33:59 +02:00
Ondrej Zajicek
f0d1396073 Filter: Implement constant promotion for multiple dispatch methods 2023-09-12 16:33:59 +02:00
Ondrej Zajicek
e886959131 Filter: Print proper error response in multiple method dispatch
When no matching method is found, print an error response containing
position and type of infringing argument and a set of expected types.
2023-09-12 16:33:59 +02:00
Ondrej Zajicek
e4ce88cc50 Filter: Move argument list reversal from function_call to var_list
List of arguments for function calls is constructed in reverse and then
reverted. This was done in function_call grammar rule. Do the reverse
directly in var_list grammar rule. This fixes reverse order of arguments
in method calls.
2023-09-12 16:33:54 +02:00
Ondrej Zajicek
cc1099a041 Filter: Implement multiple dispatch for methods
- Extend method descriptors with type signature
 - Daisy chain method descriptors for the same symbol
 - Dispatch methods for same symbol based on type signature
 - Split add/delete/filter operations to multiple methods
 - Replace ad-hoc dispatch of old-style syntax with scope-based dispatch
 - Also change method->arg_num to count initial arg

It still needs some improvements, like better handling of untyped
expressions and better error reporting when no dispatch can be done.

The multiple dispatch could also be extended to dispatch regular
function-like expressions in a uniform way.
2023-09-12 16:31:52 +02:00