Commit graph

28 commits

Author SHA1 Message Date
Maria Matejka d429bc5c84 Merge commit 'beb5f78a' into backport 2022-07-11 10:41:17 +02:00
Maria Matejka beb5f78ada Preexport callback now takes the channel instead of protocol as argument
Passing protocol to preexport was in fact a historical relic from the
old times when channels weren't a thing. Refactoring that to match
current extensibility needs.
2022-06-27 19:04:24 +02:00
Maria Matejka 19e727a248 Merge commit '60880b539b8886f76961125d89a265c6e1112b7a' into haugesund 2022-03-09 11:29:56 +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
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) 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
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 eb937358c0 Preference moved to RTA and set explicitly in protocols 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 b12442c985 Fixed a harmless warning in production build 2020-05-01 15:41:42 +02:00
Maria Matejka bbe49ae569 Nest: Assumption in rt-show for not-so-intuitive invariant. 2020-05-01 15:19:12 +02:00
Ondrej Zajicek (work) cc75b3e1dc KRT: Remove KRF_SYNC_ERROR flag
This info is now stored in an internal bmap. Unfortunately, net.flags
is still needed for temporary kernel data.
2019-12-19 16:34:35 +01:00
Ondrej Zajicek (work) 5ea39eaa96 Nest: Use bitmaps to keep track of exported routes
Use a hierarchical bitmap in a routing table to assign ids to routes, and
then use bitmaps (indexed by route id) in channels to keep track whether
routes were exported. This avoids unreliable and inefficient re-evaluation
of filters for old routes in order to determine whether they were exported.
2019-11-26 18:39:25 +01:00
Ondrej Zajicek (work) 498d8145c0 Nest: Fix primary flag in show route
The route is changed by rte_make_tmp_attrs(), so we need to compare
net->routes to the original one.

Thanks to Kenth Eriksson for the bugreport.
2019-10-25 13:28:51 +02:00
Ondrej Zajicek (work) 875cc073b0 Nest: Update handling of temporary attributes
The temporary atttributes are no longer removed by ea_do_prune(), but
they are undefined by store_tmp_attrs() protocol hooks. This fixes
several bugs where temporary attributes were removed when they should
not or not removed when they should be. The flag EAF_TEMP is no longer
needed and was removed.

Update all protocol make_tmp_attrs() / store_tmp_attrs() hooks to use
helper functions and to handle unset attributes properly.

Also fix some related bugs like improper handling of empty eattr list.
2019-03-14 17:31:40 +01:00
Jan Maria Matejka 14375237f6 Terminology cleanup: The import_control hook is now called preexport.
Once upon a time, far far away, there were the old Bird developers
discussing what direction of route flow shall be called import and
export. They decided to say "import to protocol" and "export to table"
when speaking about a protocol. When speaking about a table, they
spoke about "importing to table" and "exporting to protocol".

The latter terminology was adopted in configuration, then also the
bird CLI in commit ea2ae6dd0 started to use it (in year 2009). Now
it's 2018 and the terminology is the latter. Import is from protocol to
table, export is from table to protocol. Anyway, there was still an
import_control hook which executed right before route export.

One thing is funny. There are two commits in April 1999 with just two
minutes between them. The older announces the final settlement
on config terminology, the newer uses the other definition. Let's see
their commit messages as the git-log tool shows them (the newer first):

    commit 9e0e485e50
    Author: Martin Mares <mj@ucw.cz>
    Date:   Mon Apr 5 20:17:59 1999 +0000

	Added some new protocol hooks (look at the comments for better explanation):

		make_tmp_attrs          Convert inline attributes to ea_list
		store_tmp_attrs         Convert ea_list to inline attributes
		import_control          Pre-import decisions

    commit 5056c559c4
    Author: Martin Mares <mj@ucw.cz>
    Date:   Mon Apr 5 20:15:31 1999 +0000

	Changed syntax of attaching filters to protocols to hopefully the final
	version:

		EXPORT <filter-spec>    for outbound routes (i.e., those announced
					by BIRD to the rest of the world).
		IMPORT <filter-spec>    for inbound routes (i.e., those imported
					by BIRD from the rest of the world).

	where <filter-spec> is one of:

		ALL                     pass all routes
		NONE                    drop all routes
		FILTER <name>           use named filter
		FILTER { <filter> }     use explicitly defined filter

	For all protocols, the default is IMPORT ALL, EXPORT NONE. This includes
	the kernel protocol, so that you need to add EXPORT ALL to get the previous
	configuration of kernel syncer (as usually, see doc/bird.conf.example for
	a bird.conf example :)).

Let's say RIP to this almost 19-years-old inconsistency. For now, if you
import a route, it is always from protocol to table. If you export a
route, it is always from table to protocol.

And they lived happily ever after.
2018-12-04 10:53:01 +01:00
Jan Maria Matejka 13c0be19d3 Nest: Removing separate tmpa from route propagation
This is a fundamental change of an original (1999) concept of route
processing inside BIRD. During import/export, there was a temporary
ea_list created which was to be used instead of the another one inside
the route itself.

This led to some confusion, quirks, and strange filter code that handled
extended route attributes. Dropping it now.

The protocol interface has changed in an uniform way -- the
`struct ea_list *attrs` argument has been removed from store_tmp_attrs(),
import_control(), rt_notify() and get_route_info().
2018-05-30 17:08:49 +02:00
Ondrej Zajicek (work) a82f692e58 Nest: Trivial whitespace cleanup 2018-02-07 17:12:33 +01:00
Ondrej Zajicek (work) 75d98b6013 Merge branch 'master' into int-new 2018-01-23 18:29:32 +01:00
Ondrej Zajicek (work) eb95b5ec1a Nest: Minor formatting changes 2017-12-08 15:16:47 +01:00
Ondrej Zajicek (work) f047271cb9 Timers: Parse and format functions for microsecond times
Date/time output (e.g. in logs, show commands) can use %f to specify
subsecond time. By default, millisecond precision is used in output.
2017-12-07 13:49:27 +01:00
Ondrej Zajicek (work) a1f5e514ef Implement onlink flag for nexthops
Add proper support for per-nexthop onlink flag in routes to handle next
hop addresses that are not covered by interface IP ranges. Supported by
kernel and static protocols.

Thanks to Vincent Bernat for the idea.
2017-07-04 23:36:21 +02:00
Jan Moskyto Matejka f8d44b01df Nest: split route show into separate file 2017-05-15 12:10:51 +02:00