summaryrefslogtreecommitdiff
path: root/ospfd/ospf_spf.c
AgeCommit message (Collapse)Author
2023-03-24*: Convert event.h to frrevent.hDonald Sharp
We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_add_XXX functions to event_add_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename thread.[ch] to event.[ch]Donald Sharp
This is a first in a series of commits, whose goal is to rename the thread system in FRR to an event system. There is a continual problem where people are confusing `struct thread` with a true pthread. In reality, our entire thread.c is an event system. In this commit rename the thread.[ch] files to event.[ch]. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-17ospfd: Fix ospf_ti_lfa drop of an entire tableDonald Sharp
The new_rtrs variable was just generated and then dropped. Let's fix that entirely Signed-off-by: Donald Sharp <sharpd@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>
2023-01-31ospfd: Add missing enum's to switch statementDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-17Revert "ospfd: rSPF calc and messaging for optimal route reflection"Donatas Abraitis
This reverts commit a3d3a14c09cf212c7d402670247c4d518b99d8b7.
2023-01-17Revert "ospfd: few fixes in rSPF calc when LSA received from non root node"Donatas Abraitis
This reverts commit 9f2984d97c2e23198db47d39a725f3c50d2ee0ed.
2023-01-17Revert "bgpd, ospfd: update BGP when routes are removed from OSPF routing table"Donatas Abraitis
This reverts commit bba9435157515689cb752e1ff9ac18a44f08b73a.
2022-12-20ospfd: fix SPF table memory leakRafael Zalamena
After `free()`ing a table also set it to NULL so when the instance release function is called we know whether the pointer is valid or not. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-12-12ospfd: fix memory leak on SPF calculationRafael Zalamena
Fix the following problems: - Always free vertex next hops on `vertex_parent_free` - Signalize failure on `ospf_spf_add_parent` when parent already exists so the caller has the chance to `free()` any allocated resources. - Don't reuse vertex next hops without the reference count logic in `ospf_nexthop_calculation`. Instead allocate a new copy so it can be `free()`d later without complications Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-10-13ospfd: pass the length of string to functionanlan_cs
Fix CID 1526337: (SIZEOF_MISMATCH) Needs to pass the correct length to the function. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-10-12bgpd, ospfd: update BGP when routes are removed from OSPF routing tableMadhuri Kuruganti
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-12ospfd: few fixes in rSPF calc when LSA received from non root nodeMadhuri Kuruganti
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-12ospfd: rSPF calc and messaging for optimal route reflectionMadhuri Kuruganti
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-09-06ospfd: Adding SUPPORT_OSPF_API define in ospf_spf.cMichal Ruprich
It is not possible to build ospf_spf.c file with --disable-ospfapi because ospf_apiserver.c has SUPPORT_OSPF_API around all function definitions and that results in an undefined reference to the ospf_apiserver_notify_reachable function error while building. Signed-off-by: Michal Ruprich <mruprich@redhat.com>
2022-08-28ospfd: changes for code maintainabilitysri-mohan1
these changes are for improving the code maintainability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2022-07-16ospfd: free unreachable router LSA node so that it is not left unreachableLou Berger
allows for an LSA to be unreachable via one link and reachable via another Signed-off-by: Lou Berger <lberger@labn.net>
2022-06-02ospfd: api: add reachable router notificationsChristian Hopps
Reachable router information is used by OSPF opaque clients in order to determine if the router advertising the opaque LSA data is reachable (i.e., 2-way conectivity check). Signed-off-by: Christian Hopps <chopps@labn.net>
2022-06-02ospfd: add all_rtrs route table when opaque enabledChristian Hopps
The reachable router table is used by OSPF opaque clients in order to determine if the router advertising the opaque LSA data is reachable (i.e., 2-way conectivity check). Signed-off-by: Christian Hopps <chopps@labn.net>
2022-04-19*: Fix spelling of neccessaryDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-23*: Change thread->func to return void instead of intDonald Sharp
The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-08-31ospfd: correctly cleanup spf dataIgor Ryzhov
ospf_spf_cleanup frees the data so we need to reset the stale pointers. Fixes #9523. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-05ospfd: introduce support for Graceful Restart (restarting mode)Renato Westphal
RFC 3623 specifies the Graceful Restart enhancement to the OSPF routing protocol. This PR implements support for the restarting mode, whereas the helper mode was implemented by #6811. This work is based on #6782, which implemented the pre-restart part and settled the foundations for the post-restart part (behavioral changes, GR exit conditions, and on-exit actions). Here's a quick summary of how the GR restarting mode works: * GR can be enabled on a per-instance basis using the `graceful-restart [grace-period (1-1800)]` command; * To perform a graceful shutdown, the `graceful-restart prepare ospf` EXEC-level command needs to be issued before restarting the ospfd daemon (there's no specific requirement on how the daemon should be restarted); * `graceful-restart prepare ospf` will initiate the graceful restart for all GR-enabled instances by taking the following actions: o Flooding Grace-LSAs over all interfaces o Freezing the OSPF routes in the RIB o Saving the end of the grace period in non-volatile memory (a JSON file stored in `$frr_statedir`) * Once ospfd is started again, it will follow the procedures described in RFC 3623 until it detects it's time to exit the graceful restart (either successfully or unsuccessfully). Testing done: * New topotest featuring a multi-area OSPF topology (including stub and NSSA areas); * Successful interop tests against IOS-XR routers acting as helpers. Co-authored-by: GalaxyGorilla <sascha@netdef.org> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-06-08ospfd: fix logging of what triggered the SPF runRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-05-12ospfd: Use _func__ instead of __PRETTY_FUNCTION__Donald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-04-06ospfd: changes for PMP network /32 prefix lengthAmol Lad
Operation with PMP network on /32 prefix is needed for DMVPN Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-03-29ospfd: Max multipath config supportrgirada
Description: OSPF does not have an option to control the maximum multiple equal cost paths to reach a destination/route(ECMP). Currently, it is using the system specific max multiple paths. But Somtimes, It requires to control the multiple paths from ospf. This cli helps to configure the max number multiple paths in ospf. Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-03-17*: require semicolon after DEFINE_<typesafe...>David Lamparter
Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-09ospfd: Convert to using proper string formattingDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-28ospfd: Remove #if 0 codeDonald Sharp
The #if 0 code in ospfd, has not been compiled since at least 2012. If we are at least 9 years old at this point with no effort to use or save, we should just get rid of it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-19ospfd: Fix P2MP handling when TI-LFA is enabledGalaxyGorilla
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19ospfd: Minor memory fixesGalaxyGorilla
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19ospfd: Add support for TI-LFA node protectionGalaxyGorilla
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19ospfd: Make use of adjacency SIDs in TI-LFAGalaxyGorilla
When P and Q spaces are adjacent then it makes sense to use adjacency SIDs to from the P node to the Q node. There are some other corner cases where this makes also sense like when a P/Q node adjacent to root node. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19ospfd: Add support for reverse SPF (P2P only)GalaxyGorilla
A reverse SPF is important in the context of TI-LFA, e.g. for computing so called Q spaces. In case the weights of the links are symmetric there is no difference to the 'normal' SPF and hence this patch is really just needed for the case with asymmetric link weights. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19ospfd: TI-LFA basic infrastructure and algorithmsGalaxyGorilla
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-12-14*: Replace s_addr check agains 0 with INADDR_ANYDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-11-28ospfd: Restore POINTOMULTIPOINT to working orderDonald Sharp
Commit: 1d376ff539508f336cb5872c5592b780e3db180b removed the code to find nexthops for the POINTOMULTIPOINT and replaced it with a generic bit of code that was supposed to handle both POINTOPOINT and POINTOMULTIPOINT the problem is that the ospf rfc states that the network mask on point to multipoint should be /32 which will not allow you to properly do a prefix match on it against the network. Restore original behavior as much as possible and leave the new POINTOPOINT code alone. Fixes: #7624 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-18ospfd: fix NSSA translatorckishimo
Having 2 ABR in NSSA area where R3 is the elected translator R3# show ip ospf We are an ABR and the NSSA Elected Translator. R2# show ip ospf We are an ABR, but not the NSSA Elected Translator. When R3 loses the Border condition by shutting down the interface to the backbone, we end up with no translator in the NSSA area. It is expected R2 to take over the translator role R3# sh ip ospf It is not ABR, therefore not Translator. R2# show ip ospf We are an ABR, but not the NSSA Elected Translator. This PR forces the ABR to reevaluate the translator condition, so R2 becomes the elected Translator Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2020-10-22ospfd: replace inet_ntoaMark Stapp
Stop using inet_ntoa, use %pI4 etc or inet_ntop instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-08-27ospfd: use a new vertex list for every SPF runGalaxyGorilla
In the context of TI-LFA it is necessary to have multiple representations of SPFs for so called P and Q spaces. Hence it makes sense to start with fresh vertex lists, and only delete them when the SPF calculation is not a 'dry run'. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-08-18ospfd: bring back some P2P SPF interface codeGalaxyGorilla
In the case of P2P links it is possible to use IP unnumbered which yields a strong dependency to the interface data for nexthop resolution in the SPF calculations. While the SPF code strives to be as independent of non-LSA data as possible there is no way around here: one has to resolve the nexthop for such a special case using the interface data. For this purpose a new flag 'spf_root_node' is introduced to signal that interface data can be used for P2P links. For now this flag is always 'true' since the SPF currently always uses the calculating node as the root node. This will change with the introduction of TI-LFA where other nodes can be root nodes. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-08-18ospfd: add print helper for SPF trees and route tablesGalaxyGorilla
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-08-18ospfd: introduce a 'dry run' into SPF codeGalaxyGorilla
in OSPF interface data is used for the nexthop resolution during the SPF algorithm, see RFC2328 16.1.1. However, for certain technologies like TI-LFA it is desirable to be able to calculate SPFs for arbitrary root nodes, not just the calculating node. Since interface data is not available for other nodes it is necessary to remove this dependency and make its usage optional, depending on the intent of changing the RIB with the generated tree (or not). To signal that a SPF run is used without the intent to change the RIB an additional flag `spf_dry_run` is introduced to the ospf_area struct. This flag is currently only used within the pure SPF code but will be extended to the SPF postprocessing later on. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-08-14ospfd: clean some bitrot in SPF codeGalaxyGorilla
Just non-functional changes, cosmetics, removal of eye cancer. The intention here is to make the SPF code more approachable. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-07-14*: un-split strings across linesDavid Lamparter
Remove mid-string line breaks, cf. workflow doc: .. [#tool_style_conflicts] For example, lines over 80 characters are allowed for text strings to make it possible to search the code for them: please see `Linux kernel style (breaking long lines and strings) <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_ and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
2020-06-03ospfd: Add ECMP support to OSPF Segment RoutingOlivier Dugeon
* Change sr_prefix structure in ospf_sr.h to add support to ECMP * Add new Segment Routing information to ospf_paths in ospf_route.h * Backport MPLS label configuration from IS-IS Segment Routing implementation * Re-write log message in ospf_sr.c and ospf_ext.c Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>