]> git.ipfire.org Git - thirdparty/bird.git/log
thirdparty/bird.git
7 months agoConf: Move definition of struct keyword to conf.h
Ondrej Zajicek [Thu, 14 Sep 2023 15:24:09 +0000 (17:24 +0200)] 
Conf: Move definition of struct keyword to conf.h

7 months agoFilter: Use common initializer for undefined variables and eattrs. mq-func-types
Ondrej Zajicek [Wed, 13 Sep 2023 04:21:26 +0000 (06:21 +0200)] 
Filter: Use common initializer for undefined variables and eattrs.

Undefined paths and clists should use typed f_val with empty adata
instead of just void f_val. Use common initializer to handle both
variables and eattrs.

7 months agoFilter: Minor updates to methods
Ondrej Zajicek [Tue, 12 Sep 2023 16:44:20 +0000 (18:44 +0200)] 
Filter: Minor updates to methods

Remove warning when function-like syntax is used for calling
add/remove/... methods.

Fix argument offset in error messages for function-like syntax.

7 months agoFilter: Split clist add/delete operations to multiple methods
Ondrej Zajicek [Tue, 25 Jul 2023 17:33:51 +0000 (19:33 +0200)] 
Filter: Split clist add/delete operations to multiple methods

7 months agoFilter: Implement constant promotion for multiple dispatch methods
Ondrej Zajicek [Tue, 25 Jul 2023 15:43:52 +0000 (17:43 +0200)] 
Filter: Implement constant promotion for multiple dispatch methods

7 months agoFilter: Print proper error response in multiple method dispatch
Ondrej Zajicek [Wed, 12 Jul 2023 18:11:34 +0000 (20:11 +0200)] 
Filter: Print proper error response in multiple method dispatch

When no matching method is found, print an error response containing
position and type of infringing argument and a set of expected types.

7 months agoFilter: Move argument list reversal from function_call to var_list
Ondrej Zajicek [Wed, 12 Jul 2023 18:01:03 +0000 (20:01 +0200)] 
Filter: Move argument list reversal from function_call to var_list

List of arguments for function calls is constructed in reverse and then
reverted. This was done in function_call grammar rule. Do the reverse
directly in var_list grammar rule. This fixes reverse order of arguments
in method calls.

7 months agoFilter: Better syntax for function return types
Ondrej Zajicek [Tue, 4 Jul 2023 17:07:30 +0000 (19:07 +0200)] 
Filter: Better syntax for function return types

The C-style syntax does not really fit into rest of our syntax.

7 months agoFilter: Implement multiple dispatch for methods
Ondrej Zajicek [Mon, 3 Jul 2023 15:00:58 +0000 (17:00 +0200)] 
Filter: Implement multiple dispatch for methods

 - Extend method descriptors with type signature
 - Daisy chain method descriptors for the same symbol
 - Dispatch methods for same symbol based on type signature
 - Split add/delete/filter operations to multiple methods
 - Replace ad-hoc dispatch of old-style syntax with scope-based dispatch
 - Also change method->arg_num to count initial arg

It still needs some improvements, like better handling of untyped
expressions and better error reporting when no dispatch can be done.

The multiple dispatch could also be extended to dispatch regular
function-like expressions in a uniform way.

7 months agoFilter: Make f_method_call_*() usage symmetric
Ondrej Zajicek [Tue, 27 Jun 2023 23:21:23 +0000 (01:21 +0200)] 
Filter: Make f_method_call_*() usage symmetric

7 months agoFilter: Convert more methods to use METHOD_R()
Ondrej Zajicek [Tue, 27 Jun 2023 19:38:05 +0000 (21:38 +0200)] 
Filter: Convert more methods to use METHOD_R()

7 months agoFilter: Remove number of args from METHOD_R()
Ondrej Zajicek [Tue, 27 Jun 2023 19:16:11 +0000 (21:16 +0200)] 
Filter: Remove number of args from METHOD_R()

Macro METHOD_R() is used for simplest methods, there is no place to
define argument types, so let's force it to be 0.

7 months agoConf: Remove toksym from symbol_known
Ondrej Zajicek [Tue, 27 Jun 2023 12:49:28 +0000 (14:49 +0200)] 
Conf: Remove toksym from symbol_known

No need to have toksym in symbol_known, as defined symbols are preferred
(by scope) to keywords anyway. Adding it just creates grammar conflicts.

