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

1113 Commits

Author SHA1 Message Date
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
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
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
54d94f4b1a Showing the nexthop resolution target in import tables 2022-06-16 12:39:08 +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
8fd3811d9d Fixing FlowSpec validation for v3 internal API
Validation is called internally from route table at the same place where
nexthop resolution is done. Also accounting for rte->sender semantics
change (not a channel but the import hook instead).
2022-06-07 12:18:25 +02:00
Ondrej Zajicek
a8a3d95be5 Nest: Improve GC strategy for rtables
Use timer (configurable as 'gc period') to schedule routing table
GC/pruning to ensure that prune is done on time but not too often.

Randomize GC timers to avoid concentration of GC events from different
tables in one loop cycle.

Fix a bug that caused minimum inter-GC interval be 5 us instead of 5 s.

Make default 'gc period' adaptive based on number of routing tables,
from 10 s for small setups to 600 s for large ones.

In marge multi-table RS setup, the patch improved time of flushing
a downed peer from 20-30 min to <2 min and removed 40s latencies.
2022-06-04 17:34:57 +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
c1645b9d5b Merge commit '165156beeb2926472bbceca3c103aacc3f81a8cc' into haugesund 2022-05-30 16:53:18 +02:00
Maria Matejka
b7e2edd441 Merge commit '1d309c4ce6e95b68c64a8f007f6dd2f1830a5707' into haugesund 2022-05-30 16:48:17 +02:00
Maria Matejka
e16e1e4138 Merge commit 'f2f3163f6c3fba7f9ef03640d7b2f6323873d2cc' into haugesund 2022-05-30 16:41:15 +02:00
Maria Matejka
0097f24e2e Merge commit 'de86040b2cf4ec9bfbb64f0e208a19d4d7e51adc' into haugesund 2022-05-30 16:21:48 +02:00
Maria Matejka
86ac1045d7 Merge commit '3fb70b26faca6788aa0bdf1d558414f9f777c6cd' into haugesund 2022-05-30 16:21:02 +02:00
Maria Matejka
b3649ec77e Merge commit 'ef6a903e6f44b467f9606018446095521ad01ef1' into haugesund 2022-05-30 16:20:35 +02:00
Maria Matejka
ba35b0f818 Merge commit '0e1e632f70b74cf111f08175ab3634db2f962579' into haugesund 2022-05-30 15:43:45 +02:00
Maria Matejka
54344f15f8 Merge commit '0d0f6554a5c233bf2bf830ae319191c4b1808d49' into haugesund 2022-05-30 15:43:13 +02:00
Maria Matejka
3752654852 Merge commit '80272d4b64a38ee6f04a1c4e8566cac3a2293176' into haugesund 2022-05-30 15:39:32 +02:00
Maria Matejka
032201378f Merge commit 'cd9550b24487ac7327b0234fd825f4214fdf7b16' into haugesund 2022-05-30 15:38:24 +02:00
Maria Matejka
45af19dd99 Merge commit '652be92a21f5575e5f74f6abe98eb4200b86776c' into haugesund 2022-05-30 15:36:54 +02:00
Maria Matejka
ef3a8138c9 Merge commit '98fd158e28d89f10ee7a41b4f6a14fbd0021ef35' into haugesund 2022-05-30 15:35:29 +02:00
Maria Matejka
81aeccbb00 Merge commit 'd39ef961d1dde230c55fcc931b53f44cb34a1e63' into haugesund 2022-05-30 15:32:11 +02:00
Maria Matejka
d7b077f5d6 Merge commit '4a23ede2b056a41456790cc20a0c3d92a7137693' into haugesund 2022-05-30 15:31:19 +02:00
Maria Matejka
d024f471ea Merge commit 'ebd807c0b8eb0b7a3dc3371cd4c87ae886c00885' into haugesund 2022-05-30 15:27:46 +02:00
Maria Matejka
652be92a21 Merge remote-tracking branch 'origin/master' into haugesund-to-2.0 2022-05-30 15:20:21 +02:00
Maria Matejka
921344c3ba Merge commit '3a6eda995ecfcebff3130d86ee3baeab12a41335' into haugesund 2022-05-30 15:15:19 +02:00
Maria Matejka
938742decc Squashing the route attribute structure into one level.
For now, all route attributes are stored as eattrs in ea_list. This
should make route manipulation easier and it also allows for a layered
approach of route attributes where updates from filters will be stored
as an overlay over the previous version.
2022-05-30 14:39:09 +02:00
Maria Matejka
950775f6fa Route destination field merged with nexthop attribute; splitting flowspec validation result out.
As there is either a nexthop or another destination specification
(or othing in case of ROAs and Flowspec), it may be merged together.
This code is somehow quirky and should be replaced in future by better
implementation of nexthop.

