mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-30 12:01:43 +00:00
Merge pull request #13404 from louis-6wind/fix-flex-algo-race-condition
isisd: fix a flex algo race condition and a minor fix
This commit is contained in:
commit
b9f0c8c8d0
@ -1191,8 +1191,11 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
|
|||||||
rcap_fad = NULL;
|
rcap_fad = NULL;
|
||||||
|
|
||||||
if (!isis_flex_algo_elected_supported_local_fad(
|
if (!isis_flex_algo_elected_supported_local_fad(
|
||||||
fa->algorithm, area, &rcap_fad))
|
fa->algorithm, area, &rcap_fad)) {
|
||||||
|
fa->state = false;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
fa->state = true;
|
||||||
lsp_debug("ISIS (%s): SR Algorithm %u",
|
lsp_debug("ISIS (%s): SR Algorithm %u",
|
||||||
area->area_tag, fa->algorithm);
|
area->area_tag, fa->algorithm);
|
||||||
rcap->algo[fa->algorithm] = fa->algorithm;
|
rcap->algo[fa->algorithm] = fa->algorithm;
|
||||||
|
@ -1886,8 +1886,8 @@ void isis_run_spf(struct isis_spftree *spftree)
|
|||||||
* Flexible-Algorithm.
|
* Flexible-Algorithm.
|
||||||
*/
|
*/
|
||||||
if (flex_algo_id_valid(spftree->algorithm) &&
|
if (flex_algo_id_valid(spftree->algorithm) &&
|
||||||
!isis_flex_algo_elected_supported(spftree->algorithm,
|
!flex_algo_get_state(spftree->area->flex_algos,
|
||||||
spftree->area)) {
|
spftree->algorithm)) {
|
||||||
if (!CHECK_FLAG(spftree->flags, F_SPFTREE_DISABLED)) {
|
if (!CHECK_FLAG(spftree->flags, F_SPFTREE_DISABLED)) {
|
||||||
isis_spftree_clear(spftree);
|
isis_spftree_clear(spftree);
|
||||||
SET_FLAG(spftree->flags, F_SPFTREE_DISABLED);
|
SET_FLAG(spftree->flags, F_SPFTREE_DISABLED);
|
||||||
|
@ -79,6 +79,12 @@ bool flex_algo_definition_cmp(struct flex_algo *fa1, struct flex_algo *fa2)
|
|||||||
return false;
|
return false;
|
||||||
if (fa1->metric_type != fa2->metric_type)
|
if (fa1->metric_type != fa2->metric_type)
|
||||||
return false;
|
return false;
|
||||||
|
if (fa1->exclude_srlg != fa2->exclude_srlg)
|
||||||
|
return false;
|
||||||
|
if (fa1->flags != fa2->flags)
|
||||||
|
return false;
|
||||||
|
if (fa1->unsupported_subtlv != fa2->unsupported_subtlv)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!admin_group_cmp(&fa1->admin_group_exclude_any,
|
if (!admin_group_cmp(&fa1->admin_group_exclude_any,
|
||||||
&fa2->admin_group_exclude_any))
|
&fa2->admin_group_exclude_any))
|
||||||
@ -140,3 +146,24 @@ char *flex_algo_metric_type_print(char *type_str, size_t sz,
|
|||||||
}
|
}
|
||||||
return type_str;
|
return type_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool flex_algo_get_state(struct flex_algos *flex_algos, uint8_t algorithm)
|
||||||
|
{
|
||||||
|
struct flex_algo *fa = flex_algo_lookup(flex_algos, algorithm);
|
||||||
|
|
||||||
|
if (!fa)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return fa->state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void flex_algo_set_state(struct flex_algos *flex_algos, uint8_t algorithm,
|
||||||
|
bool state)
|
||||||
|
{
|
||||||
|
struct flex_algo *fa = flex_algo_lookup(flex_algos, algorithm);
|
||||||
|
|
||||||
|
if (!fa)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fa->state = state;
|
||||||
|
}
|
||||||
|
@ -83,6 +83,11 @@ struct flex_algo {
|
|||||||
#define FLEX_ALGO_IP 0x04
|
#define FLEX_ALGO_IP 0x04
|
||||||
uint8_t dataplanes;
|
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
|
* This property can be freely extended among different routing
|
||||||
* protocols. Since Flex-Algo is an IGP protocol agnostic, both IS-IS
|
* protocols. Since Flex-Algo is an IGP protocol agnostic, both IS-IS
|
||||||
@ -118,4 +123,8 @@ bool flex_algo_id_valid(uint16_t algorithm);
|
|||||||
char *flex_algo_metric_type_print(char *type_str, size_t sz,
|
char *flex_algo_metric_type_print(char *type_str, size_t sz,
|
||||||
enum flex_algo_metric_type metric_type);
|
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 */
|
#endif /* _FRR_FLEX_ALGO_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user