7 months agoFilter: Print instructions take only one value (simplification)
Maria Matejka [Mon, 19 Jun 2023 15:24:30 +0000 (17:24 +0200)] 
Filter: Print instructions take only one value (simplification)

7 months agoFilter: Shortened method declarations
Maria Matejka [Mon, 19 Jun 2023 13:49:51 +0000 (15:49 +0200)] 
Filter: Shortened method declarations

7 months agoFilter: The for loop uses the method system for type dispatch
Maria Matejka [Sun, 18 Jun 2023 20:50:45 +0000 (22:50 +0200)] 
Filter: The for loop uses the method system for type dispatch

7 months agoRemoving unused terminals from filter config
Maria Matejka [Sat, 17 Jun 2023 11:05:23 +0000 (13:05 +0200)] 
Removing unused terminals from filter config

7 months agoFilter: Methods rework
Maria Matejka [Fri, 16 Jun 2023 15:35:37 +0000 (17:35 +0200)] 
Filter: Methods rework

Methods can now be called as x.m(y), as long as x can have its type
inferred in config time. If used as a command, it modifies the object,
if used as a value, it keeps the original object intact.

Also functions add(x,y), delete(x,y), filter(x,y) and prepend(x,y) now
spit a warning and are considered deprecated.

It's also possible to call a method on a constant, see filter/test.conf
for examples like bgp_path = +empty+.prepend(1).

Inside instruction definitions (filter/f-inst.c), a METHOD_CONSTRUCTOR()
call is added, which registers the instruction as a method for the type
of its first argument. Each type has its own method symbol table and
filter parser switches between them based on the inferred type of the
object calling the method.

Also FI_CLIST_(ADD|DELETE|FILTER) instructions have been split to allow
for this method dispatch. With type inference, it's now possible.

7 months agoUninitialized filter variables of path/[el]?clist types are now explicitly empty
Maria Matejka [Sat, 17 Jun 2023 08:16:28 +0000 (10:16 +0200)] 
Uninitialized filter variables of path/[el]?clist types are now explicitly empty

7 months agoConf: config warnings show the file position
Maria Matejka [Fri, 16 Jun 2023 20:11:03 +0000 (22:11 +0200)] 
Conf: config warnings show the file position

7 months agoFilter: functions can and should have typed return values
Maria Matejka [Thu, 15 Jun 2023 11:25:40 +0000 (13:25 +0200)] 
Filter: functions can and should have typed return values

7 months agoFilter/Conf: Method names have their own keyword hash
Maria Matejka [Tue, 13 Jun 2023 07:39:29 +0000 (09:39 +0200)] 
Filter/Conf: Method names have their own keyword hash

To allow for future dynamic method definition, parsing method names is
done via a dedicated keyword hash/scope.

7 months agoConf: Allowing conf scope to be explicitly read only
Maria Matejka [Tue, 13 Jun 2023 09:09:41 +0000 (11:09 +0200)] 
Conf: Allowing conf scope to be explicitly read only

7 months agoConf: Symbol manipulation gets its context explicitly
Maria Matejka [Tue, 13 Jun 2023 08:51:03 +0000 (10:51 +0200)] 
Conf: Symbol manipulation gets its context explicitly

7 months agoFilter: any lvalue can get its methods called
Maria Matejka [Mon, 12 Jun 2023 09:37:50 +0000 (11:37 +0200)] 
Filter: any lvalue can get its methods called

7 months agoFilter: split out dot-notation methods to separate targets
Maria Matejka [Mon, 12 Jun 2023 09:20:49 +0000 (11:20 +0200)] 
Filter: split out dot-notation methods to separate targets

This is just a preparationary refactoring to allow type-based method
tables.

7 months agoConf: Keywords have their default symbols
Maria Matejka [Fri, 9 Jun 2023 10:49:19 +0000 (12:49 +0200)] 
Conf: Keywords have their default symbols

This avoids unnecessary collapsed soft scopes caused by keyword symbol multiallocation.

7 months agoConf: Symbol hashes for all scopes
Maria Matejka [Mon, 2 May 2022 18:29:03 +0000 (20:29 +0200)] 
Conf: Symbol hashes for all scopes

This is a backport cherry-pick of commits
  165156beeb2926472bbceca3c103aacc3f81a8cc
  cce974e8ea992d0e6d2f649eca7880b436d91d71