Also flowspec validation result has its own attribute now as it doesn't
have anything to do with route nexthop.
2022-05-30 14:39:09 +02:00
Maria Matejka
4fe9881d62 Moved hostentry to eattr 2022-05-26 14:53:09 +02:00
Maria Matejka
f15f2fcee7 Moved nexthop from struct rta to extended attribute.
This doesn't do anything more than to put the whole structure inside
adata. The overall performance is certainly going downhill; we'll
optimize this later.

Anyway, this is one of the latest items inside rta and in several
commits we may drop rta completely and move to eattrs-only routes.
2022-05-26 12:34:26 +02:00
Ondrej Zajicek
ba2a076001 BGP: Improve tx performance during feed/flush
The prefix hash table in BGP used the same hash function as the rtable.
When a batch of routes are exported during feed/flush to the BGP, they
all have similar hash values, so they are all crowded in a few slots in
the BGP prefix table (which is much smaller - around the size of the
batch - and uses higher bits from hash values), making it much slower due
to excessive collisions. Use a different hash function to avoid this.

Also, increase the batch size to fill 4k BGP packets and increase minimum
BGP bucket and prefix hash sizes to avoid back and forth resizing during
flushes.

This leads to order of magnitude faster flushes (on my test data).
2022-05-15 15:05:37 +02:00
Maria Matejka
f2e725a768 All outstanding MPLS label stacks are stored as adata 2022-05-05 19:28:56 +02:00
Maria Matejka
1c30b689dd Moved route source attribute (RTS_*) to eattrs 2022-05-04 15:39:53 +02:00
Maria Matejka
702c04fbef Removing the route scope attribute. Use custom attributes instead.
The route scope attribute was used for simple user route marking. As
there is a better tool for this (custom attributes), the old and limited
way can be dropped.
2022-05-04 15:39:21 +02:00
Maria Matejka
337c04c45e Moved route preference to eattrs 2022-05-04 15:39:21 +02:00
Maria Matejka
d8661a4397 Joined the RTA igp_metric and EA igp_metric attributes 2022-05-04 15:39:21 +02:00
Maria Matejka
cce974e8ea Conf: Allowing keyword redefinition
Some tokens are both keywords and symbols. For now, we allow only
specific keywords to be redefined; in future, more of the keywords may
be added to this category.

The redefinable keywords must be specified in any .Y file as follows:

  toksym: THE_KEYWORD ;

See proto/bgp/config.Y for an example.

Also dropped a lot of unused terminals.
2022-05-04 15:39:21 +02:00
Maria Matejka
8ebac84bc8 Moved advertising router info (FROM attribute) to eattrs 2022-05-04 15:39:21 +02:00
Maria Matejka
17f91f9e6e Explicit definition structures of route attributes
Changes in internal API:

* Every route attribute must be defined as struct ea_class somewhere.
* Registration of route attributes known at startup must be done by
  ea_register_init() from protocol build functions.
* Every attribute has now its symbol registered in a global symbol table
  defined as SYM_ATTRIBUTE
* All attribute ID's are dynamically allocated.
* Attribute value custom formatting hook is defined in the ea_class.
* Attribute names are the same for display and filters, always prefixed
  by protocol name.

