summaryrefslogtreecommitdiff
path: root/conf/cf-lex.l
AgeCommit message (Collapse)Author
2023-11-25Merge branch 'tmp3' into wireguard-next-tmp7-1Mikael Magnusson
2023-11-25fix bytestring to adata mergeMikael Magnusson
2023-11-25Merge commit 'c5c3a22b' into wireguard-next-tmp7-1Mikael Magnusson
2023-11-25Merge commit 'abae806e' into wireguard-next-tmp7-1Mikael Magnusson
2023-11-25Merge commit '333ddd4f' into wireguard-next-tmp7-1Mikael Magnusson
2023-11-25Merge commit 'bb8e2824' into wireguard-next-tmp7-1Mikael Magnusson
2023-11-25Merge commit '9ffea830' into wireguard-next-tmp7-1Mikael Magnusson
2023-11-25Merge commit 'fc4398b4' into wireguard-next-tmp7-1Mikael Magnusson
2023-11-25Merge commit 'cc1099a0' into wireguard-next-tmp7-1Mikael Magnusson
2023-11-25Merge commit 'fc9d471b' into wireguard-next-tmp7-1Mikael Magnusson
2023-11-25Merge commit 'f86c86b7913f55c1221d8c5e1ff27700aa663a6e' into ↵Mikael Magnusson
wireguard-next-tmp7-1
2023-11-25Merge commit '6b95353ebdaa724252492f941ebe75f80e9e545a' into ↵Mikael Magnusson
wireguard-next-tmp7-1
2023-11-25Merge commit '51f2e7afaf069508685281e8c1b8bb1ceda79d8f' into ↵Mikael Magnusson
wireguard-next-tmp7-1
2023-11-25Merge commit '58efa94460381309c754a3162df257ae043c2cbd' into ↵Mikael Magnusson
wireguard-next-tmp7-1
2023-11-25Merge commit '8e177cf35b582ec973c1abce4709c80847adb711' into ↵Mikael Magnusson
wireguard-next-tmp7-1
2023-10-06Conf: Bytestrings with hex: should use the same general format as ones without.Ondrej Zajicek
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.
2023-10-04Conf: Fix 'show symbols'Ondrej Zajicek
Seems like the root scope was not marked as active.
2023-10-04MPLS subsystemOndrej Zajicek
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.
2023-09-20Structures bytestring and adata merged into adata.katerina.kubecova
2023-09-14Conf: Move definition of struct keyword to conf.hOndrej Zajicek
2023-09-12Filter: Better syntax for function return typesOndrej Zajicek
The C-style syntax does not really fit into rest of our syntax.
2023-09-12Filter: Implement multiple dispatch for methodsOndrej Zajicek
- 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.
2023-09-12Filter: Methods reworkMaria Matejka
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.
2023-09-12Filter/Conf: Method names have their own keyword hashMaria Matejka
To allow for future dynamic method definition, parsing method names is done via a dedicated keyword hash/scope.
2023-09-12Conf: Allowing conf scope to be explicitly read onlyMaria Matejka
2023-09-12Conf: Symbol manipulation gets its context explicitlyMaria Matejka
2023-09-12Conf: Keywords have their default symbolsMaria Matejka
This avoids unnecessary collapsed soft scopes caused by keyword symbol multiallocation.
2023-09-12Conf: Symbol hashes for all scopesMaria Matejka
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.
2023-08-28Bytestring: implement bytestring literals and constantsMikael Magnusson
Implement byte string literals on the format b"xxx" and b64"xxx" which can be used as literals and in constants. The format b"xxx" supports character data and octal and hexadecimal data using C escapes (\n, \nn, \nnn, \xn and \xnn). The format b64"xxx" supports base64 encoded strings (RFC1341).
2023-08-24Filter: Add bytestring typeAlexander Zubkov
- 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.
2023-08-24Lib: Add functions for reading and writing of bytestringsOndrej Zajicek
Based on patch from Alexander Zubkov, thanks!
2023-06-23Add hex:XYZ syntax for short hex stringsAlexander Zubkov
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.
2023-04-27Conf: Improve handling of keywordsOndrej Zajicek
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.
2023-04-27Conf: Fix symbol lookupOndrej Zajicek
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.
2022-11-01Moved config-related allocations to config_pool and showing its size in ↵Maria Matejka
memory usage
2022-10-18Filter: Fix handling of variables in anonymous filtersOndrej Zajicek
Define scope for anonymous filters, and also explicitly distinguish block scopes and function/filter scopes instead of using anonymous / named distinction. Anonymous filters forgot to push scope, so variables for them were in fact defined in the top scope and therefore they shared a frame. This got broken after rework of variables, which assumed that there is a named scope for every function/filter.
2022-06-27Filter: Implement soft scopesOndrej Zajicek (work)
Soft scopes are anonymous scopes that most likely do not contain any symbol, so allocating regular scope is postponed when it is really needed.
2022-01-05Conf: Fix parsing full-length IPv6 addressesOndrej Zajicek (work)
Lexer expression for bytestring was too loose, accepting also full-length IPv6 addresses. It should be restricted such that colon is used between every byte or never. Fix the regex and also add some test cases for it. Thanks to Alexander Zubkov for the bugreport
2021-06-06Nest: Allow specifying security keys as hex bytes as well as stringsToke Høiland-Jørgensen
Add support for specifying a password in hexadecimal format, The result is the same whether a password is specified as a quoted string or a hex-encoded byte string, this just makes it more convenient to input high-entropy byte strings as MAC keys.
2020-11-24Minor cleanups with cfg_allocz()Ondrej Zajicek (work)
Also fixes some more failed asserts due to add_tail().
2020-05-01Lexer: strtoul shall never set endptr to NULL; it should be an errorMaria Matejka
2019-07-03Merge branch 'master' into mq-filter-stackMaria Matejka
2019-07-02Filter: Pre-evaluation of constant expressionsMaria Matejka
2019-06-25Conf/Filters: Moved argument count to conf scopeMaria Matejka
2019-06-13String: bstrtoul macro expanded to bstrtoul10 and 16Maria Matejka
2019-05-17Lexer now returns known sym / unknown sym / keywordMaria Matejka
2019-04-30BGP: Dynamic BGPOndrej Zajicek (work)
Support for dynamically spawning BGP protocols for incoming connections. Use 'neighbor range' to specify range of valid neighbor addresses, then incoming connections from these addresses spawn new BGP instances.
2019-02-26Filters: comparison of functions and filters cachingMaria Matejka
2019-02-25Custom number parser to speed up config parsingMaria Matejka
The glibc's generic parser is slow due to its versatility. Specialized parsers for base-10 and base-16 are much faster and we don't use other bases.
2019-02-25Conf: Lexer parses quoted strings in a more descriptive wayMaria Matejka