summaryrefslogtreecommitdiff
path: root/bgpd/bgp_main.c
AgeCommit message (Collapse)Author
2025-01-28bgpd: Do not ignore auto generated VRF instances when deletingDonatas Abraitis
When VRF instance is going to be deleted inside bgp_vrf_disable(), it uses a helper method that skips auto created VRF instances and that leads to STALE issue. When creating a VNI for a particular VRF vrfX with e.g. `advertise-all-vni`, auto VRF instance is created, and then we do `router bgp ASN vrf vrfX`. But when we do a reload bgp_vrf_disable() is called, and we miss previously created auto instance. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-09bgpd: backpressure - Optimize EVPN L3VNI remote routes processingRajasekar Raja
Anytime BGP gets a L3 VNI ADD/DEL from zebra, - Walking the entire global routing table per L3VNI is very expensive. - The next read (say of another VNI ADD/DEL) from the socket does not proceed unless this walk is complete. So for triggers where a bulk of L3VNI's are flapped, this results in huge output buffer FIFO growth spiking up the memory in zebra since bgp is slow/busy processing the first message. To avoid this, idea is to hookup the BGP-VRF off the struct bgp_master and maintain a struct bgp FIFO list which is processed later on, where we walk a chunk of BGP-VRFs and do the remote route install/uninstall. Ticket :#3864372 Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-12-09bgpd: backpressure - Optimize EVPN L2VNI remote routes processingRajasekar Raja
Anytime BGP gets a L2 VNI ADD from zebra, - Walking the entire global routing table per L2VNI is very expensive. - The next read (say of another VNI ADD) from the socket does not proceed unless this walk is complete. So for triggers where a bulk of L2VNI's are flapped, this results in huge output buffer FIFO growth spiking up the memory in zebra since bgp is slow/busy processing the first message. To avoid this, idea is to hookup the VPN off the bgp_master struct and maintain a VPN FIFO list which is processed later on, where we walk a chunk of VPNs and do the remote route install. Note: So far in the L3 backpressure cases(#15524), we have considered the fact that zebra is slow, and the buffer grows in the BGP. However this is the reverse i.e. BGP is very busy processing the first ZAPI message from zebra due to which the buffer grows huge in zebra and memory spikes up. Ticket :#3864372 Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-10-02bgpd: Actually make ` --v6-with-v4-nexthops` it workDonatas Abraitis
It was using `-v` which is actually a _version_. Fixes: 0435b31bb8ed55377f83d0e19bc085abc3c71b44 ("bgpd: Allow bgp to specify if it will allow v6 routing with v4 nexthops") Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-07-01*: Add and use option for graceful (re)startvivek
Add a new start option "-K" to libfrr to denote a graceful start, and use it in zebra and bgpd. zebra will use this option to denote a planned FRR graceful restart (supporting only bgpd currently) to wait for a route sync completion from bgpd before cleaning up old stale routes from the FIB. An optional timer provides an upper-bounds for this cleanup. bgpd will use this option to denote either a planned FRR graceful restart or a bgpd-only graceful restart, and this will drive the BGP GR restarting router procedures. Signed-off-by: Vivek Venkatraman <vivek@nvidia.com>
2024-07-01bgpd: Refine restarter operation - R-bit & F-bitvivek
Introduce BGP-wide flags to denote if BGP has started gracefully and GR is in progress or not. Use this for setting of the R-bit in the GR capability, and not a timer which is set for any new instance creation. Mark graceful restart is complete when the deferred path selection has been done and route sync with zebra as well as deferred EOR advertisement has been initiated. Introduce a function to check on F-bit setting rather than just base it on configuration. Subsequent commits will extend these functionalities. Signed-off-by: Vivek Venkatraman <vivek@nvidia.com>
2024-06-05bgpd: add bgp_labels hashLouis Scalbert
Add bgp_labels type and hash list. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-05-10*: Modify agentx to be allowed to be calledDonald Sharp
If you had a situation where an operator turned on ospfd with snmp but not ospf6d and agentx was configured then you get into a situation where ospf6d would complain that the config for agentx did not exist. Let's modify the code to allow this situation to happen. Fixes: #15896 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-25bgpd: backpressure - Add a typesafe list for Zebra AnnouncementDonald Sharp
Modify the bgp master to hold a type safe list for bgp_dests that need to be passed to zebra. Future commits will use this. Ticket: #3390099 Signed-off-by: Donald Sharp <sharpd@nvidia.com> Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-01-27*: fix `frr_daemon_info` indentationDavid Lamparter
clang-format doesn't understand FRR_DAEMON_INFO is a long macro where laying out items semantically makes sense. (Also use only one `FRR_DAEMON_INFO(` in isisd so editors don't get confused with the mismatching `( ( )`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-18bgpd: show per vrf rpki configuration in show runPhilippe Guibert
Show per VRF RPKI configuration in "show run". Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-18bgpd: add a hook to inform a vrf is enabled/disabledPhilippe Guibert
Add a hook to call a future callback function when bgpd knows from zebra about the activation of de-activation of a VRF. It will be used by the RPKI module in next commits. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-12-11bgpd: move l3nhg functions in separate bgp_nhg.[ch] filePhilippe Guibert
This rework separates l3nhg functionality from the nexthop tracking code, by introducing two bgp_nhg.[ch] files. The calling functions are renamed from bgp_l3nhg* to bgp_nhg*. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-08-03bgpd: Allow bgp to specify if it will allow v6 routing with v4 nexthopsDonald Sharp
Add a `--v6-with-v4-nexthop` cli to bgp to allow it to peer with neighbors in the configuration where the interface has no v6 addresses at all and there is a v4 address that is usable as a v4 address embedded in a v6 address. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert event.h to frrevent.hDonald Sharp
We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename thread.[ch] to event.[ch]Donald Sharp
This is a first in a series of commits, whose goal is to rename the thread system in FRR to an event system. There is a continual problem where people are confusing `struct thread` with a true pthread. In reality, our entire thread.c is an event system. In this commit rename the thread.[ch] files to event.[ch]. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
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-09-05bgpd: add 'mpls bgp forwarding' to ease mpls vpn ebgp peeringPhilippe Guibert
RFC4364 describes peerings between multiple AS domains, to ease the continuity of VPN services across multiple SPs. This commit implements a sub-set of IETF option b) described in chapter 10 b. The ASBR to ASBR approach is taken, with an EBGP peering between the two routers. The EBGP peering must be directly connected to the outgoing interface used. In those conditions, the next hop is directly connected, and there is no need to have a transport label to convey the VPN label. A new vty command is added on a per interface basis: This command if enabled, will permit to convey BGP VPN labels without any transport labels (i.e. with implicit-null label). restriction: this command is used only for EBGP directly connected peerings. Other use cases are not covered. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-08-08bgpd: When specifying listen address for bgpd we shouldn't imply no fib flagDonatas Abraitis
When `-l` is used, then no routes are exported to the kernel. ``` $ grep bgpd_options /etc/frr/daemons bgpd_options=" -A 127.0.0.1 -l 127.0.0.2" ``` Before: ``` donatas-pc# sh run | include no-rib bgp no-rib donatas-pc# ``` After: ``` donatas-pc# sh run | include no-rib donatas-pc# ``` Signed-off-by: Kris Shannon <k.shannon@amaze.com.au> Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2021-12-21*: rework renaming the default VRFIgor Ryzhov
Currently, it is possible to rename the default VRF either by passing `-o` option to zebra or by creating a file in `/var/run/netns` and binding it to `/proc/self/ns/net`. In both cases, only zebra knows about the rename and other daemons learn about it only after they connect to zebra. This is a problem, because daemons may read their config before they connect to zebra. To handle this rename after the config is read, we have some special code in every single daemon, which is not very bad but not desirable in my opinion. But things are getting worse when we need to handle this in northbound layer as we have to manually rewrite the config nodes. This approach is already hacky, but still works as every daemon handles its own NB structures. But it is completely incompatible with the central management daemon architecture we are aiming for, as mgmtd doesn't even have a connection with zebra to learn from it. And it shouldn't have it, because operational state changes should never affect configuration. To solve the problem and simplify the code, I propose to expand the `-o` option to all daemons. By using the startup option, we let daemons know about the rename before they read their configs so we don't need any special code to deal with it. There's an easy way to pass the option to all daemons by using `frr_global_options` variable. Unfortunately, the second way of renaming by creating a file in `/var/run/netns` is incompatible with the new mgmtd architecture. Theoretically, we could force daemons to read their configs only after they connect to zebra, but it means adding even more code to handle a very specific use-case. And anyway this won't work for mgmtd as it doesn't have a connection with zebra. So I had to remove this option. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-11*: Convert quagga_signal_X to frr_signal_XDonald Sharp
Naming functions/data structures more appropriately for the project we are actually in. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-08-25*: Drop `break` after using frr_help_exit() in switch/caseDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-08-03Revert "bgpd: register northbound callbacks to bootstrap"Igor Ryzhov
This reverts commit e4a464160dee2b53f2851879b2c736139061e74c. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-03Revert "bgpd: register nb routing hook"Igor Ryzhov
This reverts commit 374069da83f5f00f53156e1886372391c3f00b3f. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-02bgpd: cli for SRv6 SID alloc to redirect to vrf (step4)Hiroki Shirokura
This commit add cil to configure BGP SRv6-VPN sid allocation. Almost mechanism are based on BGP MPLS-VPN. User can allocate and export sid with using following config. Then bgpd try to allocate new SID to redirect vpn to vrf using SRv6 localsid End.DT4/DT6. Currently linux kernel will regect End.DT4 route install due to no-implementation. (at-least today's FRR's ci kernel.) So now we only supports BGP SRv6-VPNv6. router bgp 1 segment-routing srv6 locator loc1 ! address-family ipv6 vpn exit-address-family ! router bgp 1 vrf vrf10 address-family ipv6 unicast sid vpn export 1 !!(option1)!! sid vpn export auto !!(option2)!! exit-address-family ! Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-05-11Merge pull request #8650 from idryzhov/bgp-fix-redistRuss White
bgpd: fix redistribution in vrf
2021-05-10bgpd: deregister bgp instance from zebra when vrf is deletedIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-07lib: remove old bfd libraryIgor Ryzhov
This commit also adds missing `bfd_protocol_integration_set_shutdown` to ospf6d and pimd. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-05bgpd: Create BGP alias names for community/large-communityDonatas Abraitis
Show alias name instead of numerical value in `show bgp <prefix>. E.g.: ``` root@exit1-debian-9:~/frr# vtysh -c 'sh run' | grep 'bgp community alias' bgp community alias 65001:123 community-1 bgp community alias 65001:123:1 lcommunity-1 root@exit1-debian-9:~/frr# ``` ``` exit1-debian-9# sh ip bgp 172.16.16.1/32 BGP routing table entry for 172.16.16.1/32, version 21 Paths: (2 available, best #2, table default) Advertised to non peer-group peers: 65030 192.168.0.2 from home-spine1.donatas.net(192.168.0.2) (172.16.16.1) Origin incomplete, metric 0, valid, external, best (Neighbor IP) Community: 65001:12 65001:13 community-1 65001:65534 Large Community: lcommunity-1 65001:123:2 Last update: Fri Apr 16 12:51:27 2021 exit1-debian-9# ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-03-30bgpd: North-bound implementation for bgp rmapsSarita Patra
This commit introduces the implementation for the north-bound callbacks for the bgp-specific route-map match and set clauses. Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com> Signed-off-by: Sarita Patra <saritap@vmware.com>
2021-03-23bgpd: rework BFD integrationRafael Zalamena
Remove old BFD API usage and replace it with the new one. Highlights: - More shared code: the daemon gets notified with callbacks instead of having to roll its own code to find the notified sessions. - Less code to integrate with BFD. - Remove hidden commands to configure single / multi hop. Use protocol data instead. BGP can determine if a peer is single/multi hop according to the following criteria: a. If the IP address is a link-local address (single hop) b. The network is shared with peer (single hop) c. BGP is configured for eBGP multi hop / TTL security (multi hop) - Respect the configuration hierarchy: a. Peer configuration take precendence over peer-group configuration. b. When peer group configuration is removed, reset peer BFD configurations to defaults (unless peer had specific configs). Example: neighbor foo peer-group neighbor foo bfd profile X neighbor 192.168.0.2 peer-group foo neighbor 192.168.0.2 bfd ! If peer-group is removed the profile configuration gets ! removed from peer 192.168.0.2, but BFD will still enabled ! because of the neighbor specific bfd configuration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-03-17*: require semicolon after FRR_DAEMON_INFO & co.David Lamparter
... again ... Signed-off-by: David Lamparter <equinox@diac24.net>
2021-01-19Merge pull request #7639 from qlyoung/frr-luaRuss White
Scripting
2021-01-11bgpd: bgpd listening on multiple addressesAdriano Marto Reis
Changed bgpd so multiple IP addresses can be specified via -l option. Signed-off-by: "Adriano Marto Reis" <adrianomarto@gmail.com>
2020-12-01build: HAVE_LUA -> HAVE_SCRIPTINGQuentin Young
And also guard all scripting-related stuff with HAVE_SCRIPTING. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-12-01bgpd: update routemap scripting exampleQuentin Young
- Change from "match command <foo>" to "match script <script>" - Use new scripting API Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-11-24bgpd: L3NHG infrastructure for host routes in EVPNAnuradha Karuppiah
ES-VRF entries are maintained for the purpose of L3-NHG creation - 1. Each ES-EVI entry is associated with a tenant VRF. This associaton triggers the creation of an ES-VRF entry. 2. Type-2/MAC-IP routes are imported into a tenant VRF and programmed as a /32 or host route entry in the dataplane. If the destination of the host route is a remote-ES the route is programmed with the corresponding (keyed in by {vrf,ES-id}) L3-NHG. 3. The reason for this indirection (route->L3-NHG, L3-NHG->list-of-VTEPs) is to avoid route updates to the dplane when a remote-ES link flaps i.e. instead of updating all the dependent routes the NHG's contents are updated. This reduces the amount of dataplane updates (fewer nhg updates vs. route updates) allowing for a faster failover. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-10-21bgpd: fix crash in the MH cleanup handlingAnuradha Karuppiah
The MH datastructures were being released before the paths that were referencing them. Fix is to do the MH cleanup last. The MH finish function has also been stripped down to only do a datastructure cleanup i.e. avoid sending route updates etc. Ticket: 31376 Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-10-03bgpd: register nb routing hookChirag Shah
On bgpd bootstrap register routing hook which ensures only single bgp named instance created per vrf routing hierarchy. Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-10-03bgpd: register northbound callbacks to bootstrapChirag Shah
Register bgpd northbound callbacks to bgp daemon bootstrap. Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-07-27bgpd: Comment out dead code for futureDonald Sharp
I wanted to preserve the old code flow to see what might be needed in the future in commit: 23ca3269da5f9d898cb54d42c560d519b9cb9915 Coverity doesn't like dead code. So let's comment it out. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-07-14Revert "Rpki Encapsulation"revert-5015-rpki_vrf_encapsulationQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-07-02bgpd: add hook for running-config per vrf rpki configPhilippe Guibert
rpki config can be displayed in the 'show running-config'. there is a fix to be done yet, this is related to the order of rpki per vrf configuration. actually, the output is not saveable in the running-config since the rpki commands are swapped. this prevents from running rpki config at startup. That commit also changes the identation, since rpki configure node was with one extra space. reducing this, and add the changes for vrf configuration too. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-07-02bgpd: add a hook to inform a vrf is enabled/disabledPhilippe Guibert
this hook can be used by plugins like rpki. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-06-24bgpd: Have bgp ignore SIGHUP at the momentDonald Sharp
SIGHUP is ostensibly supposed to reload configuration from a fresh slate. This is currently horribly broken so much so that bgp just crashes. I see no point in trying to make this work considering the yang work coming down the pike. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-06-05*: add filter northbound supportRafael Zalamena
Allow all daemons to work with filter northbound. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-16*: include vrf northbound module in initChirag Shah
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-04bgpd, zebra: don't compare unsigned < 0Quentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-01bgpd: #if ENABLE_BGP_VNC -> #ifdef ENABLE_BGP_VNCQuentin Young
This macro is undefined if vnc is disabled, and while it defaults to 0, this is still wrong and causes issues with -Werror Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-10Merge pull request #5763 from ton31337/fix/return_without_parentRenato Westphal
*: Remove parenthesis on return for constants