summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_packet.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bgpd: Handle ENHE capability via dynamic capabilityDonatas Abraitis2025-01-141-0/+6
| | | | | | | | | | FRR supports dynamic capability which is useful to exchange the capabilities without tearing down the session. ENHE capability was missed to be included handling via dynamic capability. Let's add it too. This was missed and asked in Slack that it would be useful. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* bgpd: bmp loc-rib peer up/down for vrfsMaxence Younsi2024-10-111-0/+1
| | | | | | | | | | | | | | | | | added bmp bgp peer for vrfs added peer up vrf in bmp peer up state added vrf state in bmpbgp added safe bmp_peer_sendall : bmp_peer_sendall_safe changed bgp_open_send to call new bgp_open_make bgp_open_make creates a bgp open packet, now used in bmp for peer up vrf added hook and call to bgp instance state vrf peer state is recomputed when interfaces (including vrf itf) go up / down and when it gets created or removed Link: https://github.com/mxyns/frr/commit/e48ba380700d53124131f4e4419f646c05b40c86 Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> Signed-off-by: Maxence Younsi <mx.yns@outlook.fr>
* bgpd: First pass of BGP_EVENT_ADDDonald Sharp2023-09-101-1/+1
| | | | | | | | | | | Pass through a bunch of BGP_EVENT_ADD's and make the code use a proper connection instead of a peer->connection. There still are a bunch of places where peer->connection is used and later commits will probably go through and clean these up more. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: bgp_packet pass connection aroundDonald Sharp2023-09-101-2/+2
| | | | | | | | Modify all the receive functions to pass around the actual connection being acted upon. Modify the collision detection function to look at the possible two connections. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: bgp_open_send is connection oriented not peer orientedDonald Sharp2023-09-101-1/+1
| | | | | | | The bgp_open_send function should use a connection oriented pointer for it's basis. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: bgp_notify_send use peer_connection instead of peerDonald Sharp2023-09-091-4/+5
| | | | | | The bgp_notify_send function should use a peer_connection Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: Treat withdraw variable as a boolDonald Sharp2023-04-061-1/+1
| | | | | | Used as a bool, treated as a bool. Make it a bool Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: Conform bgp_packet.h with coding standardsDonald Sharp2023-04-061-12/+14
| | | | | | | | FRR's standards state that function declarations should have actual variable names for parameters passed in. Let's make this so for bgp_packet.h Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-241-3/+3
| | | | | | | | | Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-16/+1
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: avoid notify race between io and main pthreadsMark Stapp2022-09-081-0/+2
| | | | | | | | | | | | | The "bgp_notify_" apis in bgp_packet.c generate a notification to a peer, usually during error handling. The io pthread wants to send notifications in a couple of cases during early received-packet validation - but the existing api interacts with the peer struct itself, and that's not safe. Add a new api for use by the io pthread, and adjust the main notify api so that it can avoid touching the peer struct. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
* bgpd: Activate Graceful-Restart when receiving CEASE/HOLDTIME notificationsDonatas Abraitis2022-05-141-0/+1
| | | | | | | | | | | | | | If we receive CEASE Notification or HOLDTIME notification, retain STALE routes if it's not a CEASE/Hard Reset. When doing `clear ip bgp PEER`, we can control if this would be CEASE/Hard Reset or not by using `bgp hard-administrative-reset` knob. When `bgp graceful-restart notification` is disabled, STALE routes won't be retained when receiving Notification message. Co-authored-by: Biswajit Sadhu <biswajit.sadhu@gmail.com> Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* bgpd: Send Hard Reset Notification for BGP_NOTIFY_CEASE_ADMIN_RESETDonatas Abraitis2022-05-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | `clear bgp neighbor` should send Hard Reset and graceful restart should be activated. Let's make this adjustable. https://datatracker.ietf.org/doc/html/rfc8538#section-5.1 +-------+------------------------------------+----------------------+ | Value | Name | Suggested Behavior | +-------+------------------------------------+----------------------+ | 1 | Maximum Number of Prefixes Reached | Hard Reset | | 2 | Administrative Shutdown | Hard Reset | | 3 | Peer De-configured | Hard Reset | | 4 | Administrative Reset | Provide user control | | 5 | Connection Rejected | Graceful Cease | | 6 | Other Configuration Change | Graceful Cease | | 7 | Connection Collision Resolution | Graceful Cease | | 8 | Out of Resources | Graceful Cease | | 9 | Hard Reset | Hard Reset | +-------+------------------------------------+----------------------+ Enabled by default. Co-authored-by: Biswajit Sadhu <biswajit.sadhu@gmail.com> Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* bgpd: Implement CEASE/Hard Reset notificationDonatas Abraitis2022-05-021-0/+4
| | | | | | | | | | Also, add N-Bit (Notification) flag for Graceful Restart. This is a preparation for RFC8538. More information: https://datatracker.ietf.org/doc/html/rfc8538 Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-3/+3
| | | | | | | The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: bgp_packet_set_size int to voidDonatas Abraitis2021-11-291-1/+1
| | | | | | stream size is never checked anywhere in the code, just convert to void. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: require semicolon after DEFINE_HOOK & co.David Lamparter2021-03-171-2/+2
| | | | | | See previous commit. Signed-off-by: David Lamparter <equinox@diac24.net>
* bgpd: handle socket read errors in the main pthreadMark Stapp2021-03-091-0/+4
| | | | | | | | | Add a handler for socket errors that runs in the main pthread, rather than the io pthread. When the io pthread encounters a read error, capture the error and schedule a task for the main pthread. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* bgpd: Implement enhanced route refresh capabilityDonatas Abraitis2021-01-051-2/+3
| | | | | | | 16:40:49 BGP: 192.168.0.2: sending route-refresh (BoRR) for IPv4/unicast 16:40:51 BGP: 192.168.0.2: sending route-refresh (EoRR) for IPv4/unicast Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* bgpd, lib: fix style from BGP GR codeQuentin Young2020-02-041-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the noncompliant style for the following commit range: 4a6e80fbf 2ba1fe695 efcb2ebbb 8c48b3b69 dc95985fe 0f0444fbd 85ef4179a eb451ee58 2d3dd828d 9e3b51a7f d6e3c15b6 34aa74486 6102cb7fe d7b3cda6f 2bb5d39b1 5f9c1aa29 5cce3f054 3a75afa4b f009ff269 cfd47646b 2986cac29 055679e91 034e185dc 794b37d52 b0965c44e 949b0f24f 63696f1d8 Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: Restarting node does not send EOR after the convergence.bisdhdh2020-01-231-0/+1
| | | | | | | | | | | | *After a restarting router comes up and the bgp session is successfully established with the peer. If the restarting router doesn’t have any route to send, it send EOR to the peer immediately before receiving updates from its peers. *Instead the restarting router should send EOR, if the selection deferral timer is not running OR count of eor received and eor required are matches then send EOR. Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
* bgpd: Added hidden CLI command to disable sending of End-of-Rib.bisdhdh2020-01-231-0/+8
| | | | | | | | | | | | BGP disable EOR sending is a useful command for testing various scenarios of BGP graceful restart. * Added the hidden CLI command : bgp graceful-restart disable-eor * The CLI will not be displayed in "show running-config" and will not be stored in configuration file. * When enabled, EOR will not be sent to peer Signed-off-by: Biswajit Sadhu <sadhub@vmware.com> Signed-off-by: Soman K S <somanks@vmware.com>
* bgpd: Remove trailing whitespaces from some header filesDonatas Abraitis2019-09-171-6/+6
| | | | | | | | | | This is annoying when editing a file and saving the file. IDEs like VSCode can automatically remove trailing whitespaces, hence it would be better having a clean code before pushing other changes. I step onto this not the first time. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* bgpd: Remove declarations of unused functionsDonald Sharp2019-08-201-3/+0
| | | | | | | | Code inspection found some functions being declared in a .h file but FRR does not have the functions implemented. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: add packet send hookDavid Lamparter2019-07-031-0/+5
| | | | | | | Unlike MRT dumps, BMP also provides packets sent by the router. Add another hook for that. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: add & use bgp packet dump hookDavid Lamparter2019-07-031-0/+7
| | | | | | | | The MRT dump code is already hooked in at the right places to write out packets; the BMP code needs exactly the same access so let's make this a hook. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-6/+6
| | | | | | | | | | | | | | | | | | | | | | The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd, tests: comment formattingQuentin Young2017-11-301-3/+0
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: atomize write-quanta, add read-quantaQuentin Young2017-11-301-1/+0
| | | | | | | | | | | | | | bgpd supports setting a write-quanta that serves as a hint on how many packets to write per I/O cycle. Now that input is buffered, it makes sense to add the equivalent parameter for how many packets are processed per cycle. This is *not* how many packets are read off the wire per I/O cycle; rather it is how many packets are processed from the input buffer in a given cycle after having been read off the wire and sanitized. Since these values must be used from multiple threads, they have also been made atomic. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: implement buffered readsQuentin Young2017-11-301-2/+1
| | | | | | | | | | | | | | | | * Move and modify all network input related code to bgp_io.c * Add a real input buffer to `struct peer` * Move connection initialization to its own thread.c task instead of piggybacking off of bgp_read() * Tons of little fixups Primary changes are in bgp_packet.[ch], bgp_io.[ch], bgp_fsm.[ch]. Changes made elsewhere are almost exclusively refactoring peer->ibuf to peer->curr since peer->ibuf is now the true FIFO packet input buffer while peer->curr represents the packet currently being processed by the main pthread. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: move bgp i/o to a separate source fileQuentin Young2017-11-301-6/+1
| | | | | | | | | | | | | | | | After implement threading, bgp_packet.c was serving the double purpose of consolidating packet parsing functionality and handling actual I/O operations. This is somewhat messy and difficult to understand. I've thus moved all code and data structures for handling threaded packet writes to bgp_io.[ch]. Although bgp_io.[ch] only handles writes at the moment to keep the noise on this commit series down, for organization purposes, it's probably best to move bgp_read() and its trappings into here as well and restructure that code so that read()'s happen in the pthread and packet processing happens on the main thread. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: use new threading infraQuentin Young2017-11-301-0/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: dynamically allocate synchronization primitivesQuentin Young2017-11-301-0/+1
| | | | | | | | | | | | | | Changes all synchronization primitives to be dynamically allocated. This should help catch any subtle errors in pthread lifecycles. This change also pre-initializes synchronization primitives before threads begin to run, eliminating a potential race condition that probably would have caused a segfault on startup on a very fast box. Also changes mutex and condition variable allocations to use MTYPE_PTHREAD and updates tests to do the proper initializations. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: move packet writes into dedicated pthreadQuentin Young2017-11-301-3/+8
| | | | | | | | | | * BGP_WRITE_ON() removed * BGP_WRITE_OFF() removed * peer_writes_on() added * peer_writes_off() added * bgp_write_proceed_actions() removed Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-21/+23
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-18/+18
| | | | | | | | | | | The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: handling EVPN Route Type 5 NLRI messagePhilippe Guibert2017-02-141-1/+1
| | | | | | | | | | | | | | This patch introduces code to receive a NLRI message with route type 5, as defined in draft-ietf-bess-evpn-prefix-advertisement-02. It It increases the number of parameters to extract from the NLRI and to store into bgp extra information structure. Those parameters are the ESI (ethernet segment identifier), the gateway IP Address (which acts like nexthop attribute but is contained inside the NLRI itself) and the ethernet tag identifier ( that acts for the VXLan Identifier) This patch updates bgp_update() and bgp_withdraw() api, and then does the necessary adapations for rfapi. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* bgpd: Regularise bgp_update_receive, add missing notifies and checksPaul Jakma2016-10-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bgp_packet.c: (bgp_update_receive) Lots of repeated code, doing same thing for each AFI/SAFI. Except when it doesn't, e.g. the IPv4/VPN case was missing the EoR bgp_clear_stale_route call - the only action really needed for EoR. Make this function a lot more regular, using common, AFI/SAFI independent blocks so far as possible. Replace the 4 separate bgp_nlris with an array, indexed by an enum. The distinct blocks that handle calling bgp_nlri_parse for each different AFI/SAFI can now be replaced with a loop. Transmogrify the nlri SAFI from the SAFI_MPLS_LABELED_VPN code-point used on the wire, to the SAFI_MPLS_VPN safi_t enum we use internally as early as possible. The existing code was not necessarily sending a NOTIFY for NLRI parsing errors, if they arose via bgp_nlri_sanity_check. Send the correct NOTIFY - INVAL_NETWORK for the classic NLRIs and OPT_ATTR_ERR for the MP ones. EoR can now be handled in one block. The existing code seemed broken for EoR recognition in a number of ways: 1. A v4/unicast EoR should be an empty UPDATE. However, it seemed to be treating an UPDATE with attributes, inc. MP REACH/UNREACH, but no classic NLRIs, as a v4/uni EoR. 2. For other AFI/SAFIs, it was treating UPDATEs with no classic withraw and with a zero-length MP withdraw as EoRs. However, that would mean an UPDATE packet _with_ update NLRIs and a 0-len MP withdraw could be classed as an EoR. This seems to be loose coding leading to ambiguous protocol situations and likely incorrect behaviour, rather than simply being liberal. Be more strict about checking that an UPDATE really is an EoR and definitely is not trying to update any NLRIs. This same loose EoR parsing was noted by Chris Hall previously on list. (bgp_nlri_parse) Front end NLRI parse function, to fan-out to the correct parser for the AFI/SAFI. * bgp_route.c: (bgp_nlri_sanity_check) We try convert NLRI safi to internal code-point ASAP, adjust switch for that. Leave the wire code point in for defensive coding. (bgp_nlri_parse) rename to bgp_nlri_parse_ip. * tests/bgp_mp_attr_test.c: Can just use bgp_nlri_parse frontend.
* Relax draft-ietf-idr-error-handling-13 valid IP check in favor of ↵Donald Sharp2015-05-201-1/+0
| | | | draft-ietf-idr-error-handling-14
* BGP: Add dynamic update group supportDonald Sharp2015-05-201-9/+5
| | | | | | | | | | | | | | | | | | | | This patch implements the 'update-groups' functionality in BGP. This is a function that can significantly improve BGP performance for Update generation and resultant network convergence. BGP Updates are formed for "groups" of peers and then replicated and sent out to each peer rather than being formed for each peer. Thus major BGP operations related to outbound policy application, adj-out maintenance and actual Update packet formation are optimized. BGP update-groups dynamically groups peers together based on configuration as well as run-time criteria. Thus, it is more flexible than update-formation based on peer-groups, which relies on operator configuration. [Note that peer-group based update formation has been introduced into BGP by Cumulus but is currently intended only for specific releases.] From 11098af65b2b8f9535484703e7f40330a71cbae4 Mon Sep 17 00:00:00 2001 Subject: [PATCH] updgrp commits
* Correct a few fuzz failures in BGPDonald Sharp2015-05-201-0/+1
|
* Changes to improve BGP convergence time:Donald Sharp2015-05-201-0/+9
| | | | | | | | | | | - Schedule write thread for advertisements and withdraws only if corresponding FIFOs are growing and/or upon work_queue getting fully processed. - Set non-default yield time for the main work_queue, as the default value of 10ms results in yielding after processing very few nodes. - Remove unnecessary scheduling of write thread when update packet is formed. - If MRAI is 0, don't start a timer unnecessarily, directly schedule write thread. - Some debugs.
* bgpd-nht-connected-route.patchDonald Sharp2015-05-201-0/+1
| | | | | | BGP: Use next hop tracking for connected routes too And cleanup obsolete code in bgp_scan and bgp_import.
* bgpd: bgpd-update-delay.patchDonald Sharp2015-05-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | COMMAND: 'update-delay <max-delay in seconds> [<establish-wait in seconds>]' DESCRIPTION: This feature is used to enable read-only mode on BGP process restart or when BGP process is cleared using 'clear ip bgp *'. When applicable, read-only mode would begin as soon as the first peer reaches Established state and a timer for <max-delay> seconds is started. During this mode BGP doesn't run any best-path or generate any updates to its peers. This mode continues until: 1. All the configured peers, except the shutdown peers, have sent explicit EOR (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached Established is considered an implicit-EOR. If the <establish-wait> optional value is given, then BGP will wait for peers to reach establish from the begining of the update-delay till the establish-wait period is over, i.e. the minimum set of established peers for which EOR is expected would be peers established during the establish-wait window, not necessarily all the configured neighbors. 2. max-delay period is over. On hitting any of the above two conditions, BGP resumes the decision process and generates updates to its peers. Default <max-delay> is 0, i.e. the feature is off by default. This feature can be useful in reducing CPU/network used as BGP restarts/clears. Particularly useful in the topologies where BGP learns a prefix from many peers. Intermediate bestpaths are possible for the same prefix as peers get established and start receiving updates at different times. This feature should offer a value-add if the network has a high number of such prefixes. IMPLEMENTATION OBJECTIVES: Given this is an optional feature, minimized the code-churn. Used existing constructs wherever possible (existing queue-plug/unplug were used to achieve delay and resume of best-paths/update-generation). As a result, no new data-structure(s) had to be defined and allocated. When the feature is disabled, the new node is not exercised for the most part. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Dinesh Dutt <ddutt@cumulusnetworks.com>
* bgpd: code cleanupStephen Hemminger2009-12-171-0/+2
| | | | | | | | | | | * bgpd/bgp_aspath.c * ashash: only used in one file, make static * aspath_count_numas(): dead code, sayonara * bgpd/bgpd.c * peer_nsf_stop(): only used in one file, make static * bgpd/bgp_packet.h * bgp_capability_receive(): add missing prototype for a global function
* 2005-06-28 Paul Jakma <paul.jakma@sun.com>paul2005-06-281-10/+10
| | | | | | | | | | * (global) The great bgpd extern and static'ification. * bgp_routemap.c: remove unused ROUTE_MATCH_ASPATH_OLD code (route_set_metric_compile) fix u_int32_t to ULONG_MAX comparison warnings. * bgp_route.h: (bgp_process, bgp_withdraw, bgp_update) export these used by various files which had their own private declarations, in the case of mplsvpn - incorrect.
* 2005-05-23 Paul Jakma <paul@dishone.st>paul2005-05-231-0/+5
| | | | | | * bgp_fsm.h: Add extern qualifier to exported functions * bgp_nexthop.c: add static to nexthop specific globals * *.h: Add guard defines
* 2004-10-13 Paul Jakma <paul@dishone.st>paul2004-10-131-4/+4
| | | | | | | | | | | * (global) more const'ification and fixups of types to clean up code. * bgp_mplsvpn.{c,h}: (str2tag) fix abuse. Still not perfect, should use something like the VTY_GET_INTEGER macro, but without the vty_out bits.. * bgp_routemap.c: (set_aggregator_as) use VTY_GET_INTEGER_RANGE (no_set_aggregator_as) ditto. * bgpd.c: (peer_uptime) fix unlikely bug, where no buffer is returned, add comments about troublesome return value.
* 2004-06-04 Paul Jakma <paul@dishone.st>paul2004-06-041-2/+3
| | | | * type mismatch fixes
* Initial revisionpaul2002-12-131-0/+49