mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-30 22:25:41 +00:00
isisd: show non-zero algos in "show isis route prefix-sid" (2/2)
Show Prefix-SIDs and labels for all available Flex-Algos. Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
a0f45d1b5f
commit
e39af3727e
@ -2355,23 +2355,28 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix,
|
|||||||
char buf_prefix[BUFSIZ];
|
char buf_prefix[BUFSIZ];
|
||||||
|
|
||||||
(void)prefix2str(prefix, buf_prefix, sizeof(buf_prefix));
|
(void)prefix2str(prefix, buf_prefix, sizeof(buf_prefix));
|
||||||
for (ALL_LIST_ELEMENTS_RO(rinfo->nexthops, node, nexthop)) {
|
for (int alg = 0; alg < SR_ALGORITHM_COUNT; alg++) {
|
||||||
|
for (ALL_LIST_ELEMENTS_RO(rinfo->sr_algo[alg].nexthops, node,
|
||||||
|
nexthop)) {
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
char buf_iface[BUFSIZ];
|
char buf_iface[BUFSIZ];
|
||||||
char buf_nhop[BUFSIZ];
|
char buf_nhop[BUFSIZ];
|
||||||
|
|
||||||
if (!no_adjacencies) {
|
if (!no_adjacencies) {
|
||||||
inet_ntop(nexthop->family, &nexthop->ip, buf_nhop,
|
inet_ntop(nexthop->family, &nexthop->ip,
|
||||||
sizeof(buf_nhop));
|
buf_nhop, sizeof(buf_nhop));
|
||||||
ifp = if_lookup_by_index(nexthop->ifindex, VRF_DEFAULT);
|
ifp = if_lookup_by_index(nexthop->ifindex,
|
||||||
|
VRF_DEFAULT);
|
||||||
if (ifp)
|
if (ifp)
|
||||||
strlcpy(buf_iface, ifp->name,
|
strlcpy(buf_iface, ifp->name,
|
||||||
sizeof(buf_iface));
|
sizeof(buf_iface));
|
||||||
else
|
else
|
||||||
snprintf(buf_iface, sizeof(buf_iface),
|
snprintf(buf_iface, sizeof(buf_iface),
|
||||||
"ifindex %u", nexthop->ifindex);
|
"ifindex %u",
|
||||||
|
nexthop->ifindex);
|
||||||
} else {
|
} else {
|
||||||
strlcpy(buf_nhop, print_sys_hostname(nexthop->sysid),
|
strlcpy(buf_nhop,
|
||||||
|
print_sys_hostname(nexthop->sysid),
|
||||||
sizeof(buf_nhop));
|
sizeof(buf_nhop));
|
||||||
strlcpy(buf_iface, "-", sizeof(buf_iface));
|
strlcpy(buf_iface, "-", sizeof(buf_iface));
|
||||||
}
|
}
|
||||||
@ -2380,40 +2385,45 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix,
|
|||||||
char buf_sid[BUFSIZ] = {};
|
char buf_sid[BUFSIZ] = {};
|
||||||
char buf_lblop[BUFSIZ] = {};
|
char buf_lblop[BUFSIZ] = {};
|
||||||
|
|
||||||
if (nexthop->sr.present) {
|
if (rinfo->sr_algo[alg].present) {
|
||||||
snprintf(buf_sid, sizeof(buf_sid), "%u",
|
snprintf(buf_sid, sizeof(buf_sid), "%u",
|
||||||
nexthop->sr.sid.value);
|
rinfo->sr_algo[alg].sid.value);
|
||||||
sr_op2str(
|
sr_op2str(buf_lblop, sizeof(buf_lblop),
|
||||||
buf_lblop, sizeof(buf_lblop),
|
rinfo->sr_algo[alg].label,
|
||||||
rinfo->sr_algo[SR_ALGORITHM_SPF].label,
|
nexthop->sr.label);
|
||||||
nexthop->sr.label);
|
} else if (alg == SR_ALGORITHM_SPF) {
|
||||||
} else {
|
|
||||||
strlcpy(buf_sid, "-", sizeof(buf_sid));
|
strlcpy(buf_sid, "-", sizeof(buf_sid));
|
||||||
strlcpy(buf_lblop, "-", sizeof(buf_lblop));
|
strlcpy(buf_lblop, "-",
|
||||||
|
sizeof(buf_lblop));
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
ttable_add_row(tt, "%s|%u|%s|%s|%s|%s",
|
ttable_add_row(tt,
|
||||||
buf_prefix, rinfo->cost,
|
"%s|%u|%s|%s|%s|%s|%d",
|
||||||
buf_iface, buf_nhop, buf_sid,
|
buf_prefix, rinfo->cost,
|
||||||
buf_lblop);
|
buf_iface, buf_nhop,
|
||||||
|
buf_sid, buf_lblop, alg);
|
||||||
first = false;
|
first = false;
|
||||||
} else
|
} else
|
||||||
ttable_add_row(tt, "||%s|%s|%s|%s", buf_iface,
|
ttable_add_row(tt, "||%s|%s|%s|%s|%d",
|
||||||
buf_nhop, buf_sid, buf_lblop);
|
buf_iface, buf_nhop,
|
||||||
|
buf_sid, buf_lblop, alg);
|
||||||
} else {
|
} else {
|
||||||
char buf_labels[BUFSIZ] = {};
|
char buf_labels[BUFSIZ] = {};
|
||||||
|
|
||||||
if (nexthop->label_stack) {
|
if (nexthop->label_stack) {
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
i < nexthop->label_stack->num_labels;
|
i <
|
||||||
i++) {
|
nexthop->label_stack->num_labels;
|
||||||
|
i++) {
|
||||||
char buf_label[BUFSIZ];
|
char buf_label[BUFSIZ];
|
||||||
|
|
||||||
label2str(
|
label2str(nexthop->label_stack
|
||||||
nexthop->label_stack->label[i],
|
->label[i],
|
||||||
0, buf_label,
|
0, buf_label,
|
||||||
sizeof(buf_label));
|
sizeof(buf_label));
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
strlcat(buf_labels, "/",
|
strlcat(buf_labels, "/",
|
||||||
sizeof(buf_labels));
|
sizeof(buf_labels));
|
||||||
@ -2421,21 +2431,27 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix,
|
|||||||
sizeof(buf_labels));
|
sizeof(buf_labels));
|
||||||
}
|
}
|
||||||
} else if (nexthop->sr.present)
|
} else if (nexthop->sr.present)
|
||||||
label2str(nexthop->sr.label, 0, buf_labels,
|
label2str(nexthop->sr.label, 0,
|
||||||
|
buf_labels,
|
||||||
sizeof(buf_labels));
|
sizeof(buf_labels));
|
||||||
else
|
else
|
||||||
strlcpy(buf_labels, "-", sizeof(buf_labels));
|
strlcpy(buf_labels, "-",
|
||||||
|
sizeof(buf_labels));
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
ttable_add_row(tt, "%s|%u|%s|%s|%s", buf_prefix,
|
ttable_add_row(tt, "%s|%u|%s|%s|%s",
|
||||||
rinfo->cost, buf_iface, buf_nhop,
|
buf_prefix, rinfo->cost,
|
||||||
buf_labels);
|
buf_iface, buf_nhop,
|
||||||
|
buf_labels);
|
||||||
first = false;
|
first = false;
|
||||||
} else
|
} else
|
||||||
ttable_add_row(tt, "||%s|%s|%s", buf_iface,
|
ttable_add_row(tt, "||%s|%s|%s",
|
||||||
buf_nhop, buf_labels);
|
buf_iface, buf_nhop,
|
||||||
|
buf_labels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (list_isempty(rinfo->nexthops)) {
|
if (list_isempty(rinfo->nexthops)) {
|
||||||
if (prefix_sid) {
|
if (prefix_sid) {
|
||||||
char buf_sid[BUFSIZ] = {};
|
char buf_sid[BUFSIZ] = {};
|
||||||
@ -2496,7 +2512,9 @@ void isis_print_routes(struct vty *vty, struct isis_spftree *spftree,
|
|||||||
/* Prepare table. */
|
/* Prepare table. */
|
||||||
tt = ttable_new(&ttable_styles[TTSTYLE_BLANK]);
|
tt = ttable_new(&ttable_styles[TTSTYLE_BLANK]);
|
||||||
if (prefix_sid)
|
if (prefix_sid)
|
||||||
ttable_add_row(tt, "Prefix|Metric|Interface|Nexthop|SID|Label Op.");
|
ttable_add_row(
|
||||||
|
tt,
|
||||||
|
"Prefix|Metric|Interface|Nexthop|SID|Label Op.|Algo");
|
||||||
else
|
else
|
||||||
ttable_add_row(tt, "Prefix|Metric|Interface|Nexthop|Label(s)");
|
ttable_add_row(tt, "Prefix|Metric|Interface|Nexthop|Label(s)");
|
||||||
tt->style.cell.rpad = 2;
|
tt->style.cell.rpad = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user