Also added some unit testing code for filters with route attributes.
2022-05-04 15:39:19 +02:00
Maria Matejka
165156beeb Conf: Symbols are properly scoped
Now there is a persistent root symbol scope and all scopes have their
symbol hashes to store local symbols and not leak any symbol out.
2022-05-04 15:38:42 +02:00
Maria Matejka
1d309c4ce6 Enforcing certain data structure explicit paddings.
Implicit paddings have undefined values in C. We want the eattr blocks
to be comparable by memcmp and eattrs settable directly by structrure
literals. This check ensures that all paddings in eattr and bval are
explicit and therefore zeroed in all literals.
2022-05-04 15:37:41 +02:00
Maria Matejka
f2f3163f6c Filters always allocate from tmp_linpool 2022-05-04 15:37:41 +02:00
Maria Matejka
de86040b2c Attribute list normalization cleanup 2022-05-04 15:37:41 +02:00
Maria Matejka
3fb70b26fa Complex route attributes are data structures, shall be in lib also 2022-05-04 15:37:41 +02:00
Maria Matejka
ef6a903e6f Splitting route data structures out to lib 2022-05-04 15:37:41 +02:00
Maria Matejka
0e1e632f70 FIB is a data structure generic enough to be in lib 2022-05-04 15:37:41 +02:00
Maria Matejka
0d0f6554a5 Unified attribute and filter types
This commit removes the EAF_TYPE_* namespace completely and also for
route attributes, filter-based types T_* are used. This simplifies
fetching and setting route attributes from filters.

Also, there is now union bval which serves as an universal value holder
instead of private unions held separately by eattr and filter code.
2022-05-04 15:37:41 +02:00
Maria Matejka
cd9550b244 Implicit ROA check converted to explicit filter instruction sequence 2022-05-04 15:37:41 +02:00
Maria Matejka
22f95d9889 Special attribute types for enums 2022-05-04 15:37:41 +02:00
Maria Matejka
e261b32511 Dropping EAF_VAR_LENGTH as the attribute data is either embedded or adata 2022-05-04 15:37:41 +02:00
Maria Matejka
bc17fee1bf Filter: Bitfield eattrs reading / writing moved to filter code
Before this change, fetch-update-write and bitmasking was hardcoded in
attribute access code cased by the attribute type. Several filter
instructions are used to do it instead.

As this is certainly going to be a little bit slower than before, the
switch block in attribute access code should be completely removed in
near future, helping with both performance and code cleanliness.

The user interface should have stayed intact.
2022-05-04 15:37:41 +02:00
Maria Matejka
98fd158e28 RIP: fixed the EA_RIP_FROM attribute
The interface pointer was improperly converted to u32 and back. Fixing
this by explicitly allocating an adata structure for it. It's not so
memory efficient, we'll optimize this later.
2022-04-13 17:05:12 +02:00
Maria Matejka
4a23ede2b0 Protocols have their own explicit init routines 2022-04-06 18:14:08 +02:00
Maria Matejka
ebd807c0b8 Slab allocator can free the blocks without knowing the parent structure 2022-04-06 18:14:08 +02:00
Maria Matejka
7e86ff2076 All linpools use pages to allocate regular blocks 2022-04-06 18:14:08 +02:00
Maria Matejka
0f68515263 Unsetting route attributes without messing with type system 2022-04-06 18:14:08 +02:00
Maria Matejka
63cf5d5d8c Eattr flags (originated and fresh) get their own struct fields 2022-04-06 18:14:08 +02:00
Maria Matejka
af8568a870 Minor fix: f_val literals should always have named struct fields 2022-04-06 18:14:08 +02:00
Maria Matejka
c53f547a0b Printf variant with a result allocated inside a pool / linpool 2022-03-15 11:21:46 +01:00
Maria Matejka
41572e0c1b Merge commit 'f81702b7' into haugesund 2022-03-09 15:03:48 +01:00
Maria Matejka
9dc1d7782e Merge commit '0767a0c2' into haugesund
Conflicts:
	nest/rt-table.c
2022-03-09 14:40:09 +01:00
Maria Matejka
6151e51ffa Merge commit '8f3942a9' into haugesund
Conflicts:
	nest/rt-table.c
2022-03-09 14:09:34 +01:00
Maria Matejka
4eeae48214 Merge commit '56c8f2f0' into haugesund
Conflicts:
	nest/route.h
	nest/rt-table.c
2022-03-09 13:49:31 +01:00
Maria Matejka
01c9f3d78e Merge commit '575da88f' into haugesund
Conflicts:
	nest/rt-table.c
