summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_message.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2021-07-02 13:01:32 -0300
committerRenato Westphal <renato@opensourcerouting.org>2021-09-16 12:26:48 -0300
commit711650980337fad6f70fd1e3bc17bf21428b7a62 (patch)
tree0440d27c923db83330c8135337b130104c44bc6a /ospf6d/ospf6_message.c
parent1a898463a3a496ae1fa70562ea7addec9a435e49 (diff)
ospf6d: introduce support for Graceful Restart (restarting mode)
RFC 5187 specifies the Graceful Restart enhancement to the OSPFv3 routing protocol. This commit implements support for the GR restarting mode. 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 ipv6 ospf` EXEC-level command needs to be issued before restarting the ospf6d 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 ospf6d 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. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_message.c')
-rw-r--r--ospf6d/ospf6_message.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index 3dcc74589a..53f3c3468a 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -553,6 +553,21 @@ static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst,
return;
}
+ /*
+ * RFC 3623 - Section 2:
+ * "If the restarting router determines that it was the Designated
+ * Router on a given segment prior to the restart, it elects
+ * itself as the Designated Router again. The restarting router
+ * knows that it was the Designated Router if, while the
+ * associated interface is in Waiting state, a Hello packet is
+ * received from a neighbor listing the router as the Designated
+ * Router".
+ */
+ if (oi->area->ospf6->gr_info.restart_in_progress
+ && oi->state == OSPF6_INTERFACE_WAITING
+ && hello->drouter == oi->area->ospf6->router_id)
+ oi->drouter = hello->drouter;
+
/* Schedule interface events */
if (backupseen)
thread_add_event(master, backup_seen, oi, 0, NULL);