Commit Graph

312 Commits

Author SHA1 Message Date
Maria Matejka e711a991d4 MPLS: FEC Map moved from protocol to MPLS channel 2024-01-08 13:03:25 +01:00
Maria Matejka f0da632b3c Channels now can have external obstacles temporarily blocking their shutdown 2024-01-08 13:03:25 +01:00
Maria Matejka e4e90c6f4d Channel: Replacing refeed status trie by bitmap
This fixes a bug with reloading non-IP channels.
2024-01-08 12:02:25 +01:00
Maria Matejka 8c19f8a209 Merge commit 'db1eb46664d4c76d56dc55a63ce7abe853fc6862' into HEAD 2023-12-08 11:33:43 +01:00
Maria Matejka 219dc0fdb5 Merge branch 'mq-aggregator-for-v3' into thread-next 2023-11-09 16:53:34 +01:00
Maria Matejka e6362b21dc Merge branch 'mq-aggregator-for-v3' into thread-next 2023-11-09 16:34:26 +01:00
Maria Matejka 30712a2bdf Merge branch 'mq-aggregator-for-v3' into thread-next 2023-11-08 21:51:46 +01:00
Maria Matejka c6fba7d7e6 Merge branch 'thread-next' into HEAD 2023-11-02 14:43:15 +01:00
Katerina Kubecova 9680bf68e4 Automatic ROA reloads on channel import
This includes updating OSPF, Pipe and RIP to enable partial route reload
directly from the protocols' internal tables.
2023-11-02 14:37:27 +01:00
Maria Matejka 1c0bc707a0 Prefiltering routes by net and custom hook for partial reloads 2023-11-02 14:37:27 +01:00
Maria Matejka 2659aebd9b Channel feeding request respects the subnet tries 2023-11-02 14:37:27 +01:00
Maria Matejka 898e268d0f Channel feeding request has a done-hook 2023-11-02 14:37:27 +01:00
Maria Matejka f730ecef4f Dumping route sources along with protocols and routes 2023-11-01 18:25:40 +01:00
Maria Matejka 8917f16e4b Merge branch 'mq-aggregator-for-v3' into HEAD 2023-11-01 10:58:31 +01:00
Igor Putovny f42c118aa7 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.

This is a split-commit of the neighboring aggregator branch
with a bit improved lvalue handling, to have easier merge into v3.
2023-10-31 16:40:46 +01:00
Maria Matejka ddf698ec99 Renamed nest/rt.h back to nest/route.h
Some [redacted] (yes, myself) had a really bad idea
to rename nest/route.h to nest/rt.h while refactoring
some data structures out of it.

This led to unnecessarily complex problems with
merging updates from v2. Reverting this change
to make my life a bit easier.

At least it needed only one find-sed command:

    find -name '*.[chlY]' -type f -exec sed -i 's#nest/rt.h#nest/route.h#' '{}' +
2023-10-29 16:29:26 +01:00
Maria Matejka 0ba22509a8 Merge commit '51f2e7af' into thread-next
Conflicts:
	conf/cf-lex.l
	conf/conf.h
	conf/confbase.Y
	filter/config.Y
	nest/config.Y
	nest/proto.c
	nest/rt-table.c
	proto/bgp/bgp.c
	sysdep/unix/main.c
2023-10-27 18:29:31 +02:00
Maria Matejka b901cca2df Protocol: better granularity of pool management
There are now 3 different pools with specific lifetime. All of these are
available since protocol start, anyway they get freed in different
moments.

First, pool_up gets freed immediately after announcing PS_STOP, to e.g.
stop all timers and events regularly updating the routing table when the
imports are already flushing.

Then, pool_inloop gets freed just before the protocol loop is finally
stopped, after all channels, imports and exports and other hooks are
cleaned up.