2022-03-09 13:37:12 +01:00
Maria Matejka
92b832380d Merge commit '1b9189d5' into haugesund 2022-03-09 13:13:05 +01:00
Maria Matejka
1b9189d5fd Route validity check converted to generic macro dispatch 2022-03-09 12:30:05 +01:00
Maria Matejka
19e727a248 Merge commit '60880b539b8886f76961125d89a265c6e1112b7a' into haugesund 2022-03-09 11:29:56 +01:00
Maria Matejka
8a4bc4fdbf BGP Flowspec validation: Removed in-route optimization for multithreading compatibility 2022-03-09 11:27:34 +01:00
Maria Matejka
24773af9e0 Merge commit 'e42eedb9' into haugesund 2022-03-09 11:02:55 +01:00
Maria Matejka
83d9920f90 Merge commit '5cff1d5f' into haugesund
Conflicts:
      proto/bgp/attrs.c
      proto/pipe/pipe.c
2022-03-09 10:56:06 +01:00
Maria Matejka
ff47cd80dd Merge commit 'd5a32563' into haugesund 2022-03-09 10:50:38 +01:00
Maria Matejka
9e60a1fbc3 Fixed resource initialization in unit tests 2022-03-09 10:30:42 +01:00
Maria Matejka
c78247f9b9 Single-threaded version of sark-branch memory page management 2022-03-09 09:10:44 +01:00
Maria Matejka
d814a8cb93 Replaced custom linpools in tests for the common tmp_linpool 2022-03-02 12:13:49 +01:00
Ondrej Zajicek (work)
53a2540687 Merge branch 'oz-trie-table' 2022-02-06 23:42:10 +01:00
Ondrej Zajicek (work)
5a89edc6fd Nest: Implement locking of prefix tries during walks
The prune loop may may rebuild the prefix trie and therefore invalidate
walk state for asynchronous walks (used in 'show route in' cmd). Fix it
by adding locking that keeps the old trie in memory until current walks
are done.

In future this could be improved by rebuilding trie walk states (by
lookup for last found prefix) after the prefix trie rebuild.
2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work)
de6318f70a Nest: Implement prefix trie pruning
When rtable is pruned and network fib nodes are removed, we also need to
prune prefix trie. Unfortunately, rebuilding prefix trie takes long time
(got about 400 ms for 1M networks), so must not be atomic, we have to
rebuild a new trie while current one is still active. That may require
some considerable amount of temporary memory, so we do that only if
we expect significant trie size reduction.
2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work)
1f2eb2aca8 BGP: Implement flowspec validation procedure
Implement flowspec validation procedure as described in RFC 8955 sec. 6
and RFC 9117. The Validation procedure enforces that only routers in the
forwarding path for a network can originate flowspec rules for that
network.

The patch adds new mechanism for tracking inter-table dependencies, which
is necessary as the flowspec validation depends on IP routes, and flowspec
rules must be revalidated when best IP routes change.

The validation procedure is disabled by default and requires that
relevant IP table uses trie, as it uses interval queries for subnets.
2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work)
1ae42e5223 Nest: Add routing table configuration blocks
Allow to specify sorted flag, trie fla, and min/max settle time.

Also do not enable trie by default, it must be explicitly enabled.
2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work)
fde1cff012 Nest: Add convenience functions to check rtable net type 2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work)
61375bd0b3 Nest: Avoid unnecessary net_format() in 'show route' command
When output of 'show route' command was generated, the net_format() was
called for each network prematurely, even if the result was not needed.

Fix the code to call net_format() only when needed. This makes queries
that process many networks but show only few (e.g. 'show route where ..',
or 'show route count') much faster (like 5x - 10x faster).
2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work)
9ac16df3d7 Nest: Add trie iteration code to 'show route'
Add trie iteration code to rt_show_cont() CLI hook and use it to
accelerate 'show route in <addr>' commands using interval queries.
2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work)
ea97b89051 Nest: Implement 'show route in <addr>' command
Implement 'show route in <addr>' command, which shows all routes in
networks that are subnets of given network. Currently limited to IP
network types.
2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work)
836a87b8ac Nest: Attach prefix trie to rtable for faster LPM and interval queries
Attach a prefix trie to IP/VPN/ROA tables. Use it for net_route() and
net_roa_check(). This leads to 3-5x speedups for IPv4 and 5-10x
speedup for IPv6 of these calls.

TODO:
 - Rebuild the trie during rt_prune_table()
 - Better way to avoid trie_add_prefix() in net_get() for existing tables
 - Make it configurable (?)
2022-02-06 23:27:13 +01:00
Alexander Zubkov
0e1fd7ea6a Filter: Add operators to find minimum and maximum element of sets
Add operators .min and .max to find minumum or maximum element in sets
of types: clist, eclist, lclist. Example usage:

