summaryrefslogtreecommitdiff
path: root/lib/nexthop_group.h
AgeCommit message (Collapse)Author
2023-02-17Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp
*: convert to SPDX License identifiers
2023-02-13lib: add has_label function for nexthop groupsStephen Worley
Add a function nexthop_group_has_label() for determining if even a single nexthop in the group has a label on it. Signed-off-by: Stephen Worley <sworley@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-11-04*: Add ability for daemons to notice resilience changesDonald Sharp
This patch just introduces the callback mechanism for the resilient nexthop changes so that upper level daemons can take advantage of the change. This does nothing at this point but just call some code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-04lib, zebra: Add ability to encode/decode resilient nhg'sDonald Sharp
Add ability to read the nexthop group resilient linux kernel data as well as write it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-03-17*: require semicolon after DEFINE_QOBJ & co.David Lamparter
Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-08-28lib: Allow nexthop simple display to take an alternate ifp nameDonald Sharp
The nexthop_group_write_nexthop_simple function outputs the interface name, because we've stored the ifindex. The problem is that there are ephermeal interfaces in linux that can be destroyed/recreated. Allow us to keep that data and do something a bit smarter to allow show run's and other show commands to continue to work when the interface is deleted. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-27lib: break up show nexthop API a bit for reuseStephen Worley
Not everything cares about the vrf and backup info. Break up the API to add a simple version to just write gateway/interface info. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-07-17lib: support multiple backup nexthops in nexthop group cliMark Stapp
Revise the nexthop-group cli to support multiple backups for a single primary nexthop. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-05-27pbrd, lib: opt. json for `show pbr nexthop-group`Wesley Coakley
Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
2020-03-27lib: support backup nexthops in nexthop-groups and zapiMark Stapp
Add vty support for backup nexthops in nexthop groups. Capture backup nexthop info in zapi route messages. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27zebra,lib: use const in more apisMark Stapp
Use const with some args to ipaddr, zebra vxlan, mpls lsp, and nexthop apis; add some extra checks to some nexthop-related apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-02-25lib: use const in nexthop_group copy apiMark Stapp
Add some const to the nhg copy api. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-09lib,zebra: add api to enforce nexthop sort order when copyingMark Stapp
Add an api that creates a copy of a list of nexthops and enforces the canonical sort ordering; consolidate some nhg code to avoid copy-and-paste. The zebra dplane uses that api when a plugin sets up a list of nexthops, ensuring that the plugin's list is ordered when it's processed in zebra. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-06Merge pull request #5439 from mjstapp/nhg_add_labelsRenato Westphal
lib: support labelled nexthops in nexthop_groups
2019-12-04lib,zebra: use nhg_hash_entry pointer in route_entryMark Stapp
Replace the existing list of nexthops (via a nexthop_group struct) in the route_entry with a direct pointer to zebra's new shared group (from zebra_nhg.h). This allows more direct access to that shared group and the info it carries. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-03lib: support labelled nexthops in nexthop_groupsMark Stapp
Add support for labelled nexthops in nexthop-group vtysh configuration. Also update the PBR doc where the cli is described. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-10-25lib,pbrd,zebra: Use one api to delete nexthops/groupStephen Worley
Reduce the api for deleting nexthops and the containing group to just one call rather than having a special case and handling it separately. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25lib: Separate nexthop_group_equal() into recursiveStephen Worley
Separate nexthop_group_equal() into two versions. One that compares verses recurisvely resolved nexthops and one that doesn't. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25lib,zebra: Move nexthop dup marking into creationStephen Worley
We were waiting until install time to mark nexthops as duplicate. Since they are immutable now and re-used, move this marking into when they are actually created to save a bunch of cycles. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25lib: Hash on resolved nexthops by defaultStephen Worley
Include resolved nexthops when hashing a nexthop group but provide an API that allows you to non-recursively hash as well. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Add recursive functionality to NHE'sStephen Worley
Add the ability to recursively resolve nexthop group hash entries and resolve them when sending to the kernel. When copying over nexthops into an NHE, copy resolved info as well. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25lib: Add equals function for nexthop groupsStephen Worley
Add a function to check whether nexthop groups are equivalent. It does not care about ordering. Also, set any functions that it relies on to take const vars as well. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra,lib: Refactor depends to RB treeStephen Worley
Refactor the depends to use an RB tree instead of a list. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-25lib: Private api for nexthop_group manipulationStephen Worley
Add a file that exposes functions which modify nexthop groups. Nexthop groups are techincally immutable but there are a few special cases where we need direct access to add/remove nexthops after the group has been made. This file provides a way to expose those functions in a way that makes it clear this is a private/hidden api. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-25lib: Add a couple functions to nexthop_group.cDonald Sharp
Add nexthop_group_copy and nexthop_group_add_sorted functions. nexthop_group_copy -> Copy src nexthop_group into dst nexthop_group nexthop_group_add_sorted -> Adds a new nexthop to the nexthop group in a sorted manner. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-18lib: Add a counter for number of nexthopsDonald Sharp
Add a ability to count the number of nexthops in a nexthop_group. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-05lib: Add hash function for nexthop groupsStephen Worley
Add a hash function to turn a nexthop group into a 32 bit unsigned hash key with jhash. We do not care to hash any recursively resolved nexthops, just the group. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-04-04libs: use const in copy_nexthops apiMark Stapp
Use const for the source arg to copy_nexthops(). Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-02-14lib: change how nexthop groups store nexthop addressesRenato Westphal
Use a pointer to a sockunion instead of a full sockunion in the nexthop_hold structure. This prepares the ground for the next commit, which will make nexthop addresses optional (in this commit we assume nh->addr will never be NULL, but this will change). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-11lib: add extern "C" {} blocks to all libfrr headersRenato Westphal
These are necessary to use functions defined in these headers from C++. Signed-off-by: David Lamparter <equinox@diac24.net> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-11libs, daemons: changes to permit c++ compilationMark Stapp
Some misc changes to resolve some c++ compilation errors. The goal is only to permit an external module - a plugin, for example - to see frr headers, not to support or encourage contributions in c++. The changes include: avoiding use of keywords like 'new', 'delete'; cleaning up implicit type-casting from 'void *' in several places. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-07-10libs: add ALL_NEXTHOPS_PTR iterator macroMark Stapp
Because sometimes we have a pointer to a nexthop_group. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-04-17lib: Handle if up/down and vrf enable/disable eventsDonald Sharp
Properly notice when we get if up/down and vrf enable/disable events and attempt to properly install nexthops as they come in. Ticket: CM20489 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-17lib: Store nexthop information independentlyDonald Sharp
Store Nexthop's as the incoming raw data. This will allow us to separate the act of inputting the cli from the act of instantiating the cli. Ticket: CM-20489 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-14lib: Add the ability for other people to call a nexthop write lineDonald Sharp
Add code to allow nexthops to be written by people who are interested in writing their own nexthop line. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-14lib: Expose nhgc_find commandDonald Sharp
Expose to the world the nhgc_find command so that interested parties can find a stored nexthop group. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-14lib: Add nexthop-group cliDonald Sharp
Add a nexthop-group cli: nexthop-group NAME nexthop A nexthop B nexthop C ! This will allow interested parties to hook into the cli for nexthops. Users can add callback functions for add/delete of a nexthop group as well as add/delete of each individual nexthop. Future work( PBR and static routes ) will take advantage of this. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09lib, vtysh: Start cli for nexthop-groupDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09lib: Isolate nexthop_group functions to nexthop_group.cDonald Sharp
Also modify `struct route_entry` to use nexthop_groups. Move ALL_NEXTHOPS loop to nexthop_group.h Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>