0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-16 18:35:19 +00:00
Commit Graph

1709 Commits

Author SHA1 Message Date
Ondrej Zajicek
aa70e14c9e BFD: Improve handling of AdminDown
According to RFC 5882, system should not interpret the local or remote
session state transition to AdminDown as failure. We followed that for
the local session state but not for the remote session state (which
just triggered a transition of the local state to Down). The patch
fixes that.

We do not properly generate AdminDown on our side, so the patch is
relevant just for interoperability with other systems.

Thanks to Sunnat Samadov for the bugreport.
2023-08-29 18:23:29 +02:00
Ondrej Zajicek
f5140d1027 Conf: Allow keywords to be redefined by user symbols
Most syntactic constructs in BIRD configuration (e.g. protocol options)
are defined as keywords, which are distinct from symbols (user-defined
names for protocols, variables, ...). That may cause backwards
compatibility issue when a new feature is added, as it may collide with
existing user names.

We can allow keywords to be shadowed by symbols in almost all cases to
avoid this issue.

This replaces the previous mechanism, where shadowable symbols have to be
explictly added to kw_syms.
2023-08-25 23:50:44 +02:00
Ondrej Zajicek
116285f2b0 RPKI: Fix conflict in config grammar 2023-08-25 04:32:01 +02:00
Ondrej Zajicek
f411a19bb0 Conf: Use nonterminal bytestring instead of BYTETEXT
Nonterminal bytestring allows to provide expressions to be evaluated in
places where BYTETEXT is used now: passwords, radv custom option.

Based on the patch from Alexander Zubkov <green@qrator.net>, thanks!
2023-08-24 16:59:23 +02:00
Alexander Zubkov
fc3547880a Filter: Add bytestring type
- 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-24 04:33:33 +02:00
Ondrej Zajicek
e3c0eca956 Nest: Treat VRF interfaces as inside respective VRFs
Despite not having defined 'master interface', VRF interfaces should be
treated as being inside respective VRFs. They behave as a loopback for
respective VRFs. Treating the VRF interface as inside the VRF allows
e.g. OSPF to pick up IP addresses defined on the VRF interface.

For this, we also need to tell apart VRF interfaces and regular interfaces.
Extend Netlink code to parse interface type and mark VRF interfaces with
IF_VRF flag.

Based on the patch from Erin Shepherd, thanks!
2023-08-23 16:08:40 +02:00
Ondrej Zajicek
5121101136 Merge branch 'bmp' 2023-08-22 15:28:05 +02:00
Alexander Zubkov
fea04d7c34 Use more proper pointers to constant bytestrings 2023-08-22 14:44:18 +02:00
Ondrej Zajicek
9bf2048476 BGP: Update RFC reference
RFC 5549 was obsoleted by RFC 8950.
2023-08-22 14:20:59 +02:00
Ondrej Zajicek
4558adabfb BMP: Improve peer_down handling
Move all bmp_peer_down() calls to one place and make it synchronous with
BGP session down, ensuring that BMP receives peer_down before route
withdraws from flushing.

Also refactor bmp_peer_down_() message generating code.
2023-08-22 01:26:06 +02:00
Ondrej Zajicek
52641e0866 BMP: Use generic channel feed instead of direct walk over rtable
Now we use rt_notify() and channels for both feed and notifications,
in both import tables (pre-policy) and regular tables (post-policy).

Remove direct walk in bmp_route_monitor_snapshot().
2023-08-21 04:24:15 +02:00
Ondrej Zajicek
c40f29a790 BMP: Fix route timestamps 2023-08-18 15:39:08 +02:00
Ondrej Zajicek
f4deef89be BMP: Refactor route monitoring
- Manage BMP state through bmp_peer, bmp_stream, bmp_table structures
 - Use channels and rt_notify() hook for route announcements
 - Add support for post-policy monitoring
 - Send End-of-RIB even when there is no routes
 - Remove rte_update_in_notify() hook from import tables
 - Update import tables to support channels
 - Add bmp_hack (no feed / no flush) flag to channels
