]> git.ipfire.org Git - thirdparty/bird.git/log
thirdparty/bird.git
2 years agoMerge branch 'mq-fix-eattr-setting' into thread-next
Maria Matejka [Fri, 9 Sep 2022 11:10:18 +0000 (13:10 +0200)] 
Merge branch 'mq-fix-eattr-setting' into thread-next

2 years agoTable access is now locked.
Maria Matejka [Wed, 7 Sep 2022 11:54:20 +0000 (13:54 +0200)] 
Table access is now locked.

2 years agoTable feed refactoring to allow for locking and unlocking
Maria Matejka [Wed, 7 Sep 2022 18:26:20 +0000 (20:26 +0200)] 
Table feed refactoring to allow for locking and unlocking

2 years agoTable long-locking debug code
Maria Matejka [Wed, 7 Sep 2022 13:06:22 +0000 (15:06 +0200)] 
Table long-locking debug code

2 years agoNext hop updater has its own event
Maria Matejka [Wed, 7 Sep 2022 11:12:44 +0000 (13:12 +0200)] 
Next hop updater has its own event

2 years agoNext hop refactoring to allow for table locking
Maria Matejka [Tue, 6 Sep 2022 17:38:40 +0000 (19:38 +0200)] 
Next hop refactoring to allow for table locking

2 years agoNext hop update triggered at the very end of hostcache update
Maria Matejka [Mon, 5 Sep 2022 10:55:36 +0000 (12:55 +0200)] 
Next hop update triggered at the very end of hostcache update

2 years agoExporter routine refactoring to allow for nicer table locking
Maria Matejka [Mon, 5 Sep 2022 04:58:42 +0000 (06:58 +0200)] 
Exporter routine refactoring to allow for nicer table locking

2 years agoAdded an indirection to the export announcement routine
Maria Matejka [Thu, 1 Sep 2022 09:17:35 +0000 (11:17 +0200)] 
Added an indirection to the export announcement routine

There are performance reasons for this, mostly that we don't want to
ping the table service routine with every import.

2 years agoROA subscriptions are also converted to export requests.
Maria Matejka [Thu, 1 Sep 2022 08:39:56 +0000 (10:39 +0200)] 
ROA subscriptions are also converted to export requests.

By this, the requesting channels do the timers in their own loops,
avoiding unnecessary synchronization when the central timer went off.

This is of course less effective for now, yet it allows to easily
implement selective reloads in future.

2 years agoFlowspec revalidate notification converted to an export hook
Maria Matejka [Wed, 31 Aug 2022 14:04:36 +0000 (16:04 +0200)] 
Flowspec revalidate notification converted to an export hook

Instead of synchronous notifications, we use the asynchronous export
framework to notify flowspec src route updates. This allows us to
invoke flowspec revalidation without locking collisions.

2 years agoHostcache update notification converted to an export hook
Maria Matejka [Wed, 31 Aug 2022 12:01:59 +0000 (14:01 +0200)] 
Hostcache update notification converted to an export hook

Instead of synchronous notifications, we use the asynchronous export
framework to notify also hostcache updates. This allows us to do the
hostcache update and the subsequent next hop update notification without
locking collisions.

2 years agoMiscellaneous refactoring
Maria Matejka [Wed, 31 Aug 2022 09:58:27 +0000 (11:58 +0200)] 
Miscellaneous refactoring

2 years agoTable debug is now a per-table setting and has categories.
Maria Matejka [Tue, 30 Aug 2022 17:40:58 +0000 (19:40 +0200)] 
Table debug is now a per-table setting and has categories.

2 years agoDefault tables are not created unless actually used.
Maria Matejka [Thu, 1 Sep 2022 12:21:56 +0000 (14:21 +0200)] 
Default tables are not created unless actually used.

This allows for setting default table values at the beginning of config
file before "master4" and "master6" tables are initialized.

2 years agoTables: Requesting prune only after export cleanup
Maria Matejka [Tue, 30 Aug 2022 16:05:00 +0000 (18:05 +0200)] 
Tables: Requesting prune only after export cleanup

We can't free the network structures before the export has been cleaned
up, therefore it makes more sense to request prune only after export
cleanup. This change also reduces prune calls on table shutdown.

