summaryrefslogtreecommitdiffstats
path: root/staticd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: require semicolon after FRR_DAEMON_INFO & co.David Lamparter2021-03-171-1/+1
| | | | | | ... again ... Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after DEFINE_MTYPE & coDavid Lamparter2021-03-172-2/+2
| | | | | | | | | | | | | | | | | 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>
* Merge pull request #8158 from idryzhov/staticd-fix-blackholeRuss White2021-03-091-0/+36
|\ | | | | staticd: forbid blackhole and non-blackhole nexthops in a single route
| * staticd: forbid blackhole and non-blackhole nexthops in a single routeIgor Ryzhov2021-03-031-0/+36
| | | | | | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | staticd: warn on attempted delete of non-existent routeWesley Coakley2021-03-021-1/+4
|/ | | | Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
* Merge pull request #8095 from idryzhov/fix-nb-stale-pointersRuss White2021-02-231-0/+2
|\ | | | | fix stale pointers in northbound nodes
| * lib: register dependency between control plane protocol and vrf nb nodesIgor Ryzhov2021-02-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the control plane protocol is created, the vrf structure is allocated, and its address is stored in the northbound node. The vrf structure may later be deleted by the user, which will lead to a stale pointer stored in this node. Instead of this, allow daemons that use the vrf pointer to register the dependency between the control plane protocol and vrf nodes. This will guarantee that the nodes will always be created and deleted together, and there won't be any stale pointers. Add such registration to staticd and pimd. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | staticd: fix vrf enablingIgor Ryzhov2021-02-171-0/+2
| | | | | | | | | | | | | | | | | | | | When enabling the VRF, we should not install the nexthops that rely on non-existent VRF. For example, if we have route "1.1.1.0/24 2.2.2.2 vrf red nexthop-vrf blue", and VRF red is enabled, we should not install it if VRF blue doesn't exist. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | staticd: fix nexthop creation and installationIgor Ryzhov2021-02-174-65/+10
| | | | | | | | | | | | | | | | | | | | | | | | Currently, staticd creates a VRF for the nexthop it is trying to install. Later, when this nexthop is deleted, the VRF stays in the system and can not be deleted by the user because "no vrf" command doesn't work for this VRF because it was not created through northbound code. There is no need to create the VRF. Just set nh_vrf_id to VRF_UNKNOWN when the VRF doesn't exist. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | staticd: fix nexthop validationIgor Ryzhov2021-02-173-5/+11
|/ | | | | | | When checking for local connected address used as a nexthop gateway, we should check nexthop VRF, not route VRF. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* Merge pull request #7863 from chiragshah6/mdevRuss White2021-01-193-89/+43
|\ | | | | [yang,staticd]: remove when condition from static nexthop om
| * staticd: handle when condition check in nb callbacksChirag Shah2021-01-133-89/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present, libyang validate api takes longer time to complete for a transaction to complete if the same config is re-applied. For instance if set of static routes are reapplied the config completion takes longer than it took initial time. One of the solution is to remove when statement from staticd nexthop yang OM. When condition adds peformance toll on libyang's validate api. The same when condition checks are done in frr northbound validation phase (which are must faster). With this change, if the same static routes are configured agian and again, the time to completion does not go up and perfomance does not degrade. Ticket:CM-32530 Testing Done: Configure 400 static routes across two vrfs and keep re-applying them. The time to complete the config remains in few seconds. Before: root@bharat:~/stash/frr4# time vtysh -f static_route_cfg real 0m19.877s user 0m0.263s sys 0m0.014s After: root@bharat:~/stash/frr4# time vtysh -f static_route_cfg real 0m3.857s user 0m0.239s sys 0m0.034s Co-developed-by: VishalDhingra <vdhingra@vmware.com> Signed-off-by: Chirag Shah <chirag@nvidia.com>
* | staticd: Backend cofiguration code to fix table-id problemvdhingra2021-01-125-125/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | problem: table-id gets overwritten for a given route. RCA: table-id was getting overwritten from the NB layer, So route was getting installed with the latest table-id. Fix: make the table-id as the key in the NB layer. This will program the route in zebra correctly. - Removed the table-id modify callbacks. - Moved the validate and apply table-id changes to path-list creation issue #7347 Signed-off-by: vishaldhingra <vdhingra@vmware.com>
* | staticd: autogenerated code modifications due to yang changesvdhingra2021-01-102-16/+0
|/ | | | | | updated callback methods based on autogenerated code. Signed-off-by: vishaldhingra <vdhingra@vmware.com>
* Merge pull request #7478 from donaldsharp/bufferMark Stapp2020-11-181-1/+2
|\ | | | | Buffer
| * *: Convert all usage of zclient_send_message to new enumDonald Sharp2020-11-151-1/+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, lib, staticd, tests: Convert to using FOREACH_AFI_SAFIDonald Sharp2020-11-152-37/+26
|/ | | | | | | | | Move the FOREACH_AFI_SAFI macro from bgpd.h to zebra.h( GLOBAL's YOUALL ) Then convert all the places that have the two level for loop to iterate over all afi/safis Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #4770 from kssoman/fibSantosh P K2020-11-121-1/+2
|\ | | | | Advertise FIB installed routes to bgp peers
| * 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>
* | Merge pull request #7375 from vishaldhingra/staticRafael Zalamena2020-11-113-1/+37
|\ \ | |/ |/| staticd: fixed memory leak on shudown
| * staticd: fixed memory leak on shudownvdhingra2020-10-303-1/+37
| | | | | | | | | | | | | | | | When shutdown triggered, info pointer pointing to static_route_info was not getting released for route_table and srcdest_table. Signed-off-by: vishaldhingra <vdhingra@vmware.com>
* | Merge pull request #7329 from idryzhov/fix-ip-route-tableStephen Worley2020-10-271-12/+0
|\ \ | |/ |/| staticd: fix checks for table param in "ip route" commands
| * staticd: remove redundant checks from vtyIgor Ryzhov2020-10-221-12/+0
| | | | | | | | | | | | These checks are moved to NB layer. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | staticd: replace inet_ntoaMark Stapp2020-10-221-2/+1
|/ | | | | | Replace inet_ntoa with pI4 Signed-off-by: Mark Stapp <mjs@voltanet.io>
* :* Convert prefix2str to %pFXDonatas Abraitis2020-10-221-9/+6
| | | | 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>
* | staticd: To set the default value of blackhole type correctlyvdhingra2020-10-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When nexthop is allocated, default value of blockhole type was not getting set, this leads to below problem. The default value should be in-sync with the deafult value in yang model. c t ip route 131.1.1.0/24 Null0 do show running-config ... ! ip route 131.1.1.0/24 blackhole ! end Signed-off-by: vishaldhingra <vdhingra@vmware.com>
* | Merge pull request #6882 from vishaldhingra/staticDonald Sharp2020-10-038-21/+103
|\ \ | | | | | | staticd : Added the warning log for route when VRF is not ready.
| * | staticd : Added the warning log for route when VRF is not ready.vdhingra2020-09-018-21/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the yangification of staticd, refactoring of code around static_hold_route data struct has been done, In this context warning log message when VRF is not ready had been removed. This should not be removed, adding it back. I have missed one MPLS validation too, adding it back. Signed-off-by: vishaldhingra <vdhingra@vmware.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>
* | staticd: fix display of the "nexthop-vrf" parameter of static routesRenato Westphal2020-09-111-1/+2
| | | | | | | | | | | | | | | | | | | | When the static route VRF and its nexthop VRF are inactive in the kernel, both VRFs will have the same ID (VRF_UNKNOWN) even though they might not be the same. This can cause "sh run" to not display the "nexthop-vrf" parameter correctly when necessary. Change the code to compare VRFs by their names to fix this problem. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | staticd: remove checks that are no longer necessaryRenato Westphal2020-09-111-17/+3
|/ | | | | | | | All call sites of static_route_leak() are passing a non-null pointer to the 'vty' parameter, hence remove the 'vty' null checks that are no longer necessary. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* staticd: fix warning when creating routes without SR-TE colorsRenato Westphal2020-08-201-2/+3
| | | | | | | | | | | | | | | | The SR-TE color YANG leaf is optional so it shouldn't be created unconditionally (it doesn't have a default value). Fixes warnings like this when routes are created without specifying a SR-TE color: STATIC: libyang: Invalid value "" in "srte-color" element. (/frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-s taticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[p refix='99.0.0.1/32'][afi-safi='frr-routing:ipv4-unicast']/path-list[distance='1' ]/frr-nexthops/nexthop[nh-type='ip4'][vrf='default'][gateway='192.168.1.2'][inte rface='(null)']/srte-color) Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* staticd: add support for SR PoliciesSebastien Merle2020-08-127-24/+193
| | | | | | | | | | | | | | Configuration example: ip route 9.9.9.9/32 6.6.6.6 color 123 The SR Policy to be chosen is uniquely identified by the policy endpoint (6.6.6.6) and the SR-TE color (123). Traffic will be augmented with an MPLS label stack according to the active candidate path of that particular policy. Co-authored-by: GalaxyGorilla <sascha@netdef.org> Signed-off-by: Sebastien Merle <sebastien@netdef.org>
* Merge pull request #6809 from opensourcerouting/staticd-disable-aclDonald Sharp2020-08-041-1/+0
|\ | | | | vtysh: don't send access list commands to staticd
| * staticd,vtysh: no access list commandsRafael Zalamena2020-08-041-1/+0
| | | | | | | | | | | | Don't send access list commands to `staticd` since it doesn't use them. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* | *: introduce DEFPY_YANG & friendsRenato Westphal2020-08-031-14/+14
|/ | | | | | | | | | DEFPY_YANG will allow the CLI to identify which commands are YANG-modeled or not before executing them. This is going to be useful for the upcoming configuration back-off timer work that needs to commit pending configuration changes before executing a command that isn't YANG-modeled. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* staticd: Formatting changesvdhingra2020-07-161-20/+28
| | | | | | Warning fixes for indentation Signed-off-by: VishalDhingra <vdhingra@vmware.com>
* staticd: Added afi-safi as a key in route-listvdhingra2020-07-163-12/+23
| | | | | | | | To address the ip mroute command there is a need to add safi as a key. So adding the afi-safi-type identityref as a key. Signed-off-by: VishalDhingra <vdhingra@vmware.com>
* staticd : Configuration northbound implementationvdhingra2020-07-1616-1145/+2718
| | | | | | | | | 1. Modifies the data structs to make the distance, tag and table-id property of a route, i.e created a hireachical data struct to save route and nexthop information. 2. Backend northbound implementation Signed-off-by: VishalDhingra <vdhingra@vmware.com>
* staticd,zebra: use ALLOW_RECURSION for static routesMark Stapp2020-07-071-0/+1
| | | | | | | | | Remove a special-case clause for static routes - it was the same as the clause for other recursive routes. Have staticd just tell zebra that recursion is allowed. Update topotest that was aware of this 'internal' flag. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: have daemons call frr_fini() at terminationMark Stapp2020-06-111-0/+3
| | | | | | | | Fix a number of library and daemon issues so that daemons can call frr_fini() during normal termination. Without this, temporary logging files are left behind in /var/tmp/frr/. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: add filter northbound supportRafael Zalamena2020-06-051-0/+1
| | | | | | Allow all daemons to work with filter northbound. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* build: make clippy Makefile rules nicerDavid Lamparter2020-04-271-2/+3
| | | | | | | These are easy to get subtly wrong, and doing so can cause nondeterministic failures when racing in parallel builds. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: use VPATH for vtysh_scanDavid Lamparter2020-04-271-1/+1
| | | | | | No need to put $(top_srcdir) everywhere. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: sprintf -> snprintfQuentin Young2020-04-211-2/+2
| | | | | | | | | | | | | Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Merge pull request #6247 from FRRouting/nb_conversionsDonald Sharp2020-04-171-0/+1
|\ | | | | Merge nb_converions branch to master