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

200 Commits

Author SHA1 Message Date
Job Snijders
44a16bff6c BGP: Update SendHoldTimer BGP Error code
IANA registered an "Early Allocation" BGP Error code for 'Send Hold
Timer Expired' event. Update BIRD to use that error code.
2024-02-18 09:06:52 +01:00
Ondrej Zajicek
ff2ebdc7e1 BGP: Increase max length of notification data in error logs
Increase max length of notification data in error logs from 16 to 128.
There is already enough space in the buffer.

Thanks to Marco d'Itri for the suggestion.
2024-02-06 18:34:55 +01:00
Katerina Kubecova
bcf2327425 BGP: Send hold timer
Implement BGP Send hold timer according to draft-ietf-idr-bgp-sendholdtimer.
The Send hold timer drops the session if the neighbor is sending keepalives,
but does not receive our messages, causing the TCP connection to stall.
2023-12-05 04:14:45 +01:00
Ondrej Zajicek
3fb06fea1d BGP: Add options to require BGP capabilities
Some BGP capabilities change the BGP behavior in a significant way, so if
the configuration depends on it, it is better to not establish BGP
session when the capability is not available.

Add several BGP option to require individual BGP capabilities during
session negotiation.
2023-11-23 20:54:22 +01:00
Ondrej Zajicek
b6923f6386 BGP: Simplify capability handling 2023-11-23 17:18:04 +01:00
Ondrej Zajicek
9d456d5366 BGP: Add MPLS support
When MPLS is active, received routes on MPLS-aware SAFIs (ipvX-mpls,
vpnX-mpls) are automatically labeled according to active label policy and
corresponding MPLS routes are automatically generated. Also routes sent
on MPLS-aware SAFIs announce local labels when it should be done.
2023-10-04 13:01:21 +02:00
Ondrej Zajicek
21213be523 Nest: Expand rte_src.private_id to u64
In general, private_id is sparse and protocols may want to map some
internal values directly into it. For example, L3VPN needs to
map VPN route discriminators to private_id.

OTOH, u32 is enough for global_id, as these identifiers are dense.
2023-10-02 15:09:30 +02:00
Maria Matejka
8ad9c4bb33 BGP config: Splitting Route Refresh and Enhanced Route Refresh
Both toggles are on by default but if some implementation needs one or
another to be switched off separately, then it's possible now.
2023-09-27 20:18:46 +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
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
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
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
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
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 (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
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
Ondrej Zajicek
913ec57f27 BGP: Update RFC references 2023-02-19 15:42:18 +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
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
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
Ondrej Zajicek
2e484f8d29 Merge branch 'master' into backport 2022-07-24 20:08:02 +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
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
63cf5d5d8c Eattr flags (originated and fresh) get their own struct fields 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
Maria Matejka
83d9920f90 Merge commit '5cff1d5f' into haugesund
Conflicts:
      proto/bgp/attrs.c
      proto/pipe/pipe.c
2022-03-09 10:56:06 +01:00
Maria Matejka
06ece3265e Replacing BGP temporary linpools by the common temporary linpool 2022-03-02 12:13:49 +01:00
Ondrej Zajicek (work)
53a2540687 Merge branch 'oz-trie-table' 2022-02-06 23:42:10 +01:00
Ondrej Zajicek (work)
1f2eb2aca8 BGP: Implement flowspec validation procedure
Implement flowspec validation procedure as described in RFC 8955 sec. 6
and RFC 9117. The Validation procedure enforces that only routers in the
forwarding path for a network can originate flowspec rules for that
network.

The patch adds new mechanism for tracking inter-table dependencies, which
is necessary as the flowspec validation depends on IP routes, and flowspec
rules must be revalidated when best IP routes change.

The validation procedure is disabled by default and requires that
relevant IP table uses trie, as it uses interval queries for subnets.
2022-02-06 23:27:13 +01:00
Ondrej Zajicek (work)
4c6ee53f31 BGP: Make routing loops silent
One of previous commits added error logging of invalid routes. This
also inadvertently caused error logging of route loops, which should
be ignored silently. Fix that.
2022-01-28 18:13:18 +01:00
Ondrej Zajicek (work)
963b2c7ce2 BGP: Use proper class in attribute error messages
Most error messages in attribute processing are in rx/decode step and
these use L_REMOTE log class. But there are few that are in tx/export
step and these should use L_ERR log class.

Use tx-specific macro (REJECT()) in tx/export code and rename field
err_withdraw to err_reject in struct bgp_export_state to ensure that
appropriate error reporting macros are called in proper contexts.
2022-01-28 05:35:22 +01:00
Ondrej Zajicek (work)
75d01ecc2d BGP: Improve 'invalid next hop' error reporting
Distinguish multiple causes of 'invalid next hop' message and report
the relevant next hop address.

Thanks to Simon Ruderich for the original patch.
2022-01-28 05:03:03 +01:00
Ondrej Zajicek (work)
9dbb7eb6eb BGP: Log route updates that were changed to withdraws
Typical BGP error handling is treat-as-withdraw, where an invalid route
is replaced with a withdraw. Log route network when it happens.
2022-01-24 03:44:21 +01:00
Maria Matejka
5cff1d5f02 Route: moved rte_src pointer from rta to rte
It is an auxiliary key in the routing table, not a route attribute.
2021-10-13 19:09:04 +02:00
Maria Matejka
eb937358c0 Preference moved to RTA and set explicitly in protocols 2021-10-13 19:09:04 +02:00
Maria Matejka
ddd89ba12d BGP: Moved the suppressed and stale flags to pflags 2021-10-13 19:09:04 +02:00
Ondrej Zajicek (work)
91d0458389 BGP: Ensure that freed neighbor entry is not accessed
Routes from downed protocols stay in rtable (until next rtable prune
cycle ends) and may be even exported to another protocol. In BGP case,
source BGP protocol is examined, although dynamic parts (including
neighbor entries) are already freed. That may lead to crash under some
race conditions. Ensure that freed neighbor entry is not accessed to
avoid this issue.
2021-06-01 02:20:26 +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)
17de3a023f BGP: Fix handling of strange IPv6 link-local-only next hops
There are three common ways how to encode IPv6 link-local-only next hops:
(:: ll), (ll), and (ll ll). We use the first one but we should accept all
three. The patch fixes handling of the last one.

Thanks to Sebastian Hahn for the bugreport.
2020-04-29 02:50:29 +02:00
Ondrej Zajicek (work)
78e4a123bb BGP: Handle flowspec rules without dst part
The RFC 5575 does not explicitly reject flowspec rules without dst part,
it just requires dst part in validation procedure for feasibility, which
we do not implement anyway. Thus flow without dst prefix is syntactically
valid, but unfeasible (if feasibilty testing is done).

Thanks to Alex D. for the bugreport.
2020-03-03 17:45:16 +01:00