]> git.ipfire.org Git - thirdparty/bird.git/log
thirdparty/bird.git
3 months agoNetlink: Cleanups in route metrics
Ondrej Zajicek [Fri, 16 Feb 2024 13:29:54 +0000 (14:29 +0100)] 
Netlink: Cleanups in route metrics

- Add krt_fastopen_no_cookie atttibute
- Add missing krt_lock_* bits
- Fix krt_feature_allfrag
- Fix type of EA_KRT_LOCK and EA_KRT_FEATURES

3 months agoFilter: Add support for setting TCP congestion control algorithm
Ondrej Zajicek [Wed, 14 Feb 2024 13:01:04 +0000 (14:01 +0100)] 
Filter: Add support for setting TCP congestion control algorithm

Allow to set TCP congestion control algorithm using krt_congctl
route attribute.

Based on patch from Trisha Biswas <tbiswas@fastly.com>, thanks!

3 months agoFilter: Add support for string route attribute
Ondrej Zajicek [Wed, 14 Feb 2024 12:58:56 +0000 (13:58 +0100)] 
Filter: Add support for string route attribute

3 months agoBGP: Allow multiple EBGP neighbors with the same peer.
Alexander Zubkov [Wed, 7 Feb 2024 18:11:10 +0000 (19:11 +0100)] 
BGP: Allow multiple EBGP neighbors with the same peer.

We can distinguish BGP sessions if at least one side uses a different IP
address. Extend olock mechanism to handle local IP as a part of key, with
optional wildcard, so BGP sessions could local IP in the olock and not
block themselves.

3 months agobirdc: Do not execute cmd on noninteractive help request
Inrin [Tue, 6 Feb 2024 18:03:14 +0000 (19:03 +0100)] 
birdc: Do not execute cmd on noninteractive help request

The help command triggered by '?' keeps the message in readline buffer,
so it could be edited. For noninteractive shell it leads to an unexpected
side effect that `echo <cmd> ? | birdc` executes the command <cmd> after
showing its help. Avoid this by clearing the readline buffer in such case.

3 months agoBGP: Increase max length of notification data in error logs
Ondrej Zajicek [Tue, 6 Feb 2024 17:34:55 +0000 (18:34 +0100)] 
BGP: Increase max length of notification data in error logs

Increase max length of notification data in error logs from 16 to 128.
There is already enough space in the buffer.

Thanks to Marco d'Itri for the suggestion.

3 months agoNest: Fix bug in recursive routes with MPLS-labeled nexthops
Ondrej Zajicek [Sat, 27 Jan 2024 16:38:06 +0000 (17:38 +0100)] 
Nest: Fix bug in recursive routes with MPLS-labeled nexthops

When a recursive route with MPLS-labeled nexthop was exported to kernel
and read back, the nexthop_same() failed due to different labels_orig
field and kernel protocol reinstalled it unnecessarily.

For comparing hext hops, route cache has to distinguish ones with
different labels_orig, but KRT has to ignore that, so we need two
nexthop compare functions.

Thanks to Marcel Menzel for the bugreport.

3 months agoFilter: Tests for net_addr
Katerina Kubecova [Fri, 19 Jan 2024 10:54:25 +0000 (11:54 +0100)] 
Filter: Tests for net_addr

Minor changes by committer.

3 months agoTrivial code cleanups
Ondrej Zajicek [Mon, 22 Jan 2024 05:29:14 +0000 (06:29 +0100)] 
Trivial code cleanups

5 months agoOSPF: Cleanup some warnings
Ondrej Zajicek [Wed, 13 Dec 2023 17:07:38 +0000 (18:07 +0100)] 
OSPF: Cleanup some warnings

5 months agoNest: Fix memory alignment in attribute cache
Ondrej Zajicek [Wed, 13 Dec 2023 16:46:16 +0000 (17:46 +0100)] 
Nest: Fix memory alignment in attribute cache

In attribute cache, adata structures were stored densely in one memory
block, without regard to alignment. Let's force at least u32 alignment.

