4163 Commits

Author SHA1 Message Date
Simon Marsh db17330988 add debian build 2024-01-13 11:10:33 +00:00
Ondrej Zajicek 6db322b4cc NEWS and version update 2023-10-07 13:56:38 +01:00
Ondrej Zajicek 9e273f1ccc Doc: Minor fixes 2023-10-07 13:56:38 +01:00
Ondrej Zajicek b2e5590955 Conf: Bytestrings with hex: should use the same general format as ones without.
Either hex:01234567, or hex:01:23:45:67. No confusing formats like
hex:0123:4567:ab:cdef, which looks like there is an implicit zero byte.
2023-10-07 13:56:38 +01:00
Pavel Šorejs 1c06b9059e KRT: Allow to learn routes with RTPROT_KERNEL
The Kernel protocol, even with the option 'learn' enabled, ignores
direct routes created by the OS kernel (on Linux these are routes
with rtm_protocol == RTPROT_KERNEL).

Implement optional behavior where both OS kernel and third-party routes
are learned, it can be enabled by 'learn all' option.

Minor changes by committer.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek 631662d76b BGP: Improve custom BGP attributes
- Implement EA_GET for custom BGP attributes
 - Forbid EA_SET on existing opaque attributes
 - Forbid redefining existing attributes
 - Document possible compatibility problems
2023-10-07 13:56:38 +01:00
Ondrej Zajicek 7977d4a607 MPLS: Handle compatibility with old configs
Old configs do not define MPLS domains and may use a static protocol
to define static MPLS routes.

When MPLS channel is the only channel of static protocol, handle it
as a main channel. Also, define implicit MPLS domain if needed and
none is defined.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek 77cba3aa13 Filter: Fix scope handling in for loops
Changes in scope implementation broke scope handling in for loops.
The term in for loops is supposed to be parsed in the parent scope.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek 829731c0cd Conf: Fix 'show symbols'
Seems like the root scope was not marked as active.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek 9a51701e84 BGP: Custom attribute definitions should use cfg_alloc(), not malloc()
Otherwise we would get memory leaks.
2023-10-07 13:56:38 +01:00
Maria Matejka 049ec6a3d8 Filter: explicitly forbidden for-loop with pre-defined variable 2023-10-07 13:56:38 +01:00
Ondrej Zajicek c330f126cc IO: Fix race condition in event processing
When regular event was added from work event, we did remember that
regular event list was empty and therefore we did not use zero time
in poll(). This leads to ~3 s latency in route reload during
reconfiguration.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek d5998cf7dd Doc: Fix syntax errors in SGML 2023-10-07 13:56:38 +01:00
Ondrej Zajicek ff699b00f3 MPLS: Update to support and use 64bit source id 2023-10-07 13:56:38 +01:00
Ondrej Zajicek 7b1e7c12bf Doc: L3VPN documentation 2023-10-07 13:56:38 +01:00
Ondrej Zajicek 0a3a82a7f2 Doc: MPLS documentation 2023-10-07 13:56:38 +01:00
Ondrej Zajicek afbd7dcc53 L3VPN: Import/export target reconfiguration 2023-10-07 13:56:38 +01:00
Ondrej Zajicek 001e628867 BGP, L3VPN: Fix MPLS channel reload
When a MPLS channel is reloaded, it should reload all regular MPLS-aware
channels. This causes re-evaluation of routes in FEC map and possibly
reannouncement of MPLS routes.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek 50f0b8bc1b MPLS: Implement FEC map reconfiguration
This allows changing label policy or label range without restart.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek 3e780cdefd MPLS: Handle label allocation failures 2023-10-07 13:56:38 +01:00
Ondrej Zajicek a62a27958b L3VPN: Fix bug in reconfiguration
Fields import_target / export_target link to config structures, must be
updated during reconfiguration.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek 63a800583e MPLS: Improve handling of static label allocations
Use mpls_new_label() / mpls_free_label() also for static labels, to keep
track of allocated labels and to enforce label ranges.

Static label allocations always use static label range, regardless of
configured label range.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek 324caab5dc Static: Add syntax for static MPLS labels
Instead of just using route attributes, static routes with
static MPLS labels can be defined just by e.g.:

  route 10.1.1.0/24 mpls 100 via 10.1.2.1 mpls 200;
2023-10-07 13:56:38 +01:00
Ondrej Zajicek e4e46bed2c MPLS: Label range non-intersection check 2023-10-07 13:56:38 +01:00
Ondrej Zajicek d2cce26132 MPLS: Improve label range reconfiguration
Allow to shorten label range over unused area.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek ce2fd33eff MPLS: Add command 'show mpls ranges'
Add command to show MPLS label ranges and their stats.
2023-10-07 13:56:38 +01:00
Ondrej Zajicek dda228a362 Nest: Fix missing RTS_* values in filters 2023-10-07 13:56:38 +01:00
Ondrej Zajicek 3e335423b5 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-07 13:56:38 +01:00
Ondrej Zajicek 6ea4c0268c 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-07 13:56:38 +01:00
Ondrej Zajicek 274b21b124 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-07 13:56:38 +01:00
Ondrej Zajicek 0097c195ed 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-07 13:56:38 +01:00
Ondrej Zajicek 9baa846680 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-07 13:56:38 +01:00
Ondrej Zajicek a3e488589f 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-07 13:56:38 +01:00
Ondrej Zajicek (work) 0912413744 Lib: Indirect bitmap for MPLS label allocator 2023-10-07 13:56:38 +01:00
Ondrej Zajicek 08e8216d0c 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-07 13:56:38 +01:00
Maria Matejka b6da86d751 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-10-07 13:56:38 +01:00
Maria Matejka ff371d905c Aggregator: brief documentation 2023-10-07 13:56:38 +01:00
Maria Matejka 22cf9ea9e7 Aggregator: Forbidden dangerous filter computations 2023-10-07 13:56:38 +01:00
Maria Matejka 66345508c8 Aggregator: Fixed hashing of adata 2023-10-07 13:56:38 +01:00
Igor Putovny 40946b2240 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-10-07 13:56:38 +01:00
Maria Matejka f2b84cb65d Simple testing of reconfiguration to a slightly different one 2023-10-07 13:56:38 +01:00
katerina.kubecova 0c30da2306 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-10-07 13:56:38 +01:00
katerina.kubecova 6622003461 Attributes declared in config can be bytestrings 2023-10-07 13:56:38 +01:00
katerina.kubecova 32a185caca Filter: Function unset() accepts attributes declared in config 2023-10-07 13:56:38 +01:00
katerina.kubecova 529525c230 Structures bytestring and adata merged into adata. 2023-10-07 13:56:38 +01:00
Ondrej Zajicek bd8a65c0fd Conf: Move definition of struct keyword to conf.h 2023-10-07 13:56:38 +01:00
Ondrej Zajicek 24e8987564 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-10-07 13:56:38 +01:00
Ondrej Zajicek 04f41c9e34 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-10-07 13:56:38 +01:00
Ondrej Zajicek 052e666121 Filter: Split clist add/delete operations to multiple methods 2023-10-07 13:56:38 +01:00
Ondrej Zajicek 3ada694582 Filter: Implement constant promotion for multiple dispatch methods 2023-10-07 13:56:38 +01:00