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

71 Commits

Author SHA1 Message Date
Maria Matejka
b797444e94 Merge commit 'b95dc8f29f18eb177f91fdc4bf0716fac9b15366' into mq-config-ref
Also converted all _Bool's to bool.
2024-06-26 17:19:24 +02:00
Maria Matejka
951d0422fa Attributes: fix collision on free-lookup
Freeing the eattrs is tricky as somebody else may find them
via RTA-unlocked lookup inbetween.
2024-06-12 14:48:33 +02:00
Maria Matejka
a146abc8fd Revert (partial) "Route attributes now use the common lockfree usecount"
This partially reverts commit d617801c31.

The common lockfree doesn't work well for high-volume structures like
eattr cache because it expects the structure to be cleaned up by a
sweeper routine ... which is very ineffective for >1M records.

OTOH, we need the deferred ea_free in all cases ... so keeping that.
2024-06-12 14:48:33 +02:00
Maria Matejka
602595fe10 Attributes: cleanup
Dropping EAF_TYPE__MAX and adding a check for forgotten
ea class registration
2024-06-12 09:23:50 +02:00
Maria Matejka
d617801c31 Route attributes now use the common lockfree usecount
Also route attributes are not freed immediately anymore.
2024-06-04 22:20:18 +02:00
Maria Matejka
b033561045 Route attribute hash replaced with the generic one 2024-06-04 22:20:18 +02:00
Maria Matejka
7a169e46a8 BGP: export table stores routes, reloads and shows in CLI.
In future, this and rtable's data structures should be probably merged
but it isn't a good idea to do now. The used data structure is similar
to rtable -- an array of pointers to linked lists.

Feed is lockless, as with all tables.

Full export (receiving updates) is not supported yet but we don't have
any method how to use it anyway. Gonna implement it later.
2024-06-04 10:11:36 +02:00
Maria Matejka
091130e84b Using ea_lookup_tmp() for temporarily keeping attribute references
To avoid needs for keeping local temporary references for attributes,
now one can use ea_lookup_tmp() to ensure that the attributes are
valid and stored until the task ends. After that, the attributes are
automatically unref'd and also deallocated if needed.
2024-05-25 19:37:16 +02:00
Maria Matejka
83a409abd2 Cached route attributes now have explicitly marked layers
Also the rta_* functions renamed to ea_* functions
2024-05-22 11:34:34 +02:00
Maria Matejka
67aafd99d3 Route flag REF_OBSOLETE
Marking routes obsolete when being removed from table, just to be sure.
2024-05-22 11:34:34 +02:00
Ondrej Zajicek
07757b8a0c Filter: Initialize route attribute flags properly
Move 'flags' field back to ea_class, so filtering code can use it to
initialize route attribute flags when set by filters.
2024-04-01 02:53:25 +02:00
Maria Matejka
058984bc86 BGP: fixed MPLS setting in nexthops
bug introduced somewhere during conversion of nexthops to eattrs
2024-01-29 22:12:38 +01:00
Maria Matejka
8c19f8a209 Merge commit 'db1eb46664d4c76d56dc55a63ce7abe853fc6862' into HEAD 2023-12-08 11:33:43 +01:00
Maria Matejka
1df615991c Generalized the rte_src lockfree usecount algorithm 2023-12-04 10:39:32 +01:00
Maria Matejka
5a916ed53f Locking: Dropping DEFINE_DOMAIN ugly macro 2023-12-04 10:39:32 +01:00
Maria Matejka
00e40a6b80 Merge branch 'mq-aggregator-for-v3' into thread-next 2023-11-09 15:20:13 +01:00
Maria Matejka
30712a2bdf Merge branch 'mq-aggregator-for-v3' into thread-next 2023-11-08 21:51:46 +01:00
Maria Matejka
f730ecef4f Dumping route sources along with protocols and routes 2023-11-01 18:25:40 +01:00
Maria Matejka
f90f2ed680 Merge branch 'mq-aggregator-for-v3' into thread-next 2023-11-01 18:08:49 +01:00
Maria Matejka
8917f16e4b Merge branch 'mq-aggregator-for-v3' into HEAD 2023-11-01 10:58:31 +01:00
Maria Matejka
b0797c2dcd Merge commit 'de70474fed139f9acb4ed3f8e925d12de4edcdd0' into thread-next 2023-10-31 09:58:42 +01:00
Maria Matejka
c5f6dc8142 Merge commit '0a729b50' into thread-next
This merge was particularly difficult. I finally resorted to delete the
symbol scope active flag altogether and replace its usage by other
means.