2 years agoFixed initialization of Linux kernel route attributes
Maria Matejka [Thu, 18 Aug 2022 15:44:00 +0000 (17:44 +0200)] 
Fixed initialization of Linux kernel route attributes

3 years agoMerge branch 'backport' into thread-next
Maria Matejka [Fri, 5 Aug 2022 09:14:33 +0000 (11:14 +0200)] 
Merge branch 'backport' into thread-next

3 years agoMerge commit '082905a8' into thread-next
Maria Matejka [Fri, 5 Aug 2022 09:09:44 +0000 (11:09 +0200)] 
Merge commit '082905a8' into thread-next

3 years agoMerge commit '534d0a4b' into thread-next
Maria Matejka [Fri, 5 Aug 2022 08:37:53 +0000 (10:37 +0200)] 
Merge commit '534d0a4b' into thread-next

3 years agoMerge commit '2e484f8d' into thread-next
Maria Matejka [Fri, 5 Aug 2022 08:31:40 +0000 (10:31 +0200)] 
Merge commit '2e484f8d' into thread-next

3 years agoMerge commit '971721c9' into thread-next
Maria Matejka [Fri, 5 Aug 2022 08:26:13 +0000 (10:26 +0200)] 
Merge commit '971721c9' into thread-next

3 years agoMerge commit '4d48ede5' into thread-next
Maria Matejka [Fri, 5 Aug 2022 07:26:23 +0000 (09:26 +0200)] 
Merge commit '4d48ede5' into thread-next

3 years agoMerge commit 'c7d0c5b2' into thread-next
Maria Matejka [Wed, 3 Aug 2022 18:01:42 +0000 (20:01 +0200)] 
Merge commit 'c7d0c5b2' into thread-next

3 years agoMerge commit '18f66055' into thread-next
Maria Matejka [Wed, 3 Aug 2022 16:00:17 +0000 (18:00 +0200)] 
Merge commit '18f66055' into thread-next

3 years agoMerge commit '038fcf1c' into thread-next
Maria Matejka [Wed, 3 Aug 2022 15:37:16 +0000 (17:37 +0200)] 
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.

3 years agoMerge commit '082905a8' into HEAD
Maria Matejka [Wed, 3 Aug 2022 13:04:42 +0000 (15:04 +0200)] 
Merge commit '082905a8' into HEAD

3 years agorip_rte_better() uses the IGP_METRIC_UNKNOWN instead of protocol-specific infinity
Maria Matejka [Fri, 22 Jul 2022 14:09:37 +0000 (16:09 +0200)] 
rip_rte_better() uses the IGP_METRIC_UNKNOWN instead of protocol-specific infinity

3 years agoMerge commit '97476e00' into thread-next
Maria Matejka [Wed, 3 Aug 2022 12:07:53 +0000 (14:07 +0200)] 
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.

3 years agoBGP: The bucket/prefix hashes are now a resource to allow for proper cleanup
Maria Matejka [Wed, 3 Aug 2022 09:57:29 +0000 (11:57 +0200)] 
BGP: The bucket/prefix hashes are now a resource to allow for proper cleanup

3 years agoMerge commit 'f0507f05ce57398e135651896dace4cb68eeed54' into thread-next
Maria Matejka [Tue, 2 Aug 2022 20:08:59 +0000 (22:08 +0200)] 
Merge commit 'f0507f05ce57398e135651896dace4cb68eeed54' into thread-next

3 years agoMerge branch 'ballygarvan' into HEAD
Maria Matejka [Tue, 2 Aug 2022 15:58:14 +0000 (17:58 +0200)] 
Merge branch 'ballygarvan' into HEAD

Replacing the old 3.0-alpha0 cork mechanism with another one inside the
routing table. This version should be simpler and also quite clear what
it does, why and when.

3 years agoRevert "Split route table event into separate events"
Maria Matejka [Tue, 2 Aug 2022 15:55:50 +0000 (17:55 +0200)] 
Revert "Split route table event into separate events"

This reverts commit 445eeaf3df126af2c7b61e71c4f08a583eb4fa60.