from the v3.0 branch as we need symbol hashes directly inside their
scopes for more general usage than before.

7 months agoDropping empty-type const f_vals, they were copied anyway
Maria Matejka [Fri, 9 Jun 2023 09:02:05 +0000 (11:02 +0200)] 
Dropping empty-type const f_vals, they were copied anyway

7 months agoConf: Adding dummy thread-number setting for easier sharing of configuration between...
Maria Matejka [Fri, 9 Jun 2023 11:49:17 +0000 (13:49 +0200)] 
Conf: Adding dummy thread-number setting for easier sharing of configuration between v2 and v3

7 months agoBFD: Improve handling of AdminDown
Ondrej Zajicek [Tue, 29 Aug 2023 16:23:29 +0000 (18:23 +0200)] 
BFD: Improve handling of AdminDown

According to RFC 5882, system should not interpret the local or remote
session state transition to AdminDown as failure. We followed that for
the local session state but not for the remote session state (which
just triggered a transition of the local state to Down). The patch
fixes that.

We do not properly generate AdminDown on our side, so the patch is
relevant just for interoperability with other systems.

Thanks to Sunnat Samadov for the bugreport.

7 months agoConf: Allow keywords to be redefined by user symbols
Ondrej Zajicek [Tue, 13 Dec 2022 18:31:46 +0000 (19:31 +0100)] 
Conf: Allow keywords to be redefined by user symbols

Most syntactic constructs in BIRD configuration (e.g. protocol options)
are defined as keywords, which are distinct from symbols (user-defined
names for protocols, variables, ...). That may cause backwards
compatibility issue when a new feature is added, as it may collide with
existing user names.

We can allow keywords to be shadowed by symbols in almost all cases to
avoid this issue.

This replaces the previous mechanism, where shadowable symbols have to be
explictly added to kw_syms.

7 months agoFilter: Add separate instruction for uninitialized variable declaration
Ondrej Zajicek [Fri, 25 Aug 2023 21:14:36 +0000 (23:14 +0200)] 
Filter: Add separate instruction for uninitialized variable declaration

The previous approach (use VOID constant for variable initialization)
failed due to dynamic type check failure.

Thanks to Alexander Zubkov <green@qrator.net> for the bugreport.

8 months agoRPKI: Fix conflict in config grammar
Ondrej Zajicek [Fri, 25 Aug 2023 02:32:01 +0000 (04:32 +0200)] 
RPKI: Fix conflict in config grammar

8 months agoNest: Fix missing bar in kw_sym
Ondrej Zajicek [Fri, 25 Aug 2023 02:29:32 +0000 (04:29 +0200)] 
Nest: Fix missing bar in kw_sym

Thanks to Alexander Zubkov for the notice.

8 months agoDoc: Document bytestring type
Alexander Zubkov [Thu, 24 Aug 2023 16:04:33 +0000 (18:04 +0200)] 
Doc: Document bytestring type

8 months agoDoc: Document RAdv "custom option" configuration definition
Alexander Zubkov [Thu, 24 Aug 2023 15:41:51 +0000 (17:41 +0200)] 
Doc: Document RAdv "custom option" configuration definition

8 months agoConf: Use nonterminal bytestring instead of BYTETEXT
Ondrej Zajicek [Thu, 24 Aug 2023 14:59:23 +0000 (16:59 +0200)] 
Conf: Use nonterminal bytestring instead of BYTETEXT

Nonterminal bytestring allows to provide expressions to be evaluated in
places where BYTETEXT is used now: passwords, radv custom option.

Based on the patch from Alexander Zubkov <green@qrator.net>, thanks!

8 months agoFilter: Use more generic approach for intra-config expressions
Alexander Zubkov [Thu, 24 Aug 2023 02:45:55 +0000 (04:45 +0200)] 
Filter: Use more generic approach for intra-config expressions

Replace f_eval_int() function with a type-generic variant: cf_eval().
Implement similar fuction: cf_eval_int() via inline call to cf_eval().

8 months agoFilter: Add bytestring type
Alexander Zubkov [Thu, 24 Aug 2023 02:30:42 +0000 (04:30 +0200)] 
Filter: Add bytestring type

 - Rename BYTESTRING lexem to BYTETEXT, not to collide with 'bytestring' type name
 - Add bytestring type with id T_BYTESTRING (0x2c)
 - Add from_hex() filter function to create bytestring from hex string
 - Add filter test cases for bytestring type