Also I had to update custom route attribute registration to fit
both the scope updates in v2 and the data model in v3.
2023-10-29 15:42:46 +01:00
Maria Matejka
a920b5111c Properly consted routes inside table 2023-09-24 20:43:04 +02:00
Maria Matejka
98f69aa419 Propagated const through route feed routines 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
Maria Matejka
8d7f516b2a Attribute blocks are now allocated from slabs instead of malloc() 2022-10-12 18:04:39 +02:00
Maria Matejka
fb7fb67445 Table access is now locked. 2022-09-08 15:24:02 +02:00
Maria Matejka
70e01358a0 Merge commit '038fcf1c' into thread-next
It was necessary to update the code to match removal of rta, as well as
existence of cached nested attribute lists.
2022-08-03 17:37:16 +02:00
Maria Matejka
5a96b9b124 Merge commit '97476e00' into thread-next
Had to fix route source locking inside BGP export table as we need to
keep the route sources properly allocated until even last BGP pending
update is sent out, therefore the export table printout is accurate.
2022-08-03 14:07:53 +02:00
Maria Matejka
71b434a987 Merge commit 'f0507f05ce57398e135651896dace4cb68eeed54' into thread-next 2022-08-02 22:08:59 +02:00
Maria Matejka
9901ca6fb3 Fixed an annoying warning in ea_get_storage() 2022-07-18 10:56:20 +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
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
fd72c69678 Attribute lists split to storage headers and data to save BGP memory 2022-07-11 16:07:09 +02:00
Maria Matejka
d2142ad405 Fixed displaying BGP and RIP attributes after recent reworks 2022-06-27 12:32:47 +02:00
Maria Matejka
becab5072d Import tables are stored as an attribute layer inside the main tables.
The separate import tables were too memory-greedy, there is no need for
them being stored as full-sized tables.
2022-06-20 11:56:38 +02:00
Maria Matejka
8c92f47ac7 Route attribute storage keeps the previous layers 2022-06-17 10:55:23 +02:00
Maria Matejka
4364ee9b6f Merge commit '938742decc6e1d6d3a0375dd012b75172e747bbc' into haugesund 2022-06-08 15:31:28 +02:00
Maria Matejka
cae5979871 Merge commit '950775f6fa3d569a9d7cd05e33538d35e895d688' into haugesund
There were quite a lot of conflicts in flowspec validation code which
ultimately led to some code being a bit rewritten, not only adapted from
this or that branch, yet it is still in a limit of a merge.
2022-06-08 11:47:49 +02:00
Maria Matejka
ea109ce3e3 Merge commit '4fe9881d625f10e44109a649e369a413bd98de71' into haugesund 2022-05-31 12:51:34 +02:00
Maria Matejka
1493695c6b Merge commit 'f15f2fcee7eeb5a100bd204a0e67018e25953420' into haugesund 2022-05-30 17:37:08 +02:00
Maria Matejka
7b0c89a47f Merge commit 'f2e725a76882ba6b75c3ce4fb3c760bd83462410' into haugesund 2022-05-30 17:27:03 +02:00
Maria Matejka
41508ceac3 Merge commit '1c30b689ddd032ef8000fb7836348a48ba3184ff' into haugesund 2022-05-30 17:26:25 +02:00
Maria Matejka
65254128e1 Merge commit '702c04fbef222e802ca4dfac645dc75ede522db6' into haugesund 2022-05-30 17:18:46 +02:00
Maria Matejka
1a92ee9d4d Merge commit '337c04c45e1472d6d9b531a3c55f1f2d30ebf308' into haugesund 2022-05-30 17:18:03 +02:00
Maria Matejka
674587d9c8 Merge commit 'd8661a4397e4576ac404661b192dd99d928e7890' into haugesund 2022-05-30 17:11:30 +02:00
Maria Matejka
5051e3c4af Merge commit '17f91f9e6e70f7e3f29502e854823c0d48571eaa' into haugesund 2022-05-30 16:59:24 +02:00
Maria Matejka
8b4b7c6eae Merge commit 'cf07d8ad79273a3bbf0617c17e438602e4b64ece' into haugesund 2022-05-30 16:52:38 +02:00
Maria Matejka
b7e2edd441 Merge commit '1d309c4ce6e95b68c64a8f007f6dd2f1830a5707' into haugesund 2022-05-30 16:48:17 +02:00