ospf6d: implement instance shutdown command#21925
Conversation
Greptile SummaryThis PR implements an administrative
Confidence Score: 5/5The change is safe to merge; the shutdown/re-enable paths are properly guarded against double-invocation, the grace-period timer is cancelled immediately after Grace-LSA flooding, and the hello-delay timer is cleaned up by the existing interface-disable path. The core ospf6_shutdown() logic correctly sequences GR setup, Grace-LSA flooding, timer cancellation, area disable, and DB clear. The no-shutdown path properly re-enables areas and reoriginates redistributed routes. The only finding is a wrong RFC number in a code comment, which has no runtime effect. ospf6d/ospf6_top.c — the RFC citation in the GR shutdown comment should reference RFC 5187 (OSPFv3) rather than RFC 3623 (OSPFv2). Important Files Changed
Sequence DiagramsequenceDiagram
participant Op as Operator
participant R1 as R1 (ospf6d)
participant R2 as R2 (helper)
participant R3 as R3 (helper)
Op->>R1: shutdown (with graceful-restart)
R1->>R1: ospf6_gr_restart_enter(SWITCH_CONTROL_PROCESSOR)
R1-->>R2: Grace-LSA (raw socket, allspfrouters6)
R1-->>R3: Grace-LSA (raw socket, allspfrouters6)
R1->>R1: "cancel t_grace_period, restart_in_progress=false"
R1->>R1: ospf6_area_disable() → adjacencies drop
R1->>R1: ospf6_db_clear()
R2->>R2: Enter helper mode (forward R1 routes)
R3->>R3: Enter helper mode (forward R1 routes)
Op->>R1: no shutdown
R1->>R1: ospf6_area_enable()
R1->>R1: reoriginate AS-External LSAs
R1-->>R2: Hello → Full adjacency
R1-->>R3: Hello → Full adjacency
R2->>R2: Exit helper mode
R3->>R3: Exit helper mode
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
ospf6d/ospf6_top.c:248-254
The code comment cites RFC 3623, which is the OSPFv2 Graceful Restart specification. The OSPFv3 equivalent is RFC 5187; Section 4 of that RFC covers unplanned outages and the procedure of flooding Grace-LSAs before the instance goes down.
```suggestion
/*
* RFC 5187 - Section 4 ("Unplanned Outages"):
* "The grace-LSAs are encapsulated in Link State Update
* Packets and sent out to all interfaces, even though
* the restarted router has no adjacencies and no
* knowledge of previous adjacencies".
*/
```
Reviews (2): Last reviewed commit: "doc: OSPFv2 and OSPFv3 shutdown command" | Re-trigger Greptile |
Add new command to shut down the OSPFv3 instance while still retaining its configuration. It also triggers the OSPFv3 graceful restart if configured. Rename the definition `OSPF_GR_SWITCH_REDUNDANT_CARD` to `OSPF_GR_SWITCH_CONTROL_PROCESSOR` to match the RFC 3623 specification. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Test the new OSPFv3 shutdown feature. The topology tests the following cases: 1. Regular OSPFv3 instance shutdown 2. OSPFv3 instance shutdown with graceful restart The difference between the cases is that when graceful restart is enabled the OSPFv3 instance sends a grace LSA in all OSPF enabled interfaces so the helper routers keep the routes until the instance is not shutdown anymore. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Document the new OSPFv2 and OSPFv3 shutdown commands. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This is a continuation of #21759.
Add new command to shut down the OSPFv3 instance while still retaining its configuration. It also triggers the OSPFv3 graceful restart if configured.
Also add the missing documentation for the OSPFv2 shutdown.