summaryrefslogtreecommitdiff
path: root/zebra/zebra_rnh.c
AgeCommit message (Collapse)Author
2022-03-27zebra: add a few `const` in RNH codeDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27zebra: `show ip nht mrib`David Lamparter
Prints the SAFI_MULTICAST NHT state in zebra. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27zebra: register NHT nexthops with proper SAFIDavid Lamparter
Just a small puzzle piece missing in zebra SAFI NHT support. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27zebra: check other SAFIs when removing gone clientDavid Lamparter
When a client disconnects, we need to check & remove NHT entries for other SAFIs too. Otherwise we crash later trying to access stale data. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-12zebra: prefixlen is not afi/safi dependant in encoding nexthopsDonald Sharp
When encoding a response to the upper level protocol the prefixlen is not something that needs to be part of the switch statement for handling of a prefix. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-12*: When matching against a nexthop send and process what it matched againstDonald Sharp
Currently the nexthop tracking code is only sending to the requestor what it was requested to match against. When the nexthop tracking code was simplified to not need an import check and a nexthop check in b8210849b8ac1abe2d5d9a5ab2459abfde65efa5 for bgpd. It was not noticed that a longer prefix could match but it would be seen as a match because FRR was not sending up both the resolved route prefix and the route FRR was asked to match against. This code change causes the nexthop tracking code to pass back up the matched requested route (so that the calling protocol can figure out which one it is being told about ) as well as the actual prefix that was matched to. Fixes: #10766 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-22zebra: Nexthop tracking, route resolution recursive lookupvdhingra
Description: =========== Change is intended for fixing the NHT resolution logic. While recursively resolving nexthop, keep looking for a valid/useable route in the rib, by not stopping at the first/most-specific route in the rib. Consider the following set of events taking place on R1: R1(config)# ip route 2.2.2.0/24 ens192 R1# sharp watch nexthop 2.2.2.32 connected R1# show ip nht 2.2.2.32(Connected) resolved via static is directly connected, ens192 Client list: sharp(fd 33) -2.2.2.32 NHT is resolved over the above valid static route. R1# sharp install routes 2.2.2.32 nexthop 2.2.2.32 1 R1# 2.2.2.32(Connected) resolved via static is directly connected, ens192 Client list: sharp(fd 33) -.32/32 comes which is going to resolve through itself, but since this is an invalid route, it will be marked as inactive and will not affect the NHT. R1# sharp install routes 2.2.2.31 nexthop 2.2.2.32 1 R1# 2.2.2.32(Connected) unresolved(Connected) Client list: sharp(fd 50) -Now a .31/32 comes which will resolve over .32 route, but as per the current logic, this will trigger the NHT check, in turn making the NHT unresolved. -With fix, NHT should stay in resolved state as long as the valid static or connected route stays installed Fix: ==== -While resolving nexthops, walk up the tree from the most-specific match, walk up the tree without any ZEBRA_NHT_CONNECTED check. Co-authored-by: Vishal Dhingra <vdhingra@vmware.com> Co-authored-by: Kantesh Mundaragi <kmundaragi@vmware.com> Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
2021-09-27lib, zebra: Send safi for rnh resolutionDonald Sharp
Pass down the safi for when we need address resolution. At this point in time we are hard coding the safi to SAFI_UNICAST. Future commits will take advantage of this. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27zebra: Create the SAFI_MULTICAST rnh tablesDonald Sharp
Actually create the SAFI_MULTICAST rnh tables. No code uses these yet. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27zebra: Start carrying safi for rnh processingDonald Sharp
PIM is going to need to be able to send down the address it is trying to resolve in the multicast rib. We need a way to signal this to the end developer. Start the conversion by adding the ability to have a safi. But only allow SAFI_UNICAST at the moment. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27zebra: remove 'enum rnh_type' from systemDonald Sharp
This code is now dead code since there are not two nexthop resolution types. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27zebra: remove import check resolution from zebraDonald Sharp
The entirety of the import checking no longer needs to be in zebra as that no-one is calling it. Remove the code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27*: Remove the ZEBRA_IMPORT_ROUTE_XXX zapi messagesDonald Sharp
These are no longer really needed. The client just needs to call nexthop resolution instead. So let's remove the zapi types. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27*: Add resolve via default flagDonald Sharp
2021-07-15zebra: When passing lookup information back pass the fully resolvedDonald Sharp
In the reachability code we auto pass back the fully resolved nexthops. Modify the ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB code to do the exact same thing so that the zclient_lookup_nexthop code does not need to recursively look for the data that zebra already has. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-06-18zebra: We already store the last command as part of zserv_writeDonald Sharp
when sending nexthop information. We do not need to reset the last_write_cmd since that is taken care of in the send routine. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-04-08zebra: optionally hide backup-nexthop events in nhtMark Stapp
Optionally hide route changes that only involve backup nexthop activation/deactivation. The goal is to avoid route churn during backup nexthop switchover events, before the resolving routes re-converge. A UI config enables this 'hiding' behavior. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-04-07zebra: add config control to hide backup nh events in nhtMark Stapp
Add a config that can control hiding of backup-nexthop activation changes in nexthop-tracking. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-03-22zebra: kill zebra_memory.h, use MTYPE_STATICDavid Lamparter
This one also needed a bit of shuffling around, but MTYPE_RE is the only one left used across file boundaries now. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17*: require semicolon after DEFINE_MTYPE & coDavid Lamparter
Back when I put this together in 2015, ISO C11 was still reasonably new and we couldn't require it just yet. Without ISO C11, there is no "good" way (only bad hacks) to require a semicolon after a macro that ends with a function definition. And if you added one anyway, you'd get "spurious semicolon" warnings on some compilers... With C11, `_Static_assert()` at the end of a macro will make it so that the semicolon is properly required, consumed, and not warned about. Consistently requiring semicolons after "file-level" macros matches Linux kernel coding style and helps some editors against mis-syntax'ing these macros. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-14*: remove tabs & newlines from log messagesDavid Lamparter
Neither tabs nor newlines are acceptable in syslog messages. They also break line-based parsing of file logs. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-11-18zebra: fix writing to pointer instead of valueIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-22zebra: replace inet_ntoaMark Stapp
Stop using inet_ntoa - use %pI4 or inet_ntop instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22:* Convert prefix2str to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-02zebra: cleanup zebra_rnh.c debugsDonald Sharp
a) Use appropriate %p modifiers for output 2) Display vrf name in addition to vrf id c) Remove now unused function Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-08-07lib, zebra: Add SR-TE policy infrastructure to zebraSebastien Merle
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>
2020-07-27Merge pull request #6765 from mjstapp/backup_nhg_netlinkRenato Westphal
lib,zebra: support multiple backup nexthops
2020-07-20zebra: improve vty, simplify some primary/backup codeMark Stapp
Improve vty output for routes and lsps with backups, including json. Simplify or correct some code that uses both primary and backup nexthops in dplane, nht. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-16zebra: fix SA warnings in backup nexthop codeMark Stapp
Fix a couple of recent SA warnings that came from backup nexthop/nhlfe changes. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-07zebra: include backup nexthops in nexthop-trackingMark Stapp
Include backup nexthops when examining routes that resolve NHT requests. Include installed backups when sending nexthops in zapi messages to client daemons. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-10Merge pull request #6559 from mjstapp/fix_zebra_rnh_saRenato Westphal
zebra: fix SA warning in zebra_rnh.c
2020-06-10Merge pull request #6471 from volta-networks/fix_zebra_register_rnh_pseudowireDonald Sharp
zebra: Every time zebra receives a ZEBRA_PW_SET, zebra should evaluate nh
2020-06-10zebra: fix SA warning in zebra_rnh.cMark Stapp
Fix an SA warning... that I introduced while resolving a different SA warning. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-10zebra: fix coverity SA warningsMark Stapp
Fix a few coverity warnings. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-03zebra: Every time zebra receives a ZEBRA_PW_SET, zebra should evaluate nhKaren Schoener
Every time zebra receives a ZEBRA_PW_SET, zebra should call zebra_evaluate_rnh. This fixes a race condition where zebra sometimes fails to install a pseudowire that is 'up', and has a reachable next hop. Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-05-08zebra: Remove typedef rnh_type_t from systemDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-24*: remove tabs from log messagesDavid Lamparter
Some logging systems are, er, "allergic" to tabs in log messages. (RFC5424: "The syslog application SHOULD avoid octet values below 32") Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-03-18bgpd,zebra: replace some more FUNCTION macrosMark Stapp
Replace some remaining __FUNCTION__ macros with __func__, now that we're trying to converge that way. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-06*: Finish off the __PRETTY_FUNCTION__ to __func__Donald Sharp
FINISH IT Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-05Merge pull request #5918 from ton31337/fix/__func__everywhereQuentin Young
__func__ everywhere
2020-03-05*: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis
Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05zebra: when override flag is set, do not forget to update nhtPhilippe Guibert
this flag can be used when one routing daemon wants to force his route to be injected prioritary with other routes, including selected routes. for that, do not forget to update the new_selected pointer in the zebra nexthop tracking algorithm. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-02-27zebra: Embed lib nexthop-group in zebra hash entryMark Stapp
Embed nexthop-group, which is just a pointer, in the zebra nexthop-hash-entry object, rather than mallocing one. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-06*: revise zapi nexthop encodingMark Stapp
Use a per-nexthop flag to indicate the presence of labels; add some utility zapi encode/decode apis for nexthops; use the zapi apis more consistently. Signed-off-by: Mark Stapp <mjs@voltanet.io>
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-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-25zebra: Remove re->nexthop_num from reDonald Sharp
The nexthop_num is not a function of the re. It is owned by the nexthop group. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25zebra: Replace nexthop_group with pointer in route entryDonald Sharp
In the route_entry we are keeping a non pointer based nexthop group, switch the code to use a pointer for all operations here and ensure we create and delete the memory. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19Zebra: Rectifying the log messages.vdhingra
This change addresses the following : 1. Ensures zlog_debug should be under DEBUG macro check 2. Ensures zlog_err and zlog_warn wherever applicable. 3. Removed few posivite logs from fpm handling, whose frequency is high. Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2019-09-06zebra: improve cleanup of MPLS labels when zclient disconnectsRenato Westphal
Use the zserv_client_close hook to cleanup all MPLS labels advertised by a zclient when it disconnects. We were doing this cleanup for ldpd only, but now we have other daemons that are MPLS aware, like ospfd (due to the new Segment Routing feature). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>