2023-08-18 03:53:58 +02:00
Ondrej Zajicek
aec21cda24 BMP: Remove useless buffer 2023-08-01 18:39:38 +02:00
Ondrej Zajicek
8ded8baba2 BMP: Simplify route monitoring hooks
No need for *_begin(), *_commit(), and *_end() hooks. The hook *_notify()
is sufficient for everything.
2023-08-01 18:38:02 +02:00
Alexander Zubkov
ccfa48a24a RAdv: Use new syntax for custom options
And use WALK_LIST macro
2023-06-26 15:35:22 +02:00
Alexander Zubkov
9c81250c04 RAdv: Add custom options
Currently one can use only a predefined set of advertised options in RAdv
protocol, which are supported by BIRD configuration. It would be convenient
to be able to specify other possible options at least manually as a blob
so one should not wait until it is supported in the code, released, etc.

This idea is inspired by presentation by Ondřej Caletka at CSNOG, in which
he noticed the lack of either PREF64 option or possibility to add custom
options in various software.

The patch makes it possible to define such options with the syntax:

  other type <num> <bytestring>
2023-06-23 17:26:03 +02:00
Ondrej Zajicek
43d41d8449 BMP: Ensure that bmp_fire_tx() does nothing when not up 2023-06-08 05:10:05 +02:00
Ondrej Zajicek
e8838d930c BMP: Support multiple instances of BMP protocol
Add internal BMP functions with plicit bmp_proto *p as first argument,
which allows using TRACE() macro. Keep list of BMP instances and call
internal functions. Old BMP functions are wrappers that call internal
functions for all enabled BMP instances.

Extract End-of-RIB mark into separate function.

Based on patch from Michal Zagorski <mzagorsk@akamai.com>. Thanks!
2023-06-08 05:03:15 +02:00
Ondrej Zajicek
69372dc9aa Babel: Minor changes to RTT formatting
Use existing %t printf code and move 'ms' in CLI output to table header.
2023-06-02 02:34:05 +02:00
Toke Høiland-Jørgensen
f08abcb8dd Babel: Add support for the RTT extension
This adds support to the Babel protocol for the RTT extension specified
in draft-ietf-babel-rtt-extension. While this extension is not yet at the
RFC stage, it is one of the more useful extensions to Babel[0], so it
seems worth having in Bird as well.

The extension adds timestamps to Hello and IHU TLVs and uses these to
compute an RTT to each neighbour. An extra per-neighbour cost is then
computed from the RTT based on a minimum and maximum interval and cost
value specified in the configuration. The primary use case for this is
improving routing in a geographically distributed tunnel-based overlay
network.

The implementation follows the babeld implementation when picking
constants and default configuration values. It also uses the same RTT
smoothing algorithm as babeld, and follows it in adding a new 'tunnel'
interface type which enables RTT by default.

[0] https://alioth-lists.debian.net/pipermail/babel-users/2022-April/003932.html
2023-06-02 00:31:53 +02:00
Ondrej Zajicek
0799fc99ab BMP: Fix bug in buffer resize
The buffer code in bmp_buffer_grow(), reuse the MRT buffer handling code.

Based on comments by Michal Zagorski <mzagorsk@akamai.com>, Thanks!
2023-05-31 18:42:14 +02:00
Ondrej Zajicek
e8be7a7080 BMP: Proper reconfiguration and protocol status
Based on patches from Michal Zagorski <mzagorsk@akamai.com> co-authored
with Pawel Maslanka <pmaslank@akamai.com>. Thanks!
2023-05-31 17:41:53 +02:00
Ondrej Zajicek
1e45e2aa4e BMP: Add station address check
Also, do not initialize it to IPA_NONE4, use regular IPA_NONE.
2023-05-30 17:23:56 +02:00
Michal Zagorski
62d8fbdc1c BMP: Add local address option
Also remove unused local and ip_post_policy options.

Co-authored with Pawel Maslanka <pmaslank@akamai.com>.

Minor changes by committer.
2023-05-30 17:09:25 +02:00
Ondrej Zajicek
ae4d934c53 BMP: Minor formatting cleanups
Based on patches from Michal Zagorski <mzagorsk@akamai.com> co-authored
with Pawel Maslanka <pmaslank@akamai.com>. Thanks!
2023-05-30 16:23:07 +02:00
Ondrej Zajicek
c1821a9aba BGP: Improve bgp_create_update_bmp()
Fix issue with missing AF cap (e.g. IPv4 unicast when no capabilities
are announced).

Add Linpool save/restore action similar to bgp_create_update().