Minor changes by committer.

8 months agoLib: Add functions for reading and writing of bytestrings
Ondrej Zajicek [Thu, 24 Aug 2023 01:04:58 +0000 (03:04 +0200)] 
Lib: Add functions for reading and writing of bytestrings

Based on patch from Alexander Zubkov, thanks!

8 months agoNest: Treat VRF interfaces as inside respective VRFs
Ondrej Zajicek [Wed, 23 Aug 2023 13:55:31 +0000 (15:55 +0200)] 
Nest: Treat VRF interfaces as inside respective VRFs

Despite not having defined 'master interface', VRF interfaces should be
treated as being inside respective VRFs. They behave as a loopback for
respective VRFs. Treating the VRF interface as inside the VRF allows
e.g. OSPF to pick up IP addresses defined on the VRF interface.

For this, we also need to tell apart VRF interfaces and regular interfaces.
Extend Netlink code to parse interface type and mark VRF interfaces with
IF_VRF flag.

Based on the patch from Erin Shepherd, thanks!

8 months agoMerge branch 'bmp'
Ondrej Zajicek [Tue, 22 Aug 2023 13:28:05 +0000 (15:28 +0200)] 
Merge branch 'bmp'

8 months agoRPM: Sync bird.spec from Fedora dist-git
Jakub Ružička [Tue, 22 Aug 2023 12:13:55 +0000 (14:13 +0200)] 
RPM: Sync bird.spec from Fedora dist-git

It seems all Fedora packages are built from epel7 branch.

8 months agoDistro: Add apkg packaging test
Jakub Ružička [Wed, 26 Apr 2023 15:26:30 +0000 (17:26 +0200)] 
Distro: Add apkg packaging test

The test was written by Maria Matejka, thanks!

Run this using

    apkg test

8 months agoDistro: Add apkg compat level
Jakub Ružička [Fri, 21 May 2021 02:48:27 +0000 (04:48 +0200)] 
Distro: Add apkg compat level

This will allow compatibility on future apkg config updates.

8 months agoDebian: Fix for arm64 cross build
Jakub Ružička [Wed, 3 May 2023 12:13:21 +0000 (14:13 +0200)] 
Debian: Fix for arm64 cross build

Mirrors debian patch.

8 months agoDebian: Use {{ now }} in changelog
Jakub Ružička [Thu, 20 Oct 2022 16:47:09 +0000 (18:47 +0200)] 
Debian: Use {{ now }} in changelog

8 months agoDebian: Bump compat level to 11
Jakub Ružička [Wed, 22 Feb 2023 18:01:31 +0000 (19:01 +0100)] 
Debian: Bump compat level to 11

Current is 13, remaining blockers:

- Debian 9 @ 11 (EOL)
- Ubuntu 18.04 @ 12 (EOL 2023-04-02)

8 months agoDebian: Sync packaging with Debian
Jakub Ružička [Tue, 7 Feb 2023 18:20:52 +0000 (19:20 +0100)] 
Debian: Sync packaging with Debian

8 months agoDebian: Add birdcl manpage
Jakub Ružička [Tue, 7 Feb 2023 18:19:57 +0000 (19:19 +0100)] 
Debian: Add birdcl manpage

Mirrors Debian package change.

8 months agoRPM: Add missing BuildRequires: autoconf
Jakub Ružička [Thu, 20 May 2021 16:07:46 +0000 (18:07 +0200)] 
RPM: Add missing BuildRequires: autoconf

8 months agoUse more proper pointers to constant bytestrings
Alexander Zubkov [Tue, 22 Aug 2023 12:44:18 +0000 (14:44 +0200)] 
Use more proper pointers to constant bytestrings

8 months agoBGP: Update RFC reference
Ondrej Zajicek [Tue, 22 Aug 2023 12:20:59 +0000 (14:20 +0200)] 
BGP: Update RFC reference

RFC 5549 was obsoleted by RFC 8950.

8 months agoBMP: Improve peer_down handling
Ondrej Zajicek [Mon, 21 Aug 2023 23:24:21 +0000 (01:24 +0200)] 
BMP: Improve peer_down handling

Move all bmp_peer_down() calls to one place and make it synchronous with
BGP session down, ensuring that BMP receives peer_down before route
withdraws from flushing.