3 years agoRevert "Table cork: Stop creating updates when there are too many pending."
Maria Matejka [Tue, 2 Aug 2022 15:55:47 +0000 (17:55 +0200)] 
Revert "Table cork: Stop creating updates when there are too many pending."

This reverts commit 3b20722a1fc777c27ab2e0451d0ea3fee7fa81a2.

3 years agoAlso next hop update routines are corking themselves when congestion is detected
Maria Matejka [Tue, 2 Aug 2022 15:51:58 +0000 (17:51 +0200)] 
Also next hop update routines are corking themselves when congestion is detected

3 years agoBGP: respecting table cork
Maria Matejka [Tue, 2 Aug 2022 10:54:11 +0000 (12:54 +0200)] 
BGP: respecting table cork

3 years agoRoute table cork: Indicate whether the export queues are congested.
Maria Matejka [Thu, 28 Jul 2022 11:50:59 +0000 (13:50 +0200)] 
Route table cork: Indicate whether the export queues are congested.

These routines detect the export congestion (as defined by configurable
thresholds) and propagate the state to readers. There are no readers for
now, they will be added in following commits.

3 years agoIntroducing basic RCU primitives for lock-less shared data structures
Maria Matejka [Fri, 12 Nov 2021 21:58:40 +0000 (22:58 +0100)] 
Introducing basic RCU primitives for lock-less shared data structures

3 years agoFixed main birdloop init in unit tests
Maria Matejka [Mon, 1 Aug 2022 13:17:41 +0000 (15:17 +0200)] 
Fixed main birdloop init in unit tests

Some unit tests weren't initializing the birdloop, trying to write the
birdloop ping into stdin. Fixed this and also forced stdin close on
startup of every test just to be sure that CI and local build behave the
same in this. (CI was failing on this while local build not.)

3 years agoSending an event must also ping the target IO loop
Maria Matejka [Thu, 28 Jul 2022 17:52:19 +0000 (19:52 +0200)] 
Sending an event must also ping the target IO loop

3 years agoMoved the thread starting code to IO loop code
Maria Matejka [Thu, 28 Jul 2022 17:49:03 +0000 (19:49 +0200)] 
Moved the thread starting code to IO loop code

3 years agoMerge commit '03bf6b90' into thread-next
Maria Matejka [Thu, 28 Jul 2022 17:22:58 +0000 (19:22 +0200)] 
Merge commit '03bf6b90' into thread-next

3 years agoRevert "Adding a generic cork mechanism for events"
Maria Matejka [Thu, 28 Jul 2022 17:22:48 +0000 (19:22 +0200)] 
Revert "Adding a generic cork mechanism for events"

This reverts commit 6e841b3153565632b6753f6b1fe74850c37f2808.

3 years agoMerge branch 'master' into backport
Ondrej Zajicek [Tue, 26 Jul 2022 22:47:24 +0000 (00:47 +0200)] 
Merge branch 'master' into backport

3 years agoNetlink: Restrict route replace for IPv6
Ondrej Zajicek [Tue, 26 Jul 2022 16:45:20 +0000 (18:45 +0200)] 
Netlink: Restrict route replace for IPv6

Seems like the previous patch was too optimistic, as route replace is
still broken even in Linux 4.19 LTS (but fixed in Linux 5.10 LTS) for:

  ip route add 2001:db8::/32 via fe80::1 dev eth0
  ip route replace 2001:db8::/32 dev eth0

It ends with two routes instead of just the second.

The issue is limited to direct and special type (e.g. unreachable)
routes, the patch restricts route replace for cases when the new route
is a regular route (with a next hop address).

3 years agoNetlink: Simplify handling of IPv6 ECMP routes
Ondrej Zajicek [Sun, 24 Jul 2022 22:11:40 +0000 (00:11 +0200)] 
Netlink: Simplify handling of IPv6 ECMP routes

When IPv6 ECMP support first appeared in Linux kernel, it used different
API than IPv4 ECMP. Individual next hops were updated and announced
separately, instead of using RTA_MULTIPATH as in IPv4. This has several
drawbacks and requires complex code to merge received notifications to
one multipath route.

When Linux came with IPv6 RTA_MULTIPATH support, the initial versions
were somewhat buggy, so we kept using the old API for updates (splitting
multipath routes to sequences of route updates), while accepting both
old-style routes and RTA_MULTIPATH routes in scans / notifications.

