summaryrefslogtreecommitdiffstats
path: root/lib/command_lex.l (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #12248 from pguibert6WIND/bgpasdotRuss White2023-02-211-0/+2
|\ | | | | lib, bgp: add initial support for asdot format
| * lib, bgp: add initial support for asdot formatPhilippe Guibert2023-02-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AS number can be defined as an unsigned long number, or two uint16 values separated by a period (.). The possible valus are: - usual 32 bit values : [1;2^32 -1] - <1.65535>.<0.65535> for dot notation - <0.65535>.<0.65535> for dot+ notation. The 0.0 value is forbidden when configuring BGP instances or peer configurations. A new ASN type is added for parsing in the vty. The following commands use that new identifier: - router bgp .. - bgp confederation .. - neighbor <> remote-as <> - neighbor <> local-as <> - clear ip bgp <> - route-map / set as-path <> An asn library is available in lib/ and provides some services: - convert an as string into an as number. - parse an as path list string and extract a number. - convert an as number into a string. Also, the bgp tests forge an as_zero_path, and to do that, an API to relax the possibility to have a 0 as value is specifically called from the tests. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | *: manual SPDX License ID conversionsDavid Lamparter2023-02-091-17/+1
|/ | | | | | | | | | The files converted in this commit either had some random misspelling or formatting weirdness that made them escape automated replacement, or have a particularly "weird" licensing setup (e.g. dual-licensed.) This also marks a bunch of "public domain" files as SPDX License "NONE". Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: add `![...]` syntax for easy "no" formsDavid Lamparter2021-08-261-0/+1
| | | | | | | | | | This allows defining a CLI command like this: `[no] some setting ![VALUE]` with VALUE being optional for the "no" form, but required for the positive form. It's just a `[...]` where the empty branch can only be taken for commands starting with `no`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: make builddir include path consistentDavid Lamparter2021-04-211-1/+1
| | | | | | | ... by referencing all autogenerated headers relative to the root directory. (90% of the changes here is `version.h`.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: make some variables staticDavid Lamparter2019-12-131-1/+1
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: change M:A:C to X:X:X:X:X:XQuentin Young2018-10-241-2/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: early-include "config.h" in flex lexersDavid Lamparter2018-09-091-0/+5
| | | | | | This is neccessary to get _FILE_OFFSET_BITS right. Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: ignore cli lexer in clang-analyzeQuentin Young2018-04-131-0/+5
| | | | | | | Lexer code is generated by Flex and we don't care about false positives in it. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: fix more warnings on *BSDRenato Westphal2018-02-021-1/+2
| | | | | | | | | | | | | | | | | * zebra/kernel_socket.c: include "rt.h" to provide the prototypes of kernel_init() and kernel_terminate(); * lib/prefix.h: remove the deprecation warning whenever ETHER_ADDR_LEN is used. isisd uses the ETHER_HDR_LEN constant which is defined in terms of ETHER_ADDR_LEN in the *BSD system headers. So, when building FRR on *BSD, we were getting several warnings because we were using ETHER_ADDR_LEN indirectly; * lib/command_lex.l, lib/defun_lex.l: ignore other harmless warnings; * lib/spf_backoff.c: cast 'tv->tv_usec' to 'long int' before printing. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: support keywords that begin with uppercase letterDaniel Walton2017-09-141-3/+3
| | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> VARIABLE tokens must be all uppercase, this allows us to support WORD tokens that begin with an uppercase letter. The "Null0" keyword is an example of where this is needed. The only VARIABLE we had that wasn't already all uppercase was ASN:nn_or_IP-address:nn
* lib: add CLI token for 48-bit mac addressesQuentin Young2017-08-111-0/+4
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* build: convert lib/ to non-recursive buildDavid Lamparter2017-07-311-2/+2
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: add #pragma's to ignore flex sign cmp errorQuentin Young2017-04-071-0/+3
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: parser: fix allocation countingDavid Lamparter2017-01-311-7/+7
| | | | | | | command_lex.l was allocating as MTYPE_TMP, while command_parse.y would just call free(). Make both use MTYPE_LEX. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: guard yyllocDavid Lamparter2017-01-241-2/+3
| | | | | | | yylloc seems to be NULL on parser init for some flex+bison combinations... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: add error location reportingDavid Lamparter2017-01-231-1/+11
| | | | | | | | flex+bison have nice capabilities to track the location that is currently being processed; let's enable these and get better warnings for broken CLI specs. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: free Mr. TDavid Lamparter2017-01-231-1/+1
| | | | | | | Mr. T was abducted by the parser and held hostage for ransom. Murdock was called, flew in and replaced him with a Tab character. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: accept number-only word tokensDavid Lamparter2016-12-161-1/+1
| | | | | | | | There seems to be no reason why numbers don't work as plain word tokens; this is useful to have "number choices" or constants, e.g. <128|192|256> for bit encryption lengths. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: reorder bison incarnationsDavid Lamparter2016-12-161-1/+0
| | | | | | | | | | | This shuffles the code blocks in command_parser.y to match file output order, then adjusts things to make the include handling less messy. (also dropped unused DECIMAL_STRLEN_MAX define.) This should hopefully fix the build on NetBSD 6. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: use reentrant mode on flex & bisonDavid Lamparter2016-12-011-17/+21
| | | | | | | | | | | | This removes remaining global variables from the lexer, pushing the lexer state into struct parser_ctx too. At the same time, "cmd_yy" is used as prefix for all parser & lexer routines. The result is that (a) there is no collision anymore if a program uses flex/bison and links libzebra, and (b) the parser is fully encapsulated and could be called in parallel from multiple threads. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Revert "lib: Allow '_' in arguments to VARIABLE_TKN"Quentin Young2016-10-201-1/+1
| | | | This reverts commit e0a467872b307021477ea7b4ba27ffc5d20aedd0.
* lib: Allow '_' in arguments to VARIABLE_TKNQuentin Young2016-10-201-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Allow nesting options in selectorsQuentin Young2016-09-181-5/+0
| | | | | | | Options may now be nested in selectors as long as they are not the first token in sequence. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Remove unnecessary XSTRDUPQuentin Young2016-08-091-1/+1
| | | | | | yy_scan_string duplicates its input Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Fix various minor bugsQuentin Young2016-08-091-3/+11
| | | | | | | | | | | - cmd_make_strvec returns null pointer if str begins with a '#' - disallow options nested options - NULL out state variable in parser - flip backwards comparison - fix memory leak in lexer Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Code cleanup, formatting, & headersQuentin Young2016-08-081-0/+24
| | | | | | | | Gnu-style code, add copyright headers, cleanup some random style issues, shuffle around code into relevant units, add docs. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Major parser refactorQuentin Young2016-08-051-1/+1
| | | | | | | Lots of cleanup, code consolidation, organizational improvements. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Unrefactor to signed long long for rangesQuentin Young2016-08-041-2/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Allow optional whitespace in rangesQuentin Young2016-08-041-1/+1
| | | | | | | Makes ranges where both endpoints are negative somewhat more readable. Also validate ranges. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Add support for negative rangesQuentin Young2016-08-041-3/+3
| | | | | | And convert range delimiters to signed int Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Fix OOB range parses, variable matchesQuentin Young2016-08-011-1/+5
| | | | | | | | Variables now allow strings beginning with numbers to match, ranges and numbers are now long long to fix OOB parses resulting in integer wraparounds. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Fixed bad node copy, modified token regexQuentin Young2016-08-011-2/+2
| | | | | | | | | | | When building argv for matched command, only the last node was being copied to argv; the rest were added by reference. Additionally the regex for certain tokens was too restrictive and disallowed characters allowed by the old parser; these have been reinstated. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Add partial matching supportQuentin Young2016-08-011-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Cleanup some memory issues in CLIQuentin Young2016-07-291-7/+7
| | | | | | | | Various memory leaks have been fixed and the quagga memory macros are in use. Also consolidated the argv and matching code into one graph traversal. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Change some includesQuentin Young2016-07-121-0/+40
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>