Based on patch from Michal Zagorski <mzagorsk@akamai.com> co-authored
with Pawel Maslanka <pmaslank@akamai.com>. Thanks!
2023-05-30 15:37:52 +02:00
Ondrej Zajicek
f8ba82804f BGP: Fix role check when no capability option is present
When an OPEN message without capability options was parsed, the remote
role field was not initialized with the proper (non-zero) default value,
so it was interpreted as if 'provider' was announced.

Thanks to Mikhail Grishin for the bugreport.
2023-05-19 01:02:57 +02:00
Ondrej Zajicek
aa3c35498d BMP: Use OPEN messages stored in BGP
The BMP protocol needs OPEN messages of established BGP sessions to
construct appropriate Peer Up messages. Instead of saving them internally
we use OPEN messages stored in BGP instances. This allows BMP instances
to be restarted or enabled later.

Because of this change, we can simplify BMP data structures. No need to
keep track of BGP sessions when we are not started. We have to iterate
over all (established) BGP sessions when the BMP session is established.
This is just a scaffolding now, but some kind of iteration would be
necessary anyway.

Also, the commit cleans up handling of msg/msg_length arguments to be
body/body_length consistently in both rx/tx and peer_up/peer_down calls.
2023-05-01 04:01:16 +02:00
Ondrej Zajicek
1be0be1b71 BGP: Save sent and received OPEN messages
These are necessary for BMP Peer UP message and it is better to keep them
in BGP than in BMP (so BMP could be restarted or added later).
2023-05-01 04:01:16 +02:00
Ondrej Zajicek
a8a64ca0fe Conf: Improve handling of keywords
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-27 18:41:01 +02:00
Ondrej Zajicek
976dec048a BMP: Silence some log messages
Hooks called from BGP to BMP should not log warning when BMP is not
connected, that is not an error (and we do not want to flood logs with
a ton of messages).

Blocked sk_send() should not log warning, that is expected situation.
Error during sk_send() is handled in error hook anyway.
2023-04-20 17:14:45 +02:00
Ondrej Zajicek
2c7d2141ac BMP: Fix connection management
Replace broken TCP connection management with a simple state machine.
Handle failed attempts properly with a timeout, detect and handle TCP
connection close and try to reconnect after that. Remove useless
'station_connected' flag.

Keep open messages saved even after the BMP session establishment,
so they can be used after BMP session flaps.

Use proper log messages for session events.
2023-04-20 16:28:07 +02:00
Ondrej Zajicek
010df43519 BMP: Fix reconfiguration
It is not supported, but at least it must update internal config
pointer to not keep old one.
2023-04-18 18:57:54 +02:00
Ondrej Zajicek
02164814b4 BMP: Allow build without BMP and disable BMP build by default
It has still several important issues to be enabled by default.
2023-04-18 17:21:13 +02:00
Ondrej Zajicek
fbeef4b74d BMP: Move initialization to bmp_start()
That fixes BMP socket allocation from an invalid pool.
2023-04-18 15:13:24 +02:00
Ondrej Zajicek
04e3a76c94 BMP: Fix missing template
It is mandatory for protocol.
2023-04-18 15:09:21 +02:00
Ondrej Zajicek (work)
3925e65938 BMP: Add some missing bmp_buffer_free() calls
They were inadvertently removed during recent code refactoring.

Thanks to Dawid Macek for the bugreport and patch.
2023-04-16 20:06:02 +02:00
Ondrej Zajicek (work)
4d56b70dc5 BMP: Remove duplicate functions for update encoding
Use existing BGP functions also for BMP update encoding.
2023-04-16 20:06:00 +02:00
Ondrej Zajicek (work)
568fd66613 BMP: Integrate bmp_conn to bmp_proto
There is only one socket per BMP instance, no need to have separate
struct (like in BGP).
2023-04-16 20:05:17 +02:00
Ondrej Zajicek (work)
4adebdf198 BMP: Minor cleanups
Remove redundant 'disable' option, simplify IP address serialization,
and remove useless macros.
2023-04-16 20:05:17 +02:00
Ondrej Zajicek (work)
a995ed4386 BMP: Do not use global instance ptr internally
Use local variable to refence relevant instance instead of using global
instance ptr. Also, use 'p' variable instead of 'bmp' so we can use
common macros like TRACE().
2023-04-16 20:05:17 +02:00
Ondrej Zajicek (work)
ad16e35177 BMP: Remove superfluous error handling
Most error handling code was was for cases that cannot happen,
or they would be code bugs (and should use ASSERT()). Keep error
handling for just for I/O errors, like in rest of BIRD.
2023-04-16 20:05:17 +02:00
Pawel Maslanka
a848dad40a BMP protocol support
Initial implementation of a basic subset of the BMP (BGP Monitoring
Protocol, RFC 7854) from Akamai team. Submitted for further review
and improvement.
2023-04-16 20:05:15 +02:00
Trisha Biswas
9e44ace392 BGP: Add 'allow bgp_med' option for EBGP sessions
This option allows to treat bgp_med as regular transitive attribute
on EBGP sessions (without hacks in filters).

