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>
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>
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>
... 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>
* 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>
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
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>
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>
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>
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>
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>
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>
- 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>
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>
Makes ranges where both endpoints are negative
somewhat more readable. Also validate ranges.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
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>
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>
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>