Commit Graph

286 Commits

Author SHA1 Message Date
Ondrej Zajicek 371eb49043 Conf: Free stored old config before parsing new one
BIRD keeps a previous (old) configuration for the purpose of undo. The
existing code frees it after a new configuration is successfully parsed
during reconfiguration. That causes memory usage spikes as there are
temporarily three configurations (old, current, and new). The patch
changes it to free the old one before parsing the new one (as user
already requested a new config). The disadvantage is that undo is
not available after failed reconfiguration.
2022-11-09 21:54:45 +01:00
Maria Matejka 37b6444137 Moved config-related allocations to config_pool and showing its size in memory usage 2022-11-01 16:38:24 +01:00
Ondrej Zajicek e471f9e0fb Filter: Fix handling of variables in anonymous filters
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-10-18 03:58:19 +02:00
Maria Matejka c73343de67 Revert "Reducing filter stack size to allow for lesser thread stack size"
This reverts commit 2c13759136.
2022-09-16 10:11:51 +02:00
Maria Matejka 2e5bfeb73a Merge remote-tracking branch 'origin/master' into backport 2022-07-11 11:08:10 +02:00
Maria Matejka 7e9cede1fd Merge version 2.0.10 into backport 2022-07-10 14:19:24 +02:00
Ondrej Zajicek (work) a2527ee53d Filter: Improve handling of stack frames in filter bytecode
When f_line is done, we have to pop the stack frame. The old code just
removed nominal number of args/vars. Change it to use stored ventry value
modified by number of returned values. This allows to allocate variables
on a stack frame during execution of f_lines instead of just at start.

But we need to know the number of returned values for a f_line. It is 1
for term, 0 for cmd. Store that to f_line during linearization.
2022-06-27 21:13:32 +02:00
Ondrej Zajicek (work) 946cedfcfe Filter: Implement soft scopes
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-06-27 21:13:31 +02:00
Ondrej Zajicek (work) 93d6096c87 Filter: Implement type checks for function calls
Keep list of function parameters in f_line and use it to verify
types of arguments for function calls. Only static type checks
are implemented.
2022-06-27 21:13:31 +02:00
Maria Matejka 141fb51f1a IPv4 flowspec literals should reject IPv6 prefices in a well-behaved way
When writing flow4 { dst 2001:db8::dead:beef/128; }, BIRD crashed on an
not-well-debuggable segfault as it tried to copy the whole 128-bit
prefix into an IPv4-sized memory.
2022-06-07 10:38:32 +02:00
Ondrej Zajicek a8a3d95be5 Nest: Improve GC strategy for rtables
Use timer (configurable as 'gc period') to schedule routing table
GC/pruning to ensure that prune is done on time but not too often.

Randomize GC timers to avoid concentration of GC events from different
tables in one loop cycle.

Fix a bug that caused minimum inter-GC interval be 5 us instead of 5 s.

Make default 'gc period' adaptive based on number of routing tables,
from 10 s for small setups to 600 s for large ones.

In marge multi-table RS setup, the patch improved time of flushing
a downed peer from 20-30 min to <2 min and removed 40s latencies.
2022-06-04 17:34:57 +02:00
Maria Matejka d071aca7aa Merge commit '2c13759136951ef0e70a3e3c2b2d3c9a387f7ed9' into haugesund 2022-03-02 10:01:44 +01:00
Ondrej Zajicek (work) 29dda184e5 Conf: Fix parsing full-length IPv6 addresses
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
2022-01-05 16:38:49 +01:00
Ondrej Zajicek (work) 9f24fef5e9 Conf: Fix crash during shutdown
BIRD implements shutdown by reconfiguring to fake empty configuration.
Such fake config structure is created from the last running config and
shares some data, including symbol table. This allows access to (removed)
routing tables and causes crash when 'show route' command is used during
shutdown.

Clean up symbol table, table list and links to default tables, so removed
routing tables cannot be accessed during shutdown.
2021-10-20 01:51:28 +02:00
Maria Matejka 2c13759136 Reducing filter stack size to allow for lesser thread stack size 2021-09-10 18:11:28 +02:00
Toke Høiland-Jørgensen 35f88b305a Nest: Allow specifying security keys as hex bytes as well as strings
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.
2021-06-06 16:28:18 +02:00
Ondrej Zajicek (work) e5724f71d2 sysdep: Add wrapper to get random bytes - update
Simplify the code and fix an issue with getentropy() return value.
2021-06-06 16:26:06 +02:00
Toke Høiland-Jørgensen c48ebde5ce sysdep: Add wrapper to get random bytes
Add a wrapper function in sysdep to get random bytes, and required checks
in configure.ac to select how to do it. The configure script tries, in
order, getrandom(), getentropy() and reading from /dev/urandom.
2021-06-06 16:26:06 +02:00
Ondrej Zajicek (work) abc9ccc5cb Flowspec: Label field should use numeric operator and not bitmask operator 2021-05-18 20:23:08 +02:00
Vincent Bernat 714238716e BGP: Add support for BGP hostname capability
This is an implementation of draft-walton-bgp-hostname-capability-02.
It is implemented since quite some time for FRR and in datacenter, this
gives a nice output to avoid using IP addresses.

It is disabled by default. The hostname is retrieved from uname(2) and
can be overriden with "hostname" option. The domain name is never set
nor displayed.