Minor changes from committer.
2023-04-14 04:28:37 +02:00
Ondrej Zajicek
f881b98d9b BGP: Fix bgp_med handling
Missing translation from BGP attribute ID to eattr ID in bgp_unset_attr()
broke automatic removal of bgp_med during export to EBGP peers.

Thanks to Edward Sun for the bugreport.
2023-04-04 05:20:49 +02:00
Maria Matejka
2b712554d1 BGP: Free bind applies also to outbound connections
Even though the free bind option is primarily meant to alleviate problems
with addresses assigned too late, it's also possible to use BIRD with AnyIP
configuration, assigning whole ranges to the machine. Therefore free bind
allows also to create an outbound connection from specific address even though
such address is not assigned.
2023-03-16 19:23:33 +01:00
Ondrej Zajicek
913ec57f27 BGP: Update RFC references 2023-02-19 15:42:18 +01:00
Ondrej Zajicek
501256cfc8 Babel: Update RFC references 2023-02-19 15:34:43 +01:00
Toke Høiland-Jørgensen
ee91965894 Babel: Keep separate auth PC counters for unicast and multicast
The babel protocol normally sends all its messages as multicast packets,
but the protocol specification allows most messages to be sent as either
unicast or multicast, and the two can be mixed freely. In particular, the
babeld implementation can be configured to unicast updates to all peers
instead of sending them as unicast.

Daniel discovered that this can cause problems with the packet counter
checks in the MAC extension due to packet reordering. This happens on WiFi
networks where clients have power save enabled (which is quite common in
infrastructure networks): in this case, the access point will buffer all
multicast traffic and only send it out along with its beacons, leading to a
maximum buffering in default Linux-based access point configuration of up
to 200 ms.

This means that a Babel sender that mixes unicast and multicast messages
can have the unicast messages overtake the multicast messages because of
this buffering; when authentication is enabled, this causes the receiver to
discard the multicast message when it does arrive because it now has a
packet counter value less than the unicast message that arrived before it.
Daniel observed that this happens frequently enough that Babel ceases to
work entirely when runner over a WiFi network.

The issue has been described in draft-ietf-babel-mac-relaxed, which is
currently pending RFC publication. That also describes two mitigation
mechanisms: Keeping separate PC counters for unicast and multicast, and
using a reorder window for PC values. This patch implements the former as
that is the simplest, and resolves the particular issue seen on WiFi.

Thanks to Daniel Gröber for the bugreport.

Minor changes from committer.
2023-02-14 18:18:32 +01:00
Andreas Rammhold
eecc3f02e4 Babel: Implement IPv4 via IPv6 extension (RFC 9229)
The patch implements an IPv4 via IPv6 extension (RFC 9229) to the Babel
routing protocol (RFC 8966) that allows annoncing routes to an IPv4
prefix with an IPv6 next hop, which makes it possible for IPv4 traffic
to flow through interfaces that have not been assigned an IPv4 address.

The implementation is compatible with the current Babeld version.

Thanks to Toke Høiland-Jørgensen for early review on this work.

Minor changes from committer.
2023-02-14 16:17:03 +01:00
Toke Høiland-Jørgensen
dc4c5f51f8 Babel: Initialise source seqno from incoming message
When creating a new babel_source object we initialise the seqno to 0. The
caller will update the source object with the right metric and seqno value,
for both newly created and old source objects. However if we initialise the
source object seqno to 0 that may actually turn out to be a valid (higher)
seqno than the one in the routing table, because of seqno wrapping. In this
case the source metric will not be set properly, which breaks feasibility
tracking for subsequent updates.

To fix this, add a new initial_seqno argument to babel_get_source() which
is used when allocating a new object, and set that to the seqno value of
the update we're sending.

