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

583 Commits

Author SHA1 Message Date
Maria Matejka
3cfa9ac253 Merge commit 'e2f08c382a2adbbbd94c5cd7d996ce9175e0fb9c' into HEAD 2023-10-12 11:38:16 +02:00
Maria Matejka
b708dd367a Merge commit '4972590e' into thread-next 2023-10-12 11:05:28 +02:00
Maria Matejka
e2f08c382a BGP/BMP: fixed build with no bmp at all 2023-10-12 10:57:55 +02:00
Maria Matejka
4972590ea5 BGP: dropped bgp_fix_attr_flags() (useless remnant from previous versions) 2023-10-12 09:29:09 +02:00
Maria Matejka
2cbf7c48ad Merge commit 'b20b6a9ad204f2648ed3d62720435bb21dfb947c' into thread-next 2023-10-11 22:26:41 +02:00
Maria Matejka
b20b6a9ad2 BGP/BMP: Moved temporary allocation checks to the freeing functions 2023-10-11 22:23:34 +02:00
Maria Matejka
65ced75e95 Merge branch 'mq-bmp-to-merge-to-v3' into thread-next 2023-10-11 22:06:18 +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
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
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
32009cb6eb Logging: Abolished stdio in favor of write() to make the logging faster. 2023-09-24 20:40:06 +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
Ondrej Zajicek
4558adabfb BMP: Improve peer_down handling
Move all bmp_peer_down() calls to one place and make it synchronous with
BGP session down, ensuring that BMP receives peer_down before route
withdraws from flushing.

Also refactor bmp_peer_down_() message generating code.
2023-08-22 01:26:06 +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
Ondrej Zajicek
8ded8baba2 BMP: Simplify route monitoring hooks
No need for *_begin(), *_commit(), and *_end() hooks. The hook *_notify()
is sufficient for everything.
2023-08-01 18:38:02 +02:00
Ondrej Zajicek
e8838d930c BMP: Support multiple instances of BMP protocol
Add internal BMP functions with plicit bmp_proto *p as first argument,
which allows using TRACE() macro. Keep list of BMP instances and call
internal functions. Old BMP functions are wrappers that call internal
functions for all enabled BMP instances.

Extract End-of-RIB mark into separate function.

Based on patch from Michal Zagorski <mzagorsk@akamai.com>. Thanks!
2023-06-08 05:03:15 +02:00
Ondrej Zajicek
c1821a9aba BGP: Improve bgp_create_update_bmp()
Fix issue with missing AF cap (e.g. IPv4 unicast when no capabilities
are announced).

Add Linpool save/restore action similar to bgp_create_update().

Based on patch from Michal Zagorski <mzagorsk@akamai.com> co-authored
with Pawel Maslanka <pmaslank@akamai.com>. Thanks!
2023-05-30 15:37:52 +02:00
Maria Matejka
794f555f63 BGP: fix listen socket cleanup 2023-05-11 11:41:01 +02:00
Maria Matejka
a818a3011e Channel: configurable feed block size 2023-05-11 11:41:01 +02:00
Maria Matejka
bb28b16fd6 BGP: proactively rehash prefix hash up to shorten collision lists 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
7d8e541057 Linpool state save and restore refactoring 2023-05-06 10:50:31 +02:00
Ondrej Zajicek
aa3c35498d BMP: Use OPEN messages stored in BGP
The BMP protocol needs OPEN messages of established BGP sessions to
construct appropriate Peer Up messages. Instead of saving them internally
we use OPEN messages stored in BGP instances. This allows BMP instances
to be restarted or enabled later.

Because of this change, we can simplify BMP data structures. No need to
keep track of BGP sessions when we are not started. We have to iterate
over all (established) BGP sessions when the BMP session is established.
This is just a scaffolding now, but some kind of iteration would be
necessary anyway.

Also, the commit cleans up handling of msg/msg_length arguments to be
body/body_length consistently in both rx/tx and peer_up/peer_down calls.
2023-05-01 04:01:16 +02:00
Ondrej Zajicek
1be0be1b71 BGP: Save sent and received OPEN messages
These are necessary for BMP Peer UP message and it is better to keep them
in BGP than in BMP (so BMP could be restarted or added later).
2023-05-01 04:01:16 +02:00
Ondrej Zajicek
a8a64ca0fe Conf: Improve handling of keywords
For whatever reason, parser allocated a symbol for every parsed keyword
in each scope. That wasted time and memory. The effect is worsened with
recent changes allowing local scopes, so keywords often promote soft
scopes (with no symbols) to real scopes.