5 months agoLog: Add support for UDP logging
Ondrej Zajicek [Wed, 13 Dec 2023 02:48:12 +0000 (03:48 +0100)] 
Log: Add support for UDP logging

Add support for UDP logging, using RFC 3164 syslog protocol.

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

5 months agoMerge commit 'bb094fb6'
Maria Matejka [Fri, 8 Dec 2023 11:09:30 +0000 (12:09 +0100)] 
Merge commit 'bb094fb6'

5 months agoRefactoring also net_roa_check
Maria Matejka [Fri, 8 Dec 2023 11:07:46 +0000 (12:07 +0100)] 
Refactoring also net_roa_check

Having 4 functions doing almost the same is more mess than three macros.

5 months agoMerge commit '54ddf90f'
Maria Matejka [Fri, 8 Dec 2023 07:30:30 +0000 (08:30 +0100)] 
Merge commit '54ddf90f'

5 months agoConf: debug tables
Maria Matejka [Thu, 7 Dec 2023 13:38:05 +0000 (14:38 +0100)] 
Conf: debug tables

For now just a dummy config but it is needed for forward
compatibility with v3.

5 months agoRefactoring of net_route
Maria Matejka [Thu, 7 Dec 2023 13:10:11 +0000 (14:10 +0100)] 
Refactoring of net_route

5 months agoTable: Adding route refresh begin and end debug messages
Maria Matejka [Thu, 7 Dec 2023 12:54:41 +0000 (13:54 +0100)] 
Table: Adding route refresh begin and end debug messages

5 months agoBGP: Send hold timer
Katerina Kubecova [Fri, 27 Oct 2023 15:11:06 +0000 (17:11 +0200)] 
BGP: Send hold timer

Implement BGP Send hold timer according to draft-ietf-idr-bgp-sendholdtimer.
The Send hold timer drops the session if the neighbor is sending keepalives,
but does not receive our messages, causing the TCP connection to stall.

5 months agoBGP: Add options to require BGP capabilities
Ondrej Zajicek [Thu, 23 Nov 2023 19:54:22 +0000 (20:54 +0100)] 
BGP: Add options to require BGP capabilities

Some BGP capabilities change the BGP behavior in a significant way, so if
the configuration depends on it, it is better to not establish BGP
session when the capability is not available.

Add several BGP option to require individual BGP capabilities during
session negotiation.

5 months agoBGP: Simplify capability handling
Ondrej Zajicek [Thu, 23 Nov 2023 16:18:04 +0000 (17:18 +0100)] 
BGP: Simplify capability handling

6 months agoOSPF: On physical PtP links, skip next-hop resolving
Soha Jin [Thu, 9 Nov 2023 13:33:25 +0000 (14:33 +0100)] 
OSPF: On physical PtP links, skip next-hop resolving

Signed-off-by: Soha Jin <soha@jin.sh>
Co-developed-by: Wende Tan <twd2.me@gmail.com>
6 months agoNest: Minor fixes in MPLS
Ondrej Zajicek [Wed, 25 Oct 2023 16:25:46 +0000 (18:25 +0200)] 
Nest: Minor fixes in MPLS

6 months agoDoc: prefix match prefix pattern definition typo (in sets of prefixes definition)
Michal Rada [Tue, 17 Oct 2023 12:58:14 +0000 (14:58 +0200)] 
Doc: prefix match prefix pattern definition typo (in sets of prefixes definition)

6 months agoUse RTA_MAX_SIZE in rta_do_cow()
Ondrej Zajicek [Tue, 14 Mar 2023 15:02:32 +0000 (16:02 +0100)] 
Use RTA_MAX_SIZE in rta_do_cow()

This allows to modify MPLS label stack in filters. Fixes a bug in
handling of 'gw_mpls' attribute.

6 months agoAutoconf: minor reduction of redundancy
Maria Matejka [Tue, 24 Oct 2023 10:40:52 +0000 (12:40 +0200)] 
Autoconf: minor reduction of redundancy

