Maria Matejka [Tue, 1 Nov 2022 17:40:56 +0000 (18:40 +0100)]
Memory pages are not munmapped, instead we just madvise()
Memory unmapping causes slow address space fragmentation, leading in
extreme cases to failing to allocate pages at all. Removing this problem
by keeping all the pages allocated to us, yet calling madvise() to let
kernel dispose of them.
This adds a little complexity and overhead as we have to keep the
pointers to the free pages, therefore to hold e.g. 1 GB of 4K pages with
8B pointers, we have to store 2 MB of data.
Ondrej Zajicek [Tue, 18 Oct 2022 01:58:19 +0000 (03:58 +0200)]
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.
Ondrej Zajicek [Wed, 12 Oct 2022 15:57:26 +0000 (17:57 +0200)]
Netlink: Parse onlink flag even on direct routes
While onlink flag is meaningful only with explicit next hops, it can be
defined also on direct routes. Parse it also in this case to avoid
periodic updates of the same route.
Ondrej Zajicek [Mon, 10 Oct 2022 03:06:19 +0000 (05:06 +0200)]
BGP: Add option 'next hop prefer global'
Add BGP channel option 'next hop prefer global' that modifies BGP
recursive next hop resolution to use global next hop IPv6 address instead
of link-local next hop IPv6 address for immediate next hop of received
routes.
Ondrej Zajicek [Mon, 3 Oct 2022 16:53:21 +0000 (18:53 +0200)]
Nest: Add channel config flag to distinguish new or copy
It is useful to distinguish whehter channel config returned from
channel_config_get() was allocated new, or existing from template.
Caller may want to initialize new ones.
Ondrej Zajicek [Thu, 8 Sep 2022 17:41:02 +0000 (19:41 +0200)]
BGP: Do not assume that all channels are struct bgp_channel
In principle, the channel list is a list of parent struct proto and can
contain general structures of type struct channel, That is useful e.g.
for adding MPLS channels to BGP.
Maria Matejka [Tue, 27 Sep 2022 10:17:05 +0000 (12:17 +0200)]
KRT: Fix route learning
This is a reimplementation of commit 0f2be469f897b6d9f925563bbf522438c83522ea
by Alexander Zubkov. In the master branch, changes in commit eb937358
broke setting of channel preference for alien routes learned during
scan. The preference was set only for async routes.
The original solution is extended here to accomodate for v3 specifics.
Alexander Zubkov [Wed, 21 Sep 2022 15:07:11 +0000 (17:07 +0200)]
KRT: Fix setting default preference
Changes in commit eb937358 broke setting of channel preference for alien
routes learned during scan. The preference was set only for async routes.
Move common attribute processing part of functions krt_learn_async() and
krt_learn_async() to a separate function to have only one place for such
changes.
Maria Matejka [Wed, 21 Sep 2022 14:53:17 +0000 (16:53 +0200)]
Caching eattrs in filters is not needed anymore.
After flattening the route attribute structure, the ea_list ** is derivable
from rte * by arithmetics. Caching the derived value doesn't help performance
and therefore is removed as unnecessary.
Maria Matejka [Mon, 12 Sep 2022 09:09:43 +0000 (11:09 +0200)]
Fixing several race-conditions in event code.
After a suggestion by Santiago, I added the direct list pointer into
events and the events are now using this value to check whether the
route is active or not. Also the whole trick with sentinel node unioned
with event list is now gone.
For debugging, there is also an internal circular buffer to store what
has been recently happening in event code before e.g. a crash happened.
By default, this debug is off and must be manually enabled in
lib/event.c as it eats quite some time and space.