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

4502 Commits

Author SHA1 Message Date
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
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
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
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
Maria Matejka
510b1046e1 Hostentry application locking
Due to a race condition between rta_apply_hostentry() and rt_update_hostentry(),
happening when a new route is inserted to a table, this commit makes it mandatory
to lock the next hop resolution table while resolving the next hop.

This may be slow, we'll fix it better in some future release
2023-08-29 10:24:54 +02:00
Maria Matejka
7776e47e32 Config obstacles are lockless now 2023-08-24 17:21:58 +02:00
Maria Matejka
5ba9878b4f BFD: Fixed reconfiguration issues
After converting BFD to the new IO loop system, reconfiguration never
really worked. Sadly, we missed this case in our testing suite so it
passed under the radar for quite a while.

Thanks to Andrei Dinu <andrei.dinu@digitalit.ro> for reporting and
isolating this issue.
2023-05-29 19:32:26 +02:00
Maria Matejka
6a3e5c2ae8 Fixed abort when running in foreground but stdin is closed
A forgotten else-clause caused BIRD to treat some pseudo-random place in
memory as fd-pair. This was happening only on startup of the first
thread in group and the value there in memory was typically zero ... and
writing to stdin succeeded.

When running BIRD with stdin not present (like systemd does), it died on
this spurious write. Now it seems to work correctly.

Thanks to Daniel Suchy <danny@danysek.cz> for reporting.

http://trubka.network.cz/pipermail/bird-users/2023-May/016929.html
2023-05-13 20:33:35 +02:00
Maria Matejka
deb303a451 NEWS and version update 2023-05-11 11:41:01 +02:00
Maria Matejka
92d934f0d1 Fix use-after free in thread stopping code 2023-05-11 11:41:01 +02:00
Maria Matejka
794f555f63 BGP: fix listen socket cleanup 2023-05-11 11:41:01 +02:00
Maria Matejka
2623b7ba5d ID Maps are checking whether their pool is locked 2023-05-11 11:41:01 +02:00
Maria Matejka
fcbf22d1f6 Properly protecting the route src global index by RCU read lock and atomic operations
There was a bug occuring when one thread sought for a src by its global id
and another one was allocating another src with such an ID that it caused
route src global index reallocation. This brief moment of inconsistency
led to a rare use-after-free of the old global index block.
2023-05-11 11:41:01 +02:00
Maria Matejka
b36d284788 Threads take loops faster 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
cb51ff1fbb IO Loop / Thread Groups Lock moved to level -attrs- to allow for page allocation while locked 2023-05-07 16:59:19 +02:00
Maria Matejka
62432affd9 Fixed loop movement to not collide on LTT_MOVE 2023-05-07 16:58:56 +02:00
Maria Matejka
e0c09e6bee Fix loop dropping routines 2023-05-07 16:58:52 +02:00
Maria Matejka
a95141111c Fixed a bug in hot page global storage
The original algorithm was suffering from an ABA race condition:

A: fp = page_stack
B: completely allocates the same page and writes into it some data
A: unsuspecting, loads (invalid) next = fp->next
B: finishes working with the page and returns it back to page_stack
A: compare-exchange page_stack: fp => next succeeds and writes garbage
to page_stack

Fixed this by using an implicit spinlock in hot page allocator.
2023-05-06 10:50:32 +02:00
Maria Matejka
00f30ac40b Debug: keep a circular log of memory page operations 2023-05-06 10:50:32 +02:00
Maria Matejka
1e998a4349 Fixed cold page cache leak
The empty_pages pointer wasn't being propagated into the ->next pointer
when more empty_pages were to be stored
2023-05-06 10:50:31 +02:00
Maria Matejka
ed91d884d3 Hostentry: fix pool locking 2023-05-06 10:50:31 +02:00
Maria Matejka
7d8e541057 Linpool state save and restore refactoring 2023-05-06 10:50:31 +02:00
Maria Matejka
b21909c6ee Debug: Explicit mprotect() on freed pages to better locate use-after-free bugs 2023-05-06 10:50:31 +02:00
Maria Matejka
fac6405669 Page allocator: indentation of messy ifdef blocks 2023-05-06 10:50:31 +02:00
Maria Matejka
fa973c2c15 First try of loop balancing
If a thread encounters timeout == 0 for poll, it considers itself
"busy" and with some hysteresis it tries to drop loops for others to
pick and thus better distribute work between threads.
2023-05-06 10:50:26 +02:00
Maria Matejka
9f25dd79b8 Allocation from linpools and slabs requires the appropriate lock to be taken 2023-05-03 21:30:29 +02:00
Maria Matejka
010c26c296 Linpool flushes unused pages even on lp_restore() 2023-05-03 21:30:29 +02:00
Maria Matejka
91471531a1 Fixed race condition in hostentry allocation 2023-05-03 21:30:29 +02:00
Maria Matejka
9bc5cbd3c7 Show threads: Fixed problems with CLI buffer reallocation
... by allocating all the output locally and then sending it out at
once.
2023-05-03 21:30:29 +02:00
Maria Matejka
8bc27583ff Explicitly counting loops and threads 2023-05-03 21:30:29 +02:00