Joined BIRD_CHECK_GCC_OPTION and BIRD_ADD_GCC_OPTION.

7 months agoCI: Update for new netlab worker
Ondrej Zajicek [Tue, 17 Oct 2023 23:48:11 +0000 (01:48 +0200)] 
CI: Update for new netlab worker

 - Change tag from 'birdlab' to 'netlab'
 - Change path of gitlab-runner home dir
 - Use stayrtr from Debian

7 months agoCI: Add MPLS tests
Ondrej Zajicek [Mon, 16 Oct 2023 13:24:32 +0000 (15:24 +0200)] 
CI: Add MPLS tests

7 months agoMPLS: Fix issue with recursive MPLS routes
Ondrej Zajicek [Mon, 16 Oct 2023 13:21:36 +0000 (15:21 +0200)] 
MPLS: Fix issue with recursive MPLS routes

Recursive MPLS routes used hostentry from the original route, which
triggered different table than MPLS table, and therefore were not
updated.

7 months agoNEWS and version update v2.14
Ondrej Zajicek [Fri, 6 Oct 2023 16:53:25 +0000 (18:53 +0200)] 
NEWS and version update

7 months agoDoc: Minor fixes
Ondrej Zajicek [Fri, 6 Oct 2023 16:52:02 +0000 (18:52 +0200)] 
Doc: Minor fixes

7 months agoConf: Bytestrings with hex: should use the same general format as ones without.
Ondrej Zajicek [Fri, 6 Oct 2023 00:36:59 +0000 (02:36 +0200)] 
Conf: Bytestrings with hex: should use the same general format as ones without.

Either hex:01234567, or hex:01:23:45:67. No confusing formats like
hex:0123:4567:ab:cdef, which looks like there is an implicit zero byte.

7 months agoKRT: Allow to learn routes with RTPROT_KERNEL
Pavel Šorejs [Fri, 6 Oct 2023 02:31:19 +0000 (04:31 +0200)] 
KRT: Allow to learn routes with RTPROT_KERNEL

The Kernel protocol, even with the option 'learn' enabled, ignores
direct routes created by the OS kernel (on Linux these are routes
with rtm_protocol == RTPROT_KERNEL).

Implement optional behavior where both OS kernel and third-party routes
are learned, it can be enabled by 'learn all' option.

Minor changes by committer.

7 months agoBGP: Improve custom BGP attributes
Ondrej Zajicek [Thu, 5 Oct 2023 19:29:04 +0000 (21:29 +0200)] 
BGP: Improve custom BGP attributes

 - Implement EA_GET for custom BGP attributes
 - Forbid EA_SET on existing opaque attributes
 - Forbid redefining existing attributes
 - Document possible compatibility problems

7 months agoMPLS: Handle compatibility with old configs
Ondrej Zajicek [Thu, 5 Oct 2023 15:54:43 +0000 (17:54 +0200)] 
MPLS: Handle compatibility with old configs

Old configs do not define MPLS domains and may use a static protocol
to define static MPLS routes.

When MPLS channel is the only channel of static protocol, handle it
as a main channel. Also, define implicit MPLS domain if needed and
none is defined.

7 months agoFilter: Fix scope handling in for loops
Ondrej Zajicek [Thu, 5 Oct 2023 12:26:22 +0000 (14:26 +0200)] 
Filter: Fix scope handling in for loops

Changes in scope implementation broke scope handling in for loops.
The term in for loops is supposed to be parsed in the parent scope.

7 months agoConf: Fix 'show symbols'
Ondrej Zajicek [Wed, 4 Oct 2023 18:14:12 +0000 (20:14 +0200)] 
Conf: Fix 'show symbols'

Seems like the root scope was not marked as active.

7 months agoBGP: Custom attribute definitions should use cfg_alloc(), not malloc()
Ondrej Zajicek [Wed, 4 Oct 2023 17:45:00 +0000 (19:45 +0200)] 
BGP: Custom attribute definitions should use cfg_alloc(), not malloc()

