summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_gr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ospfd: fix GR state locationDavid Lamparter2024-01-271-36/+6
| | | | | | | | | This belongs in `/var/lib`, not `/var/run`. Use library facility to load/save, support previous path as fallback, and do proper fsync(). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ospfd: Configurable interface-level 'capability opaque' supportAcee2023-06-281-2/+9
| | | | | | | | | | | | | | | | Add support for "[no] ip ospf capbility opaque" at the interface level with the default being capability opaque enabled. The command "no ip ospf capability opaque" will disable opaque LSA database exchange and flooding on the interface. A change in configuration will result in the interface being flapped to update our options for neighbors but no attempt will be made to purge existing LSAs as in dense topologies, these may received by neighbors through different interfaces. Topotests are added to test both the configuration and the LSA opaque flooding suppression. Signed-off-by: Acee <aceelindem@gmail.com>
* ospfd, ospf6d: fix time_t truncationRenato Westphal2023-05-311-1/+1
| | | | | | | | Change timestamp parameter from int to time_t to avoid truncation. Found by Coverity Scan (CID 1563226 and 1563222) Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ospfd, ospf6d: introduce the "graceful-restart hello-delay" commandRenato Westphal2023-05-091-5/+34
| | | | | | | | | This command makes unplanned GR more reliable by manipulating the sending of Grace-LSAs and Hello packets for a certain amount of time, increasing the chance that the neighboring routers are aware of the ongoing graceful restart before resuming normal OSPF operation. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ospfd: add support for unplanned graceful restartRenato Westphal2023-05-091-58/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In practical terms, unplanned GR refers to the act of recovering from a software crash without affecting the forwarding plane. Unplanned GR and Planned GR work virtually the same, except for the following difference: on planned GR, the router sends the Grace-LSAs *before* restarting, whereas in unplanned GR the router sends the Grace-LSAs immediately *after* restarting. For unplanned GR to work, ospf6d was modified to send a ZEBRA_CLIENT_GR_CAPABILITIES message to zebra as soon as GR is enabled. This causes zebra to freeze the OSPF routes in the RIB as soon as the ospfd daemon dies, for as long as the configured grace period (the defaults is 120 seconds). Similarly, ospfd now stores in non-volatile memory that GR is enabled as soon as GR is configured. Those two things are no longer done during the GR preparation phase, which only happens for planned GRs. Unplanned GR will only take effect when the daemon is killed abruptly (e.g. SIGSEGV, SIGKILL), otherwise all OSPF routes will be uninstalled while ospfd is exiting. Once ospfd starts, it will check whether GR is enabled and enter in the GR mode if necessary, sending Grace-LSAs out all operational interfaces. One disadvantage of unplanned GR is that the neighboring routers might time out their corresponding adjacencies if ospfd takes too long to come back up. This is especially the case when short dead intervals are used (or BFD). For this and other reasons, planned GR should be preferred whenever possible. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp2023-03-241-2/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_add_XXX functions to event_add_XXXDonald Sharp2023-03-241-3/+3
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-241-1/+1
| | | | | | | | | 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>
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-14/+1
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build, vtysh: extract vtysh commands from .xrefDavid Lamparter2022-10-261-2/+0
| | | | | | | | | | | | | | | | | | | Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ospfd: Remove various macros that overlap THREAD_OFFDonald Sharp2022-07-211-1/+1
| | | | | | | | Let's just use THREAD_OFF consistently in the code base instead of each daemon having a special macro that needs to be looked at and remembered what it does. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ospfd,ospf6d: Add missing newline for `graceful-restart prepare` CLIDonatas Abraitis2022-03-091-1/+1
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-3/+1
| | | | | | | 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>
* ospfd: fix no-form of "graceful-restart" commandIgor Ryzhov2021-11-151-1/+1
| | | | | | | The no-form should use the same arguments as the regular command, hence replace "period" with "grace-period". Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* Merge pull request #9813 from opensourcerouting/ospf-gr-fixesDonald Sharp2021-10-151-42/+18
|\ | | | | ospfd: more GR fixes
| * ospfd: introduce additional opaque capability check in the GR codeRenato Westphal2021-10-121-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before starting the graceful restart procedures, ospf_gr_prepare() verifies for each configured OSPF instance whether it has the opaque capability enabled (a pre-requisite for GR). If not, a warning is emitted and GR isn't performed on that instance. This PR introduces an additional opaque capability check that will return a CLI error when the opaque capability isn't enabled. The idea is to make it easier for the user to identify when the GR activation has failed, instead of requiring him or her to check the logs for errors. The original opaque capability check from ospf_gr_prepare() was retaining as it's possible that that function might be called from other contexts in the future. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ospfd: fix flushing of Grace-LSAs on broadcast interfacesRenato Westphal2021-10-121-42/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ospfd opaque LSA infrastruture has an issue where it can't store different versions of the same Type-9 LSA for different interfaces. When flushing the self-originated Grace-LSAs upon exiting from the GR mode, the code was looking up the single self-originated Grace-LSA from the LSDB, setting its age to MaxAge and sending it out on all interfaces. The problem is that Grace-LSAs sent on broadcast interfaces have their own unique "IP interface address" TLV that is used to identify the restarting router. That way, just reusing the same Grace-LSA for all interfaces doesn't work. Fix this by generating a new Grace-LSA with its age manually set to MaxAge whenever one needs to be flushed. This will allow the "IP interface address" TLV to be set correctly and make GR work even in the presence of multiple broadcast interfaces. In the long term, the opaque LSA infrastructure should be updated to support Type-9 link-local LSAs correctly so that we don't need to resort to hacks like this. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | ospfd: use ospf_get_name() wherever possibleRenato Westphal2021-10-101-3/+3
|/ | | | | | Small cleanup to reduce code duplication. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ospfd: introduce support for Graceful Restart (restarting mode)Renato Westphal2021-07-051-0/+824
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>