As IPv6 RTA_MULTIPATH support is here for a long time, this patch fully
switches Netlink to the IPv6 RTA_MULTIPATH API and removes old complex
code for handling individual next hop announces.

The required Linux version is at least 4.11 for reliable operation.

Thanks to Daniel Gröber for the original patch.

3 years agoMerge branch 'master' into backport
Ondrej Zajicek [Sun, 24 Jul 2022 18:08:02 +0000 (20:08 +0200)] 
Merge branch 'master' into backport

3 years agoKRT: Scan routing tables separetely on linux to avoid congestion
Ondrej Zajicek [Sun, 24 Jul 2022 00:15:20 +0000 (02:15 +0200)] 
KRT: Scan routing tables separetely on linux to avoid congestion

Remove compile-time sysdep option CONFIG_ALL_TABLES_AT_ONCE, replace it
with runtime ability to run either separate table scans or shared scan.

On Linux, use separate table scans by default when the netlink socket
option NETLINK_GET_STRICT_CHK is available, but retreat to shared scan
when it fails.

Running separate table scans has advantages where some routing tables are
managed independently, e.g. when multiple routing daemons are running on
the same machine, as kernel routing table modification performance is
significantly reduced when the table is modified while it is being
scanned.

Thanks Daniel Gröber for the original patch and Toke Høiland-Jørgensen
for suggestions.

3 years agoFixed a rarely used part of Babel: comparing two routes in table by their metric
Maria Matejka [Fri, 22 Jul 2022 13:48:20 +0000 (15:48 +0200)] 
Fixed a rarely used part of Babel: comparing two routes in table by their metric

3 years agoRevert "Export table: Delay freeing of old stored route."
Maria Matejka [Fri, 22 Jul 2022 13:37:21 +0000 (15:37 +0200)] 
Revert "Export table: Delay freeing of old stored route."

This reverts commit cee0cd148c9b71bf47d007c850193b5fbf9486c1.
This change is not needed in version 2 and the surrounding code has
disappeared mostly in version 3.

3 years agoEvent lists rewritten to a single linked list
Maria Matejka [Fri, 24 Jun 2022 17:53:34 +0000 (19:53 +0200)] 
Event lists rewritten to a single linked list

In multithreaded environment, we need to pass messages between workers.
This is done by queuing events to their respective queues. The
double-linked list is not really useful for that as it needs locking
everywhere.

This commit rewrites the event subsystem to use a single-linked list
where events are enqueued by a single atomic instruction and the queue
is processed after atomically moving the whole queue aside.

3 years agoMerge commit '94eb0858' into thread-next
Maria Matejka [Mon, 18 Jul 2022 10:33:00 +0000 (12:33 +0200)] 
Merge commit '94eb0858' into thread-next

3 years agoMerge commit 'a4451535' into thread-next
Maria Matejka [Mon, 18 Jul 2022 09:11:46 +0000 (11:11 +0200)] 
Merge commit 'a4451535' into thread-next

3 years agoFixed an annoying warning in ea_get_storage()
Maria Matejka [Mon, 18 Jul 2022 08:56:20 +0000 (10:56 +0200)] 
Fixed an annoying warning in ea_get_storage()

3 years agoFixing build issues caused by a nonportable Makefile rule
Maria Matejka [Mon, 18 Jul 2022 08:26:55 +0000 (10:26 +0200)] 
Fixing build issues caused by a nonportable Makefile rule

3 years agoMerge commit 'a845651b' into thread-next
Maria Matejka [Mon, 18 Jul 2022 08:19:59 +0000 (10:19 +0200)] 
Merge commit 'a845651b' into thread-next

3 years agoMerge commit 'c70b3198' into thread-next [lots of conflicts]
Maria Matejka [Fri, 15 Jul 2022 12:57:02 +0000 (14:57 +0200)] 
Merge commit 'c70b3198' into thread-next [lots of conflicts]

There were more conflicts that I'd like to see, most notably in route
export. If a bisect identifies this commit with something related, it
may be simply true that this commit introduces that bug. Let's hope it
doesn't happen.