bgp_community.min
bgp_ext_community.max
filter(bgp_large_community, [(as1, as2, *)]).min

Signed-off-by: Alexander Zubkov <green@qrator.net>
2021-12-28 04:07:09 +01:00
Ondrej Zajicek (work)
b21104c97e Nest: Do not ignore secondary flag changes in ifa updates
Compare all IA_* flags that are set by sysdep iface code.

The old code ignores IA_SECONDARY flag when comparing whether iface
address updates from kernel changed anything. This is usually not an
issue as kernel removes all secondary addresses due to removal of the
primary one, but it breaks when sysctl 'promote_secondaries' is enabled
and kernel promotes secondary addresses to primary ones.

Thanks to 'Alexander' for the bugreport.
2021-12-18 01:09:52 +01:00
Maria Matejka
f772afc525 Memory statistics split into Effective and Overhead
This feature is intended mostly for checking that BIRD's allocation
strategies don't consume much memory space. There are some cases where
withdrawing routes in a specific order lead to memory fragmentation and
this output should give the user at least a notion of how much memory is
actually used for data storage and how much memory is "just allocated"
or used for overhead.

Also raising the "system allocator overhead estimation" from 8 to 16
bytes; it is probably even more. I've found 16 as a local minimum in
best scenarios among reachable machines. I couldn't find any reasonable
method to estimate this value when BIRD starts up.

This commit also fixes the inaccurate computation of memory overhead for
slabs where the "system allocater overhead estimation" was improperly
added to the size of mmap-ed memory.
2021-11-27 22:54:15 +01:00
Maria Matejka
644e9ca94e Directly mapped pages are kept for future use if temporarily not needed 2021-11-24 19:42:52 +00:00
Maria Matejka
5395880908 Fixed pipe reload/refeed 2021-11-23 12:06:27 +00:00
Maria Matejka
4ba991f19c Fixed channel export map confusion 2021-11-23 11:12:32 +00:00
Maria Matejka
adf37d8eff VRF setting reduced to one argument, using default dummy iface for default vrf 2021-11-22 19:05:44 +01:00
Maria Matejka
4f3fa1623f Pipe runs in parallel. 2021-11-22 19:05:44 +01:00
Maria Matejka
c7d0c5b252 Route subscription uses events 2021-11-22 19:05:44 +01:00
Maria Matejka
18f66055e3 Global table update pool removed 2021-11-22 19:05:44 +01:00
Maria Matejka
038fcf1c8b Locking route attributes cache
To access route attribute cache from multiple threads at once, we have
to lock the cache on writing. The route attributes data structures are
safe to read unless somebody tries to tamper with the cache itself.
2021-11-22 19:05:44 +01:00
Maria Matejka
f0507f05ce Route sources have an explicit owner
This commit prevents use-after-free of routes belonging to protocols
which have been already destroyed, delaying also all the protocols'
shutdown until all of their routes have been finally propagated through
all the pipes down to the appropriate exports.

The use-after-free was somehow hypothetic yet theoretically possible in
rare conditions, when one BGP protocol authors a lot of routes and the
user deletes that protocol by reconfiguring in the same time as next hop
update is requested, causing rte_better() to be called on a
not-yet-pruned network prefix while the owner protocol has been already
freed.

In parallel execution environments, this would happen an inter-thread
use-after-free, causing possible heisenbugs or other nasty problems.
2021-11-22 19:05:44 +01:00
Maria Matejka
dc160e11e1 Route table import-to-export announcement indirection to reduce pipe traffic 2021-11-22 19:05:44 +01:00
Maria Matejka
878eeec12b Routing tables now have their own loops.
This basically means that:
* there are some more levels of indirection and asynchronicity, mostly
  in cleanup procedures, requiring correct lock ordering
* all the internal table operations (prune, next hop update) are done
  without blocking the other parts of BIRD
