frr/ospfd/ospf_flood.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

82 lines
3.2 KiB
C
Raw Normal View History

// SPDX-License-Identifier: GPL-2.0-or-later
2002-12-13 21:15:29 +01:00
/*
* OSPF Flooding -- RFC2328 Section 13.
* Copyright (C) 1999, 2000 Toshiaki Takada
*/
#ifndef _ZEBRA_OSPF_FLOOD_H
#define _ZEBRA_OSPF_FLOOD_H
2002-12-13 21:15:29 +01:00
ospfd: Improve OSPF neighbor retransmission list granularity and precision The current OSPF neighbor retransmission operates on a single per-neighbor periodic timer that sends all LSAs on the list when it expires. Additionally, since it skips the first retransmission of received LSAs so that at least the retransmission interval (resulting in a delay of between the retransmission interval and twice the interval. In environments where the links are lossy on P2MP networks with "delay-reflood" configured (which relies on neighbor retransmission in partial meshs), the implementation is sub-optimal (to say the least). This commit reimplements OSPF neighbor retransmission as follows: 1. A new data structure making use the application managed typesafe.h doubly linked list implements an OSPF LSA list where each node includes a timestamp. 2. The existing neighbor LS retransmission LSDB data structure is augmented with a pointer to the list node on the LSA list to faciliate O(1) removal when the LSA is acknowledged. 3. The neighbor LS retransmission timer is set to the expiration timer of the LSA at the top of the list. 4. When the timer expires, LSAs are retransmitted that within the window of the current time and a small delta (50 milli-secs default). The LSAs that are retransmited are given an updated retransmission time and moved to the end of the LSA list. 5. Configuration is added to set the "retransmission-window" to a value other than 50 milliseconds. 6. Neighbor and interface LSA retransmission counters are added to provide insight into the lossiness of the links. However, these will increment quickly on non-fully meshed P2MP networks with "delay-reflood" configured. 7. Added a topotest to exercise the implementation on a non-fully meshed P2MP network with "delay-reflood" configured. The alternative was to use existing mechanisms to instroduce loss but these seem less determistic in a topotest. Signed-off-by: Acee Lindem <acee@lindem.com>
2024-05-31 16:08:04 +02:00
/*
* OSPF Temporal LSA List
*/
PREDECL_DLIST(ospf_lsa_list);
struct ospf_lsa_list_entry {
/* Linkage for LSA List */
struct ospf_lsa_list_item list_linkage;
/*
* Time associated with the list entry. For example, for a neigbhor
* link retransmission list, this is the retransmission time.
*/
struct timeval list_entry_time;
struct ospf_lsa *lsa;
};
DECLARE_DLIST(ospf_lsa_list, struct ospf_lsa_list_entry, list_linkage);
extern int ospf_flood(struct ospf *, struct ospf_neighbor *, struct ospf_lsa *,
struct ospf_lsa *);
extern int ospf_flood_through(struct ospf *, struct ospf_neighbor *,
struct ospf_lsa *);
extern int ospf_flood_through_area(struct ospf_area *, struct ospf_neighbor *,
struct ospf_lsa *);
extern int ospf_flood_through_as(struct ospf *, struct ospf_neighbor *,
struct ospf_lsa *);
ospfd: introduce support for Graceful Restart (restarting mode) 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-05-31 15:27:51 +02:00
extern int ospf_flood_through_interface(struct ospf_interface *oi,
struct ospf_neighbor *inbr,
struct ospf_lsa *lsa);
2002-12-13 21:15:29 +01:00
extern unsigned long ospf_ls_request_count(struct ospf_neighbor *);
extern int ospf_ls_request_isempty(struct ospf_neighbor *);
extern struct ospf_lsa *ospf_ls_request_new(struct lsa_header *);
extern void ospf_ls_request_free(struct ospf_lsa *);
extern void ospf_ls_request_add(struct ospf_neighbor *, struct ospf_lsa *);
extern void ospf_ls_request_delete(struct ospf_neighbor *, struct ospf_lsa *);
extern void ospf_ls_request_delete_all(struct ospf_neighbor *);
extern struct ospf_lsa *ospf_ls_request_lookup(struct ospf_neighbor *,
struct ospf_lsa *);
2002-12-13 21:15:29 +01:00
extern unsigned long ospf_ls_retransmit_count(struct ospf_neighbor *);
extern unsigned long ospf_ls_retransmit_count_self(struct ospf_neighbor *, int);
extern int ospf_ls_retransmit_isempty(struct ospf_neighbor *);
extern void ospf_ls_retransmit_add(struct ospf_neighbor *, struct ospf_lsa *);
extern void ospf_ls_retransmit_delete(struct ospf_neighbor *,
struct ospf_lsa *);
extern void ospf_ls_retransmit_clear(struct ospf_neighbor *);
ospfd: Improve OSPF neighbor retransmission list granularity and precision The current OSPF neighbor retransmission operates on a single per-neighbor periodic timer that sends all LSAs on the list when it expires. Additionally, since it skips the first retransmission of received LSAs so that at least the retransmission interval (resulting in a delay of between the retransmission interval and twice the interval. In environments where the links are lossy on P2MP networks with "delay-reflood" configured (which relies on neighbor retransmission in partial meshs), the implementation is sub-optimal (to say the least). This commit reimplements OSPF neighbor retransmission as follows: 1. A new data structure making use the application managed typesafe.h doubly linked list implements an OSPF LSA list where each node includes a timestamp. 2. The existing neighbor LS retransmission LSDB data structure is augmented with a pointer to the list node on the LSA list to faciliate O(1) removal when the LSA is acknowledged. 3. The neighbor LS retransmission timer is set to the expiration timer of the LSA at the top of the list. 4. When the timer expires, LSAs are retransmitted that within the window of the current time and a small delta (50 milli-secs default). The LSAs that are retransmited are given an updated retransmission time and moved to the end of the LSA list. 5. Configuration is added to set the "retransmission-window" to a value other than 50 milliseconds. 6. Neighbor and interface LSA retransmission counters are added to provide insight into the lossiness of the links. However, these will increment quickly on non-fully meshed P2MP networks with "delay-reflood" configured. 7. Added a topotest to exercise the implementation on a non-fully meshed P2MP network with "delay-reflood" configured. The alternative was to use existing mechanisms to instroduce loss but these seem less determistic in a topotest. Signed-off-by: Acee Lindem <acee@lindem.com>
2024-05-31 16:08:04 +02:00
extern void ospf_ls_retransmit_set_timer(struct ospf_neighbor *nbr);
extern struct ospf_lsa *ospf_ls_retransmit_lookup(struct ospf_neighbor *,
struct ospf_lsa *);
extern void ospf_ls_retransmit_delete_nbr_area(struct ospf_area *,
struct ospf_lsa *);
extern void ospf_ls_retransmit_delete_nbr_as(struct ospf *, struct ospf_lsa *);
extern void ospf_ls_retransmit_add_nbr_all(struct ospf_interface *,
2002-12-13 21:15:29 +01:00
struct ospf_lsa *);
extern void ospf_flood_lsa_area(struct ospf_lsa *, struct ospf_area *);
extern void ospf_flood_lsa_as(struct ospf_lsa *);
extern void ospf_lsa_flush_area(struct ospf_lsa *, struct ospf_area *);
extern void ospf_lsa_flush_as(struct ospf *, struct ospf_lsa *);
extern void ospf_lsa_flush(struct ospf *, struct ospf_lsa *);
extern struct external_info *ospf_external_info_check(struct ospf *,
struct ospf_lsa *);
2002-12-13 21:15:29 +01:00
extern void ospf_lsdb_init(struct ospf_lsdb *);
extern void ospf_area_update_fr_state(struct ospf_area *area);
extern void ospf_refresh_dna_type5_and_type7_lsas(struct ospf *ospf);
2002-12-13 21:15:29 +01:00
#endif /* _ZEBRA_OSPF_FLOOD_H */