3 years agoFixed invalid routes handling
Maria Matejka [Thu, 14 Jul 2022 09:09:23 +0000 (11:09 +0200)] 
Fixed invalid routes handling

The invalid routes were filtered out before they could ever get
exported, yet some of the routines need them available, e.g. for
display or import reload.

Now the invalid routes are properly exported and dropped in channel
export routines instead.

3 years agoMerge branch 'backport' into thread-next
Maria Matejka [Wed, 13 Jul 2022 12:46:36 +0000 (14:46 +0200)] 
Merge branch 'backport' into thread-next

3 years agoMerge commit '2e5bfeb73ac25e236a24b6c1a88d0f2221ca303f' into thread-next
Maria Matejka [Wed, 13 Jul 2022 12:14:37 +0000 (14:14 +0200)] 
Merge commit '2e5bfeb73ac25e236a24b6c1a88d0f2221ca303f' into thread-next

3 years agoMerge commit 'd429bc5c841a8e9d4c81786973edfa56d20a407e' into thread-next
Maria Matejka [Wed, 13 Jul 2022 10:54:20 +0000 (12:54 +0200)] 
Merge commit 'd429bc5c841a8e9d4c81786973edfa56d20a407e' into thread-next

3 years agoMerge commit '7e9cede1fd1878fb4c00e793bccd0ca6c18ad452' into thread-next
Maria Matejka [Wed, 13 Jul 2022 10:02:34 +0000 (12:02 +0200)] 
Merge commit '7e9cede1fd1878fb4c00e793bccd0ca6c18ad452' into thread-next

3 years agoFixed bug in repeated show route command
Maria Matejka [Wed, 13 Jul 2022 09:19:00 +0000 (11:19 +0200)] 
Fixed bug in repeated show route command

Introduced by 13ef5e53dd4a98c80261139b4c9ce4b1074cac40, the CLI was not
properly cleaned up when the command finished, causing BIRD to not parse
any other command after "show route".

3 years agoMerge commit 'f18968f5' into thread-next
Maria Matejka [Tue, 12 Jul 2022 13:05:04 +0000 (15:05 +0200)] 
Merge commit 'f18968f5' into thread-next

3 years agoBGP: Minor improvements to BGP roles
Ondrej Zajicek [Tue, 12 Jul 2022 13:03:17 +0000 (15:03 +0200)] 
BGP: Minor improvements to BGP roles

Add support for bgp_otc in filters and warning for configuration
inside confederations.

3 years agoMerge commit '1df20989' into thread-next
Maria Matejka [Tue, 12 Jul 2022 12:46:17 +0000 (14:46 +0200)] 
Merge commit '1df20989' into thread-next

3 years agoRevert "Special table hooks rectified."
Maria Matejka [Tue, 12 Jul 2022 12:46:06 +0000 (14:46 +0200)] 
Revert "Special table hooks rectified."

This reverts commit 44f26c49f966ca842ff9af55468de0b98c44b73e.

3 years agoRemoving the rte_modify API
Maria Matejka [Tue, 12 Jul 2022 10:40:18 +0000 (12:40 +0200)] 
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.

3 years agoRoute refresh in tables uses a stale counter.
Maria Matejka [Tue, 12 Jul 2022 08:36:10 +0000 (10:36 +0200)] 
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.

3 years agoBGP: Implement BGP roles
Eugene Bogomazov [Mon, 11 Jul 2022 15:19:34 +0000 (17:19 +0200)] 
BGP: Implement BGP roles

