0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 20:28:43 +00:00
Commit Graph

4038 Commits

Author SHA1 Message Date
Vojtech Vilimek
75dd92c1f0 fix typo 2022-07-28 09:56:14 +02:00
Vojtech Vilimek
e299ebd5b6 Stats add custom expression to protocol 2022-07-28 09:28:52 +02:00
Vojtech Vilimek
c4fdf63482 Settle timer revised version
Settle timer now doesn't inherit from timer and is meant to be embeded in other
structures.
2022-07-28 09:25:26 +02:00
Vojtech Vilimek
cbaf6bd630 TMP compiles but doesn't work 2022-07-27 13:21:47 +02:00
Vojtech Vilimek
12f02619c4 Stats documentation 2022-07-26 14:55:42 +02:00
Vojtech Vilimek
0f8e23100e Stats min/max settle time by using settle timer 2022-07-26 14:54:22 +02:00
Vojtech Vilimek
84a7cb1c60 Settle timer - minor changes 2022-07-26 14:53:21 +02:00
Vojtech Vilimek
374ee57466 Settle timer generalization
Settle timer was moved from nest/rt-table.c to lib/timer.c.
2022-07-26 10:47:41 +02:00
Vojtech Vilimek
f28713a0dd Use correct comparison on max generation 2022-07-21 17:06:09 +02:00
Vojtech Vilimek
1c12cc9a11 Settle time for stats protocol, documentation 2022-07-21 16:54:13 +02:00
Vojtech Vilimek
727a8f32c4 Add new global counter for stats channel
New symbol is added for each stats protocol channel, the symbol is accessed by
same name as the underlying channel. Symbols evaluate to the sum of all routes
exported from connected table with generation less than max generation of
particular channel. Default max generation is 16.