Minor changes by committer.
2021-02-10 16:53:57 +01:00
Ondrej Zajicek (work) 61dae32b29 Nest: Per-channel debug flags
The patch add support for per-channel debug flags, currently just
'states', 'routes', and 'filters'. Flag 'states' is used for channel
state changes, remaining two for routes passed through the channel.
The per-protocol debug flags 'routes'/'filters' still enable reporting
of routes for all channels, to keep existing behavior.

The patch causes minor changes in some log messages.
2020-12-07 22:19:40 +01:00
Ondrej Zajicek (work) 30b8468269 Minor cleanups with cfg_allocz()
Also fixes some more failed asserts due to add_tail().
2020-11-24 04:09:11 +01:00
Ondrej Zajicek (work) 1678bc0746 Fix some failed asserts due to add_tail()
When config structures are copied due to template application,
we need to reset list node structure before calling add_tail().

Thanks to Mikael Magnusson for patches.
2020-11-24 03:42:23 +01:00
Ondrej Zajicek (work) 3b56bf8849 BFD: Better handling of BFD options in BGP configs
Merge multiple BFD option blocks in BGP configs instead of using the last
one. That is necessary for proper handling of templates when BFD options
are used both in a BGP template and in a BGP protocol derived from that
template.
2020-11-12 04:02:38 +01:00
Ondrej Zajicek (work) 9d3fc3062b BFD: Allow per-request session options
BFD session options are configured per interface in BFD protocol. This
patch allows to specify them also per-request in protocols requesting
sessions (currently limited to BGP).
2020-11-08 15:33:22 +01:00
Maria Matejka 0c3b8ffe25 Lexer: strtoul shall never set endptr to NULL; it should be an error 2020-05-01 15:19:12 +02:00
Maria Matejka fd9f0c0640 Configuration strings are constant.
This is merely a const propagation. There was no problem in there.
2020-04-09 15:37:14 +02:00
Maria Matejka ab089f4fb5 Conf: Better error message when reading iproute2 config
Reported by: Martin Weinelt <martin@darmstadt.freifunk.net>
2020-02-04 10:34:46 +01:00
Ondrej Zajicek (work) 0edf0c8cd9 Support for address family constants
We already had them defined on BGP level, but they are more general.
2019-11-03 22:25:44 +01:00
Maria Matejka 2de1e2062e Conf: Fixed symbol redefinition 2019-07-30 14:28:40 +02:00
Maria Matejka eac9250fd5 Merge branch 'master' into mq-filter-stack 2019-07-03 11:12:25 +02:00
Maria Matejka 0206c070ac Filter: Split printing and dying 2019-07-03 08:27:56 +02:00
Maria Matejka b40c0f028f Filter: Pre-evaluation of constant expressions 2019-07-02 10:45:53 +02:00
Ondrej Zajicek (work) 8a68316eb9 Nest: Add command to request graceful restart
When 'graceful down' command is entered, protocols are shut down
with regard to graceful restart. Namely Kernel protocol does
not remove routes and BGP protocol does not send notification,
just closes the connection.
2019-06-30 21:29:24 +02:00
Maria Matejka 63e7620462 Conf/Filters: Moved argument count to conf scope 2019-06-25 16:18:06 +02:00
Maria Matejka 5c864e2cfa String: bstrtoul macro expanded to bstrtoul10 and 16 2019-06-13 14:27:58 +02:00
Ondrej Zajicek (work) 9106a750cd Add CLI command to test reconfiguration status
Based on patch from Kenth Eriksson <kenth.eriksson@infinera.com>.
2019-06-12 17:15:35 +02:00
Jan Maria Matejka 23e3b1e665 Filter: Some people can't pronounce "postfixify" correctly. Let's try "linearize" instead.
This is just a naming change.
2019-05-22 15:20:02 +00:00
Jan Maria Matejka 96d757c13f Filter: Store variables and function arguments on stack 2019-05-21 16:33:37 +00:00
Maria Matejka 9eef9c648c Lexer now returns known sym / unknown sym / keyword 2019-05-17 22:26:21 +02:00
Ondrej Zajicek (work) e0835db4f1 BGP: Dynamic BGP
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-04-30 13:32:39 +02:00
Maria Matejka 8d65add626 Merge branch 'master' into HEAD 2019-03-18 12:54:40 +01:00
Maria Matejka 5d511948cd Build: Automatic dependency tracking for generated files 2019-03-18 12:32:11 +01:00
Maria Matejka f249d0b84c Filters: comparison of functions and filters caching 2019-02-26 16:44:24 +01:00
Maria Matejka 2915e711f7 Custom number parser to speed up config parsing
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-25 23:28:36 +01:00
Maria Matejka 99911873a1 Conf: Lexer parses quoted strings in a more descriptive way 2019-02-25 17:22:59 +01:00
Maria Matejka 7c36eb3e8b Conf: Switch for faster (and slightly bigger) lexer 2019-02-22 12:43:43 +01:00
Maria Matejka 412614c700 Conf: Switch for faster (and slightly bigger) lexer 2019-02-22 12:41:51 +01:00
Maria Matejka 32793ab685 Filter: Fixed bugs in FI_CALL and FI_SWITCH 2019-02-20 22:30:55 +01:00
Maria Matejka 0b39b1cbb7 Conf: Symbol implementation converted from void pointers to union
... and consted some declarations.
2019-02-20 22:30:55 +01:00