mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-28 11:50:21 +00:00
isisd: update struct isis_spftree with algorithm id
The spftree has a new property called algorithm which is id used to identify the algorithm that separates it in the same IGP network. This is used in Flex-Algo. In other cases than Flex-Algo, the algorithm id is always zero. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
e7fd314f06
commit
329f87b310
@ -207,10 +207,10 @@ struct fabricd *fabricd_new(struct isis_area *area)
|
||||
rv->area = area;
|
||||
rv->initial_sync_state = FABRICD_SYNC_PENDING;
|
||||
|
||||
rv->spftree =
|
||||
isis_spftree_new(area, &area->lspdb[IS_LEVEL_2 - 1],
|
||||
area->isis->sysid, ISIS_LEVEL2, SPFTREE_IPV4,
|
||||
SPF_TYPE_FORWARD, F_SPFTREE_HOPCOUNT_METRIC);
|
||||
rv->spftree = isis_spftree_new(
|
||||
area, &area->lspdb[IS_LEVEL_2 - 1], area->isis->sysid,
|
||||
ISIS_LEVEL2, SPFTREE_IPV4, SPF_TYPE_FORWARD,
|
||||
F_SPFTREE_HOPCOUNT_METRIC, SR_ALGORITHM_SPF);
|
||||
rv->neighbors = skiplist_new(0, neighbor_entry_list_cmp,
|
||||
neighbor_entry_del_void);
|
||||
rv->neighbors_neighbors = hash_create(neighbor_entry_hash_key,
|
||||
|
@ -1098,7 +1098,8 @@ struct isis_spftree *isis_spf_reverse_run(const struct isis_spftree *spftree)
|
||||
spftree_reverse = isis_spftree_new(
|
||||
spftree->area, spftree->lspdb, spftree->sysid, spftree->level,
|
||||
spftree->tree_id, SPF_TYPE_REVERSE,
|
||||
F_SPFTREE_NO_ADJACENCIES | F_SPFTREE_NO_ROUTES);
|
||||
F_SPFTREE_NO_ADJACENCIES | F_SPFTREE_NO_ROUTES,
|
||||
SR_ALGORITHM_SPF);
|
||||
isis_run_spf(spftree_reverse);
|
||||
|
||||
return spftree_reverse;
|
||||
@ -1194,7 +1195,8 @@ struct isis_spftree *isis_tilfa_compute(struct isis_area *area,
|
||||
/* Create post-convergence SPF tree. */
|
||||
spftree_pc = isis_spftree_new(area, spftree->lspdb, spftree->sysid,
|
||||
spftree->level, spftree->tree_id,
|
||||
SPF_TYPE_TI_LFA, spftree->flags);
|
||||
SPF_TYPE_TI_LFA, spftree->flags,
|
||||
SR_ALGORITHM_SPF);
|
||||
spftree_pc->lfa.old.spftree = spftree;
|
||||
spftree_pc->lfa.old.spftree_reverse = spftree_reverse;
|
||||
spftree_pc->lfa.protected_resource = *resource;
|
||||
@ -1242,7 +1244,8 @@ int isis_spf_run_neighbors(struct isis_spftree *spftree)
|
||||
adj_node->lfa.spftree = isis_spftree_new(
|
||||
spftree->area, spftree->lspdb, adj_node->sysid,
|
||||
spftree->level, spftree->tree_id, SPF_TYPE_FORWARD,
|
||||
F_SPFTREE_NO_ADJACENCIES | F_SPFTREE_NO_ROUTES);
|
||||
F_SPFTREE_NO_ADJACENCIES | F_SPFTREE_NO_ROUTES,
|
||||
SR_ALGORITHM_SPF);
|
||||
isis_run_spf(adj_node->lfa.spftree);
|
||||
}
|
||||
|
||||
@ -1722,7 +1725,8 @@ struct isis_spftree *isis_rlfa_compute(struct isis_area *area,
|
||||
/* Create post-convergence SPF tree. */
|
||||
spftree_pc = isis_spftree_new(area, spftree->lspdb, spftree->sysid,
|
||||
spftree->level, spftree->tree_id,
|
||||
SPF_TYPE_RLFA, spftree->flags);
|
||||
SPF_TYPE_RLFA, spftree->flags,
|
||||
SR_ALGORITHM_SPF);
|
||||
spftree_pc->lfa.old.spftree = spftree;
|
||||
spftree_pc->lfa.old.spftree_reverse = spftree_reverse;
|
||||
spftree_pc->lfa.remote.max_metric = max_metric;
|
||||
|
@ -322,11 +322,10 @@ static void isis_spf_adj_free(void *arg)
|
||||
XFREE(MTYPE_ISIS_SPF_ADJ, sadj);
|
||||
}
|
||||
|
||||
struct isis_spftree *isis_spftree_new(struct isis_area *area,
|
||||
struct lspdb_head *lspdb,
|
||||
const uint8_t *sysid, int level,
|
||||
enum spf_tree_id tree_id,
|
||||
enum spf_type type, uint8_t flags)
|
||||
struct isis_spftree *
|
||||
isis_spftree_new(struct isis_area *area, struct lspdb_head *lspdb,
|
||||
const uint8_t *sysid, int level, enum spf_tree_id tree_id,
|
||||
enum spf_type type, uint8_t flags, uint8_t algorithm)
|
||||
{
|
||||
struct isis_spftree *tree;
|
||||
|
||||
@ -361,6 +360,7 @@ struct isis_spftree *isis_spftree_new(struct isis_area *area,
|
||||
isis_spf_node_list_init(&tree->lfa.p_space);
|
||||
isis_spf_node_list_init(&tree->lfa.q_space);
|
||||
}
|
||||
tree->algorithm = algorithm;
|
||||
|
||||
return tree;
|
||||
}
|
||||
@ -410,10 +410,10 @@ void spftree_area_init(struct isis_area *area)
|
||||
if (area->spftree[tree][level - 1])
|
||||
continue;
|
||||
|
||||
area->spftree[tree][level - 1] =
|
||||
isis_spftree_new(area, &area->lspdb[level - 1],
|
||||
area->isis->sysid, level, tree,
|
||||
SPF_TYPE_FORWARD, 0);
|
||||
area->spftree[tree][level - 1] = isis_spftree_new(
|
||||
area, &area->lspdb[level - 1],
|
||||
area->isis->sysid, level, tree,
|
||||
SPF_TYPE_FORWARD, 0, SR_ALGORITHM_SPF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1701,10 +1701,10 @@ struct isis_spftree *isis_run_hopcount_spf(struct isis_area *area,
|
||||
struct isis_spftree *spftree)
|
||||
{
|
||||
if (!spftree)
|
||||
spftree = isis_spftree_new(area, &area->lspdb[IS_LEVEL_2 - 1],
|
||||
sysid, ISIS_LEVEL2, SPFTREE_IPV4,
|
||||
SPF_TYPE_FORWARD,
|
||||
F_SPFTREE_HOPCOUNT_METRIC);
|
||||
spftree = isis_spftree_new(
|
||||
area, &area->lspdb[IS_LEVEL_2 - 1], sysid, ISIS_LEVEL2,
|
||||
SPFTREE_IPV4, SPF_TYPE_FORWARD,
|
||||
F_SPFTREE_HOPCOUNT_METRIC, SR_ALGORITHM_SPF);
|
||||
|
||||
init_spt(spftree, ISIS_MT_IPV4_UNICAST);
|
||||
if (!memcmp(sysid, area->isis->sysid, ISIS_SYS_ID_LEN)) {
|
||||
|
@ -37,11 +37,10 @@ struct isis_spf_adj {
|
||||
#define F_ISIS_SPF_ADJ_METRIC_INFINITY 0x04
|
||||
};
|
||||
|
||||
struct isis_spftree *isis_spftree_new(struct isis_area *area,
|
||||
struct lspdb_head *lspdb,
|
||||
const uint8_t *sysid, int level,
|
||||
enum spf_tree_id tree_id,
|
||||
enum spf_type type, uint8_t flags);
|
||||
struct isis_spftree *
|
||||
isis_spftree_new(struct isis_area *area, struct lspdb_head *lspdb,
|
||||
const uint8_t *sysid, int level, enum spf_tree_id tree_id,
|
||||
enum spf_type type, uint8_t flags, uint8_t algorithm);
|
||||
struct isis_vertex *isis_spf_prefix_sid_lookup(struct isis_spftree *spftree,
|
||||
struct isis_prefix_sid *psid);
|
||||
void isis_spf_invalidate_routes(struct isis_spftree *tree);
|
||||
|
@ -349,6 +349,7 @@ struct isis_spftree {
|
||||
uint32_t total[SPF_PREFIX_PRIO_MAX];
|
||||
} protection_counters;
|
||||
} lfa;
|
||||
uint8_t algorithm;
|
||||
uint8_t flags;
|
||||
};
|
||||
#define F_SPFTREE_HOPCOUNT_METRIC 0x01
|
||||
|
@ -49,7 +49,8 @@ static void test_run_spf(struct vty *vty, const struct isis_topology *topology,
|
||||
/* Run SPF. */
|
||||
spf_type = reverse ? SPF_TYPE_REVERSE : SPF_TYPE_FORWARD;
|
||||
spftree = isis_spftree_new(area, lspdb, root->sysid, level, tree,
|
||||
spf_type, F_SPFTREE_NO_ADJACENCIES);
|
||||
spf_type, F_SPFTREE_NO_ADJACENCIES,
|
||||
SR_ALGORITHM_SPF);
|
||||
isis_run_spf(spftree);
|
||||
|
||||
/* Print the SPT and the corresponding routing table. */
|
||||
@ -71,8 +72,9 @@ static void test_run_lfa(struct vty *vty, const struct isis_topology *topology,
|
||||
|
||||
/* Run forward SPF in the root node. */
|
||||
flags = F_SPFTREE_NO_ADJACENCIES;
|
||||
spftree_self = isis_spftree_new(area, lspdb, root->sysid, level, tree,
|
||||
SPF_TYPE_FORWARD, flags);
|
||||
spftree_self =
|
||||
isis_spftree_new(area, lspdb, root->sysid, level, tree,
|
||||
SPF_TYPE_FORWARD, flags, SR_ALGORITHM_SPF);
|
||||
isis_run_spf(spftree_self);
|
||||
|
||||
/* Run forward SPF on all adjacent routers. */
|
||||
@ -107,8 +109,9 @@ static void test_run_rlfa(struct vty *vty, const struct isis_topology *topology,
|
||||
|
||||
/* Run forward SPF in the root node. */
|
||||
flags = F_SPFTREE_NO_ADJACENCIES;
|
||||
spftree_self = isis_spftree_new(area, lspdb, root->sysid, level, tree,
|
||||
SPF_TYPE_FORWARD, flags);
|
||||
spftree_self =
|
||||
isis_spftree_new(area, lspdb, root->sysid, level, tree,
|
||||
SPF_TYPE_FORWARD, flags, SR_ALGORITHM_SPF);
|
||||
isis_run_spf(spftree_self);
|
||||
|
||||
/* Run reverse SPF in the root node. */
|
||||
@ -187,8 +190,9 @@ static void test_run_ti_lfa(struct vty *vty,
|
||||
|
||||
/* Run forward SPF in the root node. */
|
||||
flags = F_SPFTREE_NO_ADJACENCIES;
|
||||
spftree_self = isis_spftree_new(area, lspdb, root->sysid, level, tree,
|
||||
SPF_TYPE_FORWARD, flags);
|
||||
spftree_self =
|
||||
isis_spftree_new(area, lspdb, root->sysid, level, tree,
|
||||
SPF_TYPE_FORWARD, flags, SR_ALGORITHM_SPF);
|
||||
isis_run_spf(spftree_self);
|
||||
|
||||
/* Run reverse SPF in the root node. */
|
||||
|
Loading…
Reference in New Issue
Block a user