summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_packet.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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