Also refactor bmp_peer_down_() message generating code.

8 months agoBMP: Use generic channel feed instead of direct walk over rtable
Ondrej Zajicek [Mon, 21 Aug 2023 02:20:32 +0000 (04:20 +0200)] 
BMP: Use generic channel feed instead of direct walk over rtable

Now we use rt_notify() and channels for both feed and notifications,
in both import tables (pre-policy) and regular tables (post-policy).

Remove direct walk in bmp_route_monitor_snapshot().

8 months agoNest: Use generic rte_announce() also for import tables
Ondrej Zajicek [Mon, 21 Aug 2023 02:17:21 +0000 (04:17 +0200)] 
Nest: Use generic rte_announce() also for import tables

Remove special rte_announce_in(), so we can use generic rte_announce()
for bot feed and notifications.

8 months agoBMP: Fix route timestamps
Ondrej Zajicek [Fri, 18 Aug 2023 13:39:08 +0000 (15:39 +0200)] 
BMP: Fix route timestamps

8 months agoBMP: Refactor route monitoring
Ondrej Zajicek [Fri, 18 Aug 2023 01:53:58 +0000 (03:53 +0200)] 
BMP: Refactor route monitoring

 - Manage BMP state through bmp_peer, bmp_stream, bmp_table structures
 - Use channels and rt_notify() hook for route announcements
 - Add support for post-policy monitoring
 - Send End-of-RIB even when there is no routes
 - Remove rte_update_in_notify() hook from import tables
 - Update import tables to support channels
 - Add bmp_hack (no feed / no flush) flag to channels

8 months agoBMP: Remove useless buffer
Ondrej Zajicek [Tue, 1 Aug 2023 16:39:38 +0000 (18:39 +0200)] 
BMP: Remove useless buffer

8 months agoBMP: Simplify route monitoring hooks
Ondrej Zajicek [Tue, 1 Aug 2023 15:56:56 +0000 (17:56 +0200)] 
BMP: Simplify route monitoring hooks

No need for *_begin(), *_commit(), and *_end() hooks. The hook *_notify()
is sufficient for everything.

9 months agoFixed a typo in documentation
Alexander Zubkov [Fri, 30 Jun 2023 11:16:09 +0000 (13:16 +0200)] 
Fixed a typo in documentation

The problem was the "/" symbol in the prefix mask that finished the formatting definition prematurely.

9 months agoRAdv: Use new syntax for custom options
Alexander Zubkov [Mon, 26 Jun 2023 13:35:22 +0000 (15:35 +0200)] 
RAdv: Use new syntax for custom options

And use WALK_LIST macro

10 months agoRAdv: Add custom options
Alexander Zubkov [Fri, 23 Jun 2023 15:21:05 +0000 (17:21 +0200)] 
RAdv: Add custom options

Currently one can use only a predefined set of advertised options in RAdv
protocol, which are supported by BIRD configuration. It would be convenient
to be able to specify other possible options at least manually as a blob
so one should not wait until it is supported in the code, released, etc.

This idea is inspired by presentation by Ondřej Caletka at CSNOG, in which
he noticed the lack of either PREF64 option or possibility to add custom
options in various software.

The patch makes it possible to define such options with the syntax:

  other type <num> <bytestring>

10 months agoAdd hex:XYZ syntax for short hex strings
Alexander Zubkov [Fri, 23 Jun 2023 14:47:37 +0000 (16:47 +0200)] 
Add hex:XYZ syntax for short hex strings

Hexadecimal bytestring literals have minimal length to not collide
with IP addresses or regular (hexadecimal) number literals.

Allow to use shorter literals with explicit hex: prefix.

10 months agoMerge tag 'v2.13.1'
Maria Matejka [Thu, 22 Jun 2023 15:25:18 +0000 (17:25 +0200)] 
Merge tag 'v2.13.1'

10 months agoNEWS and version update stable-2.13 v2.13.1
Maria Matejka [Thu, 22 Jun 2023 14:14:12 +0000 (16:14 +0200)] 
NEWS and version update

10 months agoFilter: Fixed segfault when a case option had an empty block
Maria Matejka [Thu, 22 Jun 2023 14:07:28 +0000 (16:07 +0200)] 
Filter: Fixed segfault when a case option had an empty block

Thanks to Kobayashi_Bairuo <noc@tohunet.com> for reporting.

