summaryrefslogtreecommitdiffstats
path: root/pbrd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #8675 from wesleycoakley/pbr-table-range-core-fixMark Stapp2021-05-252-32/+127
|\ | | | | pbrd: implement sparse table lookup for nhg cache
| * pbrd: nhg "add" edge case for last in table rangeWesley Coakley2021-05-161-8/+14
| | | | | | | | | | | | | | | | When handling the addition of a nhg which would saturate the range of tables PBR is configured to install into, handle this *before* a possible call to pbr_nhgc_alloc during hash query Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
| * pbrd: use sparse table for allocated NHG table IDsWesley Coakley2021-05-162-25/+114
| | | | | | | | | | | | | | | | | | | | | | | | Represent installed ("allocated") NHG tables with a hash keyed by table ID. Replaces a pre-allocated array of booleans that implemented this functionality before. + PBR table range > 65535 is fixed (was OOB access before :)) + Pre-compute next available ID to save time when only checking if all tables are allocated Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
* | pbrd: fix coverity warningIgor Ryzhov2021-05-191-15/+13
|/ | | | | | | | | CID 1500586 There was an attempt to fix it in 920bb6f7 but the commit didn't actually fix the warning. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: remaining zassert => assertDavid Lamparter2021-04-231-2/+2
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: remove *.conf.sample filesQuentin Young2021-04-092-20/+0
| | | | | | | | | | Most of these are many, many years out of date. All of them vary randomly in quality. They show up by default in packages where they aren't really useful now that we use integrated config. Remove them. The useful ones have been moved to the docs. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* *: require semicolon after FRR_DAEMON_INFO & co.David Lamparter2021-03-171-1/+2
| | | | | | ... again ... Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after DEFINE_QOBJ & co.David Lamparter2021-03-172-3/+3
| | | | | | Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after DEFINE_MTYPE & coDavid Lamparter2021-03-176-8/+8
| | | | | | | | | | | | | | | | | 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>
* *: remove tabs & newlines from log messagesDavid Lamparter2021-02-143-13/+13
| | | | | | | 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>
* pbrd: remove extraneous breakStephen Worley2021-02-011-2/+0
| | | | | | Remove extraneous break. Not needed after goto. Signed-off-by: Stephen Worley <sworley@nvidia.com>
* pbrd: nht only handle if updates if IPV*_IFINDEX nhStephen Worley2021-02-011-29/+6
| | | | | | | | | | | | | | | | | | | | | | | | Only handle an interface update in the nexthop tracking code if the nexthop in question was set with an interface to point out of. If the nexthop is GW only, the interface update could be unrelated but have overlapping address space. Let that be handled elsewhere. Ex) ``` 5.5.5.0/30 dev dummyDoof proto kernel scope link src 5.5.5.1 5.5.5.0/24 dev goofDummy proto kernel scope link src 5.5.5.1 [root@alfred frr-2]# ip ro show table 10000 default via 5.5.5.2 dev dummyDoof proto pbr metric 20 [root@alfred frr-2]# ip link set goofDummy down [root@alfred frr-2]# ip ro show table 10000 [root@alfred frr-2]# ip link set goofDummy up [root@alfred frr-2]# ip ro show table 10000 ``` Signed-off-by: Stephen Worley <sworley@nvidia.com>
* pbrd: Remove #if 0 codeDonald Sharp2021-01-281-7/+0
| | | | | | | | I am not even sure what the goal of this code was in any way shape fashion or form. But since it's pbr_nht.c I as the original author should know... But I don't. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* pbrd: Prevent possible NULL useDonald Sharp2021-01-181-12/+14
| | | | | | | | the pnhi data structure can receive either a interface or a nhr data structure. Ensure that we don't crash. CID -> 1500586 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #7762 from sworleys/PBR-Ipv4/Ipv6-Match-FixesMark Stapp2021-01-051-0/+10
|\ | | | | pbrd: pbr ipv4/ipv6 match fixes
| * pbrd: disallow ipv4/ipv6 mismatching in match src/dstStephen Worley2020-12-171-0/+10
| | | | | | | | | | | | | | | | | | Disallow mismatching of ipv4/ipv6 matching in src/dst. Doesn't make a lot of sense to allow this based on how IP Headers work. The kernel does not allow it at all obviously. Signed-off-by: Stephen Worley <sworley@nvidia.com>
* | pbrd: clean up possible checkpatch issueMark Stapp2020-12-231-2/+7
| | | | | | | | | | | | | | PR 7724 triggered a minor style warning (at least in the CI context). Clean that up. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | pbrd: Pay attention to interface up/down events with nhtDonald Sharp2020-12-121-2/+54
|/ | | | | | | | | | | | | | | | | | | When an interface goes up/down we need to pay attention to this in PBR. In the past we were relying *only* on the nht events but this is not sufficient for cases where an interface is flapping up and down. If this is happening it could be happening fast enough that zebra is not sending nht events because they are consolidated into a single event from it's perspective and that is the right thing to do. This commit will allow us to back out commit: 0aaa722883245c2109d9856ca0656749860fc579 As that commit introduced extra processing in zebra that is actually causing issues in other places. The problem that commit was trying to solve should have always been handled in pbrd instead of making zebra do work that is unnatural to it's actual flow. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert all usage of zclient_send_message to new enumDonald Sharp2020-11-151-2/+2
| | | | | | | | | The `enum zclient_send_status` enum needs to be extended throughout the code base to use the new states and to fix up places where we tested against the return value being non zero. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: Advertise FIB installed routes to bgp peers (Part 1)Soman K S2020-11-061-1/+2
| | | | | | | | | | | | | | | | | | Issue: The bgp routes learnt from peers which are not installed in kernel are advertised to peers. This can cause routers to send traffic to these destinations only to get dropped. The fix is to provide a configurable option "bgp suppress-fib-pending". When the option is enabled, bgp will advertise routes only if it these are successfully installed in kernel. Fix (Part1) : * Added message ZEBRA_ROUTE_NOTIFY_REQUEST used by client to request FIB install status for routes * Added AFI/SAFI to ZAPI messages * Modified the functions zapi_route_notify_decode(), zsend_route_notify_owner() and route_notify_internal() to include AFI, SAFI as parameters Signed-off-by: kssoman <somanks@gmail.com>
* pbrd: Fix memory leak in json outputDonald Sharp2020-11-041-3/+9
| | | | | | Fix a memory leak in using some pbr json commands. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #7378 from donaldsharp/pbr_ifp_leakJafar Al-Gharaibeh2020-10-285-0/+23
|\ | | | | pbrd: Fix memory leak
| * pbrd: Fix memory leakDonald Sharp2020-10-235-0/+23
| | | | | | | | | | | | | | | | | | On shutdown pbr was leaking the ifp->info ( struct pbr_interface *) pointer. Add some code to notice we are being shutdown and cleanup the memory Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | pbrd: Remove inet_ntoa usage from pbrDonald Sharp2020-10-261-2/+2
|/ | | | | | Convert over to using %pI4 for the last inet_ntoa Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* :* Convert prefix2str to %pFXDonatas Abraitis2020-10-223-37/+21
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* Merge pull request #7222 from idryzhov/fix-debugRenato Westphal2020-10-101-2/+2
|\ | | | | fix debug commands node inconsistencies
| * *: move "show debugging ..." commands to enable nodeIgor Ryzhov2020-10-021-1/+1
| | | | | | | | | | | | Use the same node for "show debugging" commands in all daemons. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
| * *: move "debug ..." commands to enable nodeIgor Ryzhov2020-10-021-1/+1
| | | | | | | | | | | | Use the same node for "debug" commands in all daemons. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | vtysh: dynamically generate the list of daemons for commandsIgor Ryzhov2020-10-021-0/+1
|/ | | | | | | Some daemons were actually missing from the static definitions: nhrpd, babeld, eigrpd and bfdd. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: make failure to decode nht update an errorQuentin Young2020-10-011-1/+1
| | | | | | | This should never happen; no need to debug guard it and it's not a warning, if this isn't working then NHT is not working at all. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* pbrd: use bool for pbr_send_pbr_map() return valStephen Worley2020-09-233-9/+9
| | | | | | | | Use a bool as the return val for pbr_send_pbr_map() to make the code a bit more readable. Dont expect there to be need for values other than true or false anyway. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* pbrd: cleanup pbr ifp info if not sent to zebraStephen Worley2020-09-221-1/+12
| | | | | | | | Properly cleanup the pbr interface data if nothing actually gets sent to zebra, since we will never get the callback notification from zapi to issue final deletion. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* pbrd: add return val for pbr_send_pbr_map()Stephen Worley2020-09-222-7/+9
| | | | | | | | Add a return val so caller can know if something was actually sent to zebra here. Some things need to be cleanued up by the caller if we arent getting a callback from zapi. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* Merge pull request #7093 from donaldsharp/pbr_flappingMark Stapp2020-09-143-8/+9
|\ | | | | Pbr flapping
| * pbrd: Ensure rule is installed on interface upDonald Sharp2020-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we are experiencing an interface that is bouncing very fast and the last operation that we experienced was a ifdown we will send rule deletions associated with that interface. If we have not received notification that hte rule was removed *but* we immiedately get another ifup notification when we go to install the rule we are deciding that it's not ready to send down again, as that we still think it is installed. Force the rule installation when we have a interface up event. Ticket: CM-31042 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
| * bgpd, lib, pbrd, zebra: Pass by ifnameDonald Sharp2020-09-123-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When installing rules pass by the interface name across zapi. This is being changed because we have a situation where if you quickly create/destroy ephermeal interfaces under linux the upper level protocol may be trying to add a rule for a interface that does not quite exist at the moment. Since ip rules actually want the interface name ( to handle just this sort of situation ) convert over to passing the interface name and storing it and using it in zebra. Ticket: CM-31042 Signed-off-by: Stephen Worley <sworley@nvidia.com> Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | lib: fix crashes with leafrefs that point to non-implemented modulesRenato Westphal2020-09-111-1/+0
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever libyang loads a module that contains a leafref, it will also implicitly load the module of the referring node if it's not loaded already. That makes sense as otherwise it wouldn't be possible to validate the leafref value correctly. The problem is that loading a module implicitly violates the assumption of the northbound layer that all loaded modules are implemented (i.e. they have a northbound node associated to each schema node). This means that loading a module that isn't implemented can lead to crashes as the "priv" pointer of schema nodes is no longer guaranteed to be valid. To fix this problem, add a few null checks to ignore data nodes associated to non-implemented modules. The side effect of this change is harmless. If a daemon receives configuration it doesn't support (e.g. BFD peers on staticd), that configuration will be stored but otherwise ignored. This can only happen when using a northbound client like gRPC, as the CLI will never send to a daemon a command it doesn't support. This minor problem should go away in the long run as FRR migrates to a centralized management model, at which point the YANG-modeled configuration of all daemons will be maintained in a single place. Finally, update some daemons to stop implementing YANG modules they don't need to (i.e. revert 1b741a01c and a74b47f5). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* pbrd: add frr-vrf to the list of implemented yang modulesRenato Westphal2020-09-101-0/+1
| | | | | | | | | | | PR #6376 introduced a VRF leafref in the frr-interface YANG module. That change exposed a bug in the northbound layer that is causing pbrd to crash under certain circumstances. Even though pbrd wasn't converted to the new northbound model yet, make it implement the frr-vrf module in order to work around this problem. This is a temporary fix until a better solution is available. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* Merge pull request #7033 from mjstapp/fix_pbr_nhg_saDonald Sharp2020-09-021-4/+14
|\ | | | | pbrd: fix SA warnings in nhg map
| * pbrd: fix SA warning in nhg mapMark Stapp2020-09-011-4/+14
| | | | | | | | | | | | Fix SA warnings in nhg map functions. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | pbrd: nh "valid" semantics in nexthop trackingWesley Coakley2020-09-011-6/+6
| | | | | | | | Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
* | pbrd: be more selective about route updatesWesley Coakley2020-09-012-6/+13
|/ | | | | | | Given a received nexthop update, only send down an update to the relevant nexthop group. Avoid sending down superfluous updates Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
* pbrd: Convert pnhc->nexthop to it's own dataDonald Sharp2020-08-283-50/+49
| | | | | | | | | | | The pnhc->nexthop was a pointer copy. Causing issues with the ability to move pointers around for the different pnhc since the pnhc mirrored the nexthop caches. When we received a vrf change if we shared pointers it was impossible to know if we had already updated the code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pbrd: When multiple items share the pnhc do the right thingDonald Sharp2020-08-283-26/+86
| | | | | | | | | We had multiple pnhc cache entries with the same nexthop pointer. This causes some large amount of confusion. Fixup the code to handle this situation better. Ticket: CM-31044 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pbrd: Allow interfaces to be deleted then added back inDonald Sharp2020-08-286-2/+100
| | | | | | | | | PBR needs the ability to allow ephermeal interfaces( bonds, vrfs, dummy, bridges, etc ) to be destroyed and then recreated and at the same time keep track of them and rebuild state as appropriate when we get a change. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Allow nexthop simple display to take an alternate ifp nameDonald Sharp2020-08-281-1/+1
| | | | | | | | | | | 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>
* pbrd: Properly hook back up when vrf is destroyed than recreatedDonald Sharp2020-08-286-3/+135
| | | | | | | | | | | | | | | | | Currently when a vrf is deleted than added back in PBR was not going through and touching up all the data structures that needed to be massaged to allow it to start working again. This includes: a) Search through the nexthop groups to find any nexthop that references the old nexthop id and set it right again. b) Search through the nexthop cache for nht and reset those nexthops to the right vrf as well as re-register Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge pull request #6730 from wesleycoakley/pbrd-dscp-ecnRuss White2020-07-234-1/+165
|\ | | | | DSCP / ECN-based PBR Matching
| * pbrd: expose dscp & ecn to json for `show pbr map`Wesley Coakley2020-07-151-0/+6
| | | | | | | | Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
| * pbrd: dscp interpret standard codepointsWesley Coakley2020-07-153-6/+95
| | | | | | | | | | | | | | Matching by dscp may now also be specified by its standard codepoint (provided it has one), such as `cf0` or `af11`. Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>