Otherwise we would get memory leaks.

7 months agoFilter: explicitly forbidden for-loop with pre-defined variable
Maria Matejka [Wed, 4 Oct 2023 17:57:55 +0000 (19:57 +0200)] 
Filter: explicitly forbidden for-loop with pre-defined variable

7 months agoIO: Fix race condition in event processing
Ondrej Zajicek [Wed, 4 Oct 2023 15:36:03 +0000 (17:36 +0200)] 
IO: Fix race condition in event processing

When regular event was added from work event, we did remember that
regular event list was empty and therefore we did not use zero time
in poll(). This leads to ~3 s latency in route reload during
reconfiguration.

7 months agoDoc: Fix syntax errors in SGML
Ondrej Zajicek [Wed, 4 Oct 2023 13:25:05 +0000 (15:25 +0200)] 
Doc: Fix syntax errors in SGML

7 months agoMPLS: Update to support and use 64bit source id
Ondrej Zajicek [Wed, 4 Oct 2023 13:00:24 +0000 (15:00 +0200)] 
MPLS: Update to support and use 64bit source id

7 months agoL3VPN: Import/export target reconfiguration
Ondrej Zajicek [Sun, 1 Oct 2023 03:02:46 +0000 (05:02 +0200)] 
L3VPN: Import/export target reconfiguration

7 months agoDoc: L3VPN documentation
Ondrej Zajicek [Wed, 4 Oct 2023 11:00:06 +0000 (13:00 +0200)] 
Doc: L3VPN documentation

7 months agoBGP, L3VPN: Fix MPLS channel reload mq-master-merged-to-v3
Ondrej Zajicek [Sat, 30 Sep 2023 21:18:04 +0000 (23:18 +0200)] 
BGP, L3VPN: Fix MPLS channel reload

When a MPLS channel is reloaded, it should reload all regular MPLS-aware
channels. This causes re-evaluation of routes in FEC map and possibly
reannouncement of MPLS routes.

7 months agoDoc: MPLS documentation
Ondrej Zajicek [Tue, 3 Oct 2023 14:11:18 +0000 (16:11 +0200)] 
Doc: MPLS documentation

7 months agoMPLS: Implement FEC map reconfiguration
Ondrej Zajicek [Sat, 30 Sep 2023 18:07:40 +0000 (20:07 +0200)] 
MPLS: Implement FEC map reconfiguration

This allows changing label policy or label range without restart.

7 months agoMPLS: Handle label allocation failures
Ondrej Zajicek [Tue, 26 Sep 2023 16:50:20 +0000 (18:50 +0200)] 
MPLS: Handle label allocation failures

7 months agoL3VPN: Fix bug in reconfiguration
Ondrej Zajicek [Sat, 23 Sep 2023 22:24:50 +0000 (00:24 +0200)] 
L3VPN: Fix bug in reconfiguration

Fields import_target / export_target link to config structures, must be
updated during reconfiguration.

7 months agoMPLS: Improve handling of static label allocations
Ondrej Zajicek [Sat, 23 Sep 2023 15:55:01 +0000 (17:55 +0200)] 
MPLS: Improve handling of static label allocations

Use mpls_new_label() / mpls_free_label() also for static labels, to keep
track of allocated labels and to enforce label ranges.

Static label allocations always use static label range, regardless of
configured label range.

7 months agoStatic: Add syntax for static MPLS labels
Ondrej Zajicek [Fri, 22 Sep 2023 17:49:15 +0000 (19:49 +0200)] 
Static: Add syntax for static MPLS labels

Instead of just using route attributes, static routes with
static MPLS labels can be defined just by e.g.:

  route 10.1.1.0/24 mpls 100 via 10.1.2.1 mpls 200;

7 months agoMPLS: Label range non-intersection check
Ondrej Zajicek [Fri, 22 Sep 2023 13:47:48 +0000 (15:47 +0200)] 
MPLS: Label range non-intersection check