10 months agoBGP: Fix role check when no capability option is present
Ondrej Zajicek [Thu, 18 May 2023 23:02:57 +0000 (01:02 +0200)] 
BGP: Fix role check when no capability option is present

When an OPEN message without capability options was parsed, the remote
role field was not initialized with the proper (non-zero) default value,
so it was interpreted as if 'provider' was announced.

Thanks to Mikhail Grishin for the bugreport.

10 months agoNetlink: Allow RTA_VIA even without MPLS support
Luiz Amaral [Thu, 15 Jun 2023 13:01:50 +0000 (15:01 +0200)] 
Netlink: Allow RTA_VIA even without MPLS support

It is necessary for IPv4 over IPv6 nexthop support on FreeBSD,
and RTA_VIA is not really related to MPLS.

It breaks build for some very old systems like Debian 8 and CentOS 7,
but we generally do not support older kernels than 4.14 LTS anyway.

10 months agoCI: Remove obsolete CI targets
Ondrej Zajicek [Thu, 15 Jun 2023 13:50:18 +0000 (15:50 +0200)] 
CI: Remove obsolete CI targets

Remove build-debian-8, build-ubuntu-14_04, build-centos-7, pkg-debian-9,
and pkg-centos-7 targets.

Debian 8, Ubuntu 14.04, and CentOS 7 have unsupported kernels, Debian 9
has okay kernel, but is EOL.

10 months agoBMP: Ensure that bmp_fire_tx() does nothing when not up
Ondrej Zajicek [Thu, 8 Jun 2023 03:10:05 +0000 (05:10 +0200)] 
BMP: Ensure that bmp_fire_tx() does nothing when not up

10 months agoBMP: Support multiple instances of BMP protocol
Ondrej Zajicek [Thu, 8 Jun 2023 02:56:41 +0000 (04:56 +0200)] 
BMP: Support multiple instances of BMP protocol

Add internal BMP functions with plicit bmp_proto *p as first argument,
which allows using TRACE() macro. Keep list of BMP instances and call
internal functions. Old BMP functions are wrappers that call internal
functions for all enabled BMP instances.

Extract End-of-RIB mark into separate function.

Based on patch from Michal Zagorski <mzagorsk@akamai.com>. Thanks!

10 months agoBabel: Minor changes to RTT formatting
Ondrej Zajicek [Fri, 2 Jun 2023 00:34:05 +0000 (02:34 +0200)] 
Babel: Minor changes to RTT formatting

Use existing %t printf code and move 'ms' in CLI output to table header.

10 months agoBabel: Add support for the RTT extension
Toke Høiland-Jørgensen [Thu, 1 Jun 2023 22:31:53 +0000 (00:31 +0200)] 
Babel: Add support for the RTT extension

This adds support to the Babel protocol for the RTT extension specified
in draft-ietf-babel-rtt-extension. While this extension is not yet at the
RFC stage, it is one of the more useful extensions to Babel[0], so it
seems worth having in Bird as well.

The extension adds timestamps to Hello and IHU TLVs and uses these to
compute an RTT to each neighbour. An extra per-neighbour cost is then
computed from the RTT based on a minimum and maximum interval and cost
value specified in the configuration. The primary use case for this is
improving routing in a geographically distributed tunnel-based overlay
network.

The implementation follows the babeld implementation when picking
constants and default configuration values. It also uses the same RTT
smoothing algorithm as babeld, and follows it in adding a new 'tunnel'
interface type which enables RTT by default.

[0] https://alioth-lists.debian.net/pipermail/babel-users/2022-April/003932.html

10 months agoIO: Add current_time_now() function for immediate timestamp
Toke Høiland-Jørgensen [Thu, 1 Jun 2023 22:26:41 +0000 (00:26 +0200)] 
IO: Add current_time_now() function for immediate timestamp

Add a current_time_now() function which gets an immediate monotonic
timestamp instead of using the cached value from the event loop. This is
useful for callers that need precise times, such as the Babel RTT
measurement code.

Minor changes by committer.

10 months agoBMP: Fix bug in buffer resize
Ondrej Zajicek [Wed, 31 May 2023 16:32:53 +0000 (18:32 +0200)] 
BMP: Fix bug in buffer resize

The buffer code in bmp_buffer_grow(), reuse the MRT buffer handling code.