Thanks to Juliusz Chroboczek for the bugreport.
2023-01-31 15:52:14 +01:00
Ondrej Zajicek
96d7c4679d Babel: Improve clarity of unfeasible update handling.
Add a comment and (unnecessary) check to make correctness obvious.
2023-01-30 23:49:20 +01:00
Toke Høiland-Jørgensen
3e7e4a7186 Babel: Fix missing modulo comparison of seqnos
Juliusz noticed there were a couple of places we were doing straight
inequality comparisons of seqnos in Babel. This is wrong because seqnos can
wrap: so we need to use the modulo-64k comparison function for these cases
as well.

Introduce a strict-inequality version of the modulo-comparison for this
purpose.
2023-01-30 23:36:39 +01:00
Ondrej Zajicek
99872676df BFD: Improve incoming packet matching
For active sessions, ignore received packets with zero local id and
mismatched remote id. That forces a session timeout instead of an
immediate session restart. It makes BFD sessions more resilient to
packet spoofing.

Thanks to André Grüneberg for the suggestion.
2023-01-22 23:42:08 +01:00
Ondrej Zajicek
a82683694d VRF: Fix issues with reconfiguration
Protocols receive if_notify() announcements that are filtered according
to their VRF setting, but during reconfiguration, they access iface_list
directly and forgot to check VRF setting here, which leads to all
interfaces be addedd.

Fix this issue for Babel, OSPF, RAdv and RIP protocols.

Thanks to Marcel Menzel for the bugreport.
2023-01-22 18:21:08 +01:00
Ondrej Zajicek
af611f93aa BGP: Add received role value to role mismatch log message 2023-01-20 15:55:47 +01:00
Ondrej Zajicek
f8276812e6 Minor cleanups 2023-01-13 13:32:29 +01:00
Ondrej Zajicek
d1cd5e5a63 BGP: Allow role specific keywords to be used as symbols
Some of these new BGP role keywords use generic names that collides with
user-defined symbols. Allow them to be redefined. Also remove duplicit
keyword definition for 'prefer'.
2023-01-03 19:11:34 +01:00
Ondrej Zajicek
b28431e557 Nest: Fix leaking internal attributes in RIP and Babel
During backporting attribute changes from 3.0-branch, some internal
attributes (RIP iface and Babel seqno) leaked to 'show route all' output.
Allow protocols to hide specific attributes with GA_HIDDEN value.

Thanks to Nigel Kukard for the bugreport.
2023-01-03 17:01:54 +01:00
Ondrej Zajicek
6d1ae197d1 Nest: Fix several issues with pflags
There were some confusion about validity and usage of pflags, which
caused incorrect usage after some flags from (now removed) protocol-
specific area were moved to pflags.

We state that pflags:

 - Are secondary data used by protocol-specific hooks
 - Can be changed on an existing route (in contrast to copy-on-write
   for primary data)
 - Are irrelevant for propagation (not propagated when changed)
 - Are specific to a routing table (not propagated by pipe)

The patch did these fixes:

 - Do not compare pflags in rte_same(), as they may keep cached values
   like BGP_REF_STALE, causing spurious propagation.

 - Initialize pflags to zero in rte_get_temp(), avoid initialization in
   protocol code, fixing at least two forgotten initializations (krt
   and one case in babel).

 - Improve documentation about pflags
2023-01-01 20:10:23 +01:00
Toke Høiland-Jørgensen
8b06a4d8af Babel: Rework seqno request handling
The seqno request retransmission handling was tracking the destination
that a forwarded request was being sent to and always retransmitting to
that same destination. This is unnecessary because we only need to
retransmit requests we originate ourselves, not those we forward on
behalf of others; in fact retransmitting on behalf of others can lead to
exponential multiplication of requests, which would be bad.

So rework the seqno request tracking so that instead of storing the
destination of a request, we just track whether it was a request that we
forwarded on behalf of another node, or if it was a request we originated
ourselves. Forwarded requests are not retransmitted, they are only used
for duplicate suppression, and for triggering an update when satisfied.
If we end up originating a request that we previously forwarded, we
"upgrade" the old request and restart the retransmit counter.

One complication with this is that requests sent in response to unfeasible
updates (section 3.8.2.2 of the RFC) have to be sent as unicast to a
particular peer. However, we don't really need to retransmit those as
there's no starvation when sending such a request; so we just change
such requests to be one-off unicast requests that are not subject to
retransmission or duplicate suppression. This is the same behaviour as
babeld has for such requests.