7 months agoMPLS: Improve label range reconfiguration
Ondrej Zajicek [Mon, 18 Sep 2023 15:47:17 +0000 (17:47 +0200)] 
MPLS: Improve label range reconfiguration

Allow to shorten label range over unused area.

7 months agoMPLS: Add command 'show mpls ranges'
Ondrej Zajicek [Mon, 18 Sep 2023 15:32:24 +0000 (17:32 +0200)] 
MPLS: Add command 'show mpls ranges'

Add command to show MPLS label ranges and their stats.

7 months agoNest: Fix missing RTS_* values in filters
Ondrej Zajicek [Mon, 18 Sep 2023 12:19:20 +0000 (14:19 +0200)] 
Nest: Fix missing RTS_* values in filters

7 months agoLib: Extend MPLS label allocator bitmap
Ondrej Zajicek [Mon, 18 Sep 2023 12:12:22 +0000 (14:12 +0200)] 
Lib: Extend MPLS label allocator bitmap

Add function lmap_last_one_in_range() for finding the last active label
in a label range.

7 months agoL3VPN: BGP/MPLS VPNs using MPLS backbone
Ondrej Zajicek [Mon, 3 Oct 2022 18:06:13 +0000 (20:06 +0200)] 
L3VPN: BGP/MPLS VPNs using MPLS backbone

The L3VPN protocol implements RFC 4364 BGP/MPLS VPNs using MPLS backbone.
It works similarly to pipe. It connects IP table (one per VRF) with (global)
VPN table. Routes passed from VPN table to IP table are stripped of RD and
filtered by import targets, routes passed in the other direction are extended
with RD, MPLS labels and export targets in extended communities. A separate
MPLS channel is used to announce MPLS routes for the labels.

7 months agoMPLS: Add support for per-VRF labeling policy
Ondrej Zajicek [Sat, 1 Oct 2022 20:38:49 +0000 (22:38 +0200)] 
MPLS: Add support for per-VRF labeling policy

The new labeling policy MPLS_POLICY_VRF assigns one label to all routes
(from the same FEC map associated with one VRF), while replaces their
next hops with a lookup to a VRF table. This is useful for L3VPN
protocol.

7 months agoBGP: Add MPLS support
Ondrej Zajicek [Thu, 15 Sep 2022 00:30:15 +0000 (02:30 +0200)] 
BGP: Add MPLS support

When MPLS is active, received routes on MPLS-aware SAFIs (ipvX-mpls,
vpnX-mpls) are automatically labeled according to active label policy and
corresponding MPLS routes are automatically generated. Also routes sent
on MPLS-aware SAFIs announce local labels when it should be done.

7 months agoStatic: Add MPLS support
Ondrej Zajicek [Thu, 15 Sep 2022 00:29:12 +0000 (02:29 +0200)] 
Static: Add MPLS support

When MPLS is active, static IP/VPN routes are automatically labeled
according to active label policy and corresponding MPLS routes are
automatically generated.

7 months agoMPLS subsystem
Ondrej Zajicek [Wed, 14 Sep 2022 23:38:18 +0000 (01:38 +0200)] 
MPLS subsystem

The MPLS subsystem manages MPLS labels and handles their allocation to
MPLS-aware routing protocols. These labels are then attached to IP or VPN
routes representing label switched paths -- LSPs.

There was already a preliminary MPLS support consisting of MPLS label
net_addr, MPLS routing tables with static MPLS routes, remote labels in
next hops, and kernel protocol support.

This patch adds the MPLS domain as a basic structure representing local
label space with dynamic label allocator and configurable label ranges.
To represent LSPs, allocated local labels can be attached as route
attributes to IP or VPN routes with local labels as attributes.

There are several steps for handling LSP routes in routing protocols --
deciding to which forwarding equivalence class (FEC) the LSP route
belongs, allocating labels for new FECs, announcing MPLS routes for new
FECs, attaching labels to LSP routes. The FEC map structure implements
basic code for managing FECs in routing protocols, therefore existing
protocols can be made MPLS-aware by adding FEC map and delegating
most work related to local label management to it.