And finally, the pool itself is freed the last. Unless you explicitly
need the early free, use this pool.
2023-10-13 10:22:09 +02:00
Maria Matejka afb9d5d450 Channel: using a separate pool for export data 2023-10-12 11:38:23 +02:00
Maria Matejka b708dd367a Merge commit '4972590e' into thread-next 2023-10-12 11:05:28 +02:00
Maria Matejka 65ced75e95 Merge branch 'mq-bmp-to-merge-to-v3' into thread-next 2023-10-11 22:06:18 +02:00
Ondrej Zajicek a7a9df8639 MPLS: Implement FEC map reconfiguration
This allows changing label policy or label range without restart.
2023-10-04 13:12:05 +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
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
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 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 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 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 51f2e7afaf Conf: Symbol manipulation gets its context explicitly 2023-09-12 15:36:46 +02:00
Ondrej Zajicek 52641e0866 BMP: Use generic channel feed instead of direct walk over rtable
Now we use rt_notify() and channels for both feed and notifications,
in both import tables (pre-policy) and regular tables (post-policy).

Remove direct walk in bmp_route_monitor_snapshot().
2023-08-21 04:24:15 +02:00
Ondrej Zajicek f4deef89be BMP: Refactor route monitoring
- Manage BMP state through bmp_peer, bmp_stream, bmp_table structures
 - Use channels and rt_notify() hook for route announcements
 - Add support for post-policy monitoring
 - Send End-of-RIB even when there is no routes
 - Remove rte_update_in_notify() hook from import tables
 - Update import tables to support channels
 - Add bmp_hack (no feed / no flush) flag to channels
2023-08-18 03:53:58 +02:00
Maria Matejka a818a3011e Channel: configurable feed block size 2023-05-11 11:41:01 +02:00
Maria Matejka 318ac8720f OLocks in BGP must be freed early 2023-05-09 10:33:23 +02:00
Maria Matejka ce7495b49a Refactoring of domains connected to pools 2023-04-25 09:52:28 +02:00
Maria Matejka 22f54eaee6 Resource pools are now bound with domains.
Memory allocation is a fragile part of BIRD and we need checking that
everybody is using the resource pools in an appropriate way. To assure
this, all the resource pools are associated with locking domains and
every resource manipulation is thoroughly checked whether the
appropriate locking domain is locked.

With transitive resource manipulation like resource dumping or mass free
operations, domains are locked and unlocked on the go, thus we require
pool domains to have higher order than their parent to allow for this
transitive operations.

Adding pool locking revealed some cases of insecure memory manipulation
and this commit fixes that as well.
2023-04-24 10:33:28 +02:00
Maria Matejka 6230d87c74 Protocols and tables now use the birdloop pools as primary 2023-04-22 21:20:19 +02:00
Maria Matejka 1141ce4e2d Resource pool closing has its dedicated function 2023-04-22 20:49:58 +02:00
Maria Matejka 074739e0e9 Global protocol list is typed to avoid typecast confusion 2023-04-22 20:48:42 +02:00
Maria Matejka 787fb56da3 IO: added a specific loop pickup group for BFD; to be done better in future 2023-04-17 13:30:14 +02:00
Maria Matejka 571c4f69bf More efficient IO loop event execution to avoid long loops
If there are lots of loops in a single thread and only some of the loops
are actually active, the other loops are now kept aside and not checked
until they actually get some timers, events or active sockets.

This should help with extreme loads like 100k tables and protocols.

Also ping and loop pickup mechanism was allowing subtle race
conditions. Now properly handling collisions between loop ping and pickup.
2023-04-04 17:00:59 +02:00
Maria Matejka 0b7657a9dc Route feed marks only the relevant pending exports as done 2023-04-04 17:00:58 +02:00
Maria Matejka 3a53a12af4 Moved channel export hooks to rt.h as the channel refactoring isn't going to take place soon 2023-04-04 17:00:58 +02:00
Maria Matejka 88fc87afe6 Fixed use-after-free of old protocol name pointer copied into rte_owner structure 2023-04-04 17:00:58 +02:00
Maria Matejka 90de93ca03 Fixed unwanted reloads while reconfiguring protocols with import table on 2023-04-04 17:00:58 +02:00
Maria Matejka 97d2875e99 Fixed bad filter re-evaluation with import table if filtered->accepted
The import table feed wasn't resetting the table-specific route values
like REF_FILTERED and thus made the route look like filtered even though
it should have been re-evaluated as accepted.
2023-04-04 17:00:58 +02:00