Beware you shouldn't make cyclic references as the behavior of such
configuration is not defined!
2022-07-20 17:04:49 +02:00
Vojtech Vilimek
3c8e00c688 Refactor fix - proto_reconfigure() update pointers 2022-07-20 16:54:23 +02:00
Vojtech Vilimek
0dc82d4a1d fix missing elem. sum in stats_channel 2022-07-20 15:01:41 +02:00
Vojtech Vilimek
fe196ec397 Remove duplicate code in proto/stats/stats.c 2022-07-20 12:55:30 +02:00
Vojtech Vilimek
9661370e80 Refactor of struct channel and channel_config
Element struct channel_class *channel was renamed to *class in struct channel
and struct channel_config. New pointers were added to structures above
in both directions. This can simplify and speedup the proces of finding
channel (configuration).
2022-07-20 12:25:20 +02:00
Vojtech Vilimek
31de4be2bc Bug fix 2022-07-20 10:29:46 +02:00
Vojtech Vilimek
f3b9b30693 Code cleanup, fix compiler warnings 2022-07-19 12:15:24 +02:00
Vojtech Vilimek
58d0aeddb3 Add statistics of route exporting (per channel) 2022-07-19 11:58:23 +02:00
Vojtech Vilimek
17a3c903ce TMP: compiles and run (doesn't read max generation) 2022-07-19 10:21:43 +02:00
Vojtech Vilimek
248236db6d Fix bug in stats_rt_notify() 2022-07-15 13:59:14 +02:00
Vojtech Vilimek
3f9b92d273 Implement stats_reconfigure() 2022-07-15 13:33:42 +02:00
Vojtech Vilimek
b53d869405 Add statistics of export route (per protocol) 2022-07-14 17:08:03 +02:00
Vojtech Vilimek
b5ceb9a11c Remove old pipe protocol code. Add init function. 2022-07-14 14:51:03 +02:00
Vojtech Vilimek
a0edbf88e4 Initial commit for new protocol `stats'
The protocol was created as a copy of pipe protocol. Many things left unchanged.
2022-07-13 15:39:14 +02:00
Maria Matejka
5be34f5ab4 Merge commit '7e9cede1fd1878fb4c00e793bccd0ca6c18ad452' into thread-next 2022-07-13 12:02:34 +02:00
Maria Matejka
4ec443b5c2 Fixed bug in repeated show route command
Introduced by 13ef5e53dd, the CLI was not
properly cleaned up when the command finished, causing BIRD to not parse
any other command after "show route".
2022-07-13 11:24:09 +02:00
Maria Matejka
4f16270dd9 Merge commit 'f18968f5' into thread-next 2022-07-12 15:05:04 +02:00
Maria Matejka
2a27564423 Merge commit '1df20989' into thread-next 2022-07-12 14:46:17 +02:00
Maria Matejka
1df20989c1 Revert "Special table hooks rectified."
This reverts commit 44f26c49f9.
2022-07-12 14:46:06 +02:00
Maria Matejka
bc2ce4aaa8 Removing the rte_modify API
For BGP LLGR purposes, there was an API allowing a protocol to directly
modify their stale routes in table before flushing them. This API was
called by the table prune routine which violates the future locking
requirements.

Instead of this, BGP now requests a special route export and reimports
these routes into the table, allowing for asynchronous execution without
locking the table on export.
2022-07-12 14:45:27 +02:00
Maria Matejka
080cbd1219 Route refresh in tables uses a stale counter.
Until now, we were marking routes as REF_STALE and REF_DISCARD to
cleanup old routes after route refresh. This needed a synchronous route
table walk at both beginning and the end of route refresh routine,
marking the routes by the flags.

We avoid these walks by using a stale counter. Every route contains:
  u8 stale_cycle;
Every import hook contains:
  u8 stale_set;
  u8 stale_valid;
  u8 stale_pruned;
  u8 stale_pruning;

In base_state, stale_set == stale_valid == stale_pruned == stale_pruning
and all routes' stale_cycle also have the same value.

The route refresh looks like follows:
+ ----------- + --------- + ----------- + ------------- + ------------ +
|             | stale_set | stale_valid | stale_pruning | stale_pruned |
| Base        |     x     |      x      |        x      |       x      |
| Begin       |    x+1    |      x      |        x      |       x      |
  ... now routes are being inserted with stale_cycle == (x+1)
| End         |    x+1    |     x+1     |        x      |       x      |
  ... now table pruning routine is scheduled
| Prune begin |    x+1    |     x+1     |       x+1     |       x      |
  ... now routes with stale_cycle not between stale_set and stale_valid
      are deleted
| Prune end   |    x+1    |     x+1     |       x+1     |      x+1     |
+ ----------- + --------- + ----------- + ------------- + ------------ +

The pruning routine is asynchronous and may have high latency in
high-load environments. Therefore, multiple route refresh requests may
happen before the pruning routine starts, leading to this situation:

| Prune begin |    x+k    |     x+k     |    x -> x+k   |       x      |
  ... or even
| Prune begin |   x+k+1   |     x+k     |    x -> x+k   |       x      |
  ... if the prune event starts while another route refresh is running.

In such a case, the pruning routine still deletes routes not fitting
between stale_set and and stale_valid, effectively pruning the remnants
of all unpruned route refreshes from before:

| Prune end   |    x+k    |     x+k     |       x+k     |      x+k     |

In extremely rare cases, there may happen too many route refreshes
before any route prune routine finishes. If the difference between
stale_valid and stale_pruned becomes more than 128 when requesting for
another route refresh, the routine walks the table synchronously and
resets all the stale values to a base state, while logging a warning.
2022-07-12 12:22:41 +02:00
Maria Matejka
4ef2262bd5 There are now no internal tables at all. 2022-07-11 17:08:59 +02:00
Maria Matejka
9efaf6bafe Dropped the internal kernel protocol table for learnt routes.
The learnt routes are now pushed all into the connected table, not only
the best one. This shouldn't do any damage in well managed setups, yet
it should be noted that it is a change of behavior.

If anybody misses a feature which they implemented by misusing this
internal learn table, let us know, we'll consider implementing it in a
better way.
2022-07-11 17:04:52 +02:00
Maria Matejka
6b0368cc2c Export tables merged with BGP prefix hash
Until now, if export table was enabled, Nest was storing exactly the
route before rt_notify() was called on it. This was quite sloppy and
spooky and it also wasn't reflecting the changes BGP does before
sending. And as BGP is storing the routes to be sent anyway, we are
simply keeping the already-sent routes in there to better rule out
unneeded reexports.

Some of the route attributes (IGP metric, preference) make no sense in
BGP, therefore these will be probably replaced by something sensible.
Also the nexthop shown in the short output is the BGP nexthop.
2022-07-11 16:07:09 +02:00
Maria Matejka
d5e3272f3d Hash: iterable now per partes by an iterator
It's now possible to pause iteration through hash. This requires
struct hash_iterator to be allocated somewhere handy.

The iteration itself is surrounded by HASH_WALK_ITER and
HASH_WALK_ITER_END. Call HASH_WALK_ITER_PUT to ask for pausing; it may
still do some more iterations until it comes to a suitable pausing
point. The iterator must be initalized to an empty structure. No cleanup
is needed if iteration is abandoned inbetween.
2022-07-11 16:07:09 +02:00
Maria Matejka
b06911f6ef Do not try to check flowspec validity for piped routes 2022-07-11 16:07:09 +02:00
Maria Matejka
61842ff315 Fixed bad import table attributes freeing 2022-07-11 16:07:09 +02:00
Maria Matejka
fd72c69678 Attribute lists split to storage headers and data to save BGP memory 2022-07-11 16:07:09 +02:00
Maria Matejka
dc720a085f Show route uses the export request also for one-net queries 2022-07-11 16:07:09 +02:00
Maria Matejka
7e9cede1fd Merge version 2.0.10 into backport 2022-07-10 14:19:24 +02:00
Maria Matejka
bdd6f72839 Moved nexthop + hostentry display to other eattrs 2022-06-27 13:39:28 +02:00
Maria Matejka
d5cac1a4ef Route attribute display now normalizes ea_lists.
This is needed to display every attribute only once with overlay
attribute lists recently introduced.
2022-06-27 12:44:11 +02:00
Maria Matejka
c431d9c33c Fixed new route comparison 2022-06-27 12:32:47 +02:00
Maria Matejka
d2142ad405 Fixed displaying BGP and RIP attributes after recent reworks 2022-06-27 12:32:47 +02:00
Maria Matejka
0f2f5ac58c Fixed minor bugs in handling some route attributes 2022-06-27 12:32:47 +02:00
Maria Matejka
dfb61dfcea Fixed undefined attribute handling 2022-06-27 12:32:47 +02:00
Maria Matejka
13ef5e53dd The show-route CLI command now uses the route export API
In the multithreaded environment, it is not supposed that anybody
traverses the routing table as the CLI show-route was doing. Now the
routing table traversal is gone and CLI won't hold the table locked
while computing filters.
2022-06-27 12:32:47 +02:00
Maria Matejka
5c1ebe012e Fixed forgotten preference handling in filters 2022-06-26 14:31:31 +02:00
Maria Matejka
9c9059fd17 Allowed optimized exporting of a subprefix tree
Added an option for export filter to allow for prefiltering based on the
prefix. Routes outside the given prefix are completely ignored. Config
is simple:

	export in <net> <filter>;
2022-06-24 15:49:08 +02:00
Maria Matejka
050b4b4e5e Table export generalized to allow for exporting from non-tables 2022-06-24 15:49:08 +02:00