summaryrefslogtreecommitdiff
path: root/bgpd/bgp_label.c
AgeCommit message (Collapse)Author
2020-03-29*: fix format string warningsDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2020-03-26bgpd: Convert users of `rn->p` to use accessor functionDonald Sharp
Add new function `bgp_node_get_prefix()` and modify the bgp code base to use it. This is prep work for the struct bgp_dest rework. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-07bgpd: fix unaligned access to addpath idSantosh P K
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>
2019-06-24bgpd: fix LU label callback crashEmanuele Di Pascale
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>
2019-04-24bgpd: Do not send UPDATE message with maximum-prefixDonatas Abraitis
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>
2018-12-20bgpd, zebra: auto assign labels from label pool to regular prefixes in BGP ↵Anton Degtyarev
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>
2018-10-09bgpd: Rename various variable names to something more appropriateDonald Sharp
ri -> pi bi -> bpi info -> path info -> rmap_path ( for routemap applications ) Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09bgpd: Convert `struct bgp_info` to `struct bgp_path_info`Donald Sharp
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>
2018-09-13*: style for EC replacementsQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13bgpd: BGP_[WARN|ERR] -> EC_BGPQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-06bgpd: Modify bgp_label to use flog_warnDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14*: rename zlog_fer -> flog_errQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14bgpd: implement zlog_ferr facility for enhance error messages in bgpDon Slice
Signed-off-by: Don Slice <dslice@cumulusnetworks.com<
2018-07-02bgpd zebra: element overflow (PVS-Studio)F. Aragon
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>
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
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>
2018-03-16bgpd: Clean up peer status checking for a received nlriDonald Sharp
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>
2018-01-23bgpd: carry two MPLS labels in EVPN NLRIsMitesh Kanjariya
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>
2017-11-13bgpd, zebra: Ensure that passed flags is 0 for unregister eventDonald Sharp
The flags passed in should be 0 for an unregister event. Ensure that we respect that. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-08bgpd: fix clang warningVincent JARDIN
Remove stored value to llen that is never used. Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-07-22Revert "*: reindent pt. 2"David Lamparter
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>
2017-07-17*: reindent pt. 2whitespace / reindent
w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-12bgpd: Refactor 'struct attr_extra' into 'struct attr'Donald Sharp
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>
2017-06-20bgpd: Install SAFI_LABELED_UNICAST routes in SAFI_UNICAST tableDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-06-16bgpd: Install SAFI_LABELED_UNICAST routes in SAFI_UNICAST tableDaniel Walton
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.
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
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>
2017-04-26Update to draft-ietf-idr-bgp-prefix-sid-05Daniel Walton
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)
2017-04-06bgpd: Fix labeled-unicast generation and parsing issuesDon Slice
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:
2017-04-06bgpd, lib, zebra: Implement handling of BGP-Prefix-SID label IndexVivek Venkatraman
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>
2017-04-06bgpd: This patch implements the exchange of the BGP-Prefix-SID label index attrVivek Venkatraman
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>
2017-04-06bgpd: labeled unicast processingDon Slice
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>