Implement BGP roles as described in RFC 9234. It is  a mechanism for
route leak prevention and automatic route filtering based on common BGP
topology relationships. It defines role capability (controlled by 'local
role' option) and OTC route attribute, which is used for automatic route
filtering and leak detection.

Minor changes done by commiter.

3 years agoThere are now no internal tables at all.
Maria Matejka [Mon, 11 Jul 2022 15:08:59 +0000 (17:08 +0200)] 
There are now no internal tables at all.

3 years agoDropped the internal kernel protocol table for learnt routes.
Maria Matejka [Mon, 11 Jul 2022 15:04:52 +0000 (17:04 +0200)] 
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.

3 years agoExport tables merged with BGP prefix hash
Maria Matejka [Mon, 20 Jun 2022 17:10:49 +0000 (19:10 +0200)] 
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.

3 years agoHash: iterable now per partes by an iterator
Maria Matejka [Wed, 29 Jun 2022 11:22:40 +0000 (13:22 +0200)] 
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.

3 years agoDo not try to check flowspec validity for piped routes
Maria Matejka [Wed, 29 Jun 2022 10:51:07 +0000 (12:51 +0200)] 
Do not try to check flowspec validity for piped routes

3 years agoFixed bad import table attributes freeing
Maria Matejka [Tue, 28 Jun 2022 10:57:18 +0000 (12:57 +0200)] 
Fixed bad import table attributes freeing

3 years agoAttribute lists split to storage headers and data to save BGP memory
Maria Matejka [Tue, 28 Jun 2022 08:51:00 +0000 (10:51 +0200)] 
Attribute lists split to storage headers and data to save BGP memory

3 years agoShow route uses the export request also for one-net queries
Maria Matejka [Mon, 27 Jun 2022 17:53:06 +0000 (19:53 +0200)] 
Show route uses the export request also for one-net queries

3 years agoAdded forgotten route source locking in flowspec validation
Maria Matejka [Mon, 11 Jul 2022 11:04:01 +0000 (13:04 +0200)] 
Added forgotten route source locking in flowspec validation

3 years agoMerge remote-tracking branch 'origin/master' into backport
Maria Matejka [Mon, 11 Jul 2022 09:08:10 +0000 (11:08 +0200)] 
Merge remote-tracking branch 'origin/master' into backport

3 years agoMerge commit 'beb5f78a' into backport
Maria Matejka [Mon, 11 Jul 2022 08:41:17 +0000 (10:41 +0200)] 
Merge commit 'beb5f78a' into backport

3 years agoMerge version 2.0.10 into backport
Maria Matejka [Sun, 10 Jul 2022 12:19:24 +0000 (14:19 +0200)] 
Merge version 2.0.10 into backport

3 years agoFilter: Implement for loops
Ondrej Zajicek (work) [Mon, 14 Mar 2022 19:36:20 +0000 (20:36 +0100)] 
Filter: Implement for loops

For loops allow to iterate over elements in compound data like BGP paths
or community lists. The syntax is:

  for [ <type> ] <variable> in <expr> do <command-body>

3 years agoFilter: Implement mixed declarations of local variables
Ondrej Zajicek (work) [Thu, 10 Mar 2022 00:02:45 +0000 (01:02 +0100)] 
Filter: Implement mixed declarations of local variables

Allow variable declarations mixed with code, also in nested blocks with
proper scoping, and with variable initializers. E.g:

function fn(int a)
{
  int b;
  int c = 10;

  if a > 20 then
  {
    b = 30;
    int d = c * 2;
    print a, b, c, d;
  }

  string s = "Hello";
}

3 years agoFilter: Improve handling of stack frames in filter bytecode
Ondrej Zajicek (work) [Wed, 9 Mar 2022 01:32:29 +0000 (02:32 +0100)] 
Filter: Improve handling of stack frames in filter bytecode

When f_line is done, we have to pop the stack frame. The old code just
removed nominal number of args/vars. Change it to use stored ventry value
modified by number of returned values. This allows to allocate variables
on a stack frame during execution of f_lines instead of just at start.

But we need to know the number of returned values for a f_line. It is 1
for term, 0 for cmd. Store that to f_line during linearization.

3 years agoFilter: Simplify handling of command sequences
Ondrej Zajicek (work) [Tue, 8 Mar 2022 23:31:39 +0000 (00:31 +0100)] 
Filter: Simplify handling of command sequences

Command sequences in curly braces used a separate nonterminal in grammar.
Handle them as a regular command.

3 years agoFilter: Fix bug in variable shadowing
Ondrej Zajicek (work) [Sun, 6 Mar 2022 21:57:33 +0000 (22:57 +0100)] 
Filter: Fix bug in variable shadowing

When a new variable used the same name as an existing symbol in an outer
scope, then offset number was defined based on a scope of the existing
symbol ($3) instead of a scope of the new symbol (sym_). That can lead
to two variables sharing the same memory slot.

3 years agoFilter: Implement soft scopes
Ondrej Zajicek (work) [Sun, 6 Mar 2022 15:37:30 +0000 (16:37 +0100)] 
Filter: Implement soft scopes

Soft scopes are anonymous scopes that most likely do not contain any
symbol, so allocating regular scope is postponed when it is really
needed.

3 years agoFilter: Implement direct recursion
Ondrej Zajicek (work) [Sun, 6 Mar 2022 01:18:01 +0000 (02:18 +0100)] 
Filter: Implement direct recursion

Direct recursion almost worked, just crashed on function signature check.
Split function parsing such that function signature is saved before
function body is processed. Recursive calls are marked so they can be
avoided during f_same() and similar code walking.

Also, include tower of hanoi solver as a test case.

3 years agoFilter: Apply constant promotion for FI_EQ / FI_NEQ
Ondrej Zajicek (work) [Fri, 4 Mar 2022 16:51:50 +0000 (17:51 +0100)] 
Filter: Apply constant promotion for FI_EQ / FI_NEQ

Equality comparison is defined on all values, even of different
types, but we still want to do constant promotion if possible.

3 years agoFilter: Add literal for empty set
Alexander Zubkov [Fri, 4 Mar 2022 13:07:58 +0000 (14:07 +0100)] 
Filter: Add literal for empty set

Add literal for empty set [], which works both for tree-based sets
and prefix sets by using existing constant promotion mechanism.

Minor changes by committer.

3 years agoNest: Cleanups in as_path_filter()
Ondrej Zajicek (work) [Fri, 4 Mar 2022 01:01:34 +0000 (02:01 +0100)] 
Nest: Cleanups in as_path_filter()

Use struct f_val as a common argument for as_path_filter(), as suggested
by Alexander Zubkov. That allows to use NULL sets as valid arguments.

3 years agoFilter: Ensure that all expressions declared return type
Ondrej Zajicek (work) [Thu, 3 Mar 2022 19:34:44 +0000 (20:34 +0100)] 
Filter: Ensure that all expressions declared return type

All instructions with a return value (i.e. expressions, ones with
non-zero outval, third argument in INST()) should declare their return
type. Check that automatically by M4 macros.

Set outval of FI_RETURN to 0. The instruction adds one value to stack,
but syntactically it is a statement, not an expression.

Add fake return type declaration to FI_CALL, otherwise the automatic
check would fail builds.

3 years agoFilter: Improve description of type system
Ondrej Zajicek (work) [Thu, 3 Mar 2022 14:11:05 +0000 (15:11 +0100)] 
Filter: Improve description of type system

3 years agoFilter: Implement type checks for function calls
Ondrej Zajicek (work) [Thu, 3 Mar 2022 02:38:12 +0000 (03:38 +0100)] 
Filter: Implement type checks for function calls

Keep list of function parameters in f_line and use it to verify
types of arguments for function calls. Only static type checks
are implemented.

3 years agoFilter: Clean up function call instruction
Ondrej Zajicek (work) [Tue, 1 Mar 2022 01:04:35 +0000 (02:04 +0100)] 
Filter: Clean up function call instruction

Pass instructions of function call arguments as vararg arguments to
FI_CALL instruction constructor and move necessary magic from parser
code to interpreter / instruction code.

3 years agoPreexport callback now takes the channel instead of protocol as argument next-preexport
Maria Matejka [Mon, 27 Jun 2022 17:04:22 +0000 (19:04 +0200)] 
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.

3 years agoMoved nexthop + hostentry display to other eattrs
Maria Matejka [Mon, 27 Jun 2022 11:39:28 +0000 (13:39 +0200)] 
Moved nexthop + hostentry display to other eattrs

3 years agoRoute attribute display now normalizes ea_lists.
Maria Matejka [Mon, 27 Jun 2022 10:44:11 +0000 (12:44 +0200)] 
Route attribute display now normalizes ea_lists.

This is needed to display every attribute only once with overlay
attribute lists recently introduced.

3 years agoFixed new route comparison
Maria Matejka [Mon, 27 Jun 2022 10:32:15 +0000 (12:32 +0200)] 
Fixed new route comparison