mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-28 15:05:03 +00:00

A particular flex-algo algorithm may remain in disabled state after configuring it if its flex-algo definition is being spread in the area. It happens sometimes that, in isis_sr_flex_algo_topo1 topotest, r3 flex-algo 203 is disabled on test8. It depends on the following sequence on r3: 1. a LSP containing the flex-algo 203 definition is received from either r1 or r2 (or both). 2. the local LSP is rebuilt by lsp_build() because of the flex-algo 203 configuration 3. isis_run_spf() recomputes the algo 203 SPF tree A 1. 2. 3. sequence results in a working test whereas 2. 1. 3. is not working. The second case issue is because of an inconsistent flex-algo definition state between the following: - in lsp_build(), isis_flex_algo_elected_supported_local_fad() returns false because no flex-algo definition is known. - in isis_run_spf(), isis_flex_algo_elected_supported() returns true because a flex-algo definition is found. Set a flex-algo state lsp_build() depending on flex-algo definition existence that is used later in isis_run_spf(). Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
131 lines
3.5 KiB
C
131 lines
3.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*********************************************************************
|
|
* Copyright 2022 Hiroki Shirokura, LINE Corporation
|
|
* Copyright 2022 Masakazu Asama
|
|
* Copyright 2022 6WIND S.A.
|
|
*
|
|
* flex_algo.h: Flexible Algorithm library
|
|
*
|
|
* Authors
|
|
* -------
|
|
* Hiroki Shirokura
|
|
* Masakazu Asama
|
|
* Louis Scalbert
|
|
*/
|
|
|
|
#ifndef _FRR_FLEX_ALGO_H
|
|
#define _FRR_FLEX_ALGO_H
|
|
|
|
#include "admin_group.h"
|
|
#include "linklist.h"
|
|
#include "prefix.h"
|
|
#include "segment_routing.h"
|
|
|
|
#define FLEX_ALGO_PRIO_DEFAULT 128
|
|
|
|
#define CALC_TYPE_SPF 0
|
|
|
|
/* flex-algo definition flags */
|
|
|
|
/* M-flag (aka. prefix-metric)
|
|
* Flex-Algorithm specific prefix and ASBR metric MUST be used
|
|
*/
|
|
#define FAD_FLAG_M 0x80
|
|
|
|
/*
|
|
* Metric Type values from RFC9350 section 5.1
|
|
*/
|
|
enum flex_algo_metric_type {
|
|
MT_IGP = 0,
|
|
MT_MIN_UNI_LINK_DELAY = 1,
|
|
MT_TE_DEFAULT = 2,
|
|
};
|
|
|
|
|
|
/* Flex-Algo data about a given algorithm.
|
|
* It includes the definition and some local data.
|
|
*/
|
|
struct flex_algo {
|
|
/* Flex-Algo definition */
|
|
uint8_t algorithm;
|
|
enum flex_algo_metric_type metric_type;
|
|
uint8_t calc_type;
|
|
uint8_t priority;
|
|
uint8_t flags;
|
|
|
|
/* extended admin-groups */
|
|
struct admin_group admin_group_exclude_any;
|
|
struct admin_group admin_group_include_any;
|
|
struct admin_group admin_group_include_all;
|
|
|
|
/* Exclude SRLG Sub-TLV is not yet supported by IS-IS
|
|
* True if a Exclude SRLG Sub-TLV has been found
|
|
*/
|
|
bool exclude_srlg;
|
|
|
|
/* True if an unsupported sub-TLV other Exclude SRLG
|
|
* has been received.
|
|
* A router that receives an unsupported definition
|
|
* that is elected must not participate in the algorithm.
|
|
* This boolean prevents future sub-TLV from being considered
|
|
* as supported.
|
|
*/
|
|
bool unsupported_subtlv;
|
|
|
|
/* Flex-Algo local data */
|
|
|
|
/* True if the local definition must be advertised */
|
|
bool advertise_definition;
|
|
|
|
/* which dataplane must be used for the algorithm */
|
|
#define FLEX_ALGO_SR_MPLS 0x01
|
|
#define FLEX_ALGO_SRV6 0x02
|
|
#define FLEX_ALGO_IP 0x04
|
|
uint8_t dataplanes;
|
|
|
|
/* True if the Algorithm is locally enabled (ie. a definition has been
|
|
* found and is supported).
|
|
*/
|
|
bool state;
|
|
|
|
/*
|
|
* This property can be freely extended among different routing
|
|
* protocols. Since Flex-Algo is an IGP protocol agnostic, both IS-IS
|
|
* and OSPF can implement Flex-Algo. The struct flex_algo thus provides
|
|
* the general data structure of Flex-Algo, and the value of extending
|
|
* it with the IGP protocol is provided by this property.
|
|
*/
|
|
void *data;
|
|
};
|
|
|
|
typedef void *(*flex_algo_allocator_t)(void *);
|
|
typedef void (*flex_algo_releaser_t)(void *);
|
|
|
|
struct flex_algos {
|
|
flex_algo_allocator_t allocator;
|
|
flex_algo_releaser_t releaser;
|
|
struct list *flex_algos;
|
|
};
|
|
|
|
/*
|
|
* Flex-Algo Utilities
|
|
*/
|
|
struct flex_algos *flex_algos_alloc(flex_algo_allocator_t allocator,
|
|
flex_algo_releaser_t releaser);
|
|
struct flex_algo *flex_algo_alloc(struct flex_algos *flex_algos,
|
|
uint8_t algorithm, void *arg);
|
|
struct flex_algo *flex_algo_lookup(struct flex_algos *flex_algos,
|
|
uint8_t algorithm);
|
|
void flex_algos_free(struct flex_algos *flex_algos);
|
|
bool flex_algo_definition_cmp(struct flex_algo *fa1, struct flex_algo *fa2);
|
|
void flex_algo_delete(struct flex_algos *flex_algos, uint8_t algorithm);
|
|
bool flex_algo_id_valid(uint16_t algorithm);
|
|
char *flex_algo_metric_type_print(char *type_str, size_t sz,
|
|
enum flex_algo_metric_type metric_type);
|
|
|
|
bool flex_algo_get_state(struct flex_algos *flex_algos, uint8_t algorithm);
|
|
|
|
void flex_algo_set_state(struct flex_algos *flex_algos, uint8_t algorithm,
|
|
bool state);
|
|
#endif /* _FRR_FLEX_ALGO_H */
|