summaryrefslogtreecommitdiff
path: root/bgpd/bgp_attr_evpn.c
AgeCommit message (Collapse)Author
2024-09-18bgpd: changes for code maintainabilitysri-mohan1
these changes are for improving the code maintainability and readability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-08-11bgpd: Move evpn_overlay to a pointerDonatas Abraitis
Before this convertion: ``` /* --- cacheline 3 boundary (192 bytes) --- */ struct bgp_attr_encap_subtlv * encap_subtlvs; /* 192 8 */ struct bgp_attr_encap_subtlv * vnc_subtlvs; /* 200 8 */ struct bgp_route_evpn evpn_overlay; /* 208 36 */ ``` After this convertion: ``` /* --- cacheline 3 boundary (192 bytes) --- */ struct bgp_attr_encap_subtlv * encap_subtlvs; /* 192 8 */ struct bgp_attr_encap_subtlv * vnc_subtlvs; /* 200 8 */ struct bgp_route_evpn * evpn_overlay; /* 208 8 */ ``` Saving 28 bytes when EVPN is not used. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-07-04bgpd: Move sticky, default_gw, router_flag into a single flags variableDonatas Abraitis
Instead of using 3 uint8_t variables under struct attr, let's use a single uint8_t as the flags. Saving 2-bytes. Not a big deal, but it's even easier to track EVPN-related flags/variables. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-11*: Properly use memset() when zeroingDonatas Abraitis
Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-02-10bgpd: fix null pointer dereferencesIgor Ryzhov
They were introduced during recent ecommunity rework in b53e67a3. CID 1511347 and 1511348. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2022-02-04bgpd: Use bgp_attr_[sg]et_ecommunity for struct ecommunityDonatas Abraitis
This is an extra work before moving attr->ecommunity to attra_extra struct. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-31bgpd: Fixing memcmp to avoid coverity issueIqra Siddiqui
Description: Replacing memcmp at certain places, to avoid the coverity issues caused by it. Co-authored-by: Kantesh Mundargi <kmundaragi@vmware.com> Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
2022-01-19bgpd: replace custom union gw_addr with struct ipaddrIgor Ryzhov
BGP EVPN custom `union gw_addr` is basically the same thing as a common `struct ipaddr` but it lacks the address family which is needed in some cases. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-07bgpd: Parse EVPN RT-5 NLRI and store gateway IP for EVPN routeAmeya Dharkar
While installing this route in the EVPN table, make sure all the conditions mentioned in the draft https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement-11 are met. Draft mentions following conditions: - ESI and gateway IP cannot be both nonzero at the same time. - ESI, gateway IP, RMAC and VNI label all cannot be 0 at the same time. If the received EVPN RT-5 route does not meet these conditions, the route is treated as withdraw. Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2021-01-18bgpd: Use uint32_t for size value instead of int in ecommunity structDonald Sharp
The `struct ecommunity` structure is using an int for a size value. Let's switch it over to a uint32_t for size values since a size value for data can never be negative. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-26bgpd: support for DF election in EVPN-MHAnuradha Karuppiah
DF (Designated forwarder) election is used for picking a single BUM-traffic forwarded per-ES. RFC7432 specifies a mechanism called service carving for DF election. However that mechanism has many disadvantages - 1. LBs poorly. 2. Doesn't allow for a controlled failover needed in upgrade scenarios. 3. Not easy to hw accelerate. To fix the poor performance of service carving alternate DF mechanisms have been proposed via the following drafts - draft-ietf-bess-evpn-df-election-framework draft-ietf-bess-evpn-pref-df This commit adds support for the pref-df election mechanism which is used as the default. Other mechanisms including service-carving may be added later. In this mechanism one switch on an ES is elected as DF based on the preference value; higher preference wins with IP address acting as the tie-breaker (lower-IP wins if pref value is the same). Sample output ============= >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> torm-11# sh bgp l2vpn evpn es 03:00:00:00:00:01:11:00:00:01 ESI: 03:00:00:00:00:01:11:00:00:01 Type: LR RD: 27.0.0.15:6 Originator-IP: 27.0.0.15 Local ES DF preference: 100 VNI Count: 10 Remote VNI Count: 10 Inconsistent VNI VTEP Count: 0 Inconsistencies: - VTEPs: 27.0.0.16 flags: EA df_alg: preference df_pref: 32767 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> torm-11# sh bgp l2vpn evpn route esi 03:00:00:00:00:01:11:00:00:01 *> [4]:[03:00:00:00:00:01:11:00:00:01]:[32]:[27.0.0.15] 27.0.0.15 32768 i ET:8 ES-Import-Rt:00:00:00:00:01:11 DF: (alg: 2, pref: 100) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05bgpd: extended-community and attrs for MAC-IP SYNC route handlingAnuradha Karuppiah
A new proxy flag has been added to the already existing NA extended community to allow proxy advertisment of a local host by a VTEP that is yet to indpendently establish local reachability. Reference: draft-rbickhart-evpn-ip-mac-proxy-adv The extendend mac-mobility sequence number needs to be synced across the ES peers. However we cannot let a ES-peer path win over a local path on the same ES. To accomplish that some parameters such as the MM seq number are bubbled up from the non-best path to the local path. This mechanism is explained further in the path-selection patch. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05bgpd: attr changes for EAD routesAnuradha Karuppiah
Add ESI as an inline attribute field along with the other EVPN attributes. This may be re-worked when the rest of the EVPN attributes find a new home. Some cleanup has been done to get rid of stale/unused references to ESI. And also to consolidate duplicate definitions of ES ID types. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-30bgpd: Ability to add/update unique extended communitiesvivek
Certain extended communities cannot be repeated. An example is the BGP link bandwidth extended community. Enhance the extended community add function to ensure uniqueness, if requested. Note: This commit does not change the lack of uniqueness for any of the already-supported extended communities. Many of them such as the BGP route target can obviously be present multiple times. Others like the Router's MAC should most probably be present only once. The portions of the code which add these may already be structured such that duplicates do not arise. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2020-03-23bgpd, lib: More `const`ification of various codeDonald Sharp
More second order effects of cleaning up rn usage in bgp. Sprinkle the fairy const's all over the place. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-21bgpd: Convert lots of int type functions to bool/voidDonatas Abraitis
Some were converted to bool, where true/false status is needed. Converted to void only those, where the return status was only false or true. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-11bgpd: RFC compliance wrt invalid RMAC, GWIP, ESI and VNIKishore Aramalla
A route where ESI, GW IP, MAC and Label are all zero at the same time SHOULD be treat-as-withdraw. Invalid MAC addresses are broadcast or multicast MAC addresses. The route MUST be treat-as-withdraw in case of an invalid MAC address. As FRR support Ethernet NVO Tunnels only. Route will be withdrawn when ESI, GW IP and MAC are zero or Invalid MAC Test cases: 1) ET-5 route with valid RMAC extended community 2) ET-5 route no RMAC extended community 3) ET-5 route with Multicast MAC in RMAC extended community 4) ET-5 route with Broadcast MAC in RMAC extended community Signed-off-by: Kishore Aramalla <karamalla@vmware.com>
2019-03-06Merge pull request #3869 from qlyoung/cocci-fixesDavid Lamparter
Assorted Coccinelle fixes
2019-03-04bgpd: parse and comapre rmac attr against self macChirag Shah
Any evpn bgp update message comes with router mac extended community, which can potentially contain the madd adddress same as any of the local SVIs (L3VNI) MAC address. Set route mac exist and during route processing in bgp_update() filter the route. Ticket:CM-23674 Reviewed By:CCR-8336 Testing Done: Configure L3vni mac on TORS1 which is similar to TORC11 L3vni MAC. When TORC11 received the EVPN update with Router mac extended community, this check rejected the BGP update message. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-02-25*: remove casts of XMALLOC / XCALLOCQuentin Young
No cast necessary for void * Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-10-25bgpd, lib: few more prefixlen updatedQuentin Young
* Cast when assigning should be to uint16_t * Restored comment documenting strange behavior * Further increased PREFIX_STRLEN to 80 chars Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-07-17bgpd: support evpn nd ext communityChirag Shah
EVPN ND ext community support NA flag R-bit, to have proxy ND. Set R-bit in EVPN NA if a given router is default gateway or there is a local router attached, which can be determine based on local neighbor entry. Implement BGP ext community attribute to generate and parse R-bit and pass along zebra to program neigh entry in kernel. Upon receiving MAC/IP update with community type 0x06 and sub_type 0x08, pass the R-bit to zebra to program neigh entry. Set NTF_ROUTER in neigh entry and inform kernel to do proxy NA for EVPN. Ref: https://tools.ietf.org/html/draft-ietf-bess-evpn-na-flags-01 Ticket:CM-21712, CM-21711 Reviewed By: Testing Done: Configure Local vni enabled L3 Gateway, which would act as router, checked show evpn arp-cache vni x ip <ip of svi> on originated and remote VTEPs. "Router" flag is set. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-05-02*: change struct evpn_addr to include a union of all evpn route typesmitesh
EVPN prefix depends on the EVPN route type. Currently, in FRR we have a prefix_evpn/evpn_addr which relates to a evpn prefix. We need to convert this to encompass an union of various EVPN route-types. This diff handles the necessary code changes to adopt the new struct evpn_addr. Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
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-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-01-23bgpd/zebra/lib: Add Default Gateway extended communityMitesh Kanjariya
1. Added default gw extended community 2. code modification to handle sticky-mac/default-gw-mac as they go together 3. show command support for newly added extended community 4. State in zebra to reflect if a mac/neigh is default gateway 5. show command enhancement to refelect the same in zebra commands Ticket: CM-17428 Review: CCR-6580 Testing: Manual Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14bgpd: rmac ext commMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-09-09*: fix be32 reading / 24-bit left shiftDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-08lib, bgpd: Distinguish between AF_EVPN and AF_ETHERNETDonald Sharp
Create AF_EVPN for internal use and start using it. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-08-04bgpd: Convert to using ETH_ALENDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
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-07-12bgpd, zebra: Support for sticky MACsvivek
Implement support for sticky (static) MACs. This includes the following: - Recognize MAC is static (using NUD_NOARP flag) and inform BGP - Construct MAC mobility extended community for sticky MACs as per RFC 7432 section 15.2 - Inform to zebra that remote MAC is sticky, where appropriate - Install sticky MACs into the kernel with the right flag - Appropriate handling in route selection Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12bgpd: EVPN route handlingvivek
Core EVPN route handling functionality. This includes support for the following: - interface with zebra to learn about local VNIs and MACIPs as well as to install remote VTEPs (per VNI) and remote MACIPs - create/update/delete EVPN type-2 and type-3 routes - attribute creation, route selection and install - route handling per VNI and for the global routing table - parsing of received EVPN routes and handling by route type - encoding attributes for EVPN routes and EVPN prefix creation (for Updates) Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-05-25lib: Refine EVPN prefix definitionvivek
Modify EVPN prefix to use the generic IP address structure. Add support for EVPN type-2 and type-3 prefix dump. Fix references to modified fields as needed. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
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-04*: Clean up some wrong referencesDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-16bgpd: initialise ecom sub field str when setting routermacPhilippe Guibert
In order to avoid valgrind issue, the str field is initialised. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14bgpd: simplify str2esi functionPhilippe Guibert
The commit replaces the char-by-char handling function by sscanf routine usage. This implementation is simplified and does the same. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14bgpd: change str2mac call apiPhilippe Guibert
With the changed API, some adaptations are done in rfapi code, and in bgpd evpn code. For evpn code, the internal storage of routermac addr is kept as struct ethaddr structure. Also the evpn add_routermac api has as incoming parameter a struct ethaddr param. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14bgpd: reflect mac handling change of apis to bgpdPhilippe Guibert
As the prefix call function for mac handling has prefix_ prepended before, the change must be propagated to all locations where those functions are called. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14bgpd: use XMALLOC for ESI handlingPhilippe Guibert
The memory allocation mecanism from frr is used. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14bgpd: evpn use string handling functions from mac manipulationPhilippe Guibert
EVPN code adaptation to replace old mac string internal utility with the new one available in lib folder. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14bgpd: indent new evpn code to the frr standardsPhilippe Guibert
Using intent tool, and apply to all bgp_evpn files. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14bgpd: remove HAVE_EVPN referencesPhilippe Guibert
This commit removes HAVE_EVPN references from bgpd folder Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14bgpd: enhance network command for evpn route type 5Philippe Guibert
A new vty command available under evpn address family. This command takes following format: (af-evpn)# [no] network <A.B.C.D/M|X:X::X:X/M> rd ASN:nn_or_IP-address:nn ethtag WORD label WORD esi WORD gwip A.B.C.D routermac WORD [route-map WORD] Among new parameters, ethtag stands for the ethernet tag indentifier. ESI stands for the ethernet segment identifier, and must be entered in following format: 00:11:22:33:44:55:66:77:88:99. gwip stands for the gateway IP address contained in RT5 message. A check is done on that value since if gwip is ipv4, then ip prefix must be ipv4. The same for ipv6. RouterMAc is the gateway mac address sent as extended community attribute. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14bgpd: handling router mac extended communityPhilippe Guibert
For each received routermac extended community, the mac address is copied into routermac extended community context. For each emission, a check is done against routermac extended community, if L2VPN is enabled. If enabled, the extended community is appended. Signed-off-by: Philippe Gubiert <philippe.guibert@6wind.com>
2017-02-14bgpd: handling EVPN Route Type 5 NLRI messagePhilippe Guibert
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>
2017-02-14bgpd: enhance structures and esi and mac functions to handle EVPNPhilippe Guibert
EVPN introduces new objects to be handled: Ethernet Segment Identifier, and MAC Address. For Route type 5 message, it also involves gateway IP field that can be either IPv4 or IPv6 address. This commit introduces those main structures. It also introduces some functions to convert esi and mac address to string, and vice-versa. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>