Based on comments by Michal Zagorski <mzagorsk@akamai.com>, Thanks!

10 months agoBMP: Proper reconfiguration and protocol status
Ondrej Zajicek [Wed, 31 May 2023 15:41:53 +0000 (17:41 +0200)] 
BMP: Proper reconfiguration and protocol status

Based on patches from Michal Zagorski <mzagorsk@akamai.com> co-authored
with Pawel Maslanka <pmaslank@akamai.com>. Thanks!

10 months agoBMP: Add station address check
Ondrej Zajicek [Tue, 30 May 2023 15:23:56 +0000 (17:23 +0200)] 
BMP: Add station address check

Also, do not initialize it to IPA_NONE4, use regular IPA_NONE.

10 months agoBMP: Add local address option
Michal Zagorski [Tue, 30 May 2023 15:09:25 +0000 (17:09 +0200)] 
BMP: Add local address option

Also remove unused local and ip_post_policy options.

Co-authored with Pawel Maslanka <pmaslank@akamai.com>.

Minor changes by committer.

10 months agoBMP: Minor formatting cleanups
Ondrej Zajicek [Tue, 30 May 2023 13:52:01 +0000 (15:52 +0200)] 
BMP: Minor formatting cleanups

Based on patches from Michal Zagorski <mzagorsk@akamai.com> co-authored
with Pawel Maslanka <pmaslank@akamai.com>. Thanks!

10 months agoBGP: Improve bgp_create_update_bmp()
Ondrej Zajicek [Tue, 30 May 2023 13:37:52 +0000 (15:37 +0200)] 
BGP: Improve bgp_create_update_bmp()

Fix issue with missing AF cap (e.g. IPv4 unicast when no capabilities
are announced).

Add Linpool save/restore action similar to bgp_create_update().

Based on patch from Michal Zagorski <mzagorsk@akamai.com> co-authored
with Pawel Maslanka <pmaslank@akamai.com>. Thanks!

11 months agoBGP: Fix role check when no capability option is present
Ondrej Zajicek [Thu, 18 May 2023 23:02:57 +0000 (01:02 +0200)] 
BGP: Fix role check when no capability option is present

When an OPEN message without capability options was parsed, the remote
role field was not initialized with the proper (non-zero) default value,
so it was interpreted as if 'provider' was announced.

Thanks to Mikhail Grishin for the bugreport.

11 months agoLib: Improve IP/net hashing
Ondrej Zajicek [Thu, 18 May 2023 13:55:45 +0000 (15:55 +0200)] 
Lib: Improve IP/net hashing

Backport some changes from branch oz-parametric-hashes. Replace naive
hash function for IPv6 addresses, fix hashing of VPNx (where upper half
of RD was ignored), fix hashing of MPLS labels (where identity was used).

11 months agoNest: Add tests and benchmark for FIB
Ondrej Zajicek [Tue, 16 May 2023 11:25:48 +0000 (13:25 +0200)] 
Nest: Add tests and benchmark for FIB

Basic fib_get() / fib_find() test for random prefixes, FIB_WALK() test,
and benchmark for fib_find(). Also generalize and reuse some code from
trie tests.

11 months agoBMP: Use OPEN messages stored in BGP
Ondrej Zajicek [Mon, 1 May 2023 01:35:21 +0000 (03:35 +0200)] 
BMP: Use OPEN messages stored in BGP

The BMP protocol needs OPEN messages of established BGP sessions to
construct appropriate Peer Up messages. Instead of saving them internally
we use OPEN messages stored in BGP instances. This allows BMP instances
to be restarted or enabled later.

Because of this change, we can simplify BMP data structures. No need to
keep track of BGP sessions when we are not started. We have to iterate
over all (established) BGP sessions when the BMP session is established.
This is just a scaffolding now, but some kind of iteration would be
necessary anyway.

Also, the commit cleans up handling of msg/msg_length arguments to be
body/body_length consistently in both rx/tx and peer_up/peer_down calls.

11 months agoBGP: Save sent and received OPEN messages
Ondrej Zajicek [Fri, 28 Apr 2023 17:13:56 +0000 (19:13 +0200)] 
BGP: Save sent and received OPEN messages

These are necessary for BMP Peer UP message and it is better to keep them
in BGP than in BMP (so BMP could be restarted or added later).