7 months agoLib: Indirect bitmap for MPLS label allocator
Ondrej Zajicek (work) [Sat, 22 May 2021 10:31:47 +0000 (12:31 +0200)] 
Lib: Indirect bitmap for MPLS label allocator

7 months agoNest: Expand rte_src.private_id to u64
Ondrej Zajicek [Mon, 2 Oct 2023 13:09:30 +0000 (15:09 +0200)] 
Nest: Expand rte_src.private_id to u64

In general, private_id is sparse and protocols may want to map some
internal values directly into it. For example, L3VPN needs to
map VPN route discriminators to private_id.

OTOH, u32 is enough for global_id, as these identifiers are dense.

7 months agoBGP config: Splitting Route Refresh and Enhanced Route Refresh
Maria Matejka [Wed, 27 Sep 2023 10:51:55 +0000 (12:51 +0200)] 
BGP config: Splitting Route Refresh and Enhanced Route Refresh

Both toggles are on by default but if some implementation needs one or
another to be switched off separately, then it's possible now.

7 months agoAggregator: brief documentation
Maria Matejka [Fri, 22 Sep 2023 13:10:45 +0000 (15:10 +0200)] 
Aggregator: brief documentation

7 months agoAggregator: Forbidden dangerous filter computations
Maria Matejka [Fri, 22 Sep 2023 12:21:21 +0000 (14:21 +0200)] 
Aggregator: Forbidden dangerous filter computations

7 months agoAggregator: Fixed hashing of adata
Maria Matejka [Wed, 12 Jul 2023 13:11:00 +0000 (15:11 +0200)] 
Aggregator: Fixed hashing of adata

7 months agoBasic route aggregation
Igor Putovny [Wed, 21 Jun 2023 11:15:07 +0000 (13:15 +0200)] 
Basic route aggregation

Add a new protocol offering route aggregation.

User can specify list of route attributes in the configuration file and
run route aggregation on the export side of the pipe protocol. Routes are
sorted and for every group of equivalent routes new route is created and
exported to the routing table. It is also possible to specify filter
which will run for every route before aggregation.

Furthermore, it will be possible to set attributes of new routes
according to attributes of the aggregated routes.

This is a work in progress.

Original work by Igor Putovny, subsequent cleanups and finalization by
Maria Matejka.

7 months agoSimple testing of reconfiguration to a slightly different one
Maria Matejka [Fri, 23 Jun 2023 07:05:48 +0000 (09:05 +0200)] 
Simple testing of reconfiguration to a slightly different one

7 months agoBGP: Setting and unsetting unknown attributes kk-bgp-unknown-attributes
katerina.kubecova [Tue, 19 Sep 2023 09:11:24 +0000 (11:11 +0200)] 
BGP: Setting and unsetting unknown attributes

All these must be declared as bytestring. Allows operators to delete
unwanted attributes breaking the Internet:

    https://blog.benjojo.co.uk/post/bgp-path-attributes-grave-error-handling

7 months agoAttributes declared in config can be bytestrings
katerina.kubecova [Mon, 18 Sep 2023 12:07:59 +0000 (14:07 +0200)] 
Attributes declared in config can be bytestrings

7 months agoFilter: Function unset() accepts attributes declared in config
katerina.kubecova [Wed, 20 Sep 2023 07:50:22 +0000 (09:50 +0200)] 
Filter: Function unset() accepts attributes declared in config

7 months agoStructures bytestring and adata merged into adata.
katerina.kubecova [Mon, 18 Sep 2023 12:43:58 +0000 (14:43 +0200)] 
Structures bytestring and adata merged into adata.

8 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

8 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.

8 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.

8 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

8 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

8 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.

8 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.

8 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.

8 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.

8 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

8 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()

8 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.

8 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.

8 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)

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

8 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

8 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

8 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.

8 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

8 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

8 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

8 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.

8 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

8 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

8 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

8 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.

8 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.