1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * This is an implementation of RFC 3623 Graceful OSPF Restart.
5 * Copyright 2021 NetDEF (c), All rights reserved.
6 * Copyright 2020 6WIND (c), All rights reserved.
18 #include "ospfd/ospfd.h"
19 #include "ospfd/ospf_abr.h"
20 #include "ospfd/ospf_flood.h"
21 #include "ospfd/ospf_ism.h"
22 #include "ospfd/ospf_interface.h"
23 #include "ospfd/ospf_asbr.h"
24 #include "ospfd/ospf_lsa.h"
25 #include "ospfd/ospf_route.h"
26 #include "ospfd/ospf_zebra.h"
27 #include "ospfd/ospf_lsdb.h"
28 #include "ospfd/ospf_neighbor.h"
29 #include "ospfd/ospf_opaque.h"
30 #include "ospfd/ospf_nsm.h"
31 #include "ospfd/ospf_gr.h"
32 #include "ospfd/ospf_errors.h"
33 #include "ospfd/ospf_dump.h"
34 #include "ospfd/ospf_gr_clippy.c"
36 static void ospf_gr_nvm_delete(struct ospf
*ospf
);
38 /* Lookup self-originated Grace-LSA in the LSDB. */
39 static struct ospf_lsa
*ospf_gr_lsa_lookup(struct ospf
*ospf
,
40 struct ospf_area
*area
)
43 struct in_addr lsa_id
;
44 uint32_t lsa_id_host_byte_order
;
46 lsa_id_host_byte_order
= SET_OPAQUE_LSID(OPAQUE_TYPE_GRACE_LSA
, 0);
47 lsa_id
.s_addr
= htonl(lsa_id_host_byte_order
);
48 lsa
= ospf_lsa_lookup(ospf
, area
, OSPF_OPAQUE_LINK_LSA
, lsa_id
,
54 /* Fill in fields of the Grace-LSA that is being originated. */
55 static void ospf_gr_lsa_body_set(struct ospf_gr_info
*gr_info
,
56 struct ospf_interface
*oi
, struct stream
*s
)
58 struct grace_tlv_graceperiod tlv_period
= {};
59 struct grace_tlv_restart_reason tlv_reason
= {};
60 struct grace_tlv_restart_addr tlv_address
= {};
62 /* Put grace period. */
63 tlv_period
.header
.type
= htons(GRACE_PERIOD_TYPE
);
64 tlv_period
.header
.length
= htons(GRACE_PERIOD_LENGTH
);
65 tlv_period
.interval
= htonl(gr_info
->grace_period
);
66 stream_put(s
, &tlv_period
, sizeof(tlv_period
));
68 /* Put restart reason. */
69 tlv_reason
.header
.type
= htons(RESTART_REASON_TYPE
);
70 tlv_reason
.header
.length
= htons(RESTART_REASON_LENGTH
);
71 if (gr_info
->restart_support
)
72 tlv_reason
.reason
= OSPF_GR_SW_RESTART
;
74 tlv_reason
.reason
= OSPF_GR_UNKNOWN_RESTART
;
75 stream_put(s
, &tlv_reason
, sizeof(tlv_reason
));
78 if (oi
->type
== OSPF_IFTYPE_BROADCAST
|| oi
->type
== OSPF_IFTYPE_NBMA
79 || oi
->type
== OSPF_IFTYPE_POINTOMULTIPOINT
) {
80 tlv_address
.header
.type
= htons(RESTARTER_IP_ADDR_TYPE
);
81 tlv_address
.header
.length
= htons(RESTARTER_IP_ADDR_LEN
);
82 tlv_address
.addr
= oi
->address
->u
.prefix4
;
83 stream_put(s
, &tlv_address
, sizeof(tlv_address
));
87 /* Generate Grace-LSA for a given interface. */
88 static struct ospf_lsa
*ospf_gr_lsa_new(struct ospf_interface
*oi
)
91 struct lsa_header
*lsah
;
93 uint8_t options
, lsa_type
;
94 struct in_addr lsa_id
;
95 uint32_t lsa_id_host_byte_order
;
98 /* Create a stream for LSA. */
99 s
= stream_new(OSPF_MAX_LSA_SIZE
);
101 lsah
= (struct lsa_header
*)STREAM_DATA(s
);
103 options
= LSA_OPTIONS_GET(oi
->area
);
104 options
|= LSA_OPTIONS_NSSA_GET(oi
->area
);
105 options
|= OSPF_OPTION_O
;
107 lsa_type
= OSPF_OPAQUE_LINK_LSA
;
108 lsa_id_host_byte_order
= SET_OPAQUE_LSID(OPAQUE_TYPE_GRACE_LSA
, 0);
109 lsa_id
.s_addr
= htonl(lsa_id_host_byte_order
);
111 /* Set opaque-LSA header fields. */
112 lsa_header_set(s
, options
, lsa_type
, lsa_id
, oi
->ospf
->router_id
);
114 /* Set opaque-LSA body fields. */
115 ospf_gr_lsa_body_set(&oi
->ospf
->gr_info
, oi
, s
);
118 length
= stream_get_endp(s
);
119 lsah
->length
= htons(length
);
121 /* Now, create an OSPF LSA instance. */
122 new = ospf_lsa_new_and_data(length
);
124 if (IS_DEBUG_OSPF_GR
)
125 zlog_debug("LSA[Type%d:%pI4]: Create an Opaque-LSA/GR instance",
128 new->area
= oi
->area
;
130 SET_FLAG(new->flags
, OSPF_LSA_SELF
);
131 memcpy(new->data
, lsah
, length
);
137 /* Originate and install Grace-LSA for a given interface. */
138 static void ospf_gr_lsa_originate(struct ospf_interface
*oi
, bool maxage
)
140 struct ospf_lsa
*lsa
, *old
;
142 if (ospf_interface_neighbor_count(oi
) == 0)
145 /* Create new Grace-LSA. */
146 lsa
= ospf_gr_lsa_new(oi
);
148 zlog_warn("%s: ospf_gr_lsa_new() failed", __func__
);
153 lsa
->data
->ls_age
= htons(OSPF_LSA_MAXAGE
);
155 /* Find the old LSA and increase the seqno. */
156 old
= ospf_gr_lsa_lookup(oi
->ospf
, oi
->area
);
158 lsa
->data
->ls_seqnum
= lsa_seqnum_increment(old
);
160 /* Install this LSA into LSDB. */
161 if (ospf_lsa_install(oi
->ospf
, oi
, lsa
) == NULL
) {
162 zlog_warn("%s: ospf_lsa_install() failed", __func__
);
163 ospf_lsa_unlock(&lsa
);
167 /* Update new LSA origination count. */
168 oi
->ospf
->lsa_originate_count
++;
170 /* Flood the LSA through out the interface */
171 ospf_flood_through_interface(oi
, NULL
, lsa
);
174 /* Flush all self-originated Grace-LSAs. */
175 static void ospf_gr_flush_grace_lsas(struct ospf
*ospf
)
177 struct ospf_area
*area
;
178 struct listnode
*anode
;
180 for (ALL_LIST_ELEMENTS_RO(ospf
->areas
, anode
, area
)) {
181 struct ospf_interface
*oi
;
182 struct listnode
*inode
;
184 if (IS_DEBUG_OSPF_GR
)
186 "GR: flushing self-originated Grace-LSAs [area %pI4]",
189 for (ALL_LIST_ELEMENTS_RO(area
->oiflist
, inode
, oi
))
190 ospf_gr_lsa_originate(oi
, true);
194 /* Exit from the Graceful Restart mode. */
195 static void ospf_gr_restart_exit(struct ospf
*ospf
, const char *reason
)
197 struct ospf_area
*area
;
198 struct listnode
*onode
, *anode
;
200 if (IS_DEBUG_OSPF_GR
)
201 zlog_debug("GR: exiting graceful restart: %s", reason
);
203 ospf
->gr_info
.restart_in_progress
= false;
204 THREAD_OFF(ospf
->gr_info
.t_grace_period
);
206 /* Record in non-volatile memory that the restart is complete. */
207 ospf_gr_nvm_delete(ospf
);
209 for (ALL_LIST_ELEMENTS_RO(ospf
->areas
, onode
, area
)) {
210 struct ospf_interface
*oi
;
213 * 1) The router should reoriginate its router-LSAs for all
214 * attached areas in order to make sure they have the correct
217 ospf_router_lsa_update_area(area
);
220 * 2) The router should reoriginate network-LSAs on all segments
221 * where it is the Designated Router.
223 for (ALL_LIST_ELEMENTS_RO(area
->oiflist
, anode
, oi
))
224 if (oi
->state
== ISM_DR
)
225 ospf_network_lsa_update(oi
);
229 * 5) Any received self-originated LSAs that are no longer valid should
232 ospf_schedule_abr_task(ospf
);
235 * 3) The router reruns its OSPF routing calculations, this time
236 * installing the results into the system forwarding table, and
237 * originating summary-LSAs, Type-7 LSAs and AS-external-LSAs as
240 * 4) Any remnant entries in the system forwarding table that were
241 * installed before the restart, but that are no longer valid,
244 ospf
->gr_info
.finishing_restart
= true;
245 ospf_spf_calculate_schedule(ospf
, SPF_FLAG_GR_FINISH
);
247 /* 6) Any grace-LSAs that the router originated should be flushed. */
248 ospf_gr_flush_grace_lsas(ospf
);
251 /* Check if a Router-LSA contains a given link. */
252 static bool ospf_router_lsa_contains_adj(struct ospf_lsa
*lsa
,
255 struct router_lsa
*rl
;
257 rl
= (struct router_lsa
*)lsa
->data
;
258 for (int i
= 0; i
< ntohs(rl
->links
); i
++) {
259 struct in_addr
*link_id
= &rl
->link
[i
].link_id
;
261 if (rl
->link
[i
].type
!= LSA_LINK_TYPE_POINTOPOINT
)
264 if (IPV4_ADDR_SAME(id
, link_id
))
271 static bool ospf_gr_check_router_lsa_consistency(struct ospf
*ospf
,
272 struct ospf_area
*area
,
273 struct ospf_lsa
*lsa
)
275 if (CHECK_FLAG(lsa
->flags
, OSPF_LSA_SELF
)) {
276 struct ospf_lsa
*lsa_self
= lsa
;
277 struct router_lsa
*rl
= (struct router_lsa
*)lsa
->data
;
279 for (int i
= 0; i
< ntohs(rl
->links
); i
++) {
280 struct in_addr
*link_id
= &rl
->link
[i
].link_id
;
281 struct ospf_lsa
*lsa_adj
;
283 if (rl
->link
[i
].type
!= LSA_LINK_TYPE_POINTOPOINT
)
286 lsa_adj
= ospf_lsa_lookup_by_id(area
, OSPF_ROUTER_LSA
,
291 if (!ospf_router_lsa_contains_adj(lsa_adj
,
292 &lsa_self
->data
->id
))
296 struct ospf_lsa
*lsa_self
;
298 lsa_self
= ospf_lsa_lookup_by_id(area
, OSPF_ROUTER_LSA
,
301 || !CHECK_FLAG(lsa_self
->flags
, OSPF_LSA_RECEIVED
))
304 if (ospf_router_lsa_contains_adj(lsa
, &ospf
->router_id
)
305 != ospf_router_lsa_contains_adj(lsa_self
, &lsa
->data
->id
))
313 * Check for LSAs that are inconsistent with the pre-restart LSAs, and abort the
314 * ongoing graceful restart when that's the case.
316 void ospf_gr_check_lsdb_consistency(struct ospf
*ospf
, struct ospf_area
*area
)
318 struct route_node
*rn
;
319 struct ospf_lsa
*lsa
;
321 for (rn
= route_top(ROUTER_LSDB(area
)); rn
; rn
= route_next(rn
)) {
326 if (!ospf_gr_check_router_lsa_consistency(ospf
, area
, lsa
)) {
329 snprintfrr(reason
, sizeof(reason
),
330 "detected inconsistent LSA[%s] [area %pI4]",
331 dump_lsa_key(lsa
), &area
->area_id
);
332 ospf_gr_restart_exit(ospf
, reason
);
333 route_unlock_node(rn
);
339 /* Lookup neighbor by address in a given OSPF area. */
340 static struct ospf_neighbor
*
341 ospf_area_nbr_lookup_by_addr(struct ospf_area
*area
, struct in_addr
*addr
)
343 struct ospf_interface
*oi
;
344 struct ospf_neighbor
*nbr
;
345 struct listnode
*node
;
347 for (ALL_LIST_ELEMENTS_RO(area
->oiflist
, node
, oi
)) {
348 nbr
= ospf_nbr_lookup_by_addr(oi
->nbrs
, addr
);
356 /* Lookup neighbor by Router ID in a given OSPF area. */
357 static struct ospf_neighbor
*
358 ospf_area_nbr_lookup_by_routerid(struct ospf_area
*area
, struct in_addr
*id
)
360 struct ospf_interface
*oi
;
361 struct ospf_neighbor
*nbr
;
362 struct listnode
*node
;
364 for (ALL_LIST_ELEMENTS_RO(area
->oiflist
, node
, oi
)) {
365 nbr
= ospf_nbr_lookup_by_routerid(oi
->nbrs
, id
);
373 /* Check if there's a fully formed adjacency with the given neighbor ID. */
374 static bool ospf_gr_check_adj_id(struct ospf_area
*area
,
375 struct in_addr
*nbr_id
)
377 struct ospf_neighbor
*nbr
;
379 nbr
= ospf_area_nbr_lookup_by_routerid(area
, nbr_id
);
380 if (!nbr
|| nbr
->state
< NSM_Full
) {
381 if (IS_DEBUG_OSPF_GR
)
382 zlog_debug("GR: missing adjacency to router %pI4",
390 static bool ospf_gr_check_adjs_lsa_transit(struct ospf_area
*area
,
391 struct in_addr
*link_id
)
393 struct ospf
*ospf
= area
->ospf
;
394 struct ospf_interface
*oi
;
397 * Check if the transit network refers to a local interface (in which
398 * case it must be a DR for that network).
400 oi
= ospf_if_lookup_by_local_addr(ospf
, NULL
, *link_id
);
402 struct ospf_lsa
*lsa
;
403 struct network_lsa
*nlsa
;
406 /* Lookup Network LSA corresponding to this interface. */
407 lsa
= ospf_lsa_lookup_by_id(area
, OSPF_NETWORK_LSA
, *link_id
);
411 /* Iterate over all routers present in the network. */
412 nlsa
= (struct network_lsa
*)lsa
->data
;
413 cnt
= (lsa
->size
- (OSPF_LSA_HEADER_SIZE
+ 4)) / 4;
414 for (size_t i
= 0; i
< cnt
; i
++) {
415 struct in_addr
*nbr_id
= &nlsa
->routers
[i
];
417 /* Skip self in the pseudonode. */
418 if (IPV4_ADDR_SAME(nbr_id
, &ospf
->router_id
))
422 * Check if there's a fully formed adjacency with this
425 if (!ospf_gr_check_adj_id(area
, nbr_id
))
429 struct ospf_neighbor
*nbr
;
431 /* Check if there's a fully formed adjacency with the DR. */
432 nbr
= ospf_area_nbr_lookup_by_addr(area
, link_id
);
433 if (!nbr
|| nbr
->state
< NSM_Full
) {
434 if (IS_DEBUG_OSPF_GR
)
436 "GR: missing adjacency to DR router %pI4",
445 static bool ospf_gr_check_adjs_lsa(struct ospf_area
*area
, struct ospf_lsa
*lsa
)
447 struct router_lsa
*rl
= (struct router_lsa
*)lsa
->data
;
449 for (int i
= 0; i
< ntohs(rl
->links
); i
++) {
450 struct in_addr
*link_id
= &rl
->link
[i
].link_id
;
452 switch (rl
->link
[i
].type
) {
453 case LSA_LINK_TYPE_POINTOPOINT
:
454 if (!ospf_gr_check_adj_id(area
, link_id
))
457 case LSA_LINK_TYPE_TRANSIT
:
458 if (!ospf_gr_check_adjs_lsa_transit(area
, link_id
))
470 * Check if all adjacencies prior to the restart were reestablished.
472 * This is done using pre-restart Router LSAs and pre-restart Network LSAs
473 * received from the helping neighbors.
475 void ospf_gr_check_adjs(struct ospf
*ospf
)
477 struct ospf_area
*area
;
478 struct listnode
*node
;
480 for (ALL_LIST_ELEMENTS_RO(ospf
->areas
, node
, area
)) {
481 struct ospf_lsa
*lsa_self
;
483 lsa_self
= ospf_lsa_lookup_by_id(area
, OSPF_ROUTER_LSA
,
485 if (!lsa_self
|| !ospf_gr_check_adjs_lsa(area
, lsa_self
)) {
486 if (IS_DEBUG_OSPF_GR
)
488 "GR: not all adjacencies were reestablished yet [area %pI4]",
494 ospf_gr_restart_exit(ospf
, "all adjacencies were reestablished");
497 /* Handling of grace period expiry. */
498 static void ospf_gr_grace_period_expired(struct thread
*thread
)
500 struct ospf
*ospf
= THREAD_ARG(thread
);
502 ospf
->gr_info
.t_grace_period
= NULL
;
503 ospf_gr_restart_exit(ospf
, "grace period has expired");
507 * Returns the path of the file (non-volatile memory) that contains GR status
510 static char *ospf_gr_nvm_filepath(struct ospf
*ospf
)
512 static char filepath
[MAXPATHLEN
];
513 char instance
[16] = "";
516 snprintf(instance
, sizeof(instance
), "-%d", ospf
->instance
);
517 snprintf(filepath
, sizeof(filepath
), OSPFD_GR_STATE
, instance
);
522 * Record in non-volatile memory that the given OSPF instance is attempting to
523 * perform a graceful restart.
525 static void ospf_gr_nvm_update(struct ospf
*ospf
)
528 const char *inst_name
;
530 json_object
*json_instances
;
531 json_object
*json_instance
;
533 filepath
= ospf_gr_nvm_filepath(ospf
);
534 inst_name
= ospf_get_name(ospf
);
536 json
= json_object_from_file(filepath
);
538 json
= json_object_new_object();
540 json_object_object_get_ex(json
, "instances", &json_instances
);
541 if (!json_instances
) {
542 json_instances
= json_object_new_object();
543 json_object_object_add(json
, "instances", json_instances
);
546 json_object_object_get_ex(json_instances
, inst_name
, &json_instance
);
547 if (!json_instance
) {
548 json_instance
= json_object_new_object();
549 json_object_object_add(json_instances
, inst_name
,
554 * Record not only the grace period, but also a UNIX timestamp
555 * corresponding to the end of that period. That way, once ospfd is
556 * restarted, it will be possible to take into account the time that
557 * passed while ospfd wasn't running.
559 json_object_int_add(json_instance
, "gracePeriod",
560 ospf
->gr_info
.grace_period
);
561 json_object_int_add(json_instance
, "timestamp",
562 time(NULL
) + ospf
->gr_info
.grace_period
);
564 json_object_to_file_ext(filepath
, json
, JSON_C_TO_STRING_PRETTY
);
565 json_object_free(json
);
569 * Delete GR status information about the given OSPF instance from non-volatile
572 static void ospf_gr_nvm_delete(struct ospf
*ospf
)
575 const char *inst_name
;
577 json_object
*json_instances
;
579 filepath
= ospf_gr_nvm_filepath(ospf
);
580 inst_name
= ospf_get_name(ospf
);
582 json
= json_object_from_file(filepath
);
584 json
= json_object_new_object();
586 json_object_object_get_ex(json
, "instances", &json_instances
);
587 if (!json_instances
) {
588 json_instances
= json_object_new_object();
589 json_object_object_add(json
, "instances", json_instances
);
592 json_object_object_del(json_instances
, inst_name
);
594 json_object_to_file_ext(filepath
, json
, JSON_C_TO_STRING_PRETTY
);
595 json_object_free(json
);
599 * Fetch from non-volatile memory whether the given OSPF instance is performing
600 * a graceful shutdown or not.
602 void ospf_gr_nvm_read(struct ospf
*ospf
)
605 const char *inst_name
;
607 json_object
*json_instances
;
608 json_object
*json_instance
;
609 json_object
*json_timestamp
;
610 time_t timestamp
= 0;
612 filepath
= ospf_gr_nvm_filepath(ospf
);
613 inst_name
= ospf_get_name(ospf
);
615 json
= json_object_from_file(filepath
);
617 json
= json_object_new_object();
619 json_object_object_get_ex(json
, "instances", &json_instances
);
620 if (!json_instances
) {
621 json_instances
= json_object_new_object();
622 json_object_object_add(json
, "instances", json_instances
);
625 json_object_object_get_ex(json_instances
, inst_name
, &json_instance
);
626 if (!json_instance
) {
627 json_instance
= json_object_new_object();
628 json_object_object_add(json_instances
, inst_name
,
632 json_object_object_get_ex(json_instance
, "timestamp", &json_timestamp
);
633 if (json_timestamp
) {
635 unsigned long remaining_time
;
637 /* Check if the grace period has already expired. */
639 timestamp
= json_object_get_int(json_timestamp
);
640 if (now
> timestamp
) {
641 ospf_gr_restart_exit(
642 ospf
, "grace period has expired already");
644 /* Schedule grace period timeout. */
645 ospf
->gr_info
.restart_in_progress
= true;
646 remaining_time
= timestamp
- time(NULL
);
647 if (IS_DEBUG_OSPF_GR
)
649 "GR: remaining time until grace period expires: %lu(s)",
651 thread_add_timer(master
, ospf_gr_grace_period_expired
,
652 ospf
, remaining_time
,
653 &ospf
->gr_info
.t_grace_period
);
657 json_object_object_del(json_instances
, inst_name
);
659 json_object_to_file_ext(filepath
, json
, JSON_C_TO_STRING_PRETTY
);
660 json_object_free(json
);
663 /* Prepare to start a Graceful Restart. */
664 static void ospf_gr_prepare(void)
667 struct ospf_interface
*oi
;
668 struct listnode
*onode
;
670 for (ALL_LIST_ELEMENTS_RO(om
->ospf
, onode
, ospf
)) {
671 struct listnode
*inode
;
673 if (!ospf
->gr_info
.restart_support
674 || ospf
->gr_info
.prepare_in_progress
)
677 if (IS_DEBUG_OSPF_GR
)
679 "GR: preparing to perform a graceful restart [period %u second(s)] [vrf %s]",
680 ospf
->gr_info
.grace_period
,
681 ospf_vrf_id_to_name(ospf
->vrf_id
));
683 if (!CHECK_FLAG(ospf
->config
, OSPF_OPAQUE_CAPABLE
)) {
685 "%s: failed to activate graceful restart: opaque capability not enabled",
690 /* Freeze OSPF routes in the RIB. */
691 if (ospf_zebra_gr_enable(ospf
, ospf
->gr_info
.grace_period
)) {
693 "%s: failed to activate graceful restart: not connected to zebra",
698 /* Send a Grace-LSA to all neighbors. */
699 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, inode
, oi
))
700 ospf_gr_lsa_originate(oi
, false);
702 /* Record end of the grace period in non-volatile memory. */
703 ospf_gr_nvm_update(ospf
);
706 * Mark that a Graceful Restart preparation is in progress, to
707 * prevent ospfd from flushing its self-originated LSAs on exit.
709 ospf
->gr_info
.prepare_in_progress
= true;
713 DEFPY(graceful_restart_prepare
, graceful_restart_prepare_cmd
,
714 "graceful-restart prepare ip ospf",
715 "Graceful Restart commands\n"
716 "Prepare upcoming graceful restart\n"
718 "Prepare to restart the OSPF process\n")
721 struct listnode
*node
;
723 for (ALL_LIST_ELEMENTS_RO(om
->ospf
, node
, ospf
)) {
724 if (!CHECK_FLAG(ospf
->config
, OSPF_OPAQUE_CAPABLE
)) {
726 "%% Can't start graceful restart: opaque capability not enabled (VRF %s)\n\n",
727 ospf_get_name(ospf
));
737 DEFPY(graceful_restart
, graceful_restart_cmd
,
738 "graceful-restart [grace-period (1-1800)$grace_period]",
740 "Maximum length of the 'grace period'\n"
741 "Maximum length of the 'grace period' in seconds\n")
743 VTY_DECLVAR_INSTANCE_CONTEXT(ospf
, ospf
);
745 /* Check and get restart period if present. */
746 if (!grace_period_str
)
747 grace_period
= OSPF_DFLT_GRACE_INTERVAL
;
749 ospf
->gr_info
.restart_support
= true;
750 ospf
->gr_info
.grace_period
= grace_period
;
755 DEFPY(no_graceful_restart
, no_graceful_restart_cmd
,
756 "no graceful-restart [grace-period (1-1800)]",
758 "Maximum length of the 'grace period'\n"
759 "Maximum length of the 'grace period' in seconds\n")
761 VTY_DECLVAR_INSTANCE_CONTEXT(ospf
, ospf
);
763 if (!ospf
->gr_info
.restart_support
)
766 if (ospf
->gr_info
.prepare_in_progress
) {
768 "%% Error: Graceful Restart preparation in progress\n");
772 ospf
->gr_info
.restart_support
= false;
773 ospf
->gr_info
.grace_period
= OSPF_DFLT_GRACE_INTERVAL
;
778 void ospf_gr_init(void)
780 install_element(ENABLE_NODE
, &graceful_restart_prepare_cmd
);
781 install_element(OSPF_NODE
, &graceful_restart_cmd
);
782 install_element(OSPF_NODE
, &no_graceful_restart_cmd
);