Minor changes from committer.
2022-12-24 15:52:12 +01:00
Ondrej Zajicek
937ebf2536 BGP: Log unacceptable hold time as decimal number
Thanks Johannes Moos for the suggestion.
2022-12-10 18:06:52 +01:00
Ondrej Zajicek
3859e4efc1 BGP: Improve handling of hold and keepalive timers
The effective keepalive time now scales relative to the negotiated
hold time, to maintain proportion between the keepalive time and the
hold time. This avoids issues when both keepalive and hold times
were configured, the hold time was negotiated to a smaller value,
but the keepalive time stayed the same.

Add new options 'min hold time' and 'min keepalive time', which reject
session attempts with too small hold time.

Improve validation of config options an their documentation.

Thanks to Alexander Zubkov and Sergei Goriunov for suggestions.
2022-12-09 05:53:24 +01:00
Ondrej Zajicek
8f79e6b93e 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.
2022-10-10 05:06:19 +02:00
Ondrej Zajicek
da0b589e7b BGP: Some fixes related to VRF and MPLS interactions
- When next hop is reset to local IP, we should remove BGP label stack,
   as it is related to original next hop

 - BGP next hop or immediate next hop from one VRF should not be passed
   to another VRF, as they are different IP namespaces
2022-10-03 20:18:12 +02:00
Ondrej Zajicek
54430df953 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.
2022-10-03 20:18:12 +02:00
Maria Matejka
605ff0a0eb RPKI: wait for retry_time if we get error immediately after connected 2022-10-03 17:09:02 +02:00
Maria Matejka
dc28c6ed1c Simplified the protocol hookup code in Makefiles 2022-08-18 22:07:30 +02:00
Maria Matejka
bc4ad83dac Merge commit '082905a8' into HEAD 2022-08-03 15:04:42 +02:00
Maria Matejka
73abd91ac6 rip_rte_better() uses the IGP_METRIC_UNKNOWN instead of protocol-specific infinity 2022-08-03 15:04:28 +02:00
Ondrej Zajicek
2e484f8d29 Merge branch 'master' into backport 2022-07-24 20:08:02 +02:00
Maria Matejka
432dfe3b9b Fixed a rarely used part of Babel: comparing two routes in table by their metric 2022-07-22 15:48:20 +02:00
Ondrej Zajicek
971721c9b5 BGP: Minor improvements to BGP roles
Add support for bgp_otc in filters and warning for configuration
inside confederations.
2022-07-12 15:03:17 +02:00
Eugene Bogomazov
c73b5d2d3d BGP: Implement BGP roles
Implement BGP roles as described in RFC 9234. It is  a mechanism for
route leak prevention and automatic route filtering based on common BGP
topology relationships. It defines role capability (controlled by 'local
role' option) and OTC route attribute, which is used for automatic route
filtering and leak detection.

Minor changes done by commiter.
2022-07-11 17:25:54 +02:00
Maria Matejka
2e5bfeb73a Merge remote-tracking branch 'origin/master' into backport 2022-07-11 11:08:10 +02:00
Maria Matejka
d429bc5c84 Merge commit 'beb5f78a' into backport 2022-07-11 10:41:17 +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
Maria Matejka
beb5f78ada Preexport callback now takes the channel instead of protocol as argument
Passing protocol to preexport was in fact a historical relic from the
old times when channels weren't a thing. Refactoring that to match
current extensibility needs.
2022-06-27 19:04:24 +02:00
Ondrej Zajicek
ad686c55c3 Babel: Do not try to remove multicast seqno request objects from neighbour list
The Babel seqno request code keeps track of which seqno requests are
outstanding for a neighbour by putting them onto a per-neighbour list. When
reusing a seqno request, it will try to remove this node, but if the seqno
request in question was a multicast request with no neighbour attached this
will result in a crash because it tries to remove a list node that wasn't
added to any list.

Fix this by making the list remove conditional. Also fix neighbor removal
which were changing seqno requests to multicast ones instead of removing
them.

Fixes: ebd5751cde ("Babel: Seqno requests are properly decoupled from
neighbors when the underlying interface disappears").

Based on the patch from Toke Høiland-Jørgensen <toke@toke.dk>,
bug reported by Stefan Haller <stefan.haller@stha.de>, thanks.
2022-06-05 04:11:32 +02:00
Maria Matejka
652be92a21 Merge remote-tracking branch 'origin/master' into haugesund-to-2.0 2022-05-30 15:20:21 +02:00
Maria Matejka
097f157182 Merge commit '692055e3df6cc9f0d428d3b0dd8cdd8e825eb6f4' into haugesund-to-2.0 2022-05-30 15:17:52 +02:00
Ondrej Zajicek
a9c19b923c BGP: Display neighbor port on show protocol 2022-05-21 16:21:34 +02:00
Ondrej Zajicek
7bb06b34a1 RPKI: Display cache server port on show protocol
Thanks to Luiz Amaral for the idea.
2022-05-21 16:03:08 +02:00
Luiz Amaral
9a9439d5e1 RPKI: Implement VRF support 2022-05-19 19:43:59 +02:00
Ondrej Zajicek
ba2a076001 BGP: Improve tx performance during feed/flush
The prefix hash table in BGP used the same hash function as the rtable.
When a batch of routes are exported during feed/flush to the BGP, they
all have similar hash values, so they are all crowded in a few slots in
the BGP prefix table (which is much smaller - around the size of the
batch - and uses higher bits from hash values), making it much slower due
to excessive collisions. Use a different hash function to avoid this.

Also, increase the batch size to fill 4k BGP packets and increase minimum
BGP bucket and prefix hash sizes to avoid back and forth resizing during
flushes.

This leads to order of magnitude faster flushes (on my test data).
2022-05-15 15:05:37 +02:00
Toke Høiland-Jørgensen
d829800138 Babel: Fix compilation when LOCAL_DEBUG is set in packets.c
The debug output was not updated with the rest of the code, so packets.c
fails to compile if LOCAL_DEBUG is set.
2022-04-22 17:04:56 +02:00
Toke Høiland-Jørgensen
4aef70136d Babel: Send out low-interval hello on shutdown
When shutting down a Babel instance we send a wildcard retraction to make
sure all peers can quickly switch to other route origins. Add another small
optimisation borrowed from babeld: sending a Hello message (along with the
retraction) with a very low interval.

This will cause neighbours to modify their expiry timers for the node's
state to quickly time it out, thus conserving resources in the network.
2022-04-22 16:43:17 +02:00
Maria Matejka
98fd158e28 RIP: fixed the EA_RIP_FROM attribute
The interface pointer was improperly converted to u32 and back. Fixing
this by explicitly allocating an adata structure for it. It's not so
memory efficient, we'll optimize this later.
2022-04-13 17:05:12 +02:00
Ondrej Zajicek (work)
692055e3df BFD: Add 'strict bind' option
Add BFD protocol option 'strict bind' to use separate listening socket
for each BFD interface bound to its address instead of using shared
listening sockets.
2022-04-07 19:33:40 +02:00
Maria Matejka
d39ef961d1 BGP uses lp_save / lp_restore instead of linpool flushing
It is too cryptic to flush tmp_linpool in these cases and we don't want
anybody in the future to break this code by adding an allocation
somewhere which should persist over that flush.

Saving and restoring linpool state is safer.
2022-04-06 18:14:08 +02:00
Maria Matejka
7e86ff2076 All linpools use pages to allocate regular blocks 2022-04-06 18:14:08 +02:00
Maria Matejka
dabd7bccb3 BGP: Fixed LLGR depreferencing in bgp_rte_mergable 2022-04-06 18:14:08 +02:00
Maria Matejka
4a23ede2b0 Protocols have their own explicit init routines 2022-04-06 18:14:08 +02:00
Maria Matejka
0f68515263 Unsetting route attributes without messing with type system 2022-04-06 18:14:08 +02:00
Maria Matejka
63cf5d5d8c Eattr flags (originated and fresh) get their own struct fields 2022-04-06 18:14:08 +02:00
Maria Matejka
ebd807c0b8 Slab allocator can free the blocks without knowing the parent structure 2022-04-06 18:14:08 +02:00
Maria Matejka
19e727a248 Merge commit '60880b539b8886f76961125d89a265c6e1112b7a' into haugesund 2022-03-09 11:29:56 +01:00
Maria Matejka
8a4bc4fdbf BGP Flowspec validation: Removed in-route optimization for multithreading compatibility 2022-03-09 11:27:34 +01:00