Skip to content

Commit

Permalink
isisd: When the metric-type is configured as "wide", the IS-IS genera…
Browse files Browse the repository at this point in the history
…tes incorrect metric values for IPv4 directly connected routes.

The IPv4 directly connected route prefix exists in both the root LSP and the root's neighbor LSP:

1. When generating vertices for directly connected route prefixes with a metric of 0 based on the root LSP, the isis_spf_preload_tent_ip_reach_cb function only generates vertices of type VTYPE_IPREACH_INTERNAL without distinguishing between area->oldmetric and area->newmetric.
2. When generating vertices for the directly connected route prefix based on the neighbor LSP, the isis_spf_process_lsp function will generate vertices of type VTYPE_IPREACH_INTERNAL and VTYPE_IPREACH_TE based on area->oldmetric and area->newmetric, where the vertex metric is the sum of the metric from the root IS to the neighbor IS and from the neighbor IS to the root IS, respectively.

If area->newmetric=1, the same directly connected route prefix will have both VTYPE_IPREACH_INTERNAL vertices with a metric of 0 and VTYPE_IPREACH_TE vertices with a non-zero metric. During route generation, the isis_spf_loop function will prioritize selecting VTYPE_IPREACH_TE vertices, leading to incorrect metrics for the directly connected routes.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

fix frrbot styling issues found.

1)fix frrbot styling issues found.
2)Roll back the modifications to TE.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

Maintain code factorization and avoid duplicating code.

Maintain code factorization and avoid duplicating code.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: fix frrbot styling issues found

fix frrbot styling issues found

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: fix frrbot styling issues found

fix frrbot styling issues found

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: Resolve compilation issues.

Resolve compilation issues.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: Resolve compilation issues.

Resolve compilation issues.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: fix frrbot styling issues found

fix frrbot styling issues found

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: fix frrbot styling issues found

fix frrbot styling issues found

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: Resolve compilation issues.

Resolve compilation issues.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>
  • Loading branch information
zhou-run authored and baozhen-H3C committed May 28, 2024
1 parent c002c5c commit 39e27b8
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 81 deletions.
24 changes: 20 additions & 4 deletions isisd/isis_spf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ static int isis_spf_preload_tent_ip_reach_cb(const struct prefix *prefix,
struct isis_vertex *parent = args->parent;
struct prefix_pair ip_info;
enum vertextype vtype;
bool has_valid_psid = false;
bool has_valid_psid = false, transition = false;

if (external)
return LSP_ITER_CONTINUE;
Expand All @@ -1270,10 +1270,17 @@ static int isis_spf_preload_tent_ip_reach_cb(const struct prefix *prefix,
prefix_copy(&ip_info.dest, prefix);
apply_mask(&ip_info.dest);

if (prefix->family == AF_INET)
if (prefix->family == AF_INET) {
vtype = VTYPE_IPREACH_INTERNAL;
else

if (spftree->area->newmetric)
vtype = VTYPE_IPREACH_TE;

if (spftree->area->oldmetric && spftree->area->newmetric)
transition = true;
} else {
vtype = VTYPE_IP6REACH_INTERNAL;
}

/* Parse list of Prefix-SID subTLVs if SR is enabled */
if (spftree->area->srdb.enabled && subtlvs) {
Expand All @@ -1288,6 +1295,11 @@ static int isis_spf_preload_tent_ip_reach_cb(const struct prefix *prefix,
has_valid_psid = true;
isis_spf_add_local(spftree, vtype, &ip_info, NULL, 0,
psid, parent);
if (transition)
isis_spf_add_local(spftree,
VTYPE_IPREACH_INTERNAL,
&ip_info, NULL, 0, psid,
parent);

/*
* Stop the Prefix-SID iteration since we only support
Expand All @@ -1296,9 +1308,13 @@ static int isis_spf_preload_tent_ip_reach_cb(const struct prefix *prefix,
break;
}
}
if (!has_valid_psid)
if (!has_valid_psid) {
isis_spf_add_local(spftree, vtype, &ip_info, NULL, 0, NULL,
parent);
if (transition)
isis_spf_add_local(spftree, VTYPE_IPREACH_INTERNAL,
&ip_info, NULL, 0, NULL, parent);
}

return LSP_ITER_CONTINUE;
}
Expand Down
Loading

0 comments on commit 39e27b8

Please sign in to comment.