summaryrefslogtreecommitdiffstats
path: root/lib/nexthop.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-16/+1
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib, zebra: Notice when a nexthop is set linkdownDonald Sharp2022-06-231-0/+1
| | | | | | | | When a nexthop is set RTNH_F_LINKDOWN, start noticing that this flag is set. Allow FRR to know about this flag but at this point do not do anything with it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: Increase nexthop flags size to 16 bitsDonald Sharp2022-06-231-1/+1
| | | | | | | | | | commit: 5609e70fb87a3b23b55629a33e5afb298974c142 Added a new flag to the `struct nexthop` and this addition of a flag caused the flags size to be too small. Increase the size of flags to allow more flags to be had. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #10629 from leonshaw/fix/mp-evpn-nhRuss White2022-06-231-0/+1
|\ | | | | lib, zebra, bgpd: Move route EVPN flag to nexthop
| * lib, zebra, bgpd: Move route EVPN flag to nexthopXiao Liang2022-06-101-0/+1
| | | | | | | | | | | | | | Multipath route may have mixed nexthops of EVPN and IP unicast. Move EVPN flag to nexthop to support such cases. Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
* | lib: Abstract usage of '%pNHs' so that nexthop groups can use it tooDonald Sharp2022-06-141-0/+1
|/ | | | | | | | Abstract the usage of '%pNHs' so that when nexthop groups get a new special printfrr that it can take advantage of this functionality too. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: VRF-Lite fix nexthop typeKantesh Mundaragi2021-09-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | Description: Change is intended for fixing the following issues related to vrf route leaking: Routes with special nexthops i.e. blackhole/sink routes when imported, are not programmed into the FIB and corresponding nexthop is set as 'inactive', nexthop interface as 'unknown'. While importing/leaking routes between VRFs, in case of special nexthop(ipv4/ipv6) once bgp announces route(s) to zebra, nexthop type is incorrectly set as NEXTHOP_TYPE_IPV6_IFINDEX/NEXTHOP_TYPE_IFINDEX i.e. directly connected even though we are not able to resolve through an interface. This leads to nexthop_active_check marking nexthop !NEXTHOP_FLAG_ACTIVE. Unable to find the active nexthop(s), route is not programmed into the FIB. Whenever BGP leaks routes, set the correct nexthop type, so that route gets resolved and correctly programmed into the FIB, in the imported vrf. Co-authored-by: Kantesh Mundaragi <kmundaragi@vmware.com> Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
* lib,sharpd,zebra: update nexthop object with nh_srv6Hiroki Shirokura2021-06-021-11/+8
| | | | Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
* *: fix code format accourding to checkpatchHiroki Shirokura2021-06-021-1/+1
| | | | Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
* lib: add new nexthop's attributes seg6 (step3)Hiroki Shirokura2021-06-021-0/+5
| | | | | | | | | | | | | | | | | This commit add new nexthop's addional object for SRv6 routing about seg6 route. Before this commit, we can add MPLS info as additional object on nexthop. This commit make it add more support about seg6 routes. seg6 routes are ones of the LWT routing mechanism, so configuration of seg6local routes is performed by ZEBRA_ROUTE_SEND, it's same as MPLS configuration. Real configuration implementation isn't implemented at this commit. later commit add that. This commit add only nexthop additional object and some misc functions. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
* lib: add new nexthop's attributes seg6local (step1)Hiroki Shirokura2021-06-021-0/+8
| | | | | | | | | | | | | | | | | This commit is a part of #5853 works that add new nexthop's addional object for SRv6 routing about seg6local route. Before this commit, we can add MPLS info as additional object on nexthop. This commit make it add more support about seg6local routes. seg6local routes are ones of the LWT routing mechanism, so configuration of seg6local routes is performed by ZEBRA_ROUTE_SEND, it's same as MPLS configuration. Real configuration implementation isn't implemented at this commit. later commit add that. This commit add only nexthop additional object and some misc functions. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
* lib: add basic nexthop comparison apiMark Stapp2021-05-041-0/+5
| | | | | | | Add a simpler, more limited nexthop comparison function. This compares a few key attributes, such as vrf, gateway, labels. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib: remove nexthop_same_firsthop() apiStephen Worley2020-10-021-8/+0
| | | | | | | | | Remove the nexthop_same_firsthop() api and just call nexthop_same(). Not entirely sure why we were using this function in the first place, but now we are just marking dupes with it so lets just call a common function and avoid issues. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib, zebra: Add SR-TE policy infrastructure to zebraSebastien Merle2020-08-071-0/+4
| | | | | | | | | | | | | | | | | | | | For the sake of Segment Routing (SR) and Traffic Engineering (TE) Policies there's a need for additional infrastructure within zebra. The infrastructure in this PR is supposed to manage such policies in terms of installing binding SIDs and LSPs. Also it is capable of managing MPLS labels using the label manager, keeping track of nexthops (for resolving labels) and notifying interested parties about changes of a policy/LSP state. Further it enables a route map mechanism for BGP and SR-TE colors such that learned BGP routes can be mapped onto SR-TE Policies. This PR does not introduce any usable features by now, it is just infrastructure for other upcoming PRs which will introduce 'pathd', a new SR-TE daemon. Co-authored-by: Renato Westphal <renato@opensourcerouting.org> Co-authored-by: GalaxyGorilla <sascha@netdef.org> Signed-off-by: Sebastien Merle <sebastien@netdef.org>
* lib: use const in nexthop_level() apiMark Stapp2020-07-171-1/+1
| | | | | | Use const in nexthop_level() Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib: add nexthop_str2backupMark Stapp2020-07-171-0/+9
| | | | | | | Add an api to convert an input list into an array of backup nexthop indexes; useful for cli input. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib,sharpd,zebra: initial support for multiple backup nexthopsMark Stapp2020-07-171-5/+9
| | | | | | | | | | Initial changes to support a nexthop with multiple backups. Lib changes to hold a small array in each primary, zapi message changes to support sending multiple backups, and daemon changes to show commands to support multiple backups. The config input for multiple backup indices is not present here. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib: test vrfs in nexthop_same_firsthop()Mark Stapp2020-07-071-1/+2
| | | | | | Test the two nexthops' vrfs, and convert api to 'bool' return. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* zebra: data plane FPM add support RMAC VNIRafael Zalamena2020-04-141-0/+11
| | | | | | | Store VNI information in the data plane context so we can use it to build the FPM netlink update with that information later. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* Merge pull request #5901 from mjstapp/backup_nh_prepStephen Worley2020-03-301-2/+20
|\ | | | | zebra, lib: Backup nexthop (path) prep work
| * lib: add backup-nexthop value to nexthopMark Stapp2020-03-271-0/+9
| | | | | | | | | | | | Add a field supporting a backup nexthop. Signed-off-by: Mark Stapp <mjs@voltanet.io>
| * zebra,lib: use const in more apisMark Stapp2020-03-271-2/+11
| | | | | | | | | | | | | | | | 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>
* | lib: prepare for plugin-based frr_format checkDavid Lamparter2020-03-291-0/+4
|/ | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* lib,zebra: remove unused MATCHED nexthop flagMark Stapp2020-02-111-4/+7
| | | | | | Remove an unused flag value from the nexthop struct. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib,zebra: tighten up the nexthop_copy/nexthop_dup APIsStephen Worley2020-01-151-0/+7
| | | | | | | | | | | | Make the nexthop_copy/nexthop_dup APIs more consistent by adding a secondary, non-recursive, version of them. Before, it was inconsistent whether the APIs were expected to copy recursive info or not. Make it clear now that the default is recursive info is copied unless the _no_recurse() version is called. These APIs are not heavily used so it is fine to change them for now. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib, zebra: Allow for installation of a weighted nexthopDonald Sharp2019-12-091-0/+3
| | | | | | | | | | | | | | | | | | | Linux has the idea of allowing a weight to be sent down as part of a nexthop group to allow the kernel to weight particular nexthop paths a bit more or less than others. See: http://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.rpdb.multiple-links.html Allow for installation into the kernel using the weight attribute associated with the nexthop. This code is foundational in that it just sets up the ability to do this, we do not use it yet. Further commits will allow for the pass through of this data from upper level protocols. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: add some nexthop ctorsMark Stapp2019-11-221-0/+16
| | | | | | | | Add some apis that allocate and init nexthop objects from various kinds of arguments: ip addrs, interfaces, blackhole types. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib: Make nexthop_next* use const for nexthopStephen Worley2019-10-251-2/+3
| | | | | | | | Make nexthop_next() and nexthop_next_active_resolved() use const for the nexthop argument. They should not be modifying so it makes sense here. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib: Add nexthop quick hash apiStephen Worley2019-10-251-0/+8
| | | | | | | | | | Add a nexthop hashing api for only hashing on word-sized attributes. Calling the jhash/jhash2 function is quite slow in scaled envrionments but sometimes you do need a more granular hash. The tradeoff here is that hashtable buckets using this hash might be more full. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: Optimize the fib/notified nexthop matchingStephen Worley2019-10-251-1/+1
| | | | | | | | Optimize the fib and notified nexthop group comparison algorithm to assume ordering. There were some pretty serious performance hits with this on high ecmp routes. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: Add recursive functionality to NHE'sStephen Worley2019-10-251-0/+1
| | | | | | | | | 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>
* lib: Sort zapi_nexthops on the encodeStephen Worley2019-08-191-0/+3
| | | | | | | | | Sort nexthops before we push them to zebra. This offloads the nexthop sorting zebra is doing onto the upper level protocols so that when it gets to zebra and we construct a group, it just has to append them to the tail for every nexthop. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib: Add a nexthop_dup() that allocates and copiesStephen Worley2019-06-261-0/+4
| | | | | | | | Add a nexthop_dup() api that both allocates and copies a new nexthop from an old one. Still retain the old exposed function nexthop_copy() so we can copy without allocation. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib: Put single nexthop copy into its own functionStephen Worley2019-06-261-0/+2
| | | | | | | Put the code to copy a single nexthop into a function of its own. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib,zebra,bgpd,pbrd: Compare nexthops without labelsStephen Worley2019-05-231-0/+2
| | | | | | | | | | Allow label ignoring when comparing nexthops. Specifically, add another functon nexthop_same_no_labels() that shares a path with nexthop_same() but doesn't check labels. rib_delete() needs to ignore labels in this case. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib,zebra,bgpd: Remove nexthop_same_no_recurse()Stephen Worley2019-05-231-2/+0
| | | | | | | | The functions nexthop_same() does not check the resolved nexthops so I don't think this function is even needed anymore. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib: Make labels_match function use labels_cmpStephen Worley2019-05-231-2/+2
| | | | | | | Update the nexthop_labels_match() function to use nexthop_labels_cmp(). Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib: Add nexthop_cmpDonald Sharp2019-05-231-0/+1
| | | | | | | Add function to allow us to have a sorted order of nexthops. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: stop sending invalid nexthops to clientsDon Slice2019-04-191-0/+1
| | | | | | | | | | | | | Found that zebra_rnh_apply_nht_rmap would set the NEXTHOP_FLAG_ACTIVE if not blocked by the route-map, even if the flag was not active prior to the check. This fix changes the flag used to denote the nexthop is filtered so that proper active state can be retained. Additionally, found two cases where we would send invalid nexthops via send_client, which would also cause this crash. All three fixed in this commit. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
* lib, zebra: Remove unused flagDonald Sharp2019-04-181-2/+1
| | | | | | | | | The NEXTHOP_FLAG_FILTERED went away when we started treating static routes like every other route in the system. This was a special case for handling static route code that just didn't get finished cleaning up. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Add hash function for nexthop groupsStephen Worley2019-04-051-1/+1
| | | | | | | | 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>
* libs: nexthop comparison includes labels if presentMark Stapp2019-04-031-2/+4
| | | | | | | | Adjust the nexthop comparison api so that it calls the label- comparison api. Adjust the label-comp api so that "no labels" is "equal". Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: Explicitly mark nexthop of EVPN-sourced routes as onlinkvivek2019-02-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | In the case of EVPN symmetric routing, the tenant VRF is associated with a VNI that is used for routing and commonly referred to as the L3 VNI or VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP) interface (SVI). Overlay next hops (i.e., next hops for routes in the tenant VRF) are reachable over this interface. Howver, in the model that is supported in the implementation and commonly deployed, there is no explicit Overlay IP address associated with the next hop in the tenant VRF; the underlay IP is used if (since) the forwarding plane requires a next hop IP. Therefore, the next hop has to be explicit flagged as onlink to cause any next hop reachability checks in the forwarding plane to be skipped. https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement section 4.4 provides additional description of the above constructs. Use existing mechanism to specify the nexthops as onlink when installing these routes from bgpd to zebra and get rid of a special flag that was introduced for EVPN-sourced routes. Also, use the onlink flag during next hop validation in zebra and eliminate other special checks. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: add extern "C" {} blocks to all libfrr headersRenato Westphal2019-02-121-0/+9
| | | | | | | 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>
* lib: Add hash and use const a bit more intelligentlyQuentin Young2018-04-061-1/+18
| | | | | | | | | | | This commit adds code to notify the compiler that we will not be changing the arguments to nexthop2str and we expect thre return to be treated the same. Additionally we add some code to allow nexthops to be hashed to be used in a hash. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* lib: Add nexthop-group cliDonald Sharp2018-03-141-0/+2
| | | | | | | | | | | | | | | | | | | | 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>
* lib: Isolate nexthop_group functions to nexthop_group.cDonald Sharp2018-03-091-16/+0
| | | | | | | 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>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-7/+8
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* lib, zebra: Move nh_resolve_via_default to appropriate headerDonald Sharp2018-02-091-12/+0
| | | | | | | | The nh_resolve_via_default function is an accessor function for NHT in zebra. Let's move this function to it's proper place. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>