Do not allocate a symbol for a keyword. Take care of keywords that could
be promoted to symbols (kw_sym) and do it explicitly.
2023-04-27 18:41:01 +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
1141ce4e2d Resource pool closing has its dedicated function 2023-04-22 20:49:58 +02:00
Maria Matejka
b3f805ce29 Socket closing has its dedicated function 2023-04-22 20:48:42 +02:00
Ondrej Zajicek
02164814b4 BMP: Allow build without BMP and disable BMP build by default
It has still several important issues to be enabled by default.
2023-04-18 17:21:13 +02:00
Ondrej Zajicek (work)
4d56b70dc5 BMP: Remove duplicate functions for update encoding
Use existing BGP functions also for BMP update encoding.
2023-04-16 20:06:00 +02:00
Ondrej Zajicek (work)
4adebdf198 BMP: Minor cleanups
Remove redundant 'disable' option, simplify IP address serialization,
and remove useless macros.
2023-04-16 20:05:17 +02:00
Pawel Maslanka
a848dad40a BMP protocol support
Initial implementation of a basic subset of the BMP (BGP Monitoring
Protocol, RFC 7854) from Akamai team. Submitted for further review
and improvement.
2023-04-16 20:05:15 +02:00
Maria Matejka
61e64d6a41 Merge commit '9e44ace3' into thread-next-iface 2023-04-14 15:18:18 +02:00
Maria Matejka
1106927213 Merge commit '913ec57f' into thread-next-iface 2023-04-14 13:43:24 +02:00
Trisha Biswas
9e44ace392 BGP: Add 'allow bgp_med' option for EBGP sessions
This option allows to treat bgp_med as regular transitive attribute
on EBGP sessions (without hacks in filters).

Minor changes from committer.
2023-04-14 04:28:37 +02:00
Maria Matejka
22a0900ec2 BFD: fixed a request pickup race condition
When several BGPs requested a BFD session in short time, chances were
that the second BGP would file a request while the pickup routine was
still running and it would get enqueued into the waiting list instead of
being picked up.

Fixed this by enforcing pickup loop restart when new requests got added,
and also by atomically moving the unpicked requests to a temporary list
to announce admin down before actually being added into the wait list.
2023-04-06 12:48:02 +02:00
Maria Matejka
4a69a64745 BGP: set free bind also for connect sockets if configured 2023-04-04 17:00:59 +02:00
Maria Matejka
1b1ed1fc78 BGP: sockets use sk_resume_rx and sk_pause_rx 2023-04-04 17:00:59 +02:00
Maria Matejka
e33902e15c BGP now has its own loop 2023-04-04 17:00:59 +02:00
Maria Matejka
836e857b30 Sockets: Unified API for main and other loops
Now sk_open() requires an explicit IO loop to open the socket in. Also
specific functions for socket RX pause / resume are added to allow for
BGP corking.

And last but not least, socket reloop is now synchronous to resolve
weird cases of the target loop stopping before actually picking up the
relooped socket. Now the caller must ensure that both loops are locked
while relooping, and this way all sockets always have their respective
loop.
2023-04-04 17:00:59 +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
d9f0f4af7d Resource dumps also write out block addresses 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
98f69aa419 Propagated const through route feed routines 2023-04-04 17:00:58 +02:00
Maria Matejka
731ec00840 Allowing to restart a route refresh.
Repeated pipe refeed should not end route refresh as the prune routine
may start pruning otherwise valid routes.

The same applies for BGP repeated route refresh.
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
227352c461 BGP Export Table: Fixed route source objects leaking when prefix best routes is updated 2023-04-04 17:00:58 +02:00
Maria Matejka
2898f8f177 BGP: LLGR Staleness optimization dropped.
This brought unnecessary complexity into the decision procedures while the
performance aspects weren't worth it. It just saved one ea_list traversal
when many others are also done.
2023-04-04 17:00:58 +02:00