summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_label.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bgpd: fix unaligned access to addpath idSantosh P K2020-01-071-1/+2
| | | | | | | | uint8_t * cannot be cast to uint32_t * unless the pointed-to address is aligned according to uint32_t's alignment rules. And it usually is not. Signed-off-by: Santosh P K <sapk@vmware.com>
* bgpd: fix LU label callback crashEmanuele Di Pascale2019-06-241-2/+13
| | | | | | | | | | | | under some conditions, the callback to get a label for a LU bgp path could be called after the path had already been freed. In this case we would be reading garbage and potentially crash. Lock the path info before queueing the callback, and unlock as the first step of the callback, exiting gracefully if the path info is now NULL. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
* bgpd: Do not send UPDATE message with maximum-prefixDonatas Abraitis2019-04-241-6/+6
| | | | | | | | | | When using maximum-prefix and count is overflow BGP sends UPDATE message: Apr 15 20:45:06 exit1-debian-9 bgpd[9818]: 192.168.0.2 [Error] Error parsing NLRI Apr 15 20:45:06 exit1-debian-9 bgpd[9818]: %NOTIFICATION: sent to neighbor 192.168.0.2 3/10 (UPDATE Message Error/Invalid Network Field) 0 bytes Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* bgpd, zebra: auto assign labels from label pool to regular prefixes in BGP ↵Anton Degtyarev2018-12-201-8/+129
| | | | | | | | | | | | labeled unicast This commit is the last missing piece to complete BGP LU support in bgpd. To this moment, bgpd (and zebra) supported auto label assignment only for prefixes leaked from VRFs to vpn and for MPLS SR prefixes. This adds auto label assignment to other routes types in bgpd. The following enhancements have been made: * bgp_route.c:bgp_process_main_one() now sets implicit-null local_label to all local, aggregate and redistributed routes. * bgp_route.c:bgp_process_main_one() now will request a label from the label pool for any prefix that loses the label for some reason (for example, when the static label assignment config is removed) * bgp_label.c:bgp_reg_dereg_for_label() now requests labels from label pool for routes which have no associated label index * zebra_mpls.c:zebra_mpls_fec_register() now expects both label and label_index from the calling function, one of which must be set to MPLS_INVALID_LABEL or MPLS_INVALID_LABEL_INDEX, based on this it will decide how to register the provided FEC. Signed-off-by: Anton Degtyarev <anton@cumulusnetworks.com>
* bgpd: Rename various variable names to something more appropriateDonald Sharp2018-10-091-9/+9
| | | | | | | | | ri -> pi bi -> bpi info -> path info -> rmap_path ( for routemap applications ) Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Convert `struct bgp_info` to `struct bgp_path_info`Donald Sharp2018-10-091-2/+3
| | | | | | | | | | | | Do a straight conversion of `struct bgp_info` to `struct bgp_path_info`. This commit will setup the rename of variables as well. This is being done because `struct bgp_info` is not descriptive of what this data actually is. It is path information for routes that we keep to build the actual routes nexthops plus some extra information. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: style for EC replacementsQuentin Young2018-09-131-3/+3
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: BGP_[WARN|ERR] -> EC_BGPQuentin Young2018-09-131-7/+7
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: Modify bgp_label to use flog_warnDonald Sharp2018-09-061-2/+3
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: rename zlog_fer -> flog_errQuentin Young2018-08-141-6/+6
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: implement zlog_ferr facility for enhance error messages in bgpDon Slice2018-08-141-9/+15
| | | | Signed-off-by: Don Slice <dslice@cumulusnetworks.com<
* bgpd zebra: element overflow (PVS-Studio)F. Aragon2018-07-021-1/+1
| | | | | | | | The warning given by PVS-Studio is related to per-element overflow (there is no real overflow, because of how elements are mapped in the union). This same warning is typically reported by Coverity, too. Signed-off-by: F. Aragon <paco@voltanet.io>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-11/+11
| | | | | | | | | | | | | | | | | | | | | | 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: Clean up peer status checking for a received nlriDonald Sharp2018-03-161-4/+0
| | | | | | | | | | | In bgp_update_receive the first thing we do is establish that the peer->status is Established. We then do a bunch of work and call bgp_nlri_parse where we break out for each address family. Each AFI is then checking for being peer->status is Established again. There is no point in checking this again. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: carry two MPLS labels in EVPN NLRIsMitesh Kanjariya2018-01-241-3/+3
| | | | | | | | | | | | | | When doing symmetric routing, EVPN type-2 (MACIP) routes need to be advertised with two labels (VNIs) the first being the L2 VNI (identifying the VLAN) and the second being the L3 VNI (identifying the VRF). The receive processing needs to handle one or two labels too. Ticket: CM-18489 Review: CCR-6949 Testing: manual and bgp/evpn/mpls smoke Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
* bgpd, zebra: Ensure that passed flags is 0 for unregister eventDonald Sharp2017-11-131-1/+6
| | | | | | | The flags passed in should be 0 for an unregister event. Ensure that we respect that. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: fix clang warningVincent JARDIN2017-10-081-1/+0
| | | | | | Remove stored value to llen that is never used. Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
* Revert "*: reindent pt. 2"David Lamparter2017-07-221-1/+1
| | | | | | | | | This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindent pt. 2whitespace / reindent2017-07-171-1/+1
| | | | | | | | w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-287/+279
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: Refactor 'struct attr_extra' into 'struct attr'Donald Sharp2017-07-121-4/+2
| | | | | | | | | | | | | | | | | Most of the attributes in 'struct attr_extra' allow for the more interesting cases of using bgp. The extra overhead of managing it will induce errors as we add more attributes and the extra memory overhead is negligible on anything but full bgp feeds. Additionally this greatly simplifies the code for the handling of data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> bgpd: Fix missing label set Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Install SAFI_LABELED_UNICAST routes in SAFI_UNICAST tableDaniel Walton2017-06-201-5/+4
| | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* bgpd: Install SAFI_LABELED_UNICAST routes in SAFI_UNICAST tableDaniel Walton2017-06-161-20/+31
| | | | | | | | | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> - All ipv4 labeled-unicast routes are now installed in the ipv4 unicast table. This allows us to do things like take routes from an ipv4 unicast peer, allocate a label for them and TX them to a ipv4 labeled-unicast peer. We can do the opposite where we take routes from a labeled-unicast peer, remove the label and advertise them to an ipv4 unicast peer. - Multipath over a labeled route and non-labeled route is not allowed. - You cannot activate a peer for both 'ipv4 unicast' and 'ipv4 labeled-unicast' - The 'tag' variable was overloaded for zebra's route tag feature as well as the mpls label. I added a 'mpls_label_t mpls' variable to avoid this. This is much cleaner but resulted in touching a lot of code.
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-4/+3
| | | | | | | | | | | 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>
* Update to draft-ietf-idr-bgp-prefix-sid-05Daniel Walton2017-04-261-3/+7
| | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> The initial implementation was against draft-keyupate-idr-bgp-prefix-sid-02 This updates our label-index implementation up to draft-ietf-idr-bgp-prefix-sid-05 - changed BGP_ATTR_LABEL_INDEX to BGP_ATTR_PREFIX_SID - since there are multiple TLVs in BGP_ATTR_PREFIX_SID you can no longer rely on that flag to know if there is a label-index for the path. I changed bgp_attr_extra_new() to init the label_index to BGP_INVALID_LABEL_INDEX - put some placeholder code in for the other two TLVs (IPv6 and Originator SRGB)
* bgpd: Fix labeled-unicast generation and parsing issuesDon Slice2017-04-061-1/+1
| | | | | | | | | | | Labeled-unicast updates were being sent with an ipv6 nexthop due to not setting the mp_nexthop_len or nh_afi. On the receive side, the prefix length was being incorrectly determined and has been fixed. Also the stream for bgp_label_buf was not created. All resolved. Ticket: CM-15260 Signed-off-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by:
* bgpd, lib, zebra: Implement handling of BGP-Prefix-SID label IndexVivek Venkatraman2017-04-061-6/+21
| | | | | | | | | | | | | | | | Implement BGP Prefix-SID IETF draft to be able to signal a labeled-unicast prefix with a label index (segment ID). This makes it easier to deploy global MPLS labels with BGP, even without other aspects of Segment Routing implemented. This patch implements the handling of the BGP-Prefix-SID Label Index attribute. When received from a peer and the index is acceptable, the local label is picked up from the SRGB and is programmed as the incoming label as well as advertised to peers. If the index is not acceptable, no local label is assigned. The outgoing label will always be the one advertised by the downstream neighbor. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
* bgpd: This patch implements the exchange of the BGP-Prefix-SID label index attrVivek Venkatraman2017-04-061-0/+5
| | | | | | | | | Implement BGP Prefix-SID IETF draft to be able to signal a labeled-unicast prefix with a label index (segment ID). This makes it easier to deploy global MPLS labels with BGP, even without other aspects of Segment Routing implemented. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
* bgpd: labeled unicast processingDon Slice2017-04-061-0/+318
Implement support for negotiating IPv4 or IPv6 labeled-unicast address family, exchanging prefixes and installing them in the routing table, as well as interactions with Zebra for FEC registration. This is the implementation of RFC 3107. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>