aboutsummaryrefslogtreecommitdiffstats
path: root/filter/data.h
Commit message (Collapse)AuthorAgeFilesLines
* ASPA: checks done in filters; no autoreload yetMaria Matejka2024-03-251-0/+1
|
* Filter: Add route attribute gw_mpls_stackOndrej Zajicek2024-03-051-0/+1
| | | | | | | | | Add route attribute gw_mpls_stack to make MPLS stack of route nexthop accessible from filters. Its type is T_CLIST, which is really not correct (as it is a list, while T_CLIST is a set). Therefore, we keep this attribute *undocumented* and it will be *changed* without further notice. Based on a patch from Trisha Biswas <tbiswas@fastly.com>, thanks!
* MPLS subsystemOndrej Zajicek2023-10-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Basic route aggregationIgor Putovny2023-09-261-0/+5
| | | | | | | | | | | | | | | | | | 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.
* BGP: Setting and unsetting unknown attributeskaterina.kubecova2023-09-201-0/+1
| | | | | | | 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
* Structures bytestring and adata merged into adata.katerina.kubecova2023-09-201-1/+1
|
* Filter: Use common initializer for undefined variables and eattrs.Ondrej Zajicek2023-09-131-1/+19
| | | | | | 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.
* Filter: Print proper error response in multiple method dispatchOndrej Zajicek2023-09-121-0/+2
| | | | | When no matching method is found, print an error response containing position and type of infringing argument and a set of expected types.
* Filter: Implement multiple dispatch for methodsOndrej Zajicek2023-09-121-0/+2
| | | | | | | | | | | | | | | - 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.
* Filter: Methods reworkMaria Matejka2023-09-121-1/+7
| | | | | | | | | | | | | | | | | | | | | 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.
* Dropping empty-type const f_vals, they were copied anywayMaria Matejka2023-09-121-1/+1
|
* Filter: Add bytestring typeAlexander Zubkov2023-08-241-0/+2
| | | | | | | | | - 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.
* Filter: Allow setting the 'onlink' route attribute in filtersRadu Carpa2023-01-171-0/+1
| | | | | | | | | Add static route attribute to set onlink flag for route next hop. Can be used to build a dynamically routed IP-in-IP overlay network. Usage: ifname = "tunl0"; onlink = true; gw = bgp_next_hop;
* Filter: Change linearization of branches in switch instructionOndrej Zajicek2023-01-071-0/+1
| | | | | | | | | | | | | Most branching instructions (FI_CONDITION, FI_AND, FI_OR) linearize its branches in a recursive way, while FI_SWITCH branches are linearized from parser even before the switch instruction is allocated. Change linearization of FI_SWITCH branches to make it similar to other branching instructions. This also fixes an issue with constant switch evaluation, where linearized branch is mistaken for non-linearized during switch construction. Thanks to Jiten Kumar Pathy for the bugreport.
* Add compile-time option to enable 4-way tries instead of 16-way onesOndrej Zajicek2023-01-021-0/+7
| | | | | In some cases 16-way tries are too memory-heavy, while 4-way are almost as efficient as the original 2-way ones.
* Filter: Add some minor functions for f_tree and ECOndrej Zajicek2022-10-031-0/+5
| | | | | Add some supportive functions for f_tree and EC. These functions are used by L3VPN code.
* Merge remote-tracking branch 'origin/master' into backportMaria Matejka2022-07-111-3/+5
|\
| * Filter: Add literal for empty setAlexander Zubkov2022-06-271-4/+4
| | | | | | | | | | | | | | 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.
| * Nest: Cleanups in as_path_filter()Ondrej Zajicek (work)2022-06-271-0/+2
| | | | | | | | | | 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.
* | Merge commit '5cff1d5f' into haugesundMaria Matejka2022-03-091-0/+1
|\ \ | |/ |/| | | | | | | Conflicts: proto/bgp/attrs.c proto/pipe/pipe.c
| * Preference moved to RTA and set explicitly in protocolsMaria Matejka2021-10-131-0/+1
| |
* | Merge branch 'oz-trie-table'Ondrej Zajicek (work)2022-02-061-4/+81
|\ \
| * | Trie: Add prefix counterOndrej Zajicek (work)2022-02-061-0/+1
| | | | | | | | | | | | | | | Add counter of prefixes stored in trie. Works only for 'restricted' tries composed of explicit prefixes (pxlen == l == h), like ones used in rtables.
| * | Trie: Implement longest-prefix-match queries and walksOndrej Zajicek (work)2021-11-261-0/+51
| | | | | | | | | | | | | | | | | | | | | The prefix trie now supports longest-prefix-match query by function trie_match_longest_ipX() and it can be extended to iteration over all covering prefixes for a given prefix (from longest to shortest) using TRIE_WALK_TO_ROOT_IPx() macro.
| * | Trie: Implement trie walking codeOndrej Zajicek (work)2021-11-191-1/+22
| | | | | | | | | | | | | | | | | | Trie walking allows enumeration of prefixes in a trie in the usual lexicographic order. Optionally, trie enumeration can be restricted to a chosen subnet (and its descendants).
| * | Filter: Faster prefix setsOndrej Zajicek (work)2021-09-251-4/+8
| |/ | | | | | | | | | | | | | | | | Use 16-way (4bit) branching in prefix trie instead of basic binary branching. The change makes IPv4 prefix sets almost 3x faster, but with more memory consumption and much more complicated algorithm. Together with a previous filter change, it makes IPv4 prefix sets about ~4.3x faster and slightly smaller (on my test data).
* / Filter: Add operators to find minimum and maximum element of setsAlexander Zubkov2021-12-281-0/+2
|/ | | | | | | | | | | Add operators .min and .max to find minumum or maximum element in sets of types: clist, eclist, lclist. Example usage: bgp_community.min bgp_ext_community.max filter(bgp_large_community, [(as1, as2, *)]).min Signed-off-by: Alexander Zubkov <green@qrator.net>
* Filter: Add MPLS label route attributeTrisha Biswas2021-05-171-0/+1
| | | | | | | Add support to set or read outgoing MPLS labels using filters. Currently this supports the addition of one label per route for the first next hop. Minor changes by committer.
* Filter: Recursive filter iteration codeOndrej Zajicek (work)2021-02-071-0/+1
| | | | | Add macros for recursive filter iteration that allows to examine all instructions reachable from a filter.
* Filter: Add 'weight' route attributeOndrej Zajicek (work)2020-12-021-0/+1
| | | | | | | Add 'weight' route attribute that allows to get and set ECMP weight of nexthops. Similar to 'gw' attribute, it is limited to the first nexthop, but it is useful for handling BGP multipath, where an ECMP route is merged from multiple regular routes.
* Configuration strings are constant.Maria Matejka2020-04-091-1/+1
| | | | This is merely a const propagation. There was no problem in there.
* Filter: Optimize IPv4 prefix setsOndrej Zajicek (work)2020-03-261-7/+23
| | | | | Use separate IPv4 and IPv6 implementation of prefix sets. Just this change makes IPv4 prefix sets 60% smaller and 50% faster.
* Filter: Improve typecheck error messagesOndrej Zajicek (work)2019-11-051-0/+2
|
* Support for address family constantsOndrej Zajicek (work)2019-11-031-0/+1
| | | | We already had them defined on BGP level, but they are more general.
* Filter: Pre-evaluation of constant expressionsMaria Matejka2019-07-021-1/+2
|
* Revert "Filter: Dropped the setter instructions in favor of direct result ↵Maria Matejka2019-06-191-8/+0
| | | | | | storage." This reverts commit bd91338246c1ba40358243f1bdf5a6dbd3a29f35.
* Filter: Dropped the setter instructions in favor of direct result storage.Maria Matejka2019-06-031-0/+8
| | | | This should help filter performance a bit.
* Filter: Store variables and function arguments on stackJan Maria Matejka2019-05-211-2/+2
|
* Filter data manipulation functions separated to their fileMaria Matejka2019-02-201-0/+33
|
* Filter: merged filter instruction constructors, counting line size on ↵Maria Matejka2019-02-201-0/+169
instruction construct