11 months agoConf: Improve handling of keywords
Ondrej Zajicek [Thu, 27 Apr 2023 16:20:49 +0000 (18:20 +0200)] 
Conf: Improve handling of keywords

For whatever reason, parser allocated a symbol for every parsed keyword
in each scope. That wasted time and memory. The effect is worsened with
recent changes allowing local scopes, so keywords often promote soft
scopes (with no symbols) to real scopes.

Do not allocate a symbol for a keyword. Take care of keywords that could
be promoted to symbols (kw_sym) and do it explicitly.

11 months agoConf: Fix symbol lookup
Ondrej Zajicek [Thu, 27 Apr 2023 15:09:00 +0000 (17:09 +0200)] 
Conf: Fix symbol lookup

The symbol table used just symbol name as a key, and used a trick with
active flag to find symbols in active scopes with one hash table lookup.

The disadvantage is that it can degenerate to O(n) for negative queries
in situations where are many symbols with the same name in different
scopes.

Thanks to Yanko Kaneti for the bugreport.

12 months agoNEWS and version update v2.13
Ondrej Zajicek [Fri, 21 Apr 2023 18:24:43 +0000 (20:24 +0200)] 
NEWS and version update

12 months agoFilter: Disable some trie formatting tests
Ondrej Zajicek [Fri, 21 Apr 2023 17:29:17 +0000 (19:29 +0200)] 
Filter: Disable some trie formatting tests

Trie formatting works slightly different with 4-way tries than with
16-way ones, so these tests generated false error. Block them for now.

12 months agoMerge branch 'bmp'
Ondrej Zajicek [Fri, 21 Apr 2023 02:47:55 +0000 (04:47 +0200)] 
Merge branch 'bmp'

12 months agoBMP: Add some basic documentation
Ondrej Zajicek [Fri, 21 Apr 2023 02:42:13 +0000 (04:42 +0200)] 
BMP: Add some basic documentation

12 months agoBSD: IPv4 over IPv6 nexthop support on FreeBSD
Luiz Amaral [Thu, 20 Apr 2023 23:37:30 +0000 (01:37 +0200)] 
BSD: IPv4 over IPv6 nexthop support on FreeBSD

The support for IPv4 routes with IPv6 nexthops was implemented in FreeBSD
13.1, this patch allows to import and export such routes from/to kernel.

Minor change from committer.

12 months agoLinpool: Fix lp_restore()
Maria Matejka [Thu, 20 Apr 2023 17:33:00 +0000 (19:33 +0200)] 
Linpool: Fix lp_restore()

When lp_save() is called on an empty linpool, then some allocation is
done, then lp_restore() is called, the linpool is restored but the used
chunks are inaccessible. Fix it.

12 months agoBMP: Silence some log messages
Ondrej Zajicek [Thu, 20 Apr 2023 15:14:45 +0000 (17:14 +0200)] 
BMP: Silence some log messages

Hooks called from BGP to BMP should not log warning when BMP is not
connected, that is not an error (and we do not want to flood logs with
a ton of messages).

Blocked sk_send() should not log warning, that is expected situation.
Error during sk_send() is handled in error hook anyway.

12 months agoBMP: Fix connection management
Ondrej Zajicek [Thu, 20 Apr 2023 14:13:58 +0000 (16:13 +0200)] 
BMP: Fix connection management

Replace broken TCP connection management with a simple state machine.
Handle failed attempts properly with a timeout, detect and handle TCP
connection close and try to reconnect after that. Remove useless
'station_connected' flag.

Keep open messages saved even after the BMP session establishment,
so they can be used after BMP session flaps.

Use proper log messages for session events.

12 months agoBMP: Fix reconfiguration
Ondrej Zajicek [Tue, 18 Apr 2023 16:57:54 +0000 (18:57 +0200)] 
BMP: Fix reconfiguration

It is not supported, but at least it must update internal config
pointer to not keep old one.

12 months agoBMP: Allow build without BMP and disable BMP build by default
Ondrej Zajicek [Tue, 18 Apr 2023 15:21:13 +0000 (17:21 +0200)] 
BMP: Allow build without BMP and disable BMP build by default

It has still several important issues to be enabled by default.

12 months agoBMP: Move initialization to bmp_start()
Ondrej Zajicek [Tue, 18 Apr 2023 13:13:24 +0000 (15:13 +0200)] 
BMP: Move initialization to bmp_start()

That fixes BMP socket allocation from an invalid pool.