* the protocols may get their own loops very soon
2021-11-22 19:05:44 +01:00
Maria Matejka
aadf690b14 Higher settle times when route refresh in the source table is running 2021-11-22 19:05:44 +01:00
Maria Matejka
df476c2e5d Corking also feed start to keep BIRD running when refeeds would easily cause congestion 2021-11-22 19:05:44 +01:00
Maria Matejka
0fd1c1d091 Route attribute cache is now lockless on read / clone.
Lots of time was spent locking when accessing route attribute cache.
This overhead should be now reduced to a minimum.
2021-11-22 19:05:44 +01:00
Maria Matejka
2a224a9e1e Route sources have their separate global lock 2021-11-22 19:05:44 +01:00
Maria Matejka
94eb0858c2 Converting the former BFD loop to a universal IO loop and protocol loop.
There is a simple universal IO loop, taking care of events, timers and
sockets. Primarily, one instance of a protocol should use exactly one IO
loop to do all its work, as is now done in BFD.

Contrary to previous versions, the loop is now launched and cleaned by
the nest/proto.c code, allowing for a protocol to just request its own
loop by setting the loop's lock order in config higher than the_bird.

It is not supported nor checked if any protocol changed the requested
lock order in reconfigure. No protocol should do it at all.
2021-11-22 19:05:43 +01:00
Maria Matejka
c70b3198dc Route export is now asynchronous.
To allow for multithreaded execution, we need to break the import-export
chain and buffer the exports before actually processing them.
2021-11-22 19:05:43 +01:00
Maria Matejka
f18968f52f Better profylaction recursive route loops
In some specific configurations, it was possible to send BIRD into an
infinite loop of recursive next hop resolution. This was caused by route
priority inversion.

To prevent priority inversions affecting other next hops, we simply
refuse to resolve any next hop if the best route for the matching prefix
is recursive or any other route with the same preference is recursive.

Next hop resolution doesn't change route priority, therefore it is
perfectly OK to resolve BGP next hops e.g. by an OSPF route, yet if the
same (or covering) prefix is also announced by iBGP, by retraction of
the OSPF route we would get a possible priority inversion.
2021-11-22 19:05:43 +01:00
Maria Matejka
3b20722a1f Table cork: Stop creating updates when there are too many pending.
The corked procedure gets a callback when uncorked. Supported by table
maintenance routines and also BGP.
2021-11-22 19:05:43 +01:00
Maria Matejka
44f26c49f9 Special table hooks rectified.
* internal tables are now more standalone, having their own import and
  export hooks
* route refresh/reload uses stale counter instead of stale flag,
  allowing to drop walking the table at the beginning
* route modify (by BGP LLGR) is now done by a special refeed hook,
  reimporting the modified routes directly without filters
2021-11-22 19:05:43 +01:00
Maria Matejka
445eeaf3df Split route table event into separate events
The former rt_event is dropped in favour of separate table events.
This allows for selective corking of NHU and prune.
2021-11-22 19:05:43 +01:00
Maria Matejka
f81702b7e4 Table import and export are now explicit hooks.
Channels have now included rt_import_req and rt_export_req to hook into
the table instead of just one list node. This will (in future) allow for:

* channel import and export bound to different tables
* more efficient pipe code (dropping most of the channel code)
* conversion of 'show route' to a special kind of export
* temporary static routes from CLI

