summaryrefslogtreecommitdiff
path: root/proto/bgp/packets.c
AgeCommit message (Collapse)Author
2023-12-05BGP: Send hold timerKaterina Kubecova
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-11-23BGP: Add options to require BGP capabilitiesOndrej Zajicek
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-23BGP: Simplify capability handlingOndrej Zajicek
2023-10-04BGP: Add MPLS supportOndrej Zajicek
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-02Nest: Expand rte_src.private_id to u64Ondrej Zajicek
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-09-27BGP config: Splitting Route Refresh and Enhanced Route RefreshMaria Matejka
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-08-23Nest: Treat VRF interfaces as inside respective VRFsOndrej Zajicek
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-22Merge branch 'bmp'Ondrej Zajicek
2023-08-22BGP: Update RFC referenceOndrej Zajicek
RFC 5549 was obsoleted by RFC 8950.
2023-08-22BMP: Improve peer_down handlingOndrej Zajicek
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-01BMP: Simplify route monitoring hooksOndrej Zajicek
No need for *_begin(), *_commit(), and *_end() hooks. The hook *_notify() is sufficient for everything.
2023-06-08BMP: Support multiple instances of BMP protocolOndrej Zajicek
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-05-30BGP: Improve bgp_create_update_bmp()Ondrej Zajicek
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-19BGP: Fix role check when no capability option is presentOndrej Zajicek
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-01BMP: Use OPEN messages stored in BGPOndrej Zajicek
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-01BGP: Save sent and received OPEN messagesOndrej Zajicek
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-04-18BMP: Allow build without BMP and disable BMP build by defaultOndrej Zajicek
It has still several important issues to be enabled by default.
2023-04-16BMP: Remove duplicate functions for update encodingOndrej Zajicek (work)
Use existing BGP functions also for BMP update encoding.
2023-04-16BMP protocol supportPawel Maslanka
Initial implementation of a basic subset of the BMP (BGP Monitoring Protocol, RFC 7854) from Akamai team. Submitted for further review and improvement.
2023-02-19BGP: Update RFC referencesOndrej Zajicek
2023-01-20BGP: Add received role value to role mismatch log messageOndrej Zajicek
2023-01-01Nest: Fix several issues with pflagsOndrej Zajicek
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
2022-12-10BGP: Log unacceptable hold time as decimal numberOndrej Zajicek
Thanks Johannes Moos for the suggestion.
2022-12-09BGP: Improve handling of hold and keepalive timersOndrej Zajicek
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-10-10BGP: Add option 'next hop prefer global'Ondrej Zajicek
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-03BGP: Some fixes related to VRF and MPLS interactionsOndrej Zajicek
- 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-03BGP: Do not assume that all channels are struct bgp_channelOndrej Zajicek
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-07-24Merge branch 'master' into backportOndrej Zajicek
2022-07-11BGP: Implement BGP rolesEugene Bogomazov
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-04-06BGP uses lp_save / lp_restore instead of linpool flushingMaria Matejka
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-06Eattr flags (originated and fresh) get their own struct fieldsMaria Matejka
2022-03-09Merge commit '60880b539b8886f76961125d89a265c6e1112b7a' into haugesundMaria Matejka
2022-03-09BGP Flowspec validation: Removed in-route optimization for multithreading ↵Maria Matejka
compatibility
2022-03-09Merge commit '5cff1d5f' into haugesundMaria Matejka
Conflicts: proto/bgp/attrs.c proto/pipe/pipe.c
2022-03-02Replacing BGP temporary linpools by the common temporary linpoolMaria Matejka
2022-02-06Merge branch 'oz-trie-table'Ondrej Zajicek (work)
2022-02-06BGP: Implement flowspec validation procedureOndrej Zajicek (work)
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-01-28BGP: Make routing loops silentOndrej Zajicek (work)
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-28BGP: Use proper class in attribute error messagesOndrej Zajicek (work)
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-28BGP: Improve 'invalid next hop' error reportingOndrej Zajicek (work)
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-24BGP: Log route updates that were changed to withdrawsOndrej Zajicek (work)
Typical BGP error handling is treat-as-withdraw, where an invalid route is replaced with a withdraw. Log route network when it happens.
2021-10-13Route: moved rte_src pointer from rta to rteMaria Matejka
It is an auxiliary key in the routing table, not a route attribute.
2021-10-13Preference moved to RTA and set explicitly in protocolsMaria Matejka
2021-10-13BGP: Moved the suppressed and stale flags to pflagsMaria Matejka
2021-06-01BGP: Ensure that freed neighbor entry is not accessedOndrej Zajicek (work)
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-02-10BGP: Add support for BGP hostname capabilityVincent Bernat
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.
2020-04-29BGP: Fix handling of strange IPv6 link-local-only next hopsOndrej Zajicek (work)
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-03-03BGP: Handle flowspec rules without dst partOndrej Zajicek (work)
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.
2019-12-03BGP: Add some statisticsOndrej Zajicek (work)
Add some statistic counters to BGP consistent with BGP MIB (RFC 4273), including persistent 'FSM established transitions'.
2019-11-18BGP: Fix processing of IPv6 FlowspecOndrej Zajicek (work)
During NLRI parsing of IPv6 Flowspec, dst prefix was not properly extracted from NLRI, therefore a received flow was stored in a different position in flowspec routing table, and was not reachable by command 'show route <flow>'. Add proper prefix part accessors to flowspec code and use them from BGP NLRI parsing code. Thanks to Alex D. for the bugreport.