The import / export states are also updated to the new algorithms.
2021-11-22 18:33:53 +01:00
Maria Matejka
0767a0c288 Secondary and merged exports get a whole feed instead of traversing the table structures directly 2021-11-09 19:20:41 +01:00
Maria Matejka
8f3942a97e Route export: rejected by filter bitmap
If a route has been rejected by filter, store that information
to avoid repeated export filter runs on rejected routes.
2021-11-09 19:20:41 +01:00
Maria Matejka
56c8f2f03a Nest: Route generations and explicit tracking route propagion through pipes 2021-11-09 19:20:41 +01:00
Maria Matejka
575da88f7a Recursive route nexthop updates now announced with valid new_best/old_best information 2021-11-09 19:20:41 +01:00
Maria Matejka
69d1ffde4c Split route data structure to storage (ro) / manipulation (rw) structures.
Routes are now allocated only when they are just to be inserted to the
table. Updating a route needs a locally allocated route structure.
Ownership of the attributes is also now not transfered from protocols to
tables and vice versa but just borrowed which should be easier to handle
in a multithreaded environment.
2021-11-09 19:20:41 +01:00
Maria Matejka
3a8197a9dc Limit containment 2021-11-09 19:20:41 +01:00
Maria Matejka
c56752e436 Protocol stats split to import and export 2021-11-09 19:20:41 +01:00
Maria Matejka
1c2f66f2bd Refeed is done from export table when appropriate 2021-11-09 19:20:41 +01:00
Maria Matejka
60880b539b Extended route trace: logging Path Identifiers 2021-11-09 17:42:36 +01:00
Maria Matejka
0b295d695a Dropping the unused rte_same hook 2021-10-13 19:09:05 +02:00
Maria Matejka
89ff49f8f0 Dropping rte-local dumper entries 2021-10-13 19:09:05 +02:00
Maria Matejka
e42eedb912 Kernel: Convert the rte-local attributes to extended attributes and flags to pflags 2021-10-13 19:09:04 +02:00
Maria Matejka
5cff1d5f02 Route: moved rte_src pointer from rta to rte
It is an auxiliary key in the routing table, not a route attribute.
2021-10-13 19:09:04 +02:00
Maria Matejka
d5a32563df Preexport: No route modification, no linpool needed 2021-10-13 19:09:04 +02:00
Maria Matejka
541881bedf RIP fixup + dropping the tmp_attrs mechanism as obsolete 2021-10-13 19:09:04 +02:00
Maria Matejka
3660f19dd5 Dropping the RTS_DUMMY temporary route storage.
Kernel route sync is done by other ways now and this code is not used
currently.
2021-10-13 19:09:04 +02:00
Maria Matejka
eb937358c0 Preference moved to RTA and set explicitly in protocols 2021-10-13 19:09:04 +02:00
Maria Matejka
cee0cd148c Export table: Delay freeing of old stored route.
This is needed to provide the protocols the full old route after filters
when export table is enabled.
2021-10-13 19:09:04 +02:00
Maria Matejka
ddd89ba12d BGP: Moved the suppressed and stale flags to pflags 2021-10-13 19:09:04 +02:00
Maria Matejka
c507fb41bb Babel: Convert the rte-local attributes to extended attributes 2021-10-13 19:09:04 +02:00
Maria Matejka
8216ec3027 There may be a symbol with NULL protocol when reconfiguring 2021-10-13 19:09:04 +02:00
Maria Matejka
5f0cb61d82 OSPF: Convert the rte-local attributes to extended attributes 2021-10-13 19:09:04 +02:00
Maria Matejka
8ac20511e1 Show route may be accidentally called on shutdown also when not all default tables are present 2021-10-13 19:09:04 +02:00
Maria Matejka
a0e4c66404 RIP: convert the rte-local attributes to extended attributes 2021-10-13 19:09:04 +02:00
Maria Matejka
6e13df70fd Extended route attributes may include also pointers 2021-10-13 19:09:04 +02:00
Maria Matejka
d471d5fc7c IGP metric getter refactoring to protocol callback
Direct protocol hooks for IGP metric inside nest/rt-table.c make the
protocol API unnecessarily complex. Instead, we use a proper callback.
2021-10-13 19:09:04 +02:00
Ondrej Zajicek (work)
47d92d8f9d Nest: Clean up main channel handling
Remove assumption that main channel is the only channel.
2021-09-10 17:32:05 +02:00
Ondrej Zajicek (work)
f761be6b30 Nest: Clean up main channel handling
Remove assumption that main channel is the only channel.
2021-06-17 16:56:51 +02:00
Ondrej Zajicek (work)
1b9bf4e192 Nest: Fix export of tmpattrs through pipes
Pipes copy the original rte with old values, so they require rte to be
exported with stored tmpattrs. Other protocols access stored attributes
using eattr list, so they require rte to be exported with expanded
tmpattrs. This is temporary hack, we plan to remove whoe tmpattr mechanism.

Thanks to Paul Donohue for the bugreport.
2021-06-14 20:02:50 +02:00
Ondrej Zajicek (work)
3ebabab277 Revert "Nest: Fix export of tmpattrs through pipes"
This reverts commit f8e273b5e7.
2021-06-14 17:58:37 +02:00
Ondrej Zajicek (work)
f8e273b5e7 Nest: Fix export of tmpattrs through pipes
In most cases of export there is no need to store back temporary
attributes to rte, as receivers (protocols) access eattr list anyway.
But pipe copies the original rte with old values, so we should store
tmpattrs also during export.

Thanks to Paul Donohue for the bugreport.
2021-06-14 16:30:59 +02:00
Ondrej Zajicek (work)
596f2e32e3 Nest: Allow both 'password' and 'key' keywords for authentication keys 